(cse_insn): Don't record a SRC that's a MEM and the same as a
authorRichard Kenner <kenner@gcc.gnu.org>
Sat, 17 May 1997 19:13:18 +0000 (15:13 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Sat, 17 May 1997 19:13:18 +0000 (15:13 -0400)
REG_EQUIV note if DEST is set more than once.

From-SVN: r14074

gcc/cse.c

index 260da29e2d0cdd5ce6329333450bb95b798b5fad..1bae143b7158bc610ab739d60276ac5de434fe7e 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -6477,6 +6477,21 @@ cse_insn (insn, in_libcall_block)
       sets[i].src_in_memory = hash_arg_in_memory;
       sets[i].src_in_struct = hash_arg_in_struct;
 
+      /* If SRC is a MEM, there is a REG_EQUIV note for SRC, and DEST is
+        a pseudo that is set more than once, do not record SRC.  Using
+        SRC as a replacement for anything else will be incorrect in that
+        situation.  Note that this usually occurs only for stack slots,
+        in which case all the RTL would be refering to SRC, so we don't
+        lose any optimization opportunities by not having SRC in the
+        hash table.  */
+
+      if (GET_CODE (src) == MEM
+         && find_reg_note (insn, REG_EQUIV, src) != 0
+         && GET_CODE (dest) == REG
+         && REGNO (dest) >= FIRST_PSEUDO_REGISTER
+         && reg_n_sets[REGNO (dest)] != 1)
+       sets[i].src_volatile = 1;
+
 #if 0
       /* It is no longer clear why we used to do this, but it doesn't
         appear to still be needed.  So let's try without it since this