[llvm-dev] [Help]: How to update the live ranges after deleting a machine instruction?

abhilash bhandari via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 20 07:37:41 PDT 2019


Hi,
I'm trying to delete a redundant instruction (machine Non-SSA) and I'm having trouble updating the live ranges.
Consider the example,bb.191 (%ir-block.1008):; predecessors: %bb.183, %bb.188, %bb.190  successors: %bb.192(0x50000000), %bb.194(0x30000000); %bb.192(62.50%), %bb.194(37.50%)  ...  %231:fr64 = FsFLD0SD
  JLE_1 %bb.194, implicit killed $eflags  JMP_1 %bb.192
bb.192 (%ir-block.1023):; predecessors: %bb.191  successors: %bb.193(0x80000000); %bb.193(100.00%)
  ...  %231:fr64 = FsFLD0SD  ...  

bb.193 (%ir-block.1024):; predecessors: %bb.192, %bb.193  successors: %bb.194(0x04000000), %bb.193(0x7c000000); %bb.194(3.12%), %bb.193(96.88%)
  ....  %231:fr64 = nnan ninf nsz arcp contract afn reassoc VADDSDrr %231:fr64(tied-def 0), %1270:fr64, %1269:fr64  ....

The definition for virtual register (%231) in bb.192 is redundant as the same instruction is present in bb.191.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.How to update the Live Ranges in this case?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.I was expecting that the API "eliminateDeadDefs" in LiveRangeUpdater would handle updating the live ranges, but apparently something is wrong.Probably "eliminateDeadDefs" is not intended for this purpose.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.Any pointers/solutions would be really helpful.
Thanks,Abhilash
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190320/8c5963ea/attachment.html>


More information about the llvm-dev mailing list