aboutsummaryrefslogtreecommitdiff
path: root/gcc/sese.c
diff options
context:
space:
mode:
authorAditya Kumar <aditya.k7@samsung.com>2015-10-21 21:18:27 +0000
committerSebastian Pop <spop@gcc.gnu.org>2015-10-21 21:18:27 +0000
commit78fd2726cafeb9e0cf377e5fb2102d09d91779d5 (patch)
treeedc739b54786c480775bcdd4ce45e801f6224ec9 /gcc/sese.c
parent8b76e7fef8246b7bb6f209b8ce0768d437b7b4a0 (diff)
downloadgcc-78fd2726cafeb9e0cf377e5fb2102d09d91779d5.zip
gcc-78fd2726cafeb9e0cf377e5fb2102d09d91779d5.tar.gz
gcc-78fd2726cafeb9e0cf377e5fb2102d09d91779d5.tar.bz2
a scalar depending on vdefs in the current region is not invariant
When a scalar is defined in function of an array reference in the current scop, it does variate. Graphite cannot represent the condition in scop-11.c, as a[*] variates in the current region, and it is not an affine condition: for (j = 0; j <= 20; j++) a[j] = b + i; if (a[12] == 23) b = 3; else b = 1; for (j = 0; j <= 20; j++) a[j] = b + i; * graphite-scop-detection.c (parameter_index_in_region): Update call to invariant_in_sese_p_rec. * graphite-sese-to-poly.c (extract_affine): Same. * sese.c (invariant_in_sese_p_rec): Pass in an extra parameter has_vdefs. (scalar_evolution_in_region): Return chrec_dont_know when the scalar variable depends on virtual definitions in the current region. * sese.h (invariant_in_sese_p_rec): Update declaration. testsuite/ * gcc.dg/graphite/scop-11.c: Update pattern. Co-Authored-By: Sebastian Pop <s.pop@samsung.com> From-SVN: r229151
Diffstat (limited to 'gcc/sese.c')
-rw-r--r--gcc/sese.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/sese.c b/gcc/sese.c
index aa19c68..797dea5 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -787,10 +787,11 @@ set_ifsese_condition (ifsese if_region, tree condition)
}
/* Return true when T is defined outside REGION or when no definitions are
- variant in REGION. */
+ variant in REGION. When HAS_VDEFS is a valid pointer, sets HAS_VDEFS to true
+ when T depends on memory that may change in REGION. */
bool
-invariant_in_sese_p_rec (tree t, sese_l &region)
+invariant_in_sese_p_rec (tree t, sese_l &region, bool *has_vdefs)
{
ssa_op_iter iter;
use_operand_p use_p;
@@ -805,11 +806,15 @@ invariant_in_sese_p_rec (tree t, sese_l &region)
/* VDEF is variant when it is in the region. */
if (gimple_vdef (stmt))
- return false;
+ {
+ if (has_vdefs)
+ *has_vdefs = true;
+ return false;
+ }
/* A VUSE may or may not be variant following the VDEFs. */
if (tree vuse = gimple_vuse (stmt))
- return invariant_in_sese_p_rec (vuse, region);
+ return invariant_in_sese_p_rec (vuse, region, has_vdefs);
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
{
@@ -818,7 +823,7 @@ invariant_in_sese_p_rec (tree t, sese_l &region)
if (!defined_in_sese_p (use, region))
continue;
- if (!invariant_in_sese_p_rec (use, region))
+ if (!invariant_in_sese_p_rec (use, region, has_vdefs))
return false;
}
@@ -856,8 +861,13 @@ scalar_evolution_in_region (sese_l &region, loop_p loop, tree t)
return t;
}
- if (invariant_in_sese_p_rec (t, region))
+ bool has_vdefs = false;
+ if (invariant_in_sese_p_rec (t, region, &has_vdefs))
return t;
+ /* T variates in REGION. */
+ if (has_vdefs)
+ return chrec_dont_know;
+
return instantiate_scev (before, loop, t);
}