[LLVMdev] BasicBlock Cloning

John Criswell criswell at illinois.edu
Tue May 3 18:32:10 PDT 2011


On 5/3/11 4:14 PM, tarun agrawal wrote:
> Hi
>
> I have clone a basic block using CloneBasicBlock function but it does 
> not clone the predecessor with it. I am not able to figure out, how to 
> set the predecessor of the cloned basic block.

LLVM's CFG is explicitly maintained by the terminator instructions 
within each basic block.  In order to change the CFG, you have to change 
the terminator instructions.

To make BasicBlock B a successor of BasicBlock A, you have to modify or 
replace BasicBlock A's terminator instruction to branch to BasicBlock B.

-- John T.

>
> Tarun
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110503/47b021be/attachment.html>


More information about the llvm-dev mailing list