1 /* PR tree-optimization/20702
2    VRP did not insert ASSERT_EXPRs into dominator dominator children
3    of a basic block ending with COND_EXPR unless the children are also
4    immediate successors of the basic block.  */
5 
6 /* { dg-do compile } */
7 /* { dg-options "-O2 -fno-tree-dominator-opts -fdisable-tree-evrp -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */
8 
9 extern void bar (int);
10 
11 int
foo(int * p,int b)12 foo (int *p, int b)
13 {
14   int a;
15 
16   if (b)
17     bar (123);
18   else
19     bar (321);
20 
21   a = *p;
22   if (p == 0)
23     return 0;
24 
25   return a;
26 }
27 
28 /* Target disabling -fdelete-null-pointer-checks should not fold checks */
29 /* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
30 /* { dg-final { scan-tree-dump-times "Folding predicate" 0 "vrp1" { target {   keeps_null_pointer_checks } } } } */
31