gcc/testsuite/gcc.dg/ipa/vrp4.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -fdump-ipa-cp-details -fdump-tree-vrp1" } */ |
| 3 | |
| 4 | static __attribute__((noinline, noclone)) |
| 5 | int foo (int *p) |
| 6 | { |
| 7 | if (!p) |
| 8 | return 0; |
| 9 | *p = 1; |
| 10 | } |
| 11 | |
| 12 | struct st |
| 13 | { |
| 14 | int a; |
| 15 | int b; |
| 16 | }; |
| 17 | |
| 18 | int bar (struct st *s) |
| 19 | { |
| 20 | |
| 21 | if (!s) |
| 22 | return 0; |
| 23 | foo (&s->a); |
| 24 | foo (&s->b); |
| 25 | } |
| 26 | |
| 27 | /* { dg-final { scan-ipa-dump "Setting value range.* \\\[1, \\+INF\\\]" "cp" } } */ |
| 28 | /* { dg-final { scan-tree-dump-times "if" 1 "vrp1" } } */ |