2 /* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */
4 int arr
[105] = {2, 3, 5, 7, 11};
5 int result0
[10] = {2, 3, 5, 7, 11};
6 int result1
[10] = {0, -1, 5, -2, 11, 0};
7 int result2
[10] = {0, 0, -1, -2, -2, 0};
8 int result3
[10] = {0, 0, 0, -1, -2, -2, 0};
9 int result4
[10] = {0, 0, 0, 0, -1, -2, -2, 0};
10 int result100
[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
11 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
12 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
13 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
14 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
15 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
16 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -2, 0};
18 extern void abort (void);
21 void __attribute__((noinline
)) foo (int * restrict a
, int len
, int t1
, int t2
)
24 for (i
= 0; i
< len
; i
++)
29 sum
= sum
+ a
[i
] + a
[i
+ 3];
33 void check (int *a
, int *res
, int len
, int sval
)
40 for (i
= 0; i
< len
; i
++)
48 check (arr
, result0
, 10, 0);
51 check (arr
, result1
, 10, -2);
54 check (arr
, result2
, 10, -6);
57 check (arr
, result3
, 10, -12);
60 check (arr
, result4
, 10, -20);
62 foo (arr
, 100, 0, -2);
63 check (arr
, result100
, 105, -220);
67 /* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */