re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / vrp06.c
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-vrp1" } */
3
4 foo (int i, int j, int a)
5 {
6 if (i >= 10)
7 if (i <= 30)
8 if (i == j)
9 {
10 a--;
11
12 /* This should fold to 'if (0)'. */
13 if (i < 0)
14 i = baz ();
15
16 /* This should fold to 'if (1)'. */
17 if (j > 0)
18 a--;
19
20 /* This should fold to 'if (0)'. */
21 if (i != j)
22 return 0;
23 }
24
25 return i + a + j;
26 }
27
28 /* { dg-final { scan-tree-dump-times "Folding predicate i_.*to 0" 1 "vrp1" } } */
29 /* { dg-final { scan-tree-dump-times "Folding predicate j_.*to 1" 1 "vrp1" } } */
30 /* { dg-final { scan-tree-dump-times "Folding predicate i_.*to 0" 1 "vrp1" } } */
31 /* { dg-final { cleanup-tree-dump "vrp1" } } */