OSDN Git Service

* gcc.dg/tree-ssa/20030821-1.c: Verify that the computed goto
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Mar 2005 03:40:58 +0000 (03:40 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Mar 2005 03:40:58 +0000 (03:40 +0000)
        was folded away.
        * gcc.dg/tree-ssa/pr18133-1.c: New test.
        * gcc.dg/tree-ssa/pr18133-2.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96085 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/20030821-1.c
gcc/testsuite/gcc.dg/tree-ssa/pr18133-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr18133-2.c [new file with mode: 0644]

index c7af0c6..26c29d5 100644 (file)
@@ -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*.
index 2d1e9e7..08062ef 100644 (file)
@@ -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 (file)
index 0000000..62356a1
--- /dev/null
@@ -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 (file)
index 0000000..8717640
--- /dev/null
@@ -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" } } */