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?