>From my experience, this is not the case really.<div><br></div><div>What you can do is call 'replaceUsesOfWith' on every user of the PHI'ed variable (<span>lsr.iv44)</span> that is inside the dominator tree of the new basicblock (<span style>for.body.387.i.split).</span></div>

<div><span style><br></span></div><div><span style>LLVM has a dominator tree analysis that you can use to do it.</span></div>
<div><div><br><div class="gmail_quote">2012/3/8 Ryan Taylor <span dir="ltr"><<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


I guess I thought that once I redirected the branches and created new PHIs that LLVM would correct the variable usage when I return true (changed CFG) from the pass. Is this not the case?<div><div>
<br><br><div class="gmail_quote">On Wed, Mar 7, 2012 at 4:08 PM, Ryan Taylor <span dir="ltr"><<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here is the code snippet that I am using to create the PHIs in the loop according to the PHIs in the new preheader. At this point I have already redirected the loop backedge and removed the preheader from the loop.<br>



<br>
            for (BasicBlock::iterator II = loopHeaderBB->begin(); (PN=dyn_cast<PHINode>(II)); ++II) {<br>               // remove loop back PHI and add it to split BB<br>               errs()<<*II<<"\n";<br>




               PHINode *newPHIvalue = PHINode::Create(PN->getType(), 2, PN->getName().str(), splitBB->getFirstInsertionPt());<br>               int IDX = PN->getBasicBlockIndex(splitBB);<br>               while (IDX != -1) {<br>




                  Value *oldValue = PN->getIncomingValue((unsigned(IDX)));<br>                  PN->removeIncomingValue(IDX, false);<br>                  newPHIvalue->addIncoming(oldValue, loopLatchBB);<br>                  newPHIvalue->addIncoming(PN, loopHeaderBB);<br>




                  IDX = PN->getBasicBlockIndex(splitBB);<div><div><br>               }<br>            }<br><br><div class="gmail_quote">On Wed, Mar 7, 2012 at 4:04 PM, Ryan Taylor <span dir="ltr"><<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>></span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have attached a case of what I am trying to do, I'm pretty sure I'm just missing some simple API call. In the cfg you can see that although Im setting "lsr.iv441" as "lsr.iv44" from for.body.387.i it's not propagating that through the block or graph.<div>




<div><br>
<br><div class="gmail_quote">On Wed, Mar 7, 2012 at 12:03 PM, Ryan Taylor <span dir="ltr"><<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





I am splitting a one BB loop into two BB. <br><br>Basically, the one loop BB has 3 incoming values, one form back edge two from other edges. I want to extract the PHIs from the other two edges out into it's own BB and delete that from the loop, then redirect the backedge to the loopbody (non extracted portion) and create a new PHI coming from the extracted BB and the backedge.<br>






<br>I can do this; however, the PHIs following in all the other BBs are not getting updated, neither are the statements in the loopbody.<br><br>What is the easieset way to propagate these changes downward?<br>
</blockquote></div><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>
</div></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div></div>