gcc/testsuite/gcc.dg/tree-ssa/vrp05.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -fdump-tree-vrp1 -fno-early-inlining -fno-thread-jumps -fno-ipa-vrp" } */ |
| 3 | |
| 4 | |
| 5 | inline int ten() |
| 6 | { |
| 7 | return 10; |
| 8 | } |
| 9 | inline int zero() |
| 10 | { |
| 11 | return 0; |
| 12 | } |
| 13 | |
| 14 | int |
| 15 | foo (int k, int j) |
| 16 | { |
| 17 | if (k >= ten()) |
| 18 | { |
| 19 | if (j > k) |
| 20 | { |
| 21 | /* We should fold this to if (1). */ |
| 22 | if (j > zero()) |
| 23 | return j; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | return j+1; |
| 28 | } |
| 29 | |
| 30 | /* { dg-final { scan-tree-dump-times "Folding predicate j_.*to 1" 1 "vrp1" } } */ |