1 /* { dg-do compile } */
3 /* { dg-options "-O2 -fpredictive-commoning -fdump-tree-pcom-details" } */
5 /* Test for predictive commoning of expressions, with reassociation. */
9 unsigned a[1000], b[1000], c[1000], d[1000];
15 for (i = 0; i < 1000; i++)
16 a[i] = b[i] = d[i] = i;
18 for (i = 1; i < 998; i++)
19 c[i] = d[i + 1] * a[i + 2] * b[i + 1] - b[i - 1] * a[i] * d[i - 1];
21 for (i = 1; i < 998; i++)
22 if (c[i] != (i+1)*(i+2)*(i+1) - (i - 1) * i * (i - 1))
28 /* { dg-final { scan-tree-dump-times "Combination" 2 "pcom"} } */
29 /* { dg-final { scan-tree-dump-times "Unrolling 3 times." 1 "pcom"} } */
30 /* { dg-final { cleanup-tree-dump "pcom" } } */