annotate gcc/testsuite/gcc.dg/tree-ssa/vrp02.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile } */
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 /* { dg-options "-O2 -fdump-tree-vrp1 -fdelete-null-pointer-checks -fdisable-tree-evrp" } */
111
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 struct A
kono
parents:
diff changeset
5 {
kono
parents:
diff changeset
6 int a;
kono
parents:
diff changeset
7 int b;
kono
parents:
diff changeset
8 };
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 int
kono
parents:
diff changeset
11 foo (struct A *p, struct A *q)
kono
parents:
diff changeset
12 {
kono
parents:
diff changeset
13 int x = p->a;
kono
parents:
diff changeset
14 if (p == q)
kono
parents:
diff changeset
15 return q->a;
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 /* We should fold this to 'if (1)' but the assertion for 'p == q'
kono
parents:
diff changeset
18 was overwriting the assertion 'p != 0' from the first dereference
kono
parents:
diff changeset
19 of 'p'. */
kono
parents:
diff changeset
20 if (p)
kono
parents:
diff changeset
21 return x + p->b;
kono
parents:
diff changeset
22 }
kono
parents:
diff changeset
23 /* Target disabling -fdelete-null-pointer-checks should not fold check */
kono
parents:
diff changeset
24 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
kono
parents:
diff changeset
25 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 0 "vrp1" { target { keeps_null_pointer_checks } } } } */