[LLVMdev] Is it safe to insert instructions in batches into BBs?
Marcello Maggioni
marcello at codeplay.com
Wed Sep 18 01:16:43 PDT 2013
Il 18/09/2013 03:40, Óscar Fuentes ha scritto:
> Marcello Maggioni <marcello at codeplay.com> writes:
>
>> I'm getting a very strange behaviour while adding already created
>> instructions in batches into basicblocks instead of creating and
>> inserting them immediately.
>>
>> 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.
> [snip]
>> So , in the end, is it safe to add instructions like in the first
>> method I mentioned or actually the only safe way is to use the second
>> way? In case it should be safe, what could be the cause of the random
>> breakages?
>>
>> Cheers,
>> Marcello
>>
>> PS = Some of the instructions I'm adding are using one the output
>> value of the other.
> Does your module pass the verifier? (llvm::verifyModule)
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Yes, it does. I get no complaints by the module verifier, and the CFG at
the IR level looks fine.
If I try to print the CFG at Machine level though in some occasions the
graph is not shown (probably another one of the strange breakages I get
together with the RegisterInfo one)
Marcello
More information about the llvm-dev
mailing list