<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">You're creating a new path that doesn't include L. For all values defined in L and used outside of L, you need to determine the new reaching def. That's specific to your transformation and can't be automated. Once you do that, creating the phi in F is natural.<div>-Andy<br><div><br><div><div>On Feb 6, 2012, at 11:51 AM, Ryan Taylor <<a href="mailto:ryta1203@gmail.com">ryta1203@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">I guess not since Value is a superclass of Instruction.<br><br><div class="gmail_quote">On Mon, Feb 6, 2012 at 10:36 AM, Ryan Taylor <span dir="ltr"><<a href="mailto:ryta1203@gmail.com">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"><br><br><div class="gmail_quote"><div class="im">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Ryan Taylor</b> <span dir="ltr"><<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>></span><br>
</div><div><div class="h5">Date: Mon, Feb 6, 2012 at 10:36 AM<br>
Subject: Re: [LLVMdev] Updating PHI for Instruction Domination?<br>To: Eric Christopher <<a href="mailto:echristo@apple.com" target="_blank">echristo@apple.com</a>><br><br><br>Since I'm not sure which instructions I might want to replicate, would it be possible to cast the Value from "PHINode::getIncomingValue" to "Instruction" and then copy that and cast it back?<div>

<div><br><br>
<div class="gmail_quote">On Sun, Feb 5, 2012 at 8:49 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">


<div><div><br><br><div class="gmail_quote">On Sun, Feb 5, 2012 at 5:15 PM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@apple.com" target="_blank">echristo@apple.com</a>></span> wrote:<br>
<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">
<div><br>
On Feb 2, 2012, at 5:13 PM, Ryan Taylor wrote:<br>
<br>
> So my best bet is to try and work in reg2mem mode and then go back to mem2reg?<br>
><br>
<br>
</div>I wouldn't. That sounds painful.<br>
<div><br>
> I'm curious, it seems though when you split a block that the phis get updated, right?<br>
<br>
</div>Sure. There's code in splitBasicBlock to do this. It should just take a little bit of work to get what you want done.<br>
<span><font color="#888888"><br>
-eric<br>
</font></span></blockquote></div><div> </div></div></div><div>Yes, the first DOES sound painful (I want to avoid it) and the second is not an option. I'm adding a second path in a loop.</div><div> </div><div>The old path: BB1->BB2/BB3, BB2->BB1/BB3, BB3->n/a</div>



<div> </div><div>The new path: BB1->H/BB2, BB2->F/K, H->F, K->F,  F->BB1/G, G->BB3</div><div> </div><div>There are PHI nodes in BB1 that come in from BB2 for values defined in BB2. With the new possible path: BB1->H->F, BB2. Without adding new PHIs or Values, there exists a dominance instruction issue. So I want to create PHIs in F for each value in BB2 that is used in BB1. The update the PHI Values in BB1 (that used to come from BB2) to the new values in F (which are getting values from BB2/H). </div>



<div><br>The problem is that there is no way to copy the value from BB2, since there exists no Value constructor!? </div><div> </div><div>This seems like a pretty large limitation anytime anyone wants to add a branch inside a loop? Is there an easier way to get what I want that I'm missing?</div>



</blockquote></div><br>
</div></div></div></div></div><br>
</blockquote></div><br>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></blockquote></div><br></div></div></body></html>