This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa]: Constant propagation into PHI's screws up IVR and PRE
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 30 Jul 2003 11:29:18 -0400
- Subject: [tree-ssa]: Constant propagation into PHI's screws up IVR and PRE
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