[llvm-dev] Howto properly discard parentless instructions

陳韋任 via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 27 03:46:10 PDT 2017


Refer to [1], maybe you can try Instruction::eraseFromParent().

[1] http://llvm.org/doxygen/classllvm_1_1Instruction.html

2017-04-27 17:23 GMT+08:00 Lorenz Braun via llvm-dev <llvm-dev at lists.llvm.org>:
> Hi there,
>
> i am currently working on a transformation pass where i replace some
> function calls. I use replaceAllUsesWith() to replace them.
>
> After that i want to clean up like this:
>
> callInst->removeFromParent();
> delete callInst;
>
> If the instruction is not deleted an error occurs when running the pass
> (parentless instruction). So is it okay to do it this way or is there a
> better way to do it?
>
> Regards
>
> Lorenz
>
>
> --
> Lorenz Braun
> Research Associate
> Institute of Computer Engineering (ZITI)
> B6, 26, Building B, Office B2.20
> 68131 Mannheim
>
> Phone: +49-621-181-2696
> lorenz.braun at ziti.uni-heidelberg.de
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



-- 
Wei-Ren Chen (陳韋任)
Homepage: https://people.cs.nctu.edu.tw/~chenwj


More information about the llvm-dev mailing list