aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/BasicBlockSections.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/BasicBlockSections.cpp')
-rw-r--r--llvm/lib/CodeGen/BasicBlockSections.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/BasicBlockSections.cpp b/llvm/lib/CodeGen/BasicBlockSections.cpp
index 4ebff65..33e70b1 100644
--- a/llvm/lib/CodeGen/BasicBlockSections.cpp
+++ b/llvm/lib/CodeGen/BasicBlockSections.cpp
@@ -134,14 +134,6 @@ INITIALIZE_PASS_END(BasicBlockSections, "bbsections-prepare",
"into clusters of basic blocks.",
false, false)
-// Returns whether the given basic block has an unconditional branch.
-bool hasUnconditionalBranch(const MachineBasicBlock &MBB) {
- if (MBB.terminators().empty())
- return false;
- const MachineInstr &Terminator = *(--MBB.terminators().end());
- return Terminator.isUnconditionalBranch();
-}
-
// This function updates and optimizes the branching instructions of every basic
// block in a given function to account for changes in the layout.
static void
@@ -153,14 +145,12 @@ updateBranches(MachineFunction &MF,
auto NextMBBI = std::next(MBB.getIterator());
auto *FTMBB = PreLayoutFallThroughs[MBB.getNumber()];
// If this block had a fallthrough before we need an explicit unconditional
- // branch to that block if either one of these two conditions hold and the
- // block doesn't currently have an unconditional branch.
+ // branch to that block if either
// 1- the block ends a section, which means its next block may be
// reorderd by the linker, or
// 2- the fallthrough block is not adjacent to the block in the new
// order.
- if (FTMBB && (MBB.isEndSection() || &*NextMBBI != FTMBB) &&
- !hasUnconditionalBranch(MBB))
+ if (FTMBB && (MBB.isEndSection() || &*NextMBBI != FTMBB))
TII->insertUnconditionalBranch(MBB, FTMBB, MBB.findBranchDebugLoc());
// We do not optimize branches for machine basic blocks ending sections, as