[LLVMdev] Replacing unconditional branches with conditional ones

Cain, Harel HCain at nds.com
Mon Jun 8 00:13:18 PDT 2009


Hi all,

Somewhat of a newbie's question, hope you can help me out.

I'm trying to turn unconditional BranchInst's into conditional ones (with a condition I'm supplying) branching between the original target and a basic block of my choice.
Apparently the way to do that is to create a new conditional BranchInst and remove the unconditional one from its basic block. However when removing the unconditional branch, its target's predecessor list seems not to be updated, so that the end result is for the original target to have duplicates in its predecessor list, sometimes even an a "null" predecessor for some reason.
Can you advise what's the safest, recommended way to replace an unconditional branch with a conditional one?



Thanks,

Harel

________________________________
This e-mail is confidential, the property of NDS Ltd and intended for the addressee only. Any dissemination, copying or distribution of this message or any attachments by anyone other than the intended recipient is strictly prohibited. If you have received this message in error, please immediately notify the postmaster at nds.com and destroy the original message. Messages sent to and from NDS may be monitored. NDS cannot guarantee any message delivery method is secure or error-free. Information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. We do not accept responsibility for any errors or omissions in this message and/or attachment that arise as a result of transmission. You should carry out your own virus checks before opening any attachment. Any views or opinions presented are solely those of the author and do not necessarily represent those of NDS.

To protect the environment please do not print this e-mail unless necessary.

NDS Limited Registered Office: One London Road, Staines,Middlesex TW18 4EX, United Kingdom. A company registered in England and Wales Registered no. 3080780 VAT no. GB 603 8808 40-00
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090608/6aa6494a/attachment.html>


More information about the llvm-dev mailing list