diff options
author | Steven Bosscher <stevenb.gcc@gmail.com> | 2006-01-03 06:20:21 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2006-01-03 06:20:21 +0000 |
commit | 78b76d0884d435c6e05d023db71a8b00c0f044b2 (patch) | |
tree | 0f27e072946d5679715a3b35a103656388cb972e /gcc/cse.c | |
parent | 0884546e1b92fe109e30cca3295e6212e4b24567 (diff) | |
download | gcc-78b76d0884d435c6e05d023db71a8b00c0f044b2.zip gcc-78b76d0884d435c6e05d023db71a8b00c0f044b2.tar.gz gcc-78b76d0884d435c6e05d023db71a8b00c0f044b2.tar.bz2 |
re PR rtl-optimization/25130 (miscompilation in GCSE)
* fold-const.c (operand_equal_p): Accept a NULL operand 0 for
COMPONENT_REFs.
* emit-rtl.c (mem_attrs_htab_eq): Use iterative_hash_expr for
hashing trees instead of a pointer hash.
(mem_attrs_htab_eq): Do a deep compare instead of a pointer
compare for MEM_EXPR.
PR rtl-optimization/25130
* cse.c (exp_equiv_p): Compare MEM_ATTRS instead of MEM_ALIAS_SET
when comparing MEMs for GCSE
From-SVN: r109264
Diffstat (limited to 'gcc/cse.c')
-rw-r--r-- | gcc/cse.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -2538,16 +2538,26 @@ exp_equiv_p (rtx x, rtx y, int validate, bool for_gcse) case MEM: if (for_gcse) { - /* Can't merge two expressions in different alias sets, since we - can decide that the expression is transparent in a block when - it isn't, due to it being set with the different alias set. */ - if (MEM_ALIAS_SET (x) != MEM_ALIAS_SET (y)) - return 0; - /* A volatile mem should not be considered equivalent to any other. */ if (MEM_VOLATILE_P (x) || MEM_VOLATILE_P (y)) return 0; + + /* Can't merge two expressions in different alias sets, since we + can decide that the expression is transparent in a block when + it isn't, due to it being set with the different alias set. + + Also, can't merge two expressions with different MEM_ATTRS. + They could e.g. be two different entities allocated into the + same space on the stack (see e.g. PR25130). In that case, the + MEM addresses can be the same, even though the two MEMs are + absolutely not equivalent. + + But because really all MEM attributes should be the same for + equivalent MEMs, we just use the invariant that MEMs that have + the same attributes share the same mem_attrs data structure. */ + if (MEM_ATTRS (x) != MEM_ATTRS (y)) + return 0; } break; |