| 1 |
/* Triangle loops. */ |
| 2 |
void abort (void); |
| 3 |
|
| 4 |
#define N 500 |
| 5 |
|
| 6 |
void foo(void) |
| 7 |
{ |
| 8 |
int i,j; |
| 9 |
int A[3*N], B[3*N]; |
| 10 |
|
| 11 |
for (i = 0; i < 3*N; i++) |
| 12 |
B[i] = A[i] = i; |
| 13 |
|
| 14 |
for (i = 1; i < N; i++) |
| 15 |
for (j = 1; j < i; j++) |
| 16 |
/* This loop carried no dependency, it fails |
| 17 |
at code generation part.*/ |
| 18 |
A[j+N] = A[j] + j; |
| 19 |
|
| 20 |
for (i = 1; i < N; i++) |
| 21 |
for (j = 1; j < i; j++) |
| 22 |
if (A[j+N] != B[j] + j) |
| 23 |
abort(); |
| 24 |
} |
| 25 |
|
| 26 |
int main(void) |
| 27 |
{ |
| 28 |
foo(); |
| 29 |
|
| 30 |
return 0; |
| 31 |
} |
| 32 |
|
| 33 |
/* Check that parallel code generation part make the right answer. */ |
| 34 |
/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */ |
| 35 |
/* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */ |
| 36 |
/* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */ |