aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-09-27 12:56:38 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-09-27 12:56:38 +0000
commit59896334f97c1d58c221d2975e33abccd0d331d5 (patch)
tree98081d1a890b16cf38fe47a5ae0e7aa4b27bb30d /gcc/tree-ssa-sccvn.c
parent4e7e89e8c9acdbffa6546d5e6056c7b81238c88f (diff)
downloadgcc-59896334f97c1d58c221d2975e33abccd0d331d5.zip
gcc-59896334f97c1d58c221d2975e33abccd0d331d5.tar.gz
gcc-59896334f97c1d58c221d2975e33abccd0d331d5.tar.bz2
re PR tree-optimization/77745 (Inconsistent application of aliasing rules)
2016-09-27 Richard Biener <rguenther@suse.de> PR tree-optimization/77745 * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): When removing redundant stores make sure to check compatibility of the TBAA state for downstream accesses. * tree-ssa-sccvn.c (visit_reference_op_store): Likewise for when value-numbering virtual operands for store matches. * g++.dg/torture/pr77745.C: New testcase. From-SVN: r240534
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 7f44ec8..94fd66a 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -3599,13 +3599,21 @@ visit_reference_op_store (tree lhs, tree op, gimple *stmt)
Otherwise, the vdefs for the store are used when inserting into
the table, since the store generates a new memory state. */
- result = vn_reference_lookup (lhs, vuse, VN_NOWALK, NULL, false);
-
+ result = vn_reference_lookup (lhs, vuse, VN_NOWALK, &vnresult, false);
if (result)
{
if (TREE_CODE (result) == SSA_NAME)
result = SSA_VAL (result);
resultsame = expressions_equal_p (result, op);
+ if (resultsame)
+ {
+ /* If the TBAA state isn't compatible for downstream reads
+ we cannot value-number the VDEFs the same. */
+ alias_set_type set = get_alias_set (lhs);
+ if (vnresult->set != set
+ && ! alias_set_subset_of (set, vnresult->set))
+ resultsame = false;
+ }
}
if ((!result || !resultsame)