PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / vrp03.c
blobbafb65a53d63e5d1f2c94a5aca7f08de60e473c6
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1" } */
4 struct A
6 int a;
7 int b;
8 };
10 int
11 foo (struct A *p, struct A *q)
13 int *r = 0;
15 if (p)
17 if (p == q)
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;
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;
31 return q->a;
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" } } */