[llvm-dev] Howto properly discard parentless instructions

Lorenz Braun via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 27 02:23:38 PDT 2017


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



More information about the llvm-dev mailing list