[LLVMdev] deleting or replacing a MachineInst
Chris Sears
chris.sears at gmail.com
Wed Feb 11 15:04:00 PST 2015
I made the change to the BuildMI() call. Again, I don't think that matters.
#define BUILD_INS(opcode, new_reg, i) \
BuildMI(*MBB, OldMI, MBBI->getDebugLoc(), TII->get(X86::opcode)) \
.addReg(X86::new_reg, kill).addImm(i)
I didn't completely understand your other proposed change:
for (MachineBasicBlock::iterator MBBI = MBB->begin();
MBBI != MBB->end(); ) {
MachineInstr *NewMI = NULL;
OldMI = MBBI;
++MBBI;
I think you're saying with ++MBBI to step past the old instruction.
This seems faster speedwise but more of a hack than just restarting the
loop.
But I'll try it. It implies a certain knowledge of the iterator and MBB.
I accidentally touched MachineInstr.h and the rebuild is extracting its
punishment.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150211/e328ab9e/attachment.html>
More information about the llvm-dev
mailing list