]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/tree-ssa/vrp03.c
Fix profile update in tree_transform_and_unroll_loop
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / vrp03.c
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1 -fno-thread-jumps" } */
3
4 struct A
5 {
6 int a;
7 int b;
8 };
9
10 int
11 foo (struct A *p, struct A *q)
12 {
13 int *r = 0;
14
15 if (p)
16 {
17 if (p == q)
18 {
19 /* This should be folded to 'if (1)' because q is [p, p]
20 and p is ~[0, 0]. */
21 if (q)
22 r = &q->a;
23
24 /* This should be folded to 'if (1)' because q should be
25 ~[0, 0] and thus &q->a should be ~[0, 0]. */
26 if (r)
27 return 5;
28 }
29 }
30
31 return q->a;
32 }
33
34 /* { dg-final { scan-tree-dump-times "Folding predicate q_.*to 1" 1 "vrp1" } } */
35 /* { dg-final { scan-tree-dump-times "Folding predicate r_.*to 1" 1 "vrp1" } } */