[LLVMdev] deleting or replacing a MachineInst

Chris Sears chris.sears at gmail.com
Wed Feb 11 14:46:01 PST 2015


There are 11 BuildMI() functions in MachineInstrBuilder.h including four
using the iterator and one using an instruction. But I just don't think
that's it. The creation of the new instruction works fine (works fine with
OldMI as well) and the new instruction is present in the assembly output.

The problem is removing the old instruction correctly.

> The loop header needs to be modified, because MBBI will be invalidated
when you remove the instruction:

So if I remove the old instruction with something like:

  MBB->remove_instr(OldMI);

I could just start the loop over or is there a more better way to
invalidate the MBBI iterator?
Basic blocks aren't that long (on average 4-6 instructions) and this
peephole isn't that common either.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150211/25aea4a3/attachment.html>


More information about the llvm-dev mailing list