Hi,

On Thu, 10 Jul 2014, Jeff Law wrote:

> > The insight to note is, that undefined SSA names should really be
> > coalesced with something (otherwise you lost an optimization opportunity),
> > but it doesn't matter with _what_ each use of the undefined name is
> > coalesced, you can even identify different uses of them with different SSA
> > names (e.g. the LHS of each using stmt).  Requires some change in the
> > order things are done in out-of-ssa.
> 
> The last part is what I hinted might be problematical.  If some 
> undefined SSA_NAME appears on the RHS of two PHIs and we want to 
> coalesce that undefined SSA_NAME with the LHS of each of those PHIs, 
> then the LHS of those two PHIs must coalesce as well.  At least that's 
> my recollection of how all that stuff worked.

Only with the usual definition of coalescing (being transitive).  For 
undefined SSA names the definition can be mended.

> It was that realization that made me wonder if we should have a unique 
> SSA_NAME at each undefined use point.

It's easier to implicitely regard every individual use of an undefined SSA 
name as a unique name in coalescing I think (instead of having it be a 
unique name explicitely).  That is, given:

bb1:
  x_1 = PHI <a_2, b_3(UND)>
  ...

bb2:
  x_4 = PHI <y_5, b_3(UND)>
  ...

There is no reason to not regard the two uses of b_3 as separate and 
identify the first with x_1 and the second with x_2, _without_ coalescing 
x_1 and x_2.  But yes, this doesn't fit readily into the normal coalescing 
merge-find framework, but rather would have to be something after 
coalescing when writing out-of-ssa (whenever an undefined use is rewritten 
just take a random other fitting variable).


Ciao,
Michael.

Reply via email to