diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/vrp05.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/vrp05.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp05.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp05.c new file mode 100644 index 000000000..7b8b61b44 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp05.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1 -fno-early-inlining" } */ + + +inline int ten() +{ + return 10; +} +inline int zero() +{ + return 0; +} + +foo (int k, int j) +{ + if (k >= ten()) + { + if (j > k) + { + /* We should fold this to if (1). */ + if (j > zero()) + return j; + } + } + + return j+1; +} + +/* { dg-final { scan-tree-dump-times "Folding predicate j_.*to 1" 1 "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */ |