gcc/testsuite/gcc.dg/tree-ssa/vrp01.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -fdump-tree-vrp1 -fdisable-tree-ethread" } */ |
| 3 | |
| 4 | int |
| 5 | foo (int *p, int i) |
| 6 | { |
| 7 | int x; |
| 8 | |
| 9 | if (i > 10) |
| 10 | { |
| 11 | if (p) |
| 12 | { |
| 13 | x = *p; |
| 14 | p = 0; |
| 15 | } |
| 16 | } |
| 17 | else |
| 18 | p = 0; |
| 19 | |
| 20 | /* This should be folded to if (1), but only if we insert an |
| 21 | assertion on the ELSE edge from the inner 'if (p)'. */ |
| 22 | if (p == 0) |
| 23 | return x + 1; |
| 24 | |
| 25 | return i; |
| 26 | } |
| 27 | |
| 28 | /* { dg-final { scan-tree-dump-times "if \\\(" 2 "vrp1" } } */ |