Displaying 3 results from an estimated 3 matches for "remove_instr".
2015 Feb 11
2
[LLVMdev] deleting or replacing a MachineInst
...NewMI = BUILD_INS(TEST8ri, AH, 1 << (imm -
8));
else NewMI = BUILD_INS(BT32ri8, EAX, imm);
break;
// ...
}
}
break;
}
// NewMI has been inserted before OldMI
if (NewMI != NULL) {
// MBB->remove_instr(OldMI); // I've tried these (and others)
// OldMI->removeFromParent();
// MBB.erase(OldMI);
NumX86Peepholes++;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/201...
2015 Feb 11
2
[LLVMdev] deleting or replacing a MachineInst
...;
This works and it correctly places the new instruction just before the old
instruction in the assembly output. So far so good.
Now I have to remove the old instruction. But everything I try crashes
LLVM, either immediately or eventually. Various incantations which haven't
worked.
MBB->remove_instr(OldMI);
OldMI->removeFromParent();
MBB.erase(OldMI);
I should add that there are flags
// %EFLAGS<imp-def> is getting copied automatically
// %RDX<imp-use,kill> is not getting copied (when it appears)
So, any advice to peephole adding/deleting or just replacing M...
2015 Feb 11
2
[LLVMdev] deleting or replacing a MachineInst
...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: &l...