summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/vrp11.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/vrp11.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp11.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp11.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp11.c
new file mode 100644
index 000000000..591507c22
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp11.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fno-early-inlining" } */
+
+inline int
+bounce (int arg)
+{
+ return arg;
+}
+
+foo (int k, int j, int z)
+{
+ if (k > z)
+ {
+ if (j > k)
+ {
+ /* We should fold this to if (1). */
+ if (j > bounce (z))
+ return j;
+ }
+ }
+
+ return j+1;
+}
+
+/* { dg-final { scan-tree-dump-times "Folding predicate.*to 1" 1 "vrp1" } } */
+/* { dg-final { cleanup-tree-dump "vrp1" } } */