This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: patch for handling NOTE_INSN_DELETED_LABELS in scheduling

>> > the if_convert optimization will sometimes deleted user labels.
>> > if they occur at the beginning of an if or then block, and these
>> > blocks could otherwise be merged, flow will change the
>> > labels to a NOTE_INSN_DELETED_LABEL. If we then run the
>> > extended basic block scheduler, these note all get moved to the
>> > top of the function, and the get emitted in the wrong place.
>> What kind of failure does this cause?

Because its not a NOTE_INSN that is in the list of notes to save
at their current location, they get removed by remove_note.
These are labels whose address has been taken, which is why flow
turned them into notes in the first place. The end result is that
without the note, no label ever gets generated, and we end up with a
reference to a non existant label. IA64 hides this fact by 
deciding that if there is a reference to a deleted label,
we'll just create it at the top of the function, which causes a 
runtime failure instead of a compile time one because there address
are not correct. Im not sure why that code is there. 

the testcase 990208-1.c demonstrates the problem. You'll see the
2 labels generated at the same address a the top of the function.

>> > THis patch adds the NOTE_INSN_DELETED_LABEL note to the
>> > list of notes which are saved during scheduling, and this
>> > allows the label to be emitted properly.
>> > *************** reemit_notes (insn, last)
>> > *** 1860,1865 ****
>> > --- 1861,1868 ----
>> >   	      if (note_type == NOTE_INSN_EH_REGION_BEG
>> >   		  || note_type == NOTE_INSN_EH_REGION_END)
>> >   		NOTE_EH_HANDLER (last) = INTVAL (XEXP (note, 0));
>> > + 	      if (note_type == NOTE_INSN_DELETED_LABEL)
>> > + 		CODE_LABEL_NUMBER (last) = INTVAL (XEXP (note, 0));
>> >   	    }
>> >   	  remove_note (insn, note);
>> I'm a bit confused about which parts of a NOTE_INSN_DELETED_LABEL
>> are necessary.  The code in flow.c and jump.c seems to save the
>> label name in NOTE_SOURCE_FILE, but nowhere (certainly not in final)
>> do we seem to reuse that information.

I think all we need in the number because we are making references to
the label number in the code.   Beyond that, other experts will have
to fill in the blank :-).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]