I found the following case having tail blocks with no successors merging opportunities after block placement.
Before block placement:
bb0:
... bne a0, 0, bb2:
bb1:
mv a0, 1 ret
bb2:
...
bb3:
mv a0, 1 ret
bb4:
mv a0, -1 ret
The conditional branch bne in bb0 is opposite to beq.
After block placement:
bb0:
... beq a0, 0, bb1
bb2:
...
bb4:
mv a0, -1 ret
bb1:
mv a0, 1 ret
bb3:
mv a0, 1 ret
After block placement, that appears new tail merging opportunity, bb1 and bb3 can be merged as one block. So the conditional constraint for merging tail blocks with no successors should be removed. In my experiment for RISC-V, it decreases code size.
Author of original patch: Jim Lin
This change is it neccessary?