aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2005-03-07 20:40:58 -0700
committerJeff Law <law@gcc.gnu.org>2005-03-07 20:40:58 -0700
commit8f3a7ad64aa9ad98921ad3baf01095589dcd312c (patch)
tree5786d0f7eef0941019e0ce455a8420083fd616b0 /gcc
parentbe477406042409e5431463f963e02b4365e94ef6 (diff)
downloadgcc-8f3a7ad64aa9ad98921ad3baf01095589dcd312c.zip
gcc-8f3a7ad64aa9ad98921ad3baf01095589dcd312c.tar.gz
gcc-8f3a7ad64aa9ad98921ad3baf01095589dcd312c.tar.bz2
20030821-1.c: Verify that the computed goto was folded away.
* gcc.dg/tree-ssa/20030821-1.c: Verify that the computed goto was folded away. * gcc.dg/tree-ssa/pr18133-1.c: New test. * gcc.dg/tree-ssa/pr18133-2.c: New test. From-SVN: r96085
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20030821-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr18133-1.c27
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr18133-2.c42
4 files changed, 80 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c7af0c6..26c29d5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2005-03-07 Jeff Law <law@redhat.com>
+
+ * gcc.dg/tree-ssa/20030821-1.c: Verify that the computed goto
+ was folded away.
+ * gcc.dg/tree-ssa/pr18133-1.c: New test.
+ * gcc.dg/tree-ssa/pr18133-2.c: New test.
+
2005-03-07 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* g++.dg/warn/weak1.C: Skip test on hppa*-*-hpux*.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030821-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20030821-1.c
index 2d1e9e7..08062ef 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20030821-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20030821-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
+/* { dg-options "-O1 -fdump-tree-dom1 -fdump-tree-optimized" } */
void foo(int k)
{
@@ -21,3 +21,6 @@ y: ;
}
/* { dg-final { scan-tree-dump-times "dont_remove \\(\\)" 1 "optimized"} } */
+
+/* We should have folded away the goto &x */
+/* { dg-final { scan-tree-dump-times "goto &x" 0 "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr18133-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr18133-1.c
new file mode 100644
index 0000000..62356a1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr18133-1.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-optimized-blocks" } */
+
+void foo (void)
+{
+void *p;
+p = &&L0;
+goto *p;
+L0:
+return;
+}
+
+/* The goto &L0 should have been optimized away during CFG
+ cleanups. */
+/* { dg-final { scan-tree-dump-times "goto &L0" 0 "optimized" } } */
+
+/* There should not be any abnormal edges as DOM removed the
+ computed goto. */
+
+/* { dg-final { scan-tree-dump-times "ab" 0 "optimized" } } */
+
+/* And verify that we have fixed the fallthru flag as well.
+ After DOM we will have two fallthru edges (e->0, 0->1),
+ but in the dump files we mention the 0->1 two times. So
+ scan for 3 instances of "fallthru". */
+
+/* { dg-final { scan-tree-dump-times "fallthru" 3 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr18133-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr18133-2.c
new file mode 100644
index 0000000..8717640
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr18133-2.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-optimized-blocks" } */
+
+int c, d;
+
+int
+bar (int a)
+{
+ void *p;
+ int b;
+
+ if (a!=0)
+ {
+ b = 3;
+ p = &&L0;
+ }
+ else
+ {
+ b = 5;
+ p = &&L1;
+ }
+
+ goto *p;
+
+ L0:
+ c = b;
+ return 1;
+
+ L1:
+ d = b;
+ return 0;
+}
+
+/* The both paths to the block containing the goto *p should
+ have been threaded, thus eliminating the need for the goto *p. */
+
+/* { dg-final { scan-tree-dump-times "goto p" 0 "optimized" } } */
+
+/* There should not be any abnormal edges as DOM removed the
+ computed goto. */
+
+/* { dg-final { scan-tree-dump-times "ab" 0 "optimized" } } */