Introduce a parameter in getFallThrough() to optionally
allow returning the fall through basic block in spite of
an explicit branch instruction to it. This parameter is
set to false by default.
Introduce getLogicalFallThrough() which calls
getFallThrough(false) to obtain the block while avoiding
insertion of a jump instruction to its immediate successor.
This patch also reverts the changes made by D134557 and
solves the case where a jump is inserted after another jump
(branch-relax-no-terminators.mir).
This condition doesn't seem right.
The point of the existing code is to handle fallthrough from PrevBB to DestBB: we're inserting a block between those two blocks, so any fallthrough must be rewritten to a direct branch. We can only skip this if we can prove there isn't any fallthrough.
isIndirectBranch() doesn't prove there isn't any fallthrough; whether a branch is indirect isn't related to whether it's conditional. MachineBasicBlock::canFallThrough() is probably appropriate.