[tree-ssa]: Constant propagation into PHI's screws up IVR and PRE

Daniel Berlin dberlin@dberlin.org
Wed Jul 30 15:49:00 GMT 2003


As the subject says, constprop into phi's screws up both PRE and IVR.

Let me give an IVR example:

for (i = 0; i < 50; i++)

now becomes

i_4 = 0;
   while (1)
     {
       #   i_1 = PHI <0(0), i_7(10)>;


because of the propagated 0 in the phi, we can't properly detect i as 
an induction variable.
Why?
Trivial induction variables in SSA have the following property:
a phi of arity 2 in the loop body with one value coming from the same 
variable name in the loop pre-header, and one value coming from the 
same variable name in the loop latch.

We have no idea what variable caused that 0 to be propagated into the 
PHI. It's not necessarily "i".
So we can't call this an induction variable, because it might not 
really be one.
PRE has similar problems when trying to perform code motion and ESSA 
renaming.
I'm trying to extend PRE to handle it, but Open64 and the various 
SSAPRE papers just don't deal with it at all, because it never occurs 
for them.
--Dan



More information about the Gcc mailing list