aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-data-ref.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-05-06 12:38:35 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-05-06 12:38:35 +0000
commit1d0b81c64c05f40b94bd221558d0339c732d8cc4 (patch)
treef8264b89d277701f04c4d39df3c9cfbbb60354bd /gcc/tree-data-ref.c
parentb744fc85f549534bcbc36dedcc1659c02e16c617 (diff)
downloadgcc-1d0b81c64c05f40b94bd221558d0339c732d8cc4.zip
gcc-1d0b81c64c05f40b94bd221558d0339c732d8cc4.tar.gz
gcc-1d0b81c64c05f40b94bd221558d0339c732d8cc4.tar.bz2
re PR tree-optimization/90328 (Wrong loop distribution with aliasing)
2019-05-06 Richard Biener <rguenther@suse.de> PR tree-optimization/90328 * tree-data-ref.h (dr_may_alias_p): Pass in the actual loop nest. * tree-data-ref.c (dr_may_alias_p): Check whether the clique is valid in the loop nest before using it. (initialize_data_dependence_relation): Adjust. * graphite-scop-detection.c (build_alias_set): Pass the SCOP enclosing loop as loop-nest to dr_may_alias_p. * gcc.dg/torture/pr90328.c: New testcase. From-SVN: r270906
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r--gcc/tree-data-ref.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 6c69f77..67b960d 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -2231,7 +2231,7 @@ object_address_invariant_in_loop_p (const struct loop *loop, const_tree obj)
bool
dr_may_alias_p (const struct data_reference *a, const struct data_reference *b,
- bool loop_nest)
+ struct loop *loop_nest)
{
tree addr_a = DR_BASE_OBJECT (a);
tree addr_b = DR_BASE_OBJECT (b);
@@ -2255,6 +2255,11 @@ dr_may_alias_p (const struct data_reference *a, const struct data_reference *b,
if ((TREE_CODE (addr_a) == MEM_REF || TREE_CODE (addr_a) == TARGET_MEM_REF)
&& (TREE_CODE (addr_b) == MEM_REF || TREE_CODE (addr_b) == TARGET_MEM_REF)
+ /* For cross-iteration dependences the cliques must be valid for the
+ whole loop, not just individual iterations. */
+ && (!loop_nest
+ || MR_DEPENDENCE_CLIQUE (addr_a) == 1
+ || MR_DEPENDENCE_CLIQUE (addr_a) == loop_nest->owned_clique)
&& MR_DEPENDENCE_CLIQUE (addr_a) == MR_DEPENDENCE_CLIQUE (addr_b)
&& MR_DEPENDENCE_BASE (addr_a) != MR_DEPENDENCE_BASE (addr_b))
return false;
@@ -2366,7 +2371,7 @@ initialize_data_dependence_relation (struct data_reference *a,
}
/* If the data references do not alias, then they are independent. */
- if (!dr_may_alias_p (a, b, loop_nest.exists ()))
+ if (!dr_may_alias_p (a, b, loop_nest.exists () ? loop_nest[0] : NULL))
{
DDR_ARE_DEPENDENT (res) = chrec_known;
return res;