1 /* PR 30730, PR 26900, number of iterations analysis should be able to
2 determine number of iterations of the following loops unconditionally. */
3
4 /* { dg-do compile } */
5 /* { dg-options "-O2 -fstrict-overflow -fdump-tree-optimized-blocks" } */
6
foo(unsigned int n)7 unsigned foo(unsigned int n)
8 {
9 unsigned x = 0;;
10
11 while (n > 10)
12 {
13 n -= 2;
14 x++;
15 }
16
17 return x;
18 }
19
foo0(int i0,int i1)20 int foo0(int i0, int i1)
21 {
22 int i, j = 0;
23 for (i=i0; i<=i1+1; ++i)
24 ++j;
25 return j;
26 }
27
28 /* { dg-final { scan-tree-dump-times "if" 2 "optimized" } } */
29