diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:17:27 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:17:27 +0000 | 
| commit | 67c32a98315f785a9ec9d531c1f571a0196c7463 (patch) | |
| tree | 4abb9cbeecc7901726dd0b4a37369596c852e9ef /lib/CodeGen/MachineBlockPlacement.cpp | |
| parent | 9f61947910e6ab40de38e6b4034751ef1513200f (diff) | |
Notes
Diffstat (limited to 'lib/CodeGen/MachineBlockPlacement.cpp')
| -rw-r--r-- | lib/CodeGen/MachineBlockPlacement.cpp | 16 | 
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/CodeGen/MachineBlockPlacement.cpp b/lib/CodeGen/MachineBlockPlacement.cpp index 74af1e2d64b0..aaa7d9156976 100644 --- a/lib/CodeGen/MachineBlockPlacement.cpp +++ b/lib/CodeGen/MachineBlockPlacement.cpp @@ -42,6 +42,7 @@  #include "llvm/Support/Debug.h"  #include "llvm/Target/TargetInstrInfo.h"  #include "llvm/Target/TargetLowering.h" +#include "llvm/Target/TargetSubtargetInfo.h"  #include <algorithm>  using namespace llvm; @@ -812,7 +813,7 @@ void MachineBlockPlacement::buildLoopChains(MachineFunction &F,                                     BE = L.block_end();         BI != BE; ++BI) {      BlockChain &Chain = *BlockToChain[*BI]; -    if (!UpdatedPreds.insert(&Chain)) +    if (!UpdatedPreds.insert(&Chain).second)        continue;      assert(Chain.LoopPredecessors == 0); @@ -913,7 +914,7 @@ void MachineBlockPlacement::buildCFGChains(MachineFunction &F) {    for (MachineFunction::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) {      MachineBasicBlock *BB = &*FI;      BlockChain &Chain = *BlockToChain[BB]; -    if (!UpdatedPreds.insert(&Chain)) +    if (!UpdatedPreds.insert(&Chain).second)        continue;      assert(Chain.LoopPredecessors == 0); @@ -1045,9 +1046,6 @@ void MachineBlockPlacement::buildCFGChains(MachineFunction &F) {    if (F.getFunction()->getAttributes().          hasAttribute(AttributeSet::FunctionIndex, Attribute::OptimizeForSize))      return; -  unsigned Align = TLI->getPrefLoopAlignment(); -  if (!Align) -    return;  // Don't care about loop alignment.    if (FunctionChain.begin() == FunctionChain.end())      return;  // Empty chain. @@ -1065,6 +1063,10 @@ void MachineBlockPlacement::buildCFGChains(MachineFunction &F) {      if (!L)        continue; +    unsigned Align = TLI->getPrefLoopAlignment(L); +    if (!Align) +      continue;  // Don't care about loop alignment. +      // If the block is cold relative to the function entry don't waste space      // aligning it.      BlockFrequency Freq = MBFI->getBlockFreq(*BI); @@ -1111,8 +1113,8 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &F) {    MBPI = &getAnalysis<MachineBranchProbabilityInfo>();    MBFI = &getAnalysis<MachineBlockFrequencyInfo>();    MLI = &getAnalysis<MachineLoopInfo>(); -  TII = F.getTarget().getInstrInfo(); -  TLI = F.getTarget().getTargetLowering(); +  TII = F.getSubtarget().getInstrInfo(); +  TLI = F.getSubtarget().getTargetLowering();    assert(BlockToChain.empty());    buildCFGChains(F);  | 
