00001 /* Triangle loops. */ 00002 void abort (void); 00003 00004 #define N 500 00005 00006 void foo(void) 00007 { 00008 int i,j; 00009 int A[3*N], B[3*N]; 00010 00011 for (i = 0; i < 3*N; i++) 00012 B[i] = A[i] = i; 00013 00014 for (i = 1; i < N; i++) 00015 for (j = 1; j < i; j++) 00016 /* This loop carried no dependency, it fails 00017 at code generation part.*/ 00018 A[j+N] = A[j] + j; 00019 00020 for (i = 1; i < N; i++) 00021 for (j = 1; j < i; j++) 00022 if (A[j+N] != B[j] + j) 00023 abort(); 00024 } 00025 00026 int main(void) 00027 { 00028 foo(); 00029 00030 return 0; 00031 } 00032 00033 /* Check that parallel code generation part make the right answer. */ 00034 /* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */ 00035 /* { dg-final { cleanup-tree-dump "graphite" } } */ 00036 /* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */ 00037 /* { dg-final { scan-tree-dump-times "loopfn.1" 5 "optimized" } } */ 00038 /* { dg-final { cleanup-tree-dump "parloops" } } */ 00039 /* { dg-final { cleanup-tree-dump "optimized" } } */