From e7b789b5293b179b7972d6d3d6b85e010f221e66 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Mon, 19 Nov 2018 05:23:16 +0000 Subject: [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 --- llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | 4 ++-- llvm/lib/Analysis/ProfileSummaryInfo.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'llvm/lib/Analysis') 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().getPSI(); + auto *PSI = &getAnalysis().getPSI(); Index.emplace(buildModuleSummaryIndex( M, [this](const Function &F) { @@ -673,7 +673,7 @@ bool ModuleSummaryIndexWrapperPass::runOnModule(Module &M) { *const_cast(&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); } -- cgit v1.2.3