[llvm-dev] Replacing an instruction in a post-RA pass
Krzysztof Parzyszek via llvm-dev
llvm-dev at lists.llvm.org
Mon May 9 12:47:15 PDT 2016
On 5/9/2016 2:43 PM, Phil Tomson via llvm-dev wrote:
>
> MachineBasicBlock::instr_iterator II = MFI->instr_begin();
> while( II != MFI->instr_end()) {
> [...]
> MachineBasicBlock::instr_iterator NII = std::next(II);
>[...]
> MI.eraseFromParent();
> II = NII;
> }
> }
> }
> ++II;
>
> Unfortunately, this leads to a segfault. Is this the proper way to do
> this or is there another suggested way of doing it?
What if II is the last instruction?
-Krzysztof
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
More information about the llvm-dev
mailing list