http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57451

--- Comment #8 from Teresa Johnson <tejohnson at google dot com> ---
On Fri, Aug 9, 2013 at 4:23 PM, ccoutant at google dot com
<gcc-bugzi...@gcc.gnu.org> wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57451
>
> --- Comment #7 from ccoutant at google dot com ---
>> Index: final.c
>> ===================================================================
>> --- final.c (revision 201461)
>> +++ final.c (working copy)
>> @@ -1560,6 +1560,16 @@ change_scope (rtx orig_insn, tree s1, tree s2)
>>    tree ts1 = s1, ts2 = s2;
>>    tree s;
>>
>> +  if (NOTE_P (orig_insn) && NOTE_KIND (orig_insn) ==
>> NOTE_INSN_SWITCH_TEXT_SECTIONS)
>> +    {
>> +      gcc_assert (s1 == s1);
>
> That should be s1 == s2, right?

Woops, yes.

>
>> +      rtx note = emit_note_before (NOTE_INSN_BLOCK_END, orig_insn);
>> +      NOTE_BLOCK (note) = s1;
>> +      note = emit_note_before (NOTE_INSN_BLOCK_BEG, next_insn (orig_insn));
>> +      NOTE_BLOCK (note) = s1;
>> +      return;
>> +    }
>> +
>>    while (ts1 != ts2)
>>      {
>>        gcc_assert (ts1 && ts2);
>> @@ -1604,12 +1614,16 @@ reemit_insn_block_notes (void)
>>    rtx insn, note;
>>
>>    insn = get_insns ();
>> -  if (!active_insn_p (insn))
>> -    insn = next_active_insn (insn);
>> -  for (; insn; insn = next_active_insn (insn))
>> +  for (; insn; insn = next_insn (insn))
>>      {
>>        tree this_block;
>>
>> +      if (NOTE_P (insn) && NOTE_KIND (insn) == 
>> NOTE_INSN_SWITCH_TEXT_SECTIONS)
>> +        change_scope (insn, cur_block, cur_block);
>
> It seems to me like you should just emit the three notes directly
> here. This is really using change_scope for a new purpose, as you're
> not really changing scopes, just putting a break into one.

Ok.

>
>> +      if (!active_insn_p (insn))
>> +        continue;
>
> I'm not clear on why this is needed. Is it because after the
> change_scope, insn will now be a NOTE? If that's it, just put the
> continue in the previous if clause.

Because the notes were being skipped by the iteration over
instructions, which previously only walked active instructions (notes
are not active instructions). So to see the switch section note I had
to walk all instructions, and just skip non-active instructions after
I am done checking for the note of interest.

Thanks,
Teresa

>
> -cary
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
> You reported the bug.

Reply via email to