Skip to content

Commit

Permalink
Reapply "blockfreq: Rewrite BlockFrequencyInfoImpl" (llvm-mirror#2)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dexonsmith committed Apr 18, 2014
1 parent e0d2d7f commit 036e26b
Show file tree
Hide file tree
Showing 12 changed files with 3,103 additions and 316 deletions.
1,889 changes: 1,606 additions & 283 deletions include/llvm/Analysis/BlockFrequencyInfoImpl.h

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions lib/Analysis/BlockFrequencyInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//

#define DEBUG_TYPE "block-freq"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/BlockFrequencyInfoImpl.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
Expand Down Expand Up @@ -106,6 +107,7 @@ struct DOTGraphTraits<BlockFrequencyInfo*> : public DefaultDOTGraphTraits {
INITIALIZE_PASS_BEGIN(BlockFrequencyInfo, "block-freq",
"Block Frequency Analysis", true, true)
INITIALIZE_PASS_DEPENDENCY(BranchProbabilityInfo)
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
INITIALIZE_PASS_END(BlockFrequencyInfo, "block-freq",
"Block Frequency Analysis", true, true)

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

void BlockFrequencyInfo::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<BranchProbabilityInfo>();
AU.addRequired<LoopInfo>();
AU.setPreservesAll();
}

bool BlockFrequencyInfo::runOnFunction(Function &F) {
BranchProbabilityInfo &BPI = getAnalysis<BranchProbabilityInfo>();
LoopInfo &LI = getAnalysis<LoopInfo>();
if (!BFI)
BFI.reset(new ImplType);
BFI->doFunction(&F, &BPI);
BFI->doFunction(&F, &BPI, &LI);
#ifndef NDEBUG
if (ViewBlockFreqPropagationDAG != GVDT_None)
view();
Expand Down Expand Up @@ -158,7 +162,7 @@ void BlockFrequencyInfo::view() const {
}

const Function *BlockFrequencyInfo::getFunction() const {
return BFI ? BFI->Fn : nullptr;
return BFI ? BFI->getFunction() : nullptr;
}

raw_ostream &BlockFrequencyInfo::
Expand Down
Loading

0 comments on commit 036e26b

Please sign in to comment.