This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] Eliminate more dead PHIs


In message <20040107224329.GG15609@atrey.karlin.mff.cuni.cz>, Jan Hubicka write
s:
 >> In message <20040107221648.GF15609@atrey.karlin.mff.cuni.cz>, Jan Hubicka w
 >rite
 >> s:
 >>  >> Zdenek's changes help, but only slightly.
 >>  >> 
 >>  >> We never need to consider a PHI for a virtual variable inherently 
 >>  >> necessary -- and that little trick eliminates a ton of totally
 >>  >> useless PHI nodes.  Whee.
 >>  >
 >>  >Sounds very cool!
 >> Maybe maybe not.
 >
 >I remember looking into virtual operands walking loops on one of
 >Gerald's testcases as they showed very top in the profile.  THis may
 >help this somewhat.
It might.  Depends on if those loops were part of ssa1, dom1 or dce1
all of which will still need to iterate over the same number of PHIs.

Elimination of the PHIs only helps later runs of those passes.

 >> To give you a feel.  For alias.c we this code eliminates a few thousand
 >> PHI nodes, later passes re-introduce about 30 PHI nodes for new variables
 >> or re-rewritten variables.
 >
 >Hmm I see, you won't get ping pong as the vdefs and/or vuses are simply
 >gone, 
You could in theory get a ping-pong -- that would happen if a later
run of the dominator optimizer marked a lot of virtual operands for
re-renaming -- that could potentially re-introduce a lot of the
PHI nodes.

However, in practice, the vast majority of re-renaming occurs in the
first dominator optimizer.


 >it is more like ellimination of useless PHIs by copy propagation
 >for normal operands...
Err, no.  It's dead code elimination.  The result of the PHI is never
used.  Thus, the PHI itself is unnecessary, which in turn can cause
other PHIs to become unnecessary.

Copy propagation of virtual operands as performed by the dominator optimizer
certainly exposes more possibilities for elimination of dead PHIs.


Zdenek's code removes PHIs by determining that a particular PHI will
always have the same value.  ie

x1 = phi (x0, x0, x0)

Then copy propagates x0 into all uses of x1 which means the PHI is now
dead and can be eliminated.

jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]