flow.c (propagate_one_insn): Revise yesterday's patch.
authorJeff Law <law@redhat.com>
Thu, 30 May 2002 20:20:28 +0000 (14:20 -0600)
committerJeff Law <law@gcc.gnu.org>
Thu, 30 May 2002 20:20:28 +0000 (14:20 -0600)
        * flow.c (propagate_one_insn): Revise yesterday's patch.  Delete
        a dead insn with a REG_RETVAL note when the entire libcall is not
        dead and remove the associated REG_LIBCALL note at the same time.

From-SVN: r54065

gcc/ChangeLog
gcc/flow.c

index b38f8e30a6f1b8fbf27359aaadbefe3edb088e21..2bc6148b635bf4eb788a672c4d727bc6cbbf1aef 100644 (file)
@@ -1,3 +1,9 @@
+2002-05-30  Jeff Law <law@redhat.com>
+
+       * flow.c (propagate_one_insn): Revise yesterday's patch.  Delete
+       a dead insn with a REG_RETVAL note when the entire libcall is not
+       dead and remove the associated REG_LIBCALL note at the same time.
+
 Thu May 30 19:54:30 2002  J"orn Rennecke <joern.rennecke@superh.com>
 
        * lcm.c (output.h): #include.
index ed2b24f7180f9dc862965ce82feaeb45ac3e070a..78cd43990aa9fb91ddf27f4fea8611b0d8c2f689 100644 (file)
@@ -1643,8 +1643,27 @@ propagate_one_insn (pbi, insn)
 
       if (libcall_is_dead)
        prev = propagate_block_delete_libcall ( insn, note);
-      else if (!note)
-       propagate_block_delete_insn (insn);
+      else
+       {
+
+         if (note)
+           {
+             /* If INSN contains a RETVAL note and is dead, but the libcall
+                as a whole is not dead, then we want to remove INSN, but
+                not the whole libcall sequence.
+
+                However, we need to also remove the dangling REG_LIBCALL       
+                note so that we do not have mis-matched LIBCALL/RETVAL
+                notes.  In theory we could find a new location for the
+                REG_RETVAL note, but it hardly seems worth the effort.  */
+             rtx libcall_note;
+        
+             libcall_note
+               = find_reg_note (XEXP (note, 0), REG_LIBCALL, NULL_RTX);
+             remove_note (XEXP (note, 0), libcall_note);
+           }
+         propagate_block_delete_insn (insn);
+       }
 
       return prev;
     }