* cse.c (cse_insn): Don't change the result register of a libcall.
authorJ"orn Rennecke <amylaar@cygnus.co.uk>
Mon, 22 Mar 1999 13:55:22 +0000 (13:55 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Mon, 22 Mar 1999 13:55:22 +0000 (13:55 +0000)
From-SVN: r25898

gcc/ChangeLog
gcc/cse.c

index b44745a34146c59ffdc8a9e1fee5166215e32271..00bc658356d5960bc4d353ec9644944a1299c0a0 100644 (file)
@@ -1,3 +1,7 @@
+Mon Mar 22 21:51:57 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+       * cse.c (cse_insn): Don't change the result register of a libcall.
+
 Mon Mar 22 21:08:59 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
 
        * rtl.h (shallow_copy_rtx): Declare.
index bc22df9e2c8a9ba5e2a1aec25015553facbaf9f1..e632d4bd174517d4b6e0f9a366747de0fad2d86c 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -7802,7 +7802,11 @@ cse_insn (insn, libcall_insn)
      then be used in the sequel and we may be changing a two-operand insn
      into a three-operand insn.
 
-     Also do not do this if we are operating on a copy of INSN.  */
+     Also do not do this if we are operating on a copy of INSN.
+
+     Also don't do this if INSN ends a libcall; this would cause an unrelated
+     register to be set in the middle of a libcall, and we then get bad code
+     if the libcall is deleted.  */
 
   if (n_sets == 1 && sets[0].rtl && GET_CODE (SET_DEST (sets[0].rtl)) == REG
       && NEXT_INSN (PREV_INSN (insn)) == insn
@@ -7810,7 +7814,8 @@ cse_insn (insn, libcall_insn)
       && REGNO (SET_SRC (sets[0].rtl)) >= FIRST_PSEUDO_REGISTER
       && REGNO_QTY_VALID_P (REGNO (SET_SRC (sets[0].rtl)))
       && (qty_first_reg[reg_qty[REGNO (SET_SRC (sets[0].rtl))]]
-         == REGNO (SET_DEST (sets[0].rtl))))
+         == REGNO (SET_DEST (sets[0].rtl)))
+      && ! find_reg_note (insn, REG_RETVAL, NULL_RTX))
     {
       rtx prev = PREV_INSN (insn);
       while (prev && GET_CODE (prev) == NOTE)