On Tue, 2003-05-13 at 15:50, Daniel Berlin wrote:
On Tuesday, May 13, 2003, at 03:36 PM, Andrew MacLeod wrote:
On Tue, 2003-05-13 at 15:26, Daniel Berlin wrote:
*However*, doing simple const-prop during SSA-rewriting (as we do now)
transforms the original into:
;; Function main (main)
main ()
{
int a;
int b;
int c;
a_2 = 5;
b_3 = 25
if (c_4 != 0)
{
{
a_5 = 6;
}
}
else
{
{
a_6 = 7;
}
};
# a_1 = PHI <a_5(1), a_6(2)>;
b_7 = a_1 * 5
}
We can't SSAPRE this at *all*, and therefore, are left with the
multiply.
Propping the constants into the phi won't help you here, because it's
different on each branch.
But you will see:
main ()
{
int a;
int b;
int c;
a_2 = 5;
b_3 = 25
if (c_4 != 0)
{
{
a_5 = 6;
}
}
else
{
{
a_6 = 7;
}
};
# a_1 = PHI <6(1), 7(2)>;
b_7 = a_1 * 5
and then it seems pretty easy to do exactly the same thing with the
caclulation of b_7
its clear that on edge (1,3) b_7 can be calculated as 6 * 5, and on
edge (2,3) its 7 * 5...
So isn't it just as trivial for someone to insert temps on those
edges: