[LLVMdev] Cloning block for newbie

Nileih Cimeil nileih at gmail.com
Thu Jun 21 10:47:24 PDT 2012


Hello everybody.

I'm quite new to LLVM and I'm encontering problems with cloning basic
blocks. My two basic blocks are in the same function and it doesn't really
matter how the cloned one behave for the moment. Of course, to do so, I
used the cloning.h 's method "CloneBasicBlock" but I have the "Instruction
does not dominate all uses!" error.
I know what it means, I just don't know how to get rid of it without
getting more complicated errors. (I tried manipulating the VMap, the
metadatas, cloning each instruction one by one,...).

Is there a way to know if an instruction is a definition (so I could remove
or rename the value)?
Is there a VMap book for newbies?
Is there some documentations I forgot to look at?


Thank you.



virtual BasicBlock* createAlteredBasicBlock(BasicBlock * basicBlock, const
Twine &  Name = "", Function * F = 0){

            ValueToValueMapTy VMap;
            BasicBlock * alteredBB = llvm::CloneBasicBlock (basicBlock,
VMap, Name, F);

            return alteredBB;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120621/169acc2e/attachment.html>


More information about the llvm-dev mailing list