From: Richard Kenner Date: Sat, 17 May 1997 19:13:18 +0000 (-0400) Subject: (cse_insn): Don't record a SRC that's a MEM and the same as a X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=50196afaca12b3d80a75fd1d5c4c7fca44e6ba75;p=gcc.git (cse_insn): Don't record a SRC that's a MEM and the same as a REG_EQUIV note if DEST is set more than once. From-SVN: r14074 --- diff --git a/gcc/cse.c b/gcc/cse.c index 260da29e2d0..1bae143b715 100644 --- 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