re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / loop-26.c
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 "-O -fstrict-overflow -fdump-tree-empty" } */
6
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
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 "Removing empty loop" 2 "empty" } } */
29 /* { dg-final { cleanup-tree-dump "empty" } } */