I appreciate the explanation Chuck. I guess I know where I got it wrong,<br>I thought phi node only considers incoming edges where there is a value flowing in.<br>I guess the truth is that any phi node should consider all incoming edges whether or not<br>
there is an incoming value (or a 'real' defined incoming value)<br>For those edges without a real defined value, phi nodes just put undef as their value for that edge. <br>Am I right? This makes a lot sense now.<br>
<br><div class="gmail_quote">On Sat, Mar 2, 2013 at 10:14 PM, Caldarale, Charles R <span dir="ltr"><<a href="mailto:Chuck.Caldarale@unisys.com" target="_blank">Chuck.Caldarale@unisys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> From: Wei Dang [mailto:<a href="mailto:jacdang@gmail.com">jacdang@gmail.com</a>]<br>
> Subject: Re: [LLVMdev] Question about method CodeExtractor::severSplitPHINodes<br>
<div class="im"><br>
> Please excuse me if I'm not supposed to reply to all.<br>
<br>
</div>You should do reply-all, to make sure the list sees all of the thread.<br>
<div class="im"><br>
> Are you saying all PHI nodes are required to include all its predecessor blocks<br>
> no matter they have input or not?<br>
<br>
</div>That's the way SSA works - each input to a block must be provided by all paths leading to the block. That must be from each immediate predecessor or from a common predecessor of two or more immediate predecessors that do not mutate the value.<br>
<div class="im"><br>
> What about successor blocks? Are they optional if they don't provide inputs?<br>
<br>
</div>The question doesn't make sense; we're only concerned with the predecessors here. If you have a loop, some successor (possibly the block of interest) is also a predecessor and must conform to SSA usage.<br>
<div class="im"><br>
> where should I look at to verify this, the mem2reg.cpp & PromoteMemToReg.cpp?<br>
<br>
</div>It's an inherent characteristic of SSA:<br>
<a href="http://en.wikipedia.org/wiki/Static_single_assignment_form" target="_blank">http://en.wikipedia.org/wiki/Static_single_assignment_form</a><br>
<br>
(or any of numerous textbooks and papers).<br>
<div class="HOEnZb"><div class="h5"><br>
- Chuck<br>
<br>
<br>
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Wei Dang