From 4fa9f3ae45206639c800639a40ece9b3bbeeb433 Mon Sep 17 00:00:00 2001 From: Haicheng Wu Date: Tue, 7 Jun 2016 15:17:21 +0000 Subject: Revert "[MBP] Reduce code size by running tail merging in MBP." This reverts commit r271930, r271915, r271923. They break a thumb selfhosting bot. llvm-svn: 272017 --- llvm/lib/CodeGen/MachineBlockPlacement.cpp | 39 +++--------------------------- 1 file changed, 3 insertions(+), 36 deletions(-) (limited to 'llvm/lib/CodeGen/MachineBlockPlacement.cpp') diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp index 42bad4c7301..c562af9d964 100644 --- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp +++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp @@ -26,8 +26,6 @@ //===----------------------------------------------------------------------===// #include "llvm/CodeGen/Passes.h" -#include "llvm/CodeGen/TargetPassConfig.h" -#include "BranchFolding.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" @@ -118,12 +116,6 @@ static cl::opt JumpInstCost("jump-inst-cost", cl::desc("Cost of jump instructions."), cl::init(1), cl::Hidden); -static cl::opt -BranchFoldPlacement("branch-fold-placement", - cl::desc("Perform branch folding during placement. " - "Reduces code size."), - cl::init(true), cl::Hidden); - extern cl::opt StaticLikelyProb; namespace { @@ -240,10 +232,10 @@ class MachineBlockPlacement : public MachineFunctionPass { const MachineBranchProbabilityInfo *MBPI; /// \brief A handle to the function-wide block frequency pass. - std::unique_ptr MBFI; + const MachineBlockFrequencyInfo *MBFI; /// \brief A handle to the loop info. - MachineLoopInfo *MLI; + const MachineLoopInfo *MLI; /// \brief A handle to the target's instruction info. const TargetInstrInfo *TII; @@ -331,7 +323,6 @@ public: AU.addRequired(); AU.addRequired(); AU.addRequired(); - AU.addRequired(); MachineFunctionPass::getAnalysisUsage(AU); } }; @@ -1471,8 +1462,7 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &F) { return false; MBPI = &getAnalysis(); - MBFI = llvm::make_unique( - getAnalysis()); + MBFI = &getAnalysis(); MLI = &getAnalysis(); TII = F.getSubtarget().getInstrInfo(); TLI = F.getSubtarget().getTargetLowering(); @@ -1480,29 +1470,6 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &F) { assert(BlockToChain.empty()); buildCFGChains(F); - - // Changing the layout can create new tail merging opportunities. - TargetPassConfig *PassConfig = &getAnalysis(); - // TailMerge can create jump into if branches that make CFG irreducible for - // HW that requires structurized CFG. - bool EnableTailMerge = !F.getTarget().requiresStructuredCFG() && - PassConfig->getEnableTailMerge() && - BranchFoldPlacement; - // No tail merging opportunities if the block number is less than four. - if (F.size() > 3 && EnableTailMerge) { - BranchFolder BF(/*EnableTailMerge=*/true, /*CommonHoist=*/false, *MBFI, - *MBPI); - - if (BF.OptimizeFunction(F, TII, F.getSubtarget().getRegisterInfo(), - getAnalysisIfAvailable(), MLI, - /*AfterBlockPlacement=*/true)) { - // Redo the layout if tail merging creates/removes/moves blocks. - BlockToChain.clear(); - ChainAllocator.DestroyAll(); - buildCFGChains(F); - } - } - optimizeBranches(F); alignBlocks(F); -- cgit v1.2.3