Reverts wrong modification to MachineBlockPlacement & BranchFolding; uses a new strat...
[oota-llvm.git] / lib / Target / AArch64 / AArch64InstrInfo.cpp
index c9c982ed7b5949bd8d1d897450d708146b2bbfc5..f398117de953b2f2d9a55673cfbaa0ca7c11ecab 100644 (file)
@@ -217,25 +217,6 @@ bool AArch64InstrInfo::ReverseBranchCondition(
   return false;
 }
 
-// XXX-update: Returns whether we can remove a conditional branch instruction.
-// If it's one that is mannually added by us, then don't remove it (return
-// false). All their successors are the same.
-static bool shouldRemoveConditionalBranch(MachineInstr* I) {
-  auto* MBB = I->getParent();
-  assert(isCondBranchOpcode(I->getOpcode()));
-  bool SameSuccessor = true;
-  MachineBasicBlock* BB = nullptr;
-  for (auto* Succ : MBB->successors()) {
-    if (!BB) {
-      BB = Succ;
-    }
-    if (BB != Succ) {
-      SameSuccessor = false;
-    }
-  }
-  return !SameSuccessor;
-}
-
 unsigned AArch64InstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
   MachineBasicBlock::iterator I = MBB.getLastNonDebugInstr();
   if (I == MBB.end())
@@ -245,11 +226,6 @@ unsigned AArch64InstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
       !isCondBranchOpcode(I->getOpcode()))
     return 0;
 
-  // XXX-update: Don't remove fake conditional branches.
-  if (isCondBranchOpcode(I->getOpcode()) && !shouldRemoveConditionalBranch(I)) {
-    return 0;
-  }
-
   // Remove the branch.
   I->eraseFromParent();
 
@@ -261,11 +237,6 @@ unsigned AArch64InstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
   if (!isCondBranchOpcode(I->getOpcode()))
     return 1;
 
-  // XXX-update: Don't remove fake conditional branches.
-  if (!shouldRemoveConditionalBranch(I)) {
-    return 1;
-  }
-
   // Remove the branch.
   I->eraseFromParent();
   return 2;