diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-06-14 16:59:52 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-06-14 16:59:52 +0200 |
commit | 8a76c4a040d2c601206ee24bd59b176d542c7f35 (patch) | |
tree | 1c93aea3877d84bba3664e6b823915a058c8dc67 /gcc/cse.c | |
parent | b4a9343cf59f4ccb03c5be05a9314ff1f45712b4 (diff) | |
download | gcc-8a76c4a040d2c601206ee24bd59b176d542c7f35.zip gcc-8a76c4a040d2c601206ee24bd59b176d542c7f35.tar.gz gcc-8a76c4a040d2c601206ee24bd59b176d542c7f35.tar.bz2 |
re PR rtl-optimization/49390 (GCSE miscompilation)
PR rtl-optimization/49390
Revert:
2010-06-29 Bernd Schmidt <bernds@codesourcery.com>
* cse.c (exp_equiv_p): For MEMs, if for_gcse, only compare
MEM_ALIAS_SET.
* gcc.c-torture/execute/pr49390.c: New test.
From-SVN: r175023
Diffstat (limited to 'gcc/cse.c')
-rw-r--r-- | gcc/cse.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -2669,16 +2669,26 @@ exp_equiv_p (const_rtx x, const_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; |