Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 54850be

Browse files
committed
Reapply "blockfreq: Rewrite BlockFrequencyInfoImpl"
This reverts commit r206556, effectively reapplying commit r206548 and its fixups in r206549 and r206550. In an intervening commit I've added target triples to the tests that were failing remotely [1] (but passing locally). I'm hoping the mystery is solved? I'll revert this again if the tests are still failing remotely. [1]: http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/1816 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206622 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 1e1954f commit 54850be

12 files changed

+3101
-316
lines changed

include/llvm/Analysis/BlockFrequencyInfoImpl.h

Lines changed: 1606 additions & 283 deletions
Large diffs are not rendered by default.

lib/Analysis/BlockFrequencyInfo.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14+
#define DEBUG_TYPE "block-freq"
1415
#include "llvm/Analysis/BlockFrequencyInfo.h"
1516
#include "llvm/Analysis/BlockFrequencyInfoImpl.h"
1617
#include "llvm/Analysis/BranchProbabilityInfo.h"
@@ -106,6 +107,7 @@ struct DOTGraphTraits<BlockFrequencyInfo*> : public DefaultDOTGraphTraits {
106107
INITIALIZE_PASS_BEGIN(BlockFrequencyInfo, "block-freq",
107108
"Block Frequency Analysis", true, true)
108109
INITIALIZE_PASS_DEPENDENCY(BranchProbabilityInfo)
110+
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
109111
INITIALIZE_PASS_END(BlockFrequencyInfo, "block-freq",
110112
"Block Frequency Analysis", true, true)
111113

@@ -120,14 +122,16 @@ BlockFrequencyInfo::~BlockFrequencyInfo() {}
120122

121123
void BlockFrequencyInfo::getAnalysisUsage(AnalysisUsage &AU) const {
122124
AU.addRequired<BranchProbabilityInfo>();
125+
AU.addRequired<LoopInfo>();
123126
AU.setPreservesAll();
124127
}
125128

126129
bool BlockFrequencyInfo::runOnFunction(Function &F) {
127130
BranchProbabilityInfo &BPI = getAnalysis<BranchProbabilityInfo>();
131+
LoopInfo &LI = getAnalysis<LoopInfo>();
128132
if (!BFI)
129133
BFI.reset(new ImplType);
130-
BFI->doFunction(&F, &BPI);
134+
BFI->doFunction(&F, &BPI, &LI);
131135
#ifndef NDEBUG
132136
if (ViewBlockFreqPropagationDAG != GVDT_None)
133137
view();
@@ -158,7 +162,7 @@ void BlockFrequencyInfo::view() const {
158162
}
159163

160164
const Function *BlockFrequencyInfo::getFunction() const {
161-
return BFI ? BFI->Fn : nullptr;
165+
return BFI ? BFI->getFunction() : nullptr;
162166
}
163167

164168
raw_ostream &BlockFrequencyInfo::

0 commit comments

Comments
 (0)