re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-ccp-14.c
1 /* PR tree-optimization/29738. We used not to realize that "i" can never
2 become nonzero. */
3
4 /* { dg-do compile } */
5 /* { dg-options "-O2 -fdump-tree-optimized" } */
6
7 int i;
8
9 void foo (void);
10 void bar (void)
11 {
12 int j;
13 i = 0;
14 for (j = 0; j < 10000; j++)
15 if (i)
16 foo ();
17 }
18
19 /* Everything except for the "i = 0" assignment should get removed. */
20 /* { dg-final { scan-tree-dump-times "if" 0 "optimized"} } */
21 /* { dg-final { cleanup-tree-dump "optimized" } } */