aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-im.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-04-16 07:55:41 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-04-16 07:55:41 +0000
commit8c996ec644d4dfa8d067f822ba63b3e4a3a17ef8 (patch)
tree1cbc2c80ede9e67a31e5a00d72cb176dda0fbced /gcc/tree-ssa-loop-im.c
parent5d71d6f24fee0385acfec934d4337061eb863c0f (diff)
downloadgcc-8c996ec644d4dfa8d067f822ba63b3e4a3a17ef8.zip
gcc-8c996ec644d4dfa8d067f822ba63b3e4a3a17ef8.tar.gz
gcc-8c996ec644d4dfa8d067f822ba63b3e4a3a17ef8.tar.bz2
re PR tree-optimization/56049 (Simplification to constants not done)
2019-04-16 Richard Biener <rguenther@suse.de> PR tree-optimization/56049 * tree-ssa-loop-im.c (mem_ref_hasher::equal): Elide alias-set equality check if alias-set zero will prevail. * gfortran.dg/pr56049.f90: New testcase. From-SVN: r270378
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r--gcc/tree-ssa-loop-im.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 631dd90..56d8e8e 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -178,7 +178,17 @@ mem_ref_hasher::equal (const im_mem_ref *mem1, const ao_ref *obj2)
&& known_eq (mem1->mem.size, obj2->size)
&& known_eq (mem1->mem.max_size, obj2->max_size)
&& mem1->mem.volatile_p == obj2->volatile_p
- && mem1->mem.ref_alias_set == obj2->ref_alias_set
+ && (mem1->mem.ref_alias_set == obj2->ref_alias_set
+ /* We are not canonicalizing alias-sets but for the
+ special-case we didn't canonicalize yet and the
+ incoming ref is a alias-set zero MEM we pick
+ the correct one already. */
+ || (!mem1->ref_canonical
+ && (TREE_CODE (obj2->ref) == MEM_REF
+ || TREE_CODE (obj2->ref) == TARGET_MEM_REF)
+ && obj2->ref_alias_set == 0)
+ /* Likewise if there's a canonical ref with alias-set zero. */
+ || (mem1->ref_canonical && mem1->mem.ref_alias_set == 0))
&& types_compatible_p (TREE_TYPE (mem1->mem.ref),
TREE_TYPE (obj2->ref)));
else