aboutsummaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-07-05 23:33:36 +0000
committerJeff Law <law@gcc.gnu.org>1998-07-05 17:33:36 -0600
commit9de2c71a47cdd2531c359d20c839c1a0b6cccfe6 (patch)
tree817f057be0d30d722b3e39eb6880d25dffc2c751 /gcc/cse.c
parentadc05e6ce6c535b2dcc218e0486dd6298f5c7ba8 (diff)
downloadgcc-9de2c71a47cdd2531c359d20c839c1a0b6cccfe6.zip
gcc-9de2c71a47cdd2531c359d20c839c1a0b6cccfe6.tar.gz
gcc-9de2c71a47cdd2531c359d20c839c1a0b6cccfe6.tar.bz2
cse.c (cse_insn): When SETting (MEM (ADDRESSOF (X))) to Y...
* cse.c (cse_insn): When SETting (MEM (ADDRESSOF (X))) to Y, don't claim that the former is equivalent to the latter. From-SVN: r20935
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 3705511..055bbd9 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -7405,6 +7405,7 @@ cse_insn (insn, in_libcall_block)
if (sets[i].rtl)
{
register rtx dest = SET_DEST (sets[i].rtl);
+ rtx inner_dest = sets[i].inner_dest;
register struct table_elt *elt;
/* Don't record value if we are not supposed to risk allocating
@@ -7453,8 +7454,18 @@ cse_insn (insn, in_libcall_block)
sets[i].dest_hash = HASH (dest, GET_MODE (dest));
}
- elt = insert (dest, sets[i].src_elt,
- sets[i].dest_hash, GET_MODE (dest));
+ if (GET_CODE (inner_dest) == MEM
+ && GET_CODE (XEXP (inner_dest, 0)) == ADDRESSOF)
+ /* Given (SET (MEM (ADDRESSOF (X))) Y) we don't want to say
+ that (MEM (ADDRESSOF (X))) is equivalent to Y.
+ Consider the case in which the address of the MEM is
+ passed to a function, which alters the MEM. Then, if we
+ later use Y instead of the MEM we'll miss the update. */
+ elt = insert (dest, 0, sets[i].dest_hash, GET_MODE (dest));
+ else
+ elt = insert (dest, sets[i].src_elt,
+ sets[i].dest_hash, GET_MODE (dest));
+
elt->in_memory = (GET_CODE (sets[i].inner_dest) == MEM
&& (! RTX_UNCHANGING_P (sets[i].inner_dest)
|| FIXED_BASE_PLUS_P (XEXP (sets[i].inner_dest,