[llvm-dev] Replacing an instruction in a post-RA pass

Phil Tomson via llvm-dev llvm-dev at lists.llvm.org
Mon May 9 13:14:26 PDT 2016


Ah, yes, thank you very much for that hint.

Phil

On Mon, May 9, 2016 at 12:47 PM, Krzysztof Parzyszek via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> 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
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160509/7e7289b8/attachment.html>


More information about the llvm-dev mailing list