[PATCH] new tree-ssa pass (documented too)
Andrew Pinski
pinskia@physics.uc.edu
Fri May 14 15:04:00 GMT 2004
I think I did not explain my self fully maybe but Steven asked
me to explain this more fully.
Two return statements are merged into one by creating a new basic
block and changing those two basic blocks containing the return
statements to go directly to the new basic block.
So
if (a)
return b;
else
return c;
is transformed into:
if (a)
{
Temp1 = b;
goto newbasicblock;
}
else
{
Temp1 = b;
goto newbasicblock;
}
newbasicblock:
return Temp1;
Oh, and I had forgot a testcase also, I will send a patch to fix the
xfails later in this test:
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-return1 -fdump-tree-tailc-details
-fdump-tree-phiopt1-details" } */
/* PR optimization/14135 */
int f(int i)
{
int result;
result = t(i);
if (result)
return result;
return 0;
}
/* We should merge the return in two basic blocks into one return
statement. */
/* { dg-final { scan-tree-dump-times "return" 1 "return1" } } */
/* We should convert one COND_EXPRs into straightline code. */
/* { dg-final { scan-tree-dump-times "straightline" 1 "phiopt1" {xfail
*-*-* } } */
/* Also we should have found that the call to t is tail called. */
/* { dg-final { scan-tree-dump-times "Found tail call" 1 "tailc" {xfail
*-*-*} } } */
More information about the Gcc-patches
mailing list