OSDN Git Service

* cse.c (cse_insn): Don't change the result register of a libcall.
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Mar 1999 13:55:22 +0000 (13:55 +0000)
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Mar 1999 13:55:22 +0000 (13:55 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25898 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cse.c

index b44745a..00bc658 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 bc22df9..e632d4b 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)