aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-07-05 12:50:45 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-07-05 12:50:45 +0000
commitfb4697e30bd0cd4bda66932e21c183273a5d1e63 (patch)
tree392c65691fc7f7d8fd6d1dce0b8283095de689d5 /gcc/tree-ssa-alias.c
parent75fad0a98919da8212be4efc479d098499f4f1c3 (diff)
downloadgcc-fb4697e30bd0cd4bda66932e21c183273a5d1e63.zip
gcc-fb4697e30bd0cd4bda66932e21c183273a5d1e63.tar.gz
gcc-fb4697e30bd0cd4bda66932e21c183273a5d1e63.tar.bz2
re PR tree-optimization/91091 ([missed optimization] Missing optimization in unaliased pointers)
2019-07-05 Richard Biener <rguenther@suse.de> PR tree-optimization/91091 * tree-ssa-alias.h (get_continuation_for_phi): Add tbaa_p parameter. (walk_non_aliased_vuses): Likewise. * tree-ssa-alias.c (maybe_skip_until): Pass down tbaa_p. (get_continuation_for_phi): New tbaa_p parameter and pass it down. (walk_non_aliased_vuses): Likewise. * ipa-prop.c (determine_known_aggregate_parts): Adjust. * tree-ssa-pre.c (translate_vuse_through_block): Likewise. * tree-ssa-scopedtables.c (avail_exprs_stack::lookup_avail_expr): Likewise. * tree-ssa-sccvn.c (struct vn_walk_cb_data): Add tbaa_p flag. (adjust_offsets_for_equal_base_address): New function. (vn_reference_lookup_3): Use it to catch more base equivalences. Handle and pass down tbaa_p flag. (vn_reference_lookup_pieces): Adjust. (vn_reference_lookup): Remove alias-set altering, instead pass down false as tbaa_p. * gcc.dg/tree-ssa/pr91091-2.c: New testcase. * gcc.dg/tree-ssa/ssa-fre-70.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-71.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-72.c: Likewise. From-SVN: r273135
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index d52d47c..b5e980d 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -3054,8 +3054,8 @@ stmt_kills_ref_p (gimple *stmt, tree ref)
static bool
maybe_skip_until (gimple *phi, tree &target, basic_block target_bb,
- ao_ref *ref, tree vuse, unsigned int &limit, bitmap *visited,
- bool abort_on_visited,
+ ao_ref *ref, tree vuse, bool tbaa_p, unsigned int &limit,
+ bitmap *visited, bool abort_on_visited,
void *(*translate)(ao_ref *, tree, void *, bool *),
void *data)
{
@@ -3089,7 +3089,7 @@ maybe_skip_until (gimple *phi, tree &target, basic_block target_bb,
/* An already visited PHI node ends the walk successfully. */
if (bitmap_bit_p (*visited, SSA_NAME_VERSION (PHI_RESULT (def_stmt))))
return !abort_on_visited;
- vuse = get_continuation_for_phi (def_stmt, ref, limit,
+ vuse = get_continuation_for_phi (def_stmt, ref, tbaa_p, limit,
visited, abort_on_visited,
translate, data);
if (!vuse)
@@ -3104,7 +3104,7 @@ maybe_skip_until (gimple *phi, tree &target, basic_block target_bb,
if ((int)limit <= 0)
return false;
--limit;
- if (stmt_may_clobber_ref_p_1 (def_stmt, ref))
+ if (stmt_may_clobber_ref_p_1 (def_stmt, ref, tbaa_p))
{
bool disambiguate_only = true;
if (translate
@@ -3136,7 +3136,7 @@ maybe_skip_until (gimple *phi, tree &target, basic_block target_bb,
Returns NULL_TREE if no suitable virtual operand can be found. */
tree
-get_continuation_for_phi (gimple *phi, ao_ref *ref,
+get_continuation_for_phi (gimple *phi, ao_ref *ref, bool tbaa_p,
unsigned int &limit, bitmap *visited,
bool abort_on_visited,
void *(*translate)(ao_ref *, tree, void *, bool *),
@@ -3179,7 +3179,8 @@ get_continuation_for_phi (gimple *phi, ao_ref *ref,
arg1 = PHI_ARG_DEF (phi, i);
if (arg1 == arg0)
;
- else if (! maybe_skip_until (phi, arg0, dom, ref, arg1, limit, visited,
+ else if (! maybe_skip_until (phi, arg0, dom, ref, arg1, tbaa_p,
+ limit, visited,
abort_on_visited,
/* Do not translate when walking over
backedges. */
@@ -3223,7 +3224,7 @@ get_continuation_for_phi (gimple *phi, ao_ref *ref,
TODO: Cache the vector of equivalent vuses per ref, vuse pair. */
void *
-walk_non_aliased_vuses (ao_ref *ref, tree vuse,
+walk_non_aliased_vuses (ao_ref *ref, tree vuse, bool tbaa_p,
void *(*walker)(ao_ref *, tree, void *),
void *(*translate)(ao_ref *, tree, void *, bool *),
tree (*valueize)(tree),
@@ -3264,7 +3265,7 @@ walk_non_aliased_vuses (ao_ref *ref, tree vuse,
if (gimple_nop_p (def_stmt))
break;
else if (gimple_code (def_stmt) == GIMPLE_PHI)
- vuse = get_continuation_for_phi (def_stmt, ref, limit,
+ vuse = get_continuation_for_phi (def_stmt, ref, tbaa_p, limit,
&visited, translated, translate, data);
else
{
@@ -3274,7 +3275,7 @@ walk_non_aliased_vuses (ao_ref *ref, tree vuse,
break;
}
--limit;
- if (stmt_may_clobber_ref_p_1 (def_stmt, ref))
+ if (stmt_may_clobber_ref_p_1 (def_stmt, ref, tbaa_p))
{
if (!translate)
break;