PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr20702.c
blobc896857748c5a2ff81849b5a75968f52e2ed9bb3
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. */
6 /* { dg-do compile } */
7 /* { dg-options "-O2 -fno-tree-dominator-opts -fdisable-tree-evrp -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */
9 extern void bar (int);
11 int
12 foo (int *p, int b)
14 int a;
16 if (b)
17 bar (123);
18 else
19 bar (321);
21 a = *p;
22 if (p == 0)
23 return 0;
25 return a;
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 } } } } */