This patch adds a check to optimize conditional branch (BC and BCn) based on a constant set by CRSET or CRUNSET.
Other optimizers, such as block placement, may generate such code and hence I do this at the very end of the optimization in pre-emit peephole pass.
A conditional branch based on a constant is eliminated or converted into unconditional branch. Also CRSET/CRUNSET is also eliminated if the condition code register is not used by instruction other than the branch to be optimized.
I observed such redundancy happened around 150 times while building LLVM bootctrap.
Any one of these successors now might have become unreachable, right? Should this just be a static recursive function?
Seems that it would be nice if we could just run a pass that eliminates unreachable blocks after this pass.