This is the mail archive of the 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] Copy propagation [patch]

In message <20030301002257 dot GA27233 at tornado dot toronto dot redhat dot com>, Diego Novillo w
 >I finally found time to adapt aldyh's copy propagation pass
 >(  Not
 >surprisingly, this patch looks quite different from the original.
 >The original implementation was done before we rewrote the base
 >This is arguably one of the simplest optimization passes in SSA.
 >All it does is traverse the flowgraph looking for variable loads.
 >For every variable X_i, it checks its unique reaching definition.
 >If the definition is of the form X_i = Y_j, it replaces X_i with
 >As Aldy pointed out, copy propagation can make two different
 >versions of the same variable live at the same time.  For
 >	tmp_1 = y_1;
 >	if (...)
 >	  y_2 = ...
 >	z_3 = tmp_1;
 >Copy propagation will change the last assignment to 'z_3 = y_1'.
 >Since we do not yet have a real SSA->normal pass, when the
 >program is converted to normal form, GCC generates the following:
 >	tmp = y;
 >	if (...)
 >	  y = ...
 >	z = y;
 >The pass is obviously not enabled by default.  My intention is to
 >use it to debug the SSA->normal pass that I'll be implementing
 >next (unless somebody beats me to it.  Hi Jeff :).
FWIW, you can do this essentially for free while building the SSA
form, along with value numbering and simple copy propagations.  In
addition to being effectively free, you also get to cut down on the
amount of code all the other SSA opts ever see.

Anyway, I'm damn close to having the double-gimplification problem
nailed down.  There's a couple nits that I'm still tracking down, but
it's real real close.


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