1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-vrp1 -fno-early-inlining -fdelete-null-pointer-checks" } */
3
4 typedef struct {
5 int code;
6 } *rtx;
7
zero()8 static inline void *zero ()
9 {
10 return 0;
11 }
three()12 static inline int three ()
13 {
14 return 3;
15 }
16
17 int
can_combine_p(rtx insn,rtx elt)18 can_combine_p (rtx insn, rtx elt)
19 {
20 rtx set;
21
22 set = zero ();
23 if (insn->code == three ())
24 set = insn;
25 else
26 {
27 set = elt;
28 if (set == zero ())
29 return 0;
30 }
31
32 if (set == zero ())
33 return 1;
34
35 return 0;
36 }
37
38 /* Target disabling -fdelete-null-pointer-checks should not fold checks */
39 /* { dg-final { scan-tree-dump-times "Folding predicate.*to 0" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
40 /* { dg-final { scan-tree-dump-times "Folding predicate.*to 0" 0 "vrp1" { target { keeps_null_pointer_checks } } } } */
41