diff options
author | Richard Biener <rguenther@suse.de> | 2016-02-16 15:00:45 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-02-16 15:00:45 +0000 |
commit | 87440c298eb2ed47166b8d57a4afc90d310f3a8f (patch) | |
tree | 8d0e66b862f18cc6aaa9eaf860c087a6377e9e42 /gcc/tree-ssa-dom.c | |
parent | 6d87c306c6a44f8db81a9a9f2f5de4d943d5e57f (diff) | |
download | gcc-87440c298eb2ed47166b8d57a4afc90d310f3a8f.zip gcc-87440c298eb2ed47166b8d57a4afc90d310f3a8f.tar.gz gcc-87440c298eb2ed47166b8d57a4afc90d310f3a8f.tar.bz2 |
re PR tree-optimization/69776 (Wrong optimization with aliasing)
2016-02-16 Richard Biener <rguenther@suse.de>
PR tree-optimization/69776
* tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Get alias
sets from caller.
(indirect_refs_may_alias_p): Likewise.
(refs_may_alias_p_1): Pass alias sets as from ao_ref.
* tree-ssa-sccvn.c (vn_reference_lookup): Also adjust vr alias-set
according to tbaa_p.
* tree-ssa-dom.c (lookup_avail_expr): Add tbaa_p flag.
(optimize_stmt): For redundant store discovery do not allow tbaa.
* gcc.dg/torture/pr69776-2.c: New testcase.
From-SVN: r233453
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r-- | gcc/tree-ssa-dom.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index f44ac13..9aaa372 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -103,7 +103,8 @@ static struct opt_stats_d opt_stats; static edge optimize_stmt (basic_block, gimple_stmt_iterator, class const_and_copies *, class avail_exprs_stack *); -static tree lookup_avail_expr (gimple *, bool, class avail_exprs_stack *); +static tree lookup_avail_expr (gimple *, bool, class avail_exprs_stack *, + bool = true); static void record_cond (cond_equivalence *, class avail_exprs_stack *); static void record_equality (tree, tree, class const_and_copies *); static void record_equivalences_from_phis (basic_block); @@ -1893,7 +1894,8 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si, else new_stmt = gimple_build_assign (rhs, lhs); gimple_set_vuse (new_stmt, gimple_vuse (stmt)); - cached_lhs = lookup_avail_expr (new_stmt, false, avail_exprs_stack); + cached_lhs = lookup_avail_expr (new_stmt, false, avail_exprs_stack, + false); if (cached_lhs && rhs == cached_lhs) { @@ -1997,7 +1999,7 @@ vuse_eq (ao_ref *, tree vuse1, unsigned int cnt, void *data) static tree lookup_avail_expr (gimple *stmt, bool insert, - class avail_exprs_stack *avail_exprs_stack) + class avail_exprs_stack *avail_exprs_stack, bool tbaa_p) { expr_hash_elt **slot; tree lhs; @@ -2054,7 +2056,8 @@ lookup_avail_expr (gimple *stmt, bool insert, if (!(vuse1 && vuse2 && gimple_assign_single_p (stmt) && TREE_CODE (gimple_assign_lhs (stmt)) == SSA_NAME - && (ao_ref_init (&ref, gimple_assign_rhs1 (stmt)), true) + && (ao_ref_init (&ref, gimple_assign_rhs1 (stmt)), + ref.base_alias_set = ref.ref_alias_set = tbaa_p ? -1 : 0, true) && walk_non_aliased_vuses (&ref, vuse2, vuse_eq, NULL, NULL, vuse1) != NULL)) { |