RFA: redirect_jump_1: fix REG_EQUAL notes

Joern RENNECKE joern.rennecke@st.com
Tue Mar 1 19:03:00 GMT 2005


Roger Sayle wrote:

>    
>
>I think the source of the misunderstanding might be that we don't have to
>validate changes in a REG_EQUAL note.  The reason why the REG_EQUAL note
>  
>
Yes, I know we don't need that, but it seemed so much simpler to lump 
these changes
together with the changes to the PATTERN.  You do have a point that the
validate_change machinery also adds overhead.  I see now a way to make 
the code
simple and functional, yet do the REG_EQUAL changing only after commiting to
do the change.  The idea is to use redirect_jump_2 from 
ifcvt.c:dead_or_predictable.
The one hunk of code that looks a bit funny in this context is this:

  /* If we're eliding the jump over exception cleanups at the end of a
     function, move the function end note so that -Wreturn-type works.  */
  if (olabel && nlabel
      && NEXT_INSN (olabel)
      && GET_CODE (NEXT_INSN (olabel)) == NOTE
      && NOTE_LINE_NUMBER (NEXT_INSN (olabel)) == NOTE_INSN_FUNCTION_END)
    emit_note_after (NOTE_INSN_FUNCTION_END, nlabel);

When dead_or_predictable is called from find_if_case_1, olabel might be
at the end of the function, but we'd like the end of the function stay where
it is.  So we definitely don't want this code to be executed when it is 
called from
dead_or_predictable.
It is also funny that we end up with two NOTE_INSN_FUNCTION_END notes
if delete_unused is zero.  I wonder if this hunk of code should be 
predicated by
delete_unused too.  However, there are so many callers of invert_jump and
redirect_jump that it is probably better to handle this as a separate issue.
So for the time being, I propose to make delete_unused a ternary value, 
using -1
for don't delete and don't duplicate the NOTE_INSN_FUNCTION_END note.
   



More information about the Gcc-patches mailing list