[LLVMdev] Is it safe to insert instructions in batches into BBs?

Caldarale, Charles R Chuck.Caldarale at unisys.com
Tue Sep 17 20:04:27 PDT 2013


> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
> On Behalf Of Marcello Maggioni
> Subject: [LLVMdev] Is it safe to insert instructions in batches into BBs?

> Because I need to insert instructions in a certain specific order inside 
> multiple different BBs I found it easy to use the IRBuilder to create 
> instructions without inserting them into a BB, storing them somewhere 
> (vector, map ... etc) and later on inserting all of them in one go into 
> their positions in the BBs.

You cannot insert the same instruction object into more than one basic block.  You might be able to clone instructions and add the clones to the other blocks.

 - Chuck





More information about the llvm-dev mailing list