aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-09-29 13:04:18 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-09-29 13:04:18 +0000
commite7cbc0960edec3d2ce1edf00b6c536a6f2faca33 (patch)
tree5013d6531f4e348668278ebcc16763017f224884 /gcc/tree-ssa-alias.c
parenteada851cc9fb2822989d3ef81bb5b4b08dcc81a7 (diff)
downloadgcc-e7cbc0960edec3d2ce1edf00b6c536a6f2faca33.zip
gcc-e7cbc0960edec3d2ce1edf00b6c536a6f2faca33.tar.gz
gcc-e7cbc0960edec3d2ce1edf00b6c536a6f2faca33.tar.bz2
re PR fortran/67170 (PRE can't hoist out a readonly argument)
2015-09-29 Richard Biener <rguenther@suse.de> PR tree-optimization/67170 * tree-ssa-alias.h (get_continuation_for_phi): Adjust the translate function pointer parameter to get the bool whether to disambiguate only by reference. (walk_non_aliased_vuses): Likewise. * tree-ssa-alias.c (maybe_skip_until): Adjust. (get_continuation_for_phi_1): Likewise. (get_continuation_for_phi): Likewise. (walk_non_aliased_vuses): Likewise. * tree-ssa-sccvn.c (const_parms): New bitmap. (vn_reference_lookup_3): Adjust for interface change. Disambiguate parameters pointing to readonly memory. (free_scc_vn): Free const_parms. (run_scc_vn): Initialize const_parms from a fn spec attribute. * gfortran.dg/pr67170.f90: New testcase. From-SVN: r228244
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 5ff2275..3b8d594 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -2442,7 +2442,7 @@ static bool
maybe_skip_until (gimple *phi, tree target, ao_ref *ref,
tree vuse, unsigned int *cnt, bitmap *visited,
bool abort_on_visited,
- void *(*translate)(ao_ref *, tree, void *, bool),
+ void *(*translate)(ao_ref *, tree, void *, bool *),
void *data)
{
basic_block bb = gimple_bb (phi);
@@ -2477,8 +2477,9 @@ maybe_skip_until (gimple *phi, tree target, ao_ref *ref,
++*cnt;
if (stmt_may_clobber_ref_p_1 (def_stmt, ref))
{
+ bool disambiguate_only = true;
if (translate
- && (*translate) (ref, vuse, data, true) == NULL)
+ && (*translate) (ref, vuse, data, &disambiguate_only) == NULL)
;
else
return false;
@@ -2505,7 +2506,7 @@ static tree
get_continuation_for_phi_1 (gimple *phi, tree arg0, tree arg1,
ao_ref *ref, unsigned int *cnt,
bitmap *visited, bool abort_on_visited,
- void *(*translate)(ao_ref *, tree, void *, bool),
+ void *(*translate)(ao_ref *, tree, void *, bool *),
void *data)
{
gimple *def0 = SSA_NAME_DEF_STMT (arg0);
@@ -2547,13 +2548,14 @@ get_continuation_for_phi_1 (gimple *phi, tree arg0, tree arg1,
else if ((common_vuse = gimple_vuse (def0))
&& common_vuse == gimple_vuse (def1))
{
+ bool disambiguate_only = true;
*cnt += 2;
if ((!stmt_may_clobber_ref_p_1 (def0, ref)
|| (translate
- && (*translate) (ref, arg0, data, true) == NULL))
+ && (*translate) (ref, arg0, data, &disambiguate_only) == NULL))
&& (!stmt_may_clobber_ref_p_1 (def1, ref)
|| (translate
- && (*translate) (ref, arg1, data, true) == NULL)))
+ && (*translate) (ref, arg1, data, &disambiguate_only) == NULL)))
return common_vuse;
}
@@ -2571,7 +2573,7 @@ tree
get_continuation_for_phi (gimple *phi, ao_ref *ref,
unsigned int *cnt, bitmap *visited,
bool abort_on_visited,
- void *(*translate)(ao_ref *, tree, void *, bool),
+ void *(*translate)(ao_ref *, tree, void *, bool *),
void *data)
{
unsigned nargs = gimple_phi_num_args (phi);
@@ -2648,7 +2650,7 @@ get_continuation_for_phi (gimple *phi, ao_ref *ref,
void *
walk_non_aliased_vuses (ao_ref *ref, tree vuse,
void *(*walker)(ao_ref *, tree, unsigned int, void *),
- void *(*translate)(ao_ref *, tree, void *, bool),
+ void *(*translate)(ao_ref *, tree, void *, bool *),
tree (*valueize)(tree),
void *data)
{
@@ -2690,7 +2692,8 @@ walk_non_aliased_vuses (ao_ref *ref, tree vuse,
{
if (!translate)
break;
- res = (*translate) (ref, vuse, data, false);
+ bool disambiguate_only = false;
+ res = (*translate) (ref, vuse, data, &disambiguate_only);
/* Failed lookup and translation. */
if (res == (void *)-1)
{
@@ -2701,7 +2704,7 @@ walk_non_aliased_vuses (ao_ref *ref, tree vuse,
else if (res != NULL)
break;
/* Translation succeeded, continue walking. */
- translated = true;
+ translated = translated || !disambiguate_only;
}
vuse = gimple_vuse (def_stmt);
}