<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Apr 7, 2014, at 7:01 AM, Tom Stellard <<a href="mailto:tom@stellard.net">tom@stellard.net</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Sat, Apr 05, 2014 at 12:36:19AM -0700, Andrew Trick wrote:<br><blockquote type="cite"><br>On Apr 3, 2014, at 6:29 PM, Tom Stellard <<a href="mailto:tom@stellard.net">tom@stellard.net</a>> wrote:<br><br><blockquote type="cite">Hi,<br><br>I am working on a simple copy propagation pass for the R600 backend that<br>propagates immediates rather than registers. For example, I want to<br>transform:<br><br>...<br>%vreg1 = V_MOV_B32 1<br>%vreg2 = V_ADD_I32 %vreg1, %vreg0<br>...<br><br>into:<br><br>%vreg1 = V_MOV_B32 1 ; <- Only delete this if it is dead<br>%vreg2 = V_ADD_I32 1, %vreg0<br><br>For best results, I am trying to run this pass after the<br>TwoAddressInstruction pass, which means I need to preserve<br>the LiveIntervals analysis.<br><br>My question is: How do I update the LiveIntervals to reflect the fact<br>that V_ADD_I32 no longer uses %vreg0?<br></blockquote><br>Hi Tom,<br><br>Hopefully you figured this out ;) IIRC, the safe thing to do is call removeInterval and createAndComputeVirtRegInterval for both vreg0 and vreg1.<br><br></blockquote><br>I found a slightly different solution, which was to<br>call LiveIntervals::shrinkToUses(vreg1). This also gives me a list of<br>dead instructions, which is nice. Are there an disadvantages to doing<br>it this way?<br></div></blockquote></div><br><div>No, that is the best thing to do. Looking at your example again I see that you’re only propagating a constant through a copy, so you’ve only eliminated a use of vreg1 (ignore my previous comment about vreg0). That’s exactly what shrinkToUses is meant for.</div><div><br></div><div>-Andy</div></body></html>