[LLVMdev] How to delete a instruction?

lucefe
Wed, 21 Apr 2010 00:13:57 -0000

I did a simple test just now, but I alse failed.

I delete several ordered instructions from end to begin,
but after deleting the first instruction(the last instruction of F), the
program crashed.
My test code is below (F is a function only containing several sequential
instructions):

for (inst_iterator inst == --inst_end(F); inst != inst_begin(F); --inst) {
Instruction * i =  &*inst;
i->eraseFromParent();
}


Best Regards!
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20100421/14ae2a33/attachment.html>