1 /* { dg-do run } */
2 /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */
3 
4 /* Copied from graphite/interchange-4.c */
5 
6 #define DEBUG 0
7 #if DEBUG
8 #include <stdio.h>
9 #endif
10 
11 unsigned u[1024];
12 
13 static void __attribute__((noinline,noclone,noipa))
foo(int N,int M,unsigned * res)14 foo (int N, int M, unsigned *res)
15 {
16   int i, j;
17   unsigned sum = 0;
18   if (N > 0)
19     for (i = 0; i < M; i++)
20       for (j = 0; j < N; j++)
21 	sum = u[i + 3 * j] - sum;
22 
23   *res = sum;
24 }
25 
26 extern void abort ();
27 
28 int
main(void)29 main (void)
30 {
31   int i, j;
32   unsigned res;
33 
34   u[0] = 1;
35   u[1] = 2;
36   u[2] = 4;
37   u[3] = 5;
38   u[4] = 7;
39   u[5] = 8;
40 
41   foo (2, 3, &res);
42 
43 #if DEBUG
44   fprintf (stderr, "res = %d \n", res);
45 #endif
46 
47   if (res != 13)
48     abort ();
49 
50   return 0;
51 }
52 
53 /* { dg-final { scan-tree-dump-not "is interchanged" "linterchange"} } */
54