diff options
author | Vedant Kumar <vsk@apple.com> | 2018-11-19 05:23:16 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2018-11-19 05:23:16 +0000 |
commit | e7b789b5293b179b7972d6d3d6b85e010f221e66 (patch) | |
tree | f68e7334298c8889b904d6e5374f5b94acf7cadd /llvm/lib/Analysis | |
parent | 3616891046e7f13a758e53dcc6fa73a7c3232b35 (diff) | |
download | bcm5719-llvm-e7b789b5293b179b7972d6d3d6b85e010f221e66.tar.gz bcm5719-llvm-e7b789b5293b179b7972d6d3d6b85e010f221e66.zip |
[ProfileSummary] Standardize methods and fix comment
Every Analysis pass has a get method that returns a reference of the Result of
the Analysis, for example, BlockFrequencyInfo
&BlockFrequencyInfoWrapperPass::getBFI(). I believe that
ProfileSummaryInfo::getPSI() is the only exception to that, as it was returning
a pointer.
Another change is renaming isHotBB and isColdBB to isHotBlock and isColdBlock,
respectively. Most methods use BB as the argument of variable names while
methods usually refer to Basic Blocks as Blocks, instead of BB. For example,
Function::getEntryBlock, Loop:getExitBlock, etc.
I also fixed one of the comments.
Patch by Rodrigo Caetano Rocha!
Differential Revision: https://reviews.llvm.org/D54669
llvm-svn: 347182
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Analysis/ProfileSummaryInfo.cpp | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index 237faede16b..5a13149c022 100644 --- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -665,7 +665,7 @@ ModuleSummaryIndexWrapperPass::ModuleSummaryIndexWrapperPass() } bool ModuleSummaryIndexWrapperPass::runOnModule(Module &M) { - auto &PSI = *getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI(); + auto *PSI = &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI(); Index.emplace(buildModuleSummaryIndex( M, [this](const Function &F) { @@ -673,7 +673,7 @@ bool ModuleSummaryIndexWrapperPass::runOnModule(Module &M) { *const_cast<Function *>(&F)) .getBFI()); }, - &PSI)); + PSI)); return false; } diff --git a/llvm/lib/Analysis/ProfileSummaryInfo.cpp b/llvm/lib/Analysis/ProfileSummaryInfo.cpp index 7472b6201c2..bd8459ddb82 100644 --- a/llvm/lib/Analysis/ProfileSummaryInfo.cpp +++ b/llvm/lib/Analysis/ProfileSummaryInfo.cpp @@ -151,7 +151,7 @@ bool ProfileSummaryInfo::isFunctionHotInCallGraph(const Function *F, return true; } for (const auto &BB : *F) - if (isHotBB(&BB, &BFI)) + if (isHotBlock(&BB, &BFI)) return true; return false; } @@ -180,7 +180,7 @@ bool ProfileSummaryInfo::isFunctionColdInCallGraph(const Function *F, return false; } for (const auto &BB : *F) - if (!isColdBB(&BB, &BFI)) + if (!isColdBlock(&BB, &BFI)) return false; return true; } @@ -253,14 +253,14 @@ uint64_t ProfileSummaryInfo::getOrCompColdCountThreshold() { return ColdCountThreshold ? ColdCountThreshold.getValue() : 0; } -bool ProfileSummaryInfo::isHotBB(const BasicBlock *B, BlockFrequencyInfo *BFI) { - auto Count = BFI->getBlockProfileCount(B); +bool ProfileSummaryInfo::isHotBlock(const BasicBlock *BB, BlockFrequencyInfo *BFI) { + auto Count = BFI->getBlockProfileCount(BB); return Count && isHotCount(*Count); } -bool ProfileSummaryInfo::isColdBB(const BasicBlock *B, +bool ProfileSummaryInfo::isColdBlock(const BasicBlock *BB, BlockFrequencyInfo *BFI) { - auto Count = BFI->getBlockProfileCount(B); + auto Count = BFI->getBlockProfileCount(BB); return Count && isColdCount(*Count); } |