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. Tarun -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110504/74cdc609/attachment.html>
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>
Thank you john that has really worked for me On Wed, May 4, 2011 at 7:02 AM, John Criswell <criswell at illinois.edu> wrote:> 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 listLLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110504/666e1eb9/attachment.html>