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

Commit 036e26b

Browse files
committed
Reapply "blockfreq: Rewrite BlockFrequencyInfoImpl" (#2)
This reverts commit r206628, reapplying r206622 (and r206626). Two tests are failing only on buildbots [1][2]: i.e., I can't reproduce on Darwin, and Chandler can't reproduce on Linux. Asan and valgrind don't tell us anything, but we're hoping the msan bot will catch it. So, I'm applying this again to get more feedback from the bots. I'll leave it in long enough to trigger builds in at least the sanitizer buildbots (it was failing for reasons unrelated to my commit last time it was in), and hopefully a few others.... and then I expect to revert a third time. [1]: http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/1816 [2]: http://llvm-amd64.freebsd.your.org/b/builders/clang-i386-freebsd/builds/18445 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206666 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent e0d2d7f commit 036e26b

12 files changed

+3103
-316
lines changed

include/llvm/Analysis/BlockFrequencyInfoImpl.h

+1,606-283
Large diffs are not rendered by default.

lib/Analysis/BlockFrequencyInfo.cpp

+6-2
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)