aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2006-02-07 12:59:34 -0700
committerJeff Law <law@gcc.gnu.org>2006-02-07 12:59:34 -0700
commit29ba5b7a7c72bd5d6728af89b4d44135e17fa39f (patch)
tree8e9ba84f2ce9153486e40e321248a9c2c00faa8c
parent1104b28bc84483a6e98335cc5369d089a56ec6ed (diff)
downloadgcc-29ba5b7a7c72bd5d6728af89b4d44135e17fa39f.zip
gcc-29ba5b7a7c72bd5d6728af89b4d44135e17fa39f.tar.gz
gcc-29ba5b7a7c72bd5d6728af89b4d44135e17fa39f.tar.bz2
pr21559.c: New test.
* gcc.dg/tree-ssa/pr21559.c: New test. From-SVN: r110713
-rw-r--r--gcc/testsuite/ChangeLog2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr21559.c45
2 files changed, 47 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e9fb7d1..b0b39a3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -5,6 +5,8 @@
2006-02-07 Jeff Law <law@redhat.com>
+ * gcc.dg/tree-ssa/pr21559.c: New test.
+
* gcc.dg/tree-ssa/vrp01.c: Update dumpfile names now that we have
multiple VRP passes.
* gcc.dg/tree-ssa/vrp09.c: Likewise.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c
new file mode 100644
index 0000000..6ffcfa1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-vrp1-details" } */
+
+static int blocksize = 4096;
+
+int bar (int);
+
+void foo (void)
+{
+ int toread;
+ int bytes;
+ static char eof_reached = 0;
+
+ toread = blocksize;
+ bytes = 1;
+
+ while (toread != 0)
+ {
+ bytes = bar (toread);
+ if (bytes <= 0)
+ {
+ if (bytes < 0)
+ continue;
+ break;
+ }
+ toread -= bytes;
+ }
+
+ if (bytes == 0)
+ eof_reached = 1;
+}
+
+
+/* First, we should simplify the bits < 0 test within the loop. */
+/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */
+
+/* Second, we should thread the edge out of the loop via the break
+ statement. */
+/* { dg-final { scan-tree-dump-times "Threaded jump" 1 "vrp1" } } */
+
+/* Now if we were really good, we'd realize that the final bytes == 0
+ test is totally useless. That's not likely to happen anytime soon. */
+
+/* { dg-final { cleanup-tree-dump "vrp1" } } */
+