Merge reload-branch up to revision 101000
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / loop-7.c
bloba4597b196d71db420e32014c96f9313d7f356556
1 /* PR tree-optimization/19828 */
2 /* { dg-do compile } */
3 /* { dg-options "-O1 -fdump-tree-lim-details" } */
5 int cst_fun1 (int) __attribute__((__const__));
6 int cst_fun2 (int) __attribute__((__const__));
7 int pure_fun1 (int) __attribute__((__pure__));
8 int pure_fun2 (int) __attribute__((__pure__));
9 int foo (void);
11 int xxx (void)
13 int i, k = foo (), x = 0;
15 for (i = 0; i < 100; i++)
17 x += cst_fun1 (k);
18 x += pure_fun1 (k);
20 if (k)
22 x += cst_fun2 (k);
23 x += pure_fun2 (k);
27 return x;
30 /* Calls to cst_fun1 and pure_fun1 may be moved out of the loop.
31 Calls to cst_fun2 and pure_fun2 should not be, since calling
32 with k = 0 may be invalid. */
34 /* { dg-final { scan-tree-dump-times "Moving statement" 3 "lim" } } */
35 /* { dg-final { cleanup-tree-dump "lim" } } */