1 /* { dg-do run } */
2 /* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */
3
4 int arr[105] = {2, 3, 5, 7, 11};
5 int result0[10] = {2, 3, 5, 7, 11};
6 int result1[10] = {0, 3, 5, -2, 11, 0};
7
8 extern void abort (void);
9
foo(int * a,int len,int flag)10 void __attribute__((noinline)) foo (int *a, int len, int flag)
11 {
12 int i;
13 for (i = 0; i < len; i++)
14 {
15 a[i] = 0;
16 if (flag)
17 a[i + 1] = -1;
18 a[i + 3] = -2;
19 }
20 }
21
check(int * a,int * res,int len)22 void check (int *a, int *res, int len)
23 {
24 int i;
25
26 for (i = 0; i < len; i++)
27 if (a[i] != res[i])
28 abort ();
29 }
30
main(void)31 int main (void)
32 {
33 int i;
34
35 foo (arr, 0, 0);
36 check (arr, result0, 10);
37
38 foo (arr, 1, 0);
39 check (arr, result1, 10);
40
41 return 0;
42 }
43 /* { dg-final { scan-tree-dump-not "Store-stores chain" "pcom"} } */
44
45