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
This commit is contained in:
Jeff Law 2005-03-07 20:40:58 -07:00 committed by Jeff Law
parent be47740604
commit 8f3a7ad64a
4 changed files with 80 additions and 1 deletions

View 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*.

View 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"} } */

View File

@ -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" } } */

View File

@ -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" } } */