processBBWithCommonDomCondition converts a conditional branch of BB
into an unconditional branch if possible, when the basic block BBa
dominates BB and both basic blocks have conditional branches under the
same condition.
BBa:
%cmp = ... br i1 %cmp, label %LA1, label %LA2 ...
BB:
... br i1 %cmp, label %LD1, label %LD2
The condition to apply this optimization is that the predecessors of
BB is divided into the set S1 coming from LA1 and the set S2 coming
from LA2.
If S1(or S2) is empty, it rewrites the conditional branch to an
unconditional branch to LD2(or LD1).
If both S1 and S2 are not empty and BB can be copied, BB is copied for
S2, and each conditional branches in BB and the copied BB are
converted into unconditional branches for LD1 and LD2, respectively.
You are missing a flag to enable/disable this transform.