<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Abhilash,<div class=""><br class=""></div><div class="">I am only half surprised that eliminateDeadDefs does not do what you want.</div><div class=""><br class=""></div><div class="">This method is expected to be called on live-ranges that are dead, i.e., that don’t have any connection to uses.</div><div class="">In a nutshell, this method removes the live-range of the definition and shrinks the live-ranges of the values used by this definition.</div><div class=""><br class=""></div><div class="">At this point, you have two options:</div><div class="">- Update the interval by hand (look at <span style="font-family: Menlo; font-size: 11px;" class="">LiveIntervals::</span>handleMove for some inspiration)</div><div class="">- Unmark the LiveIntervals pass as preserved in your pass and rely on it being recomputed</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">-Quentin</div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Mar 20, 2019, at 7:37 AM, abhilash bhandari via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div class="">Hi,</div><div class=""><br class=""></div><div class="">I'm trying to delete a redundant instruction (machine Non-SSA) and I'm having trouble updating the live ranges.</div><div class=""><br class=""></div><div class="">Consider the example,</div><div class=""><span class=""><div class="">bb.191 (%ir-block.1008):</div><div class="">; predecessors: %bb.183, %bb.188, %bb.190</div><div class="">  successors: %bb.192(0x50000000), %bb.194(0x30000000); %bb.192(62.50%), %bb.194(37.50%)</div><div class="">  ...</div><div class="">  %231:fr64 = FsFLD0SD<br class=""></div><div class="">  JLE_1 %bb.194, implicit killed $eflags</div><div class="">  JMP_1 %bb.192</div><div class=""><br class=""></div><div class="">bb.192 (%ir-block.1023):</div><div class="">; predecessors: %bb.191</div><div class="">  successors: %bb.193(0x80000000); %bb.193(100.00%)</div><div class=""><br class=""></div><div class="">  ...</div><div class="">  %231:fr64 = FsFLD0SD</div><div class="">  ...  </div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">bb.193 (%ir-block.1024):</div><div class="">; predecessors: %bb.192, %bb.193</div><div class="">  successors: %bb.194(0x04000000), %bb.193(0x7c000000); %bb.194(3.12%), %bb.193(96.88%)</div><div class=""><br class=""></div><div class="">  ....</div><div class="">  %231:fr64 = nnan ninf nsz arcp contract afn reassoc VADDSDrr %231:fr64(tied-def 0), %1270:fr64, %1269:fr64</div><div class="">  ....</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">The definition for virtual register (%231) in bb.192 is redundant as the same instruction is present in bb.191.</div><div class="">I want to delete the redundant instruction in bb.192 so that all the uses of this definition, now point to the definition in bb.191.</div><div class="">How to update the Live Ranges in this case?</div><div class="">The redundancy is evident only during the Register Coalescing and hence my fix includes marking the instruction in bb.192 as dead and then deleting it.</div><div class="">I was expecting that the API "eliminateDeadDefs" in LiveRangeUpdater would handle updating the live ranges, but apparently something is wrong.</div><div class="">Probably "eliminateDeadDefs" is not intended for this purpose.</div><div class="">I was not able to find any other API which would tell me that the uses of deleted instruction (in bb.192) will now use the definition in bb.191.</div><div class="">Any pointers/solutions would be really helpful.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Abhilash</div><div class=""><br class=""></div></span></div><div class="ydpe1ba7f7byahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"></div></div>_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></div></body></html>