<html><body><p>So if I first create the value in an entry BB and then build a CopyToReg but then I have to read it in a BB that loops back to itself, with it's own CopyToReg at the end, then I have two CopyToReg nodes for the same value. In this case, I need to create 3 virt regs, 1 for each CopyToReg and a third for the CopyFromReg in the beginning of the loop BB, right? And then I need to build a PHI instruction at the beginning of the loop MBB that relates the 3 virt regs, right? Is there anything else I need to do regarding the creation of the new phi instruction, do you know?<br><br>Tyler<br><br><br><img width="16" height="16" src="cid:1__=0ABB0A8BDFE5AA848f9e8a93df938690918c0AB@" border="0" alt="Inactive hide details for Matthias Braun ---08/23/2016 05:17:14 PM---> On Aug 23, 2016, at 2:07 PM, Tyler Kenney <tjkenney@us.i"><font color="#424282">Matthias Braun ---08/23/2016 05:17:14 PM---> On Aug 23, 2016, at 2:07 PM, Tyler Kenney <tjkenney@us.ibm.com> wrote: ></font><br><br><font size="2" color="#5F5F5F">From:        </font><font size="2">Matthias Braun <mbraun@apple.com></font><br><font size="2" color="#5F5F5F">To:        </font><font size="2">Tyler Kenney/Marlborough/IBM@IBMUS</font><br><font size="2" color="#5F5F5F">Cc:        </font><font size="2">llvm-dev@lists.llvm.org</font><br><font size="2" color="#5F5F5F">Date:        </font><font size="2">08/23/2016 05:17 PM</font><br><font size="2" color="#5F5F5F">Subject:        </font><font size="2">Re: [llvm-dev] Help in understanding physreg LiveVariables</font><br><font size="2" color="#5F5F5F">Sent by:        </font><font size="2">mbraun@apple.com</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br>
<ul><ul><font size="4">On Aug 23, 2016, at 2:07 PM, Tyler Kenney <</font><a href="mailto:tjkenney@us.ibm.com"><u><font size="4" color="#0000FF">tjkenney@us.ibm.com</font></u></a><font size="4">> wrote:</font><br>
<p><font size="4">So if I create a value with a DAG.getUndef(myVT); call during instruction legalization, how can I access that value as input in another BB/DAG (also during instruction legalization) without worrying about live-ins and/or phi nodes? <br><br>Can I create a single virtual register and build both a CopyToReg and a CopyFromReg node with it? I assumed that would break SSA.</font></ul></ul><font size="4">Yes in Selection to you need to use CopyToReg/CoptFromReg to write to/from vregs that should cross basic blocks. Yes indeed this currently has to respect SSA form, so there should only be a single CopyToReg for each vreg and that def should dominate all users.</font><ul><ul><font size="4"><br>Perhaps I should have said that what stops me is that I don't know how to pass a newly created virtual register from one MBB/DAG to another.</font></ul></ul><font size="4">You have to remember the number somewhere, so you can use CopyFromReg on the vreg.</font><br><br><font size="4">- Matthias</font><br><br><BR>
</body></html>