OSDN Git Service

* rtlanal.c (noop_move_p): Insns with a REG_RETVAL note
authorwehle <wehle@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 11 Oct 2001 03:51:24 +0000 (03:51 +0000)
committerwehle <wehle@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 11 Oct 2001 03:51:24 +0000 (03:51 +0000)
should not be considered as a no-op.
* flow.c (delete_noop_moves): Handle REG_LIBCALL notes.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46174 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/flow.c
gcc/rtlanal.c

index 536a351..1b06df2 100644 (file)
@@ -1,3 +1,9 @@
+Wed Oct 10 23:49:06 EDT 2001  John Wehle  (john@feith.com)
+
+       * rtlanal.c (noop_move_p): Insns with a REG_RETVAL note
+       should not be considered as a no-op.
+       * flow.c (delete_noop_moves): Handle REG_LIBCALL notes.
+
 2001-10-10  Stan Shebs  <shebs@apple.com>
 
        * alias.c: Remove uses of "register" specifier in declarations
index f0dd62e..030a233 100644 (file)
@@ -771,8 +771,25 @@ delete_noop_moves (f)
          next = NEXT_INSN (insn);
          if (INSN_P (insn) && noop_move_p (insn))
            {
-             /* Do not call delete_insn here to not confuse backward
-                pointers of LIBCALL block.  */
+             rtx note;
+
+             /* If we're about to remove the first insn of a libcall
+                then move the libcall note to the next real insn and
+                update the retval note.  */
+             if ((note = find_reg_note (insn, REG_LIBCALL, NULL_RTX))
+                      && XEXP (note, 0) != insn)
+               {
+                 rtx new_libcall_insn = next_real_insn (insn);
+                 rtx retval_note = find_reg_note (XEXP (note, 0),
+                                                  REG_RETVAL, NULL_RTX);
+                 REG_NOTES (new_libcall_insn)
+                   = gen_rtx_INSN_LIST (REG_LIBCALL, XEXP (note, 0),
+                                        REG_NOTES (new_libcall_insn));
+                 XEXP (retval_note, 0) = new_libcall_insn;
+               }
+
+             /* Do not call delete_insn here since that may change
+                the basic block boundaries which upsets some callers.  */
              PUT_CODE (insn, NOTE);
              NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
              NOTE_SOURCE_FILE (insn) = 0;
index ee40d6c..9cf879c 100644 (file)
@@ -1037,6 +1037,11 @@ noop_move_p (insn)
   if (find_reg_note (insn, REG_EQUAL, NULL_RTX))
     return 0;
 
+  /* For now treat an insn with a REG_RETVAL note as a
+     a special insn which should not be considered a no-op.  */
+  if (find_reg_note (insn, REG_RETVAL, NULL_RTX))
+    return 0;
+
   if (GET_CODE (pat) == SET && set_noop_p (pat))
     return 1;