summaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1998-07-05 23:33:36 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1998-07-05 23:33:36 +0000
commita97275a96d89f8172cf2824a590290b4ea3fdb9c (patch)
tree817f057be0d30d722b3e39eb6880d25dffc2c751 /gcc/cse.c
parented0bc7f4d00f1737e4c5916913245503c37059b9 (diff)
downloadgcc-a97275a96d89f8172cf2824a590290b4ea3fdb9c.tar.gz
* cse.c (cse_insn): When SETting (MEM (ADDRESSOF (X))) to Y,
don't claim that the former is equivalent to the latter. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20935 138bc75d-0d04-0410-961f-82ee72b054a4
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 37055110575..055bbd90e2c 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,