Merge from mainline
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr21294.c
blob567e6366ad4caaf941e55f9915e244bce23e4c4d
1 /* PR tree-optimization/21294
2 VRP did not notice that an address of the form &p->i is nonnull
3 when p is known to be nonnull. In this testcase, noticing that
4 allows us to eliminate the second "if" statement. */
6 /* { dg-do compile } */
7 /* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1-details" } */
9 struct f {
10 int i;
13 int
14 foo (struct f *p)
16 if (p != 0)
17 if (&p->i != 0)
18 return 123;
19 return 0;
22 /* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp1"} } */
23 /* { dg-final { cleanup-tree-dump "vrp1" } } */