1 /* { dg-options "-O3 -fdump-tree-lversion-details" } */
2
3 /* Versioning for step == 1 in these loops would allow loop interchange,
4 but otherwise isn't worthwhile. At the moment we decide not to version. */
5
6 struct foo {
7 int a[100];
8 };
9
10 void
f1(struct foo * x,int step,int n)11 f1 (struct foo *x, int step, int n)
12 {
13 for (int i = 0; i < n; ++i)
14 for (int j = 0; j < n; ++j)
15 x[j * step].a[i] = 100;
16 }
17
18 void
f2(struct foo * x,int step,int n)19 f2 (struct foo *x, int step, int n)
20 {
21 for (int i = 0; i < n; ++i)
22 for (int j = 0; j < n; ++j)
23 x[j].a[i * step] = 100;
24 }
25
26 void
f3(struct foo * x,int step,int limit)27 f3 (struct foo *x, int step, int limit)
28 {
29 for (int i = 0; i < 100; ++i)
30 for (int j = 0; j < limit; j += step)
31 x[j].a[i] = 100;
32 }
33
34 void
f4(struct foo * x,int step,int limit)35 f4 (struct foo *x, int step, int limit)
36 {
37 for (int i = 0; i < limit; i += step)
38 for (int j = 0; j < 100; ++j)
39 x[j].a[i] = 100;
40 }
41
42 /* { dg-final { scan-tree-dump-not {want to version} "lversion" } } */
43 /* { dg-final { scan-tree-dump-not {versioned} "lversion" } } */
44