Fix PR47653: do not handle loops using wrapping semantics in graphite

2011-07-26  Sebastian Pop  <sebastian.pop@amd.com>

	PR middle-end/47653
	* graphite-scop-detection.c (graphite_can_represent_loop): Discard
	loops using wrapping semantics.

	* gcc.dg/graphite/run-id-pr47653.c: New.
	* gcc.dg/graphite/interchange-3.c: Do not use unsigned types for
	induction variables.
	* gcc.dg/graphite/scop-16.c: Same.
	* gcc.dg/graphite/scop-17.c: Same.
	* gcc.dg/graphite/scop-21.c: Same.

From-SVN: r176802
This commit is contained in:
Sebastian Pop 2011-07-26 18:48:08 +00:00 committed by Sebastian Pop
parent 4c7d675552
commit cbc1994b2f
9 changed files with 47 additions and 14 deletions

View file

@ -1,3 +1,9 @@
2011-07-26 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/47653
* graphite-scop-detection.c (graphite_can_represent_loop): Discard
loops using wrapping semantics.
2011-07-26 Sebastian Pop <sebastian.pop@amd.com> 2011-07-26 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/48805 PR middle-end/48805

View file

@ -378,17 +378,17 @@ harmful_stmt_in_bb (basic_block scop_entry, loop_p outer_loop, basic_block bb)
static bool static bool
graphite_can_represent_loop (basic_block scop_entry, loop_p loop) graphite_can_represent_loop (basic_block scop_entry, loop_p loop)
{ {
tree niter = number_of_latch_executions (loop); tree niter;
struct tree_niter_desc niter_desc;
/* Number of iterations unknown. */ /* FIXME: For the moment, graphite cannot be used on loops that
if (chrec_contains_undetermined (niter)) iterate using induction variables that wrap. */
return false;
/* Number of iterations not affine. */ return number_of_iterations_exit (loop, single_exit (loop), &niter_desc, false)
if (!graphite_can_represent_expr (scop_entry, loop, niter)) && niter_desc.control.no_overflow
return false; && (niter = number_of_latch_executions (loop))
&& !chrec_contains_undetermined (niter)
return true; && graphite_can_represent_expr (scop_entry, loop, niter);
} }
/* Store information needed by scopdet_* functions. */ /* Store information needed by scopdet_* functions. */

View file

@ -1,3 +1,13 @@
2011-07-26 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/47653
* gcc.dg/graphite/run-id-pr47653.c: New.
* gcc.dg/graphite/interchange-3.c: Do not use unsigned types for
induction variables.
* gcc.dg/graphite/scop-16.c: Same.
* gcc.dg/graphite/scop-17.c: Same.
* gcc.dg/graphite/scop-21.c: Same.
2011-07-26 Sebastian Pop <sebastian.pop@amd.com> 2011-07-26 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/48805 PR middle-end/48805

View file

@ -12,7 +12,7 @@ double u[1782225];
static void __attribute__((noinline)) static void __attribute__((noinline))
foo (int N, int *res) foo (int N, int *res)
{ {
unsigned int i, j; int i, j;
double sum = 0; double sum = 0;
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
{ {

View file

@ -0,0 +1,17 @@
/* { dg-options "-O -fstack-check=generic -ftree-pre -fgraphite-identity" } */
int main ()
{
int i, j;
int x[8][8];
for (i = 0; i < 8; i++)
for (j = i; j < 8; j++)
x[i][j] = 4;
for (i = 0; i < 8; i++)
for (j = i; j < 8; j++)
if (x[i][j] != 4)
__builtin_abort ();
return 0;
}

View file

@ -6,7 +6,7 @@ int test ()
{ {
int a[N][N]; int a[N][N];
int b[N][N]; int b[N][N];
unsigned i, j; int i, j;
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
for (j = 0; j < N; j++) for (j = 0; j < N; j++)

View file

@ -5,7 +5,7 @@ void foo (int);
int test () int test ()
{ {
int a[N][N]; int a[N][N];
unsigned i, j; int i, j;
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
for (j = 0; j < N; j++) for (j = 0; j < N; j++)

View file

@ -3,7 +3,7 @@ void foo (int);
int test () int test ()
{ {
int a[N+6]; int a[N+6];
unsigned i; int i;
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
{ {

View file

@ -23,7 +23,7 @@ int main(void)
} }
/* Check that parallel code generation part make the right answer. */ /* Check that parallel code generation part make the right answer. */
/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 2 "graphite" } } */ /* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 2 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-final { scan-tree-dump-times "loopfn" 5 "optimized" } } */ /* { dg-final { scan-tree-dump-times "loopfn" 5 "optimized" } } */
/* { dg-final { cleanup-tree-dump "parloops" } } */ /* { dg-final { cleanup-tree-dump "parloops" } } */