1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3 /* { dg-require-effective-target int32plus } */
4
5 int bar (void);
6
foo(void)7 void foo (void)
8 {
9 unsigned i, j, n;
10
11 for (i = 0; i < 100000; i++)
12 ;
13
14 n = bar ();
15 for (i = 0; i < n; i++)
16 ;
17
18 for (i = 0; i < n; i++)
19 for (j = 0; j < n; j++)
20 ;
21
22 /* These should not be removed. */
23 for (i = 0; i < 10000; i++)
24 bar ();
25
26 for (i = 0; i != n; i += 2)
27 ;
28 }
29
30 /* { dg-final { scan-tree-dump-times "if " 3 "optimized" } } */
31 /* { dg-final { scan-tree-dump-times "bar " 2 "optimized" } } */
32
33