[llvm] r268067 - [MBP] Split placement and alignment into two functions. NFC.

Haicheng Wu via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 10:06:44 PDT 2016


Author: haicheng
Date: Fri Apr 29 12:06:44 2016
New Revision: 268067

URL: http://llvm.org/viewvc/llvm-project?rev=268067&view=rev
Log:
[MBP] Split placement and alignment into two functions. NFC.

Cut and Paste.

Modified:
    llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp

Modified: llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp?rev=268067&r1=268066&r2=268067&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp Fri Apr 29 12:06:44 2016
@@ -300,6 +300,7 @@ class MachineBlockPlacement : public Mac
   void rotateLoopWithProfile(BlockChain &LoopChain, MachineLoop &L,
                              const BlockFilterSet &LoopBlockSet);
   void buildCFGChains(MachineFunction &F);
+  void alignBlocks(MachineFunction &F);
 
 public:
   static char ID; // Pass identification, replacement for typeid
@@ -1357,7 +1358,9 @@ void MachineBlockPlacement::buildCFGChai
   MachineBasicBlock *TBB = nullptr, *FBB = nullptr; // For AnalyzeBranch.
   if (!TII->AnalyzeBranch(F.back(), TBB, FBB, Cond))
     F.back().updateTerminator();
+}
 
+void MachineBlockPlacement::alignBlocks(MachineFunction &F) {
   // Walk through the backedges of the function now that we have fully laid out
   // the basic blocks and align the destination of each backedge. We don't rely
   // exclusively on the loop info here so that we can align backedges in
@@ -1366,6 +1369,7 @@ void MachineBlockPlacement::buildCFGChai
   // FIXME: Use Function::optForSize().
   if (F.getFunction()->hasFnAttribute(Attribute::OptimizeForSize))
     return;
+  BlockChain &FunctionChain = *BlockToChain[&F.front()];
   if (FunctionChain.begin() == FunctionChain.end())
     return; // Empty chain.
 
@@ -1442,6 +1446,7 @@ bool MachineBlockPlacement::runOnMachine
   assert(BlockToChain.empty());
 
   buildCFGChains(F);
+  alignBlocks(F);
 
   BlockToChain.clear();
   ChainAllocator.DestroyAll();




More information about the llvm-commits mailing list