re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / vrp08.c
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fno-tree-fre -fdump-tree-vrp1-details" } */
3
4 /* Compile with -fno-tree-fre -O2 to prevent CSEing *p. */
5 foo (int a, int *p)
6 {
7 int x = *p + 2;
8 int y = *p - 1;
9 int z = *p + 9;
10
11 /* This should be folded to if (1), but only one ASSERT_EXPR should
12 be inserted. */
13 if (p)
14 a = x + y + z;
15 else
16 a = x - y;
17
18 return a;
19 }
20
21 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" } } */
22 /* { dg-final { scan-tree-dump-times "PREDICATE: p_.* ne_expr 0" 1 "vrp1" } } */
23 /* { dg-final { cleanup-tree-dump "vrp1" } } */