For a basic block I want to change conditional jump to an unconditional jump. So if a basic block had two successors I want to remove the edge to one of the successor. I want the basic block to directly jump to one of the successor. How can I do that?
To illustrate my point, I want to change
A
/ \
/ \
B C
to
A
\
\
C
I think the simplest way will be just to create a new unconditional branch instruction, then replace the old one with it. So, something like:
Where
Xis 0 or 1, depending if you want the “true” branch or the “false” branch.