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.  */
5 
6 /* { dg-do compile } */
7 /* { dg-options "-O2 -fno-tree-dominator-opts -fdisable-tree-evrp -fdump-tree-vrp1-details" } */
8 
9 struct f {
10   int i;
11 };
12 
13 int
foo(struct f * p)14 foo (struct f *p)
15 {
16   if (p != 0)
17     if (&p->i != 0)
18       return 123;
19   return 0;
20 }
21 
22 /* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp1"} } */
23