aboutsummaryrefslogtreecommitdiff
path: root/gcc/graphite-dependences.c
diff options
context:
space:
mode:
authorSebastian Pop <sebastian.pop@amd.com>2010-02-06 17:41:54 +0000
committerSebastian Pop <sebastian.pop@amd.com>2010-02-06 17:41:54 +0000
commit3ec5616065ad63fa3c790cc31f96c5c02f22bcea (patch)
tree5ec8cdc506e9cb28fd43883064338835c5bdf06e /gcc/graphite-dependences.c
parent77e80b17507571beb318dece6d26e94ed4562924 (diff)
Fix PR42637.
2010-02-05 Sebastian Pop <sebastian.pop@amd.com> Konrad Trifunovic <konrad.trifunovic@inria.fr> PR middle-end/42637 * graphite-dependences.c (build_lexicographical_constraint): Return a union of dependence polyhedra. (dependence_polyhedron_1): Adapt for build_lexicographical_constraint. * testsuite/gcc.dg/graphite/block-0.c: Enable runtime check. XFAILed. * testsuite/gcc.dg/graphite/block-4.c: Same. * testsuite/gcc.dg/graphite/block-7.c: Same. * testsuite/gcc.dg/graphite/interchange-12.c: Same. * testsuite/gcc.dg/graphite/interchange-mvt.c: Same. * testsuite/gfortran.dg/graphite/interchange-1.f: XFAILed. * testsuite/gfortran.dg/graphite/interchange-3.f90: XFAILed. * testsuite/gfortran.dg/graphite/run-id-1.f: New testcase for PR42637. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@156552 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite-dependences.c')
-rw-r--r--gcc/graphite-dependences.c67
1 files changed, 35 insertions, 32 deletions
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index a6a7e57596d..4dc5854b3f9 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -412,58 +412,56 @@ build_pairwise_scheduling (graphite_dim_t dim,
return res;
}
-/* Add to a non empty polyhedron RES the precedence constraints for
- the lexicographical comparison of time vectors in RES following the
- lexicographical order. DIM is the dimension of the polyhedron RES.
+/* Add to a non empty polyhedron BAG the precedence constraints for
+ the lexicographical comparison of time vectors in BAG following the
+ lexicographical order. DIM is the dimension of the polyhedron BAG.
TDIM is the number of loops common to the two statements that are
compared lexicographically, i.e. the number of loops containing
both statements. OFFSET is the number of dimensions needed to
represent the first statement, i.e. dimT1 + dimI1 in the layout of
- the RES polyhedron: T1|I1|T2|I2|S1|S2|G. When DIRECTION is set to
+ the BAG polyhedron: T1|I1|T2|I2|S1|S2|G. When DIRECTION is set to
1, compute the direct dependence from PDR1 to PDR2, and when
DIRECTION is -1, compute the reversed dependence relation, from
PDR2 to PDR1. */
-static void
-build_lexicographical_constraint (ppl_Pointset_Powerset_C_Polyhedron_t *res,
+static ppl_Pointset_Powerset_C_Polyhedron_t
+build_lexicographical_constraint (ppl_Pointset_Powerset_C_Polyhedron_t bag,
graphite_dim_t dim,
graphite_dim_t tdim,
graphite_dim_t offset,
int direction)
{
graphite_dim_t i;
+ ppl_Pointset_Powerset_C_Polyhedron_t res, lex;
- for (i = 0; i < tdim - 1; i+=2)
- {
- ppl_Pointset_Powerset_C_Polyhedron_t ineq;
- bool empty_p;
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension (&res, dim, 1);
- /* Identify the static schedule dimensions. */
- ineq = build_pairwise_scheduling (dim, i, offset, 0);
- ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (ineq, *res);
- empty_p = ppl_Pointset_Powerset_C_Polyhedron_is_empty (ineq);
+ lex = build_pairwise_scheduling (dim, 0, offset, direction);
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (lex, bag);
- if (empty_p)
- {
- /* Add the lexicographical dynamic schedule dimension. */
- if (i > 0)
- ineq = build_pairwise_scheduling (dim, i - 1, offset, direction);
+ if (!ppl_Pointset_Powerset_C_Polyhedron_is_empty (lex))
+ ppl_Pointset_Powerset_C_Polyhedron_upper_bound_assign (res, lex);
- return;
- }
+ ppl_delete_Pointset_Powerset_C_Polyhedron (lex);
+
+ for (i = 0; i < tdim - 1; i++)
+ {
+ ppl_Pointset_Powerset_C_Polyhedron_t sceq;
+
+ sceq = build_pairwise_scheduling (dim, i, offset, 0);
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (bag, sceq);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (sceq);
+
+ lex = build_pairwise_scheduling (dim, i + 1, offset, direction);
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (lex, bag);
- ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (*res, ineq);
- ppl_delete_Pointset_Powerset_C_Polyhedron (ineq);
+ if (!ppl_Pointset_Powerset_C_Polyhedron_is_empty (lex))
+ ppl_Pointset_Powerset_C_Polyhedron_upper_bound_assign (res, lex);
- /* Identify the dynamic schedule dimensions. */
- ineq = build_pairwise_scheduling (dim, i + 1, offset, 0);
- ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (*res, ineq);
- ppl_delete_Pointset_Powerset_C_Polyhedron (ineq);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (lex);
}
- /* There is no dependence. */
- ppl_delete_Pointset_Powerset_C_Polyhedron (*res);
- ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension (res, dim, 1);
+ return res;
}
/* Build the dependence polyhedron for data references PDR1 and PDR2.
@@ -553,8 +551,13 @@ dependence_polyhedron_1 (poly_dr_p pdr1, poly_dr_p pdr2,
ppl_delete_Pointset_Powerset_C_Polyhedron (dreq);
if (!ppl_Pointset_Powerset_C_Polyhedron_is_empty (res))
- build_lexicographical_constraint (&res, dim, MIN (tdim1, tdim2),
- tdim1 + ddim1, direction);
+ {
+ ppl_Pointset_Powerset_C_Polyhedron_t lex =
+ build_lexicographical_constraint (res, dim, MIN (tdim1, tdim2),
+ tdim1 + ddim1, direction);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (res);
+ res = lex;
+ }
return res;
}