annotate gcc/testsuite/gcc.dg/tree-ssa/vrp03.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 } */
kono
parents:
diff changeset
2 /* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1" } */
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 *r = 0;
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 if (p)
kono
parents:
diff changeset
16 {
kono
parents:
diff changeset
17 if (p == q)
kono
parents:
diff changeset
18 {
kono
parents:
diff changeset
19 /* This should be folded to 'if (1)' because q is [p, p]
kono
parents:
diff changeset
20 and p is ~[0, 0]. */
kono
parents:
diff changeset
21 if (q)
kono
parents:
diff changeset
22 r = &q->a;
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 /* This should be folded to 'if (1)' because q should be
kono
parents:
diff changeset
25 ~[0, 0] and thus &q->a should be ~[0, 0]. */
kono
parents:
diff changeset
26 if (r)
kono
parents:
diff changeset
27 return 5;
kono
parents:
diff changeset
28 }
kono
parents:
diff changeset
29 }
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 return q->a;
kono
parents:
diff changeset
32 }
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 /* { dg-final { scan-tree-dump-times "Folding predicate q_.*to 1" 1 "vrp1" } } */
kono
parents:
diff changeset
35 /* { dg-final { scan-tree-dump-times "Folding predicate r_.*to 1" 1 "vrp1" } } */