aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSebastian Pop <sebastian.pop@amd.com>2010-02-06 17:41:54 +0000
committerSebastian Pop <spop@gcc.gnu.org>2010-02-06 17:41:54 +0000
commit28f9f1456e551dabd84c62c6a595256d4c681319 (patch)
tree5ec8cdc506e9cb28fd43883064338835c5bdf06e /gcc
parent4d0bf08b1fee38f60ed5ca16bf8cde66bfc872a4 (diff)
downloadgcc-28f9f1456e551dabd84c62c6a595256d4c681319.zip
gcc-28f9f1456e551dabd84c62c6a595256d4c681319.tar.gz
gcc-28f9f1456e551dabd84c62c6a595256d4c681319.tar.bz2
re PR tree-optimization/42637 ([graphite] wrong code for -floop-interchange -ftree-loop-distribution)
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. Co-Authored-By: Konrad Trifunovic <konrad.trifunovic@inria.fr> From-SVN: r156552
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog.graphite17
-rw-r--r--gcc/graphite-dependences.c67
-rw-r--r--gcc/testsuite/gcc.dg/graphite/block-0.c5
-rw-r--r--gcc/testsuite/gcc.dg/graphite/block-4.c5
-rw-r--r--gcc/testsuite/gcc.dg/graphite/block-7.c5
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-12.c5
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-mvt.c5
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/interchange-1.f2
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/interchange-3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/run-id-1.f47
10 files changed, 106 insertions, 54 deletions
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 55a0b7a..5a6a919 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,20 @@
+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.
+
2010-02-03 Sebastian Pop <sebastian.pop@amd.com>
* testsuite/gcc.dg/graphite/interchange-12.c: Return 0 to avoid
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index a6a7e57..4dc5854 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;
}
diff --git a/gcc/testsuite/gcc.dg/graphite/block-0.c b/gcc/testsuite/gcc.dg/graphite/block-0.c
index e965017..320ee79 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-0.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-0.c
@@ -32,11 +32,8 @@ main()
fprintf (stderr, "res = %d \n", res);
#endif
- /* Avoid runtime check for this testcase, as it is miscompiled by
- Graphite for the moment. */
- return 0;
return res != 1999;
}
-/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-4.c b/gcc/testsuite/gcc.dg/graphite/block-4.c
index e24def0..5092757 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-4.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-4.c
@@ -46,11 +46,8 @@ main (void)
fprintf (stderr, "res = %d \n", res);
#endif
- /* Avoid runtime check for this testcase, as it is miscompiled by
- Graphite for the moment. */
- return 0;
return res != 998001;
}
-/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-7.c b/gcc/testsuite/gcc.dg/graphite/block-7.c
index 9f057ca..a07ef11 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-7.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-7.c
@@ -44,11 +44,8 @@ main (void)
fprintf (stderr, "res = %d \n", res);
#endif
- /* Avoid runtime check for this testcase, as it is miscompiled by
- Graphite for the moment. */
- return 0;
return res != 529340000;
}
-/* { dg-final { scan-tree-dump-times "SCoP will be loop blocked" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-12.c b/gcc/testsuite/gcc.dg/graphite/interchange-12.c
index 0a6ed60..c0e331b 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-12.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-12.c
@@ -44,11 +44,8 @@ main (void)
fprintf (stderr, "res = %d \n", res);
#endif
- /* Avoid runtime check for this testcase, as it is miscompiled by
- Graphite for the moment. */
- return 0;
return res != 2626800;
}
-/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c b/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c
index 7caaeed..a1310dd 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c
@@ -49,12 +49,9 @@ main (void)
fprintf (stderr, "res = %d \n", res);
#endif
- /* Avoid runtime check for this testcase, as it is miscompiled by
- Graphite for the moment. */
- return 0;
return res != 199900000;
}
-/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gfortran.dg/graphite/interchange-1.f b/gcc/testsuite/gfortran.dg/graphite/interchange-1.f
index fad61e2..334fbd8 100644
--- a/gcc/testsuite/gfortran.dg/graphite/interchange-1.f
+++ b/gcc/testsuite/gfortran.dg/graphite/interchange-1.f
@@ -41,5 +41,5 @@
! known to be 4 in the inner two loops. See interchange-2.f for the
! kernel from bwaves.
-! { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } }
+! { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } }
! { dg-final { cleanup-tree-dump "graphite" } }
diff --git a/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90 b/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90
index 06da2b3..04f4a13 100644
--- a/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90
@@ -24,5 +24,5 @@ Program FOO
end Program FOO
-! { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } }
+! { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } }
! { dg-final { cleanup-tree-dump "graphite" } }
diff --git a/gcc/testsuite/gfortran.dg/graphite/run-id-1.f b/gcc/testsuite/gfortran.dg/graphite/run-id-1.f
new file mode 100644
index 0000000..521d268
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/run-id-1.f
@@ -0,0 +1,47 @@
+ subroutine mul66(rt,rtt,r)
+ real*8 rt(6,6),r(6,6),rtt(6,6)
+ do i=1,6
+ do j=1,6
+ do ia=1,6
+ rtt(i,ia)=rt(i,j)*r(j,ia)+rtt(i,ia)
+ end do
+ end do
+ end do
+ end
+
+ program test
+ real*8 xj(6,6),w(6,6),w1(6,6)
+ parameter(idump=0)
+ integer i,j
+
+ do i=1,6
+ do j=1,6
+ xj(i,j) = 0.0d0
+ w1(i,j) = 0.0d0
+ w(i,j) = i * 10.0d0 + j;
+ end do
+ end do
+
+ xj(1,2) = 1.0d0
+ xj(2,1) = -1.0d0
+ xj(3,4) = 1.0d0
+ xj(4,3) = -1.0d0
+ xj(5,6) = 1.0d0
+ xj(6,5) = -1.0d0
+
+ call mul66(xj,w1,w)
+
+ if (idump.ne.0) then
+ write(6,*) 'w1 after call to mul66'
+ do i = 1,6
+ do j = 1,6
+ write(6,'(D15.7)') w1(i,j)
+ end do
+ end do
+ end if
+
+ if (w1(1,1).ne.21.0d0) then
+ call abort()
+ end if
+
+ end