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

Marcello Maggioni marcello at codeplay.com
Wed Sep 18 01:19:18 PDT 2013


Il 18/09/2013 04:04, Caldarale, Charles R ha scritto:
>> 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
I'm not doing that, I only insert an instruction in a single basicblock. 
I'm using that method of insertion because it makes the code clearer to 
insert the instructions like that instead of inserting them immediately 
where they are created (the actual code is more complex than the example 
I shown , but is conceptually the same)

Marcello



More information about the llvm-dev mailing list