LLVM
13.0.0git
|
Analysis providing profile information. More...
#include "llvm/Analysis/ProfileSummaryInfo.h"
Public Member Functions | |
ProfileSummaryInfo (const Module &M) | |
ProfileSummaryInfo (std::unique_ptr< ProfileSummary > PSI) | |
ProfileSummaryInfo (ProfileSummaryInfo &&Arg)=default | |
void | refresh () |
If no summary is present, attempt to refresh. More... | |
bool | hasProfileSummary () const |
Returns true if profile summary is available. More... | |
bool | hasSampleProfile () const |
Returns true if module M has sample profile. More... | |
bool | hasInstrumentationProfile () const |
Returns true if module M has instrumentation profile. More... | |
bool | hasCSInstrumentationProfile () const |
Returns true if module M has context sensitive instrumentation profile. More... | |
bool | invalidate (Module &, const PreservedAnalyses &, ModuleAnalysisManager::Invalidator &) |
Handle the invalidation of this information. More... | |
Optional< uint64_t > | getProfileCount (const CallBase &CallInst, BlockFrequencyInfo *BFI, bool AllowSynthetic=false) const |
Returns the profile count for CallInst . More... | |
bool | hasPartialSampleProfile () const |
Returns true if module M has partial-profile sample profile. More... | |
bool | hasHugeWorkingSetSize () const |
Returns true if the working set size of the code is considered huge. More... | |
bool | hasLargeWorkingSetSize () const |
Returns true if the working set size of the code is considered large. More... | |
bool | isFunctionEntryHot (const Function *F) const |
Returns true if F has hot function entry. More... | |
bool | isFunctionHotInCallGraph (const Function *F, BlockFrequencyInfo &BFI) const |
Returns true if F contains hot code. More... | |
bool | isFunctionEntryCold (const Function *F) const |
Returns true if F has cold function entry. More... | |
bool | isFunctionColdInCallGraph (const Function *F, BlockFrequencyInfo &BFI) const |
Returns true if F contains only cold code. More... | |
bool | isFunctionHotnessUnknown (const Function &F) const |
Returns true if the hotness of F is unknown. More... | |
bool | isFunctionHotInCallGraphNthPercentile (int PercentileCutoff, const Function *F, BlockFrequencyInfo &BFI) const |
Returns true if F contains hot code with regard to a given hot percentile cutoff value. More... | |
bool | isFunctionColdInCallGraphNthPercentile (int PercentileCutoff, const Function *F, BlockFrequencyInfo &BFI) const |
Returns true if F contains cold code with regard to a given cold percentile cutoff value. More... | |
bool | isHotCount (uint64_t C) const |
Returns true if count C is considered hot. More... | |
bool | isColdCount (uint64_t C) const |
Returns true if count C is considered cold. More... | |
bool | isHotCountNthPercentile (int PercentileCutoff, uint64_t C) const |
Returns true if count C is considered hot with regard to a given hot percentile cutoff value. More... | |
bool | isColdCountNthPercentile (int PercentileCutoff, uint64_t C) const |
Returns true if count C is considered cold with regard to a given cold percentile cutoff value. More... | |
bool | isHotBlock (const BasicBlock *BB, BlockFrequencyInfo *BFI) const |
Returns true if BasicBlock BB is considered hot. More... | |
bool | isColdBlock (const BasicBlock *BB, BlockFrequencyInfo *BFI) const |
Returns true if BasicBlock BB is considered cold. More... | |
bool | isHotBlockNthPercentile (int PercentileCutoff, const BasicBlock *BB, BlockFrequencyInfo *BFI) const |
Returns true if BasicBlock BB is considered hot with regard to a given hot percentile cutoff value. More... | |
bool | isColdBlockNthPercentile (int PercentileCutoff, const BasicBlock *BB, BlockFrequencyInfo *BFI) const |
Returns true if BasicBlock BB is considered cold with regard to a given cold percentile cutoff value. More... | |
bool | isHotCallSite (const CallBase &CB, BlockFrequencyInfo *BFI) const |
Returns true if the call site CB is considered hot. More... | |
bool | isColdCallSite (const CallBase &CB, BlockFrequencyInfo *BFI) const |
Returns true if call site CB is considered cold. More... | |
uint64_t | getOrCompHotCountThreshold () const |
Returns HotCountThreshold if set. More... | |
uint64_t | getOrCompColdCountThreshold () const |
Returns ColdCountThreshold if set. More... | |
uint64_t | getHotCountThreshold () const |
Returns HotCountThreshold if set. More... | |
uint64_t | getColdCountThreshold () const |
Returns ColdCountThreshold if set. More... | |
Analysis providing profile information.
This is an immutable analysis pass that provides ability to query global (program-level) profile information. The main APIs are isHotCount and isColdCount that tells whether a given profile count is considered hot/cold based on the profile summary. This also provides convenience methods to check whether a function is hot or cold.
Definition at line 39 of file ProfileSummaryInfo.h.
Definition at line 61 of file ProfileSummaryInfo.h.
|
inline |
Definition at line 62 of file ProfileSummaryInfo.h.
References M.
|
default |
|
inline |
Returns ColdCountThreshold if set.
Definition at line 171 of file ProfileSummaryInfo.h.
References llvm::Optional< T >::getValue().
|
inline |
Returns HotCountThreshold if set.
Definition at line 167 of file ProfileSummaryInfo.h.
References llvm::Optional< T >::getValue().
Referenced by annotateAllFunctions().
uint64_t ProfileSummaryInfo::getOrCompColdCountThreshold | ( | ) | const |
Returns ColdCountThreshold if set.
Recompute HotCountThreshold if not set.
Definition at line 362 of file ProfileSummaryInfo.cpp.
References llvm::Optional< T >::getValue().
Referenced by annotateAllFunctions().
uint64_t ProfileSummaryInfo::getOrCompHotCountThreshold | ( | ) | const |
Returns HotCountThreshold if set.
Recompute HotCountThreshold if not set.
Definition at line 358 of file ProfileSummaryInfo.cpp.
References llvm::Optional< T >::getValue(), and UINT64_MAX.
Referenced by annotateAllFunctions().
Optional< uint64_t > ProfileSummaryInfo::getProfileCount | ( | const CallBase & | CallInst, |
BlockFrequencyInfo * | BFI, | ||
bool | AllowSynthetic = false |
||
) | const |
Returns the profile count for CallInst
.
Definition at line 113 of file ProfileSummaryInfo.cpp.
References assert(), llvm::AMDGPUISD::BFI, hasSampleProfile(), and llvm::None.
Referenced by computeFunctionSummary(), isColdCallSite(), isFunctionColdInCallGraph(), isFunctionHotInCallGraph(), isHotCallSite(), and updateCallProfile().
|
inline |
Returns true if module M
has context sensitive instrumentation profile.
Definition at line 86 of file ProfileSummaryInfo.h.
References hasProfileSummary(), and llvm::ProfileSummary::PSK_CSInstr.
bool ProfileSummaryInfo::hasHugeWorkingSetSize | ( | ) | const |
Returns true if the working set size of the code is considered huge.
Definition at line 322 of file ProfileSummaryInfo.cpp.
References llvm::Optional< T >::getValue().
|
inline |
Returns true if module M
has instrumentation profile.
Definition at line 80 of file ProfileSummaryInfo.h.
References hasProfileSummary(), and llvm::ProfileSummary::PSK_Instr.
Referenced by llvm::isPGSOColdCodeOnly().
bool ProfileSummaryInfo::hasLargeWorkingSetSize | ( | ) | const |
Returns true if the working set size of the code is considered large.
Definition at line 326 of file ProfileSummaryInfo.cpp.
References llvm::Optional< T >::getValue().
Referenced by llvm::isPGSOColdCodeOnly().
bool ProfileSummaryInfo::hasPartialSampleProfile | ( | ) | const |
Returns true if module M
has partial-profile sample profile.
Definition at line 415 of file ProfileSummaryInfo.cpp.
References hasProfileSummary(), PartialProfile, and llvm::ProfileSummary::PSK_Sample.
Referenced by isFunctionHotnessUnknown(), and llvm::isPGSOColdCodeOnly().
|
inline |
Returns true if profile summary is available.
Definition at line 71 of file ProfileSummaryInfo.h.
Referenced by hasCSInstrumentationProfile(), hasInstrumentationProfile(), hasPartialSampleProfile(), hasSampleProfile(), isFunctionColdInCallGraph(), isFunctionEntryCold(), isFunctionEntryHot(), isFunctionHotInCallGraph(), refresh(), llvm::InstructionCombiningPass::runOnFunction(), llvm::InstructionSelect::runOnMachineFunction(), shouldApply(), llvm::shouldFuncOptimizeForSizeImpl(), and llvm::shouldOptimizeForSizeImpl().
|
inline |
Returns true if module M
has sample profile.
Definition at line 74 of file ProfileSummaryInfo.h.
References hasProfileSummary(), and llvm::ProfileSummary::PSK_Sample.
Referenced by getProfileCount(), isColdCallSite(), isFunctionColdInCallGraph(), isFunctionHotInCallGraph(), llvm::isPGSOColdCodeOnly(), llvm::shouldFuncOptimizeForSizeImpl(), and llvm::shouldOptimizeForSizeImpl().
|
inline |
Handle the invalidation of this information.
When used as a result of ProfileSummaryAnalysis
this method will be called when the module this was computed for changes. Since profile summary is immutable after it is annotated on the module, we return false here.
Definition at line 97 of file ProfileSummaryInfo.h.
bool ProfileSummaryInfo::isColdBlock | ( | const BasicBlock * | BB, |
BlockFrequencyInfo * | BFI | ||
) | const |
Returns true if BasicBlock BB
is considered cold.
Definition at line 372 of file ProfileSummaryInfo.cpp.
References BB, llvm::AMDGPUISD::BFI, and isColdCount().
Referenced by isFunctionColdInCallGraph().
bool ProfileSummaryInfo::isColdBlockNthPercentile | ( | int | PercentileCutoff, |
const BasicBlock * | BB, | ||
BlockFrequencyInfo * | BFI | ||
) | const |
Returns true if BasicBlock BB
is considered cold with regard to a given cold percentile cutoff value.
Definition at line 393 of file ProfileSummaryInfo.cpp.
References BB, llvm::AMDGPUISD::BFI, and PercentileCutoff.
bool ProfileSummaryInfo::isColdCallSite | ( | const CallBase & | CB, |
BlockFrequencyInfo * | BFI | ||
) | const |
Returns true if call site CB
is considered cold.
Definition at line 404 of file ProfileSummaryInfo.cpp.
References llvm::AMDGPUISD::BFI, llvm::CallBase::getCaller(), getProfileCount(), llvm::Function::hasProfileData(), hasSampleProfile(), and isColdCount().
bool ProfileSummaryInfo::isColdCount | ( | uint64_t | C | ) | const |
Returns true if count C
is considered cold.
Definition at line 334 of file ProfileSummaryInfo.cpp.
References llvm::Optional< T >::getValue().
Referenced by llvm::sampleprofutil::callsiteIsHot(), getHotness(), isColdBlock(), isColdCallSite(), isFunctionColdInCallGraph(), and isFunctionEntryCold().
bool ProfileSummaryInfo::isColdCountNthPercentile | ( | int | PercentileCutoff, |
uint64_t | C | ||
) | const |
Returns true if count C
is considered cold with regard to a given cold percentile cutoff value.
Definition at line 353 of file ProfileSummaryInfo.cpp.
References PercentileCutoff.
Referenced by isColdBlock().
bool ProfileSummaryInfo::isFunctionColdInCallGraph | ( | const Function * | F, |
BlockFrequencyInfo & | BFI | ||
) | const |
Returns true if F
contains only cold code.
Returns true if the function only contains cold code.
This means that the function entry and blocks are all cold, and (in the case of Sample PGO) the total call edge count is cold. If it returns false, it either means it is not cold or it is unknown (for example, no profile data is available).
Definition at line 179 of file ProfileSummaryInfo.cpp.
References BB, llvm::AMDGPUISD::BFI, F, getProfileCount(), hasProfileSummary(), hasSampleProfile(), I, isColdBlock(), and isColdCount().
bool ProfileSummaryInfo::isFunctionColdInCallGraphNthPercentile | ( | int | PercentileCutoff, |
const Function * | F, | ||
BlockFrequencyInfo & | BFI | ||
) | const |
Returns true if F
contains cold code with regard to a given cold percentile cutoff value.
Definition at line 249 of file ProfileSummaryInfo.cpp.
References llvm::AMDGPUISD::BFI, F, and PercentileCutoff.
Returns true if F
has cold function entry.
Returns true if the function's entry is a cold.
If it returns false, it either means it is not cold or it is unknown whether it is cold or not (for example, no profile data is available).
Definition at line 258 of file ProfileSummaryInfo.cpp.
References llvm::CallingConv::Cold, F, hasProfileSummary(), and isColdCount().
Referenced by llvm::ProfileSummaryPrinterPass::run().
Returns true if F
has hot function entry.
Returns true if the function's entry is hot.
If it returns false, it either means it is not hot or it is unknown whether it is hot or not (for example, no profile data is available).
Definition at line 135 of file ProfileSummaryInfo.cpp.
References F, hasProfileSummary(), and isHotCount().
Referenced by llvm::ProfileSummaryPrinterPass::run(), and shouldApply().
bool ProfileSummaryInfo::isFunctionHotInCallGraph | ( | const Function * | F, |
BlockFrequencyInfo & | BFI | ||
) | const |
Returns true if F
contains hot code.
Returns true if the function contains hot code.
This can include a hot function entry count, hot basic block, or (in the case of Sample PGO) hot total call edge count. If it returns false, it either means it is not hot or it is unknown (for example, no profile data is available).
Definition at line 150 of file ProfileSummaryInfo.cpp.
References BB, llvm::AMDGPUISD::BFI, F, getProfileCount(), hasProfileSummary(), hasSampleProfile(), I, isHotBlock(), and isHotCount().
bool ProfileSummaryInfo::isFunctionHotInCallGraphNthPercentile | ( | int | PercentileCutoff, |
const Function * | F, | ||
BlockFrequencyInfo & | BFI | ||
) | const |
Returns true if F
contains hot code with regard to a given hot percentile cutoff value.
Definition at line 243 of file ProfileSummaryInfo.cpp.
References llvm::AMDGPUISD::BFI, F, and PercentileCutoff.
Returns true if the hotness of F
is unknown.
Definition at line 203 of file ProfileSummaryInfo.cpp.
References assert(), F, and hasPartialSampleProfile().
bool ProfileSummaryInfo::isHotBlock | ( | const BasicBlock * | BB, |
BlockFrequencyInfo * | BFI | ||
) | const |
Returns true if BasicBlock BB
is considered hot.
Definition at line 366 of file ProfileSummaryInfo.cpp.
References BB, llvm::AMDGPUISD::BFI, and isHotCount().
Referenced by isFunctionHotInCallGraph().
bool ProfileSummaryInfo::isHotBlockNthPercentile | ( | int | PercentileCutoff, |
const BasicBlock * | BB, | ||
BlockFrequencyInfo * | BFI | ||
) | const |
Returns true if BasicBlock BB
is considered hot with regard to a given hot percentile cutoff value.
Definition at line 388 of file ProfileSummaryInfo.cpp.
References BB, llvm::AMDGPUISD::BFI, and PercentileCutoff.
bool ProfileSummaryInfo::isHotCallSite | ( | const CallBase & | CB, |
BlockFrequencyInfo * | BFI | ||
) | const |
Returns true if the call site CB
is considered hot.
Definition at line 398 of file ProfileSummaryInfo.cpp.
References llvm::AMDGPUISD::BFI, getProfileCount(), and isHotCount().
bool ProfileSummaryInfo::isHotCount | ( | uint64_t | C | ) | const |
Returns true if count C
is considered hot.
Definition at line 330 of file ProfileSummaryInfo.cpp.
References llvm::Optional< T >::getValue().
Referenced by llvm::sampleprofutil::callsiteIsHot(), getHotness(), isFunctionEntryHot(), isFunctionHotInCallGraph(), isHotBlock(), and isHotCallSite().
bool ProfileSummaryInfo::isHotCountNthPercentile | ( | int | PercentileCutoff, |
uint64_t | C | ||
) | const |
Returns true if count C
is considered hot with regard to a given hot percentile cutoff value.
Definition at line 348 of file ProfileSummaryInfo.cpp.
References PercentileCutoff.
void ProfileSummaryInfo::refresh | ( | ) |
If no summary is present, attempt to refresh.
Definition at line 94 of file ProfileSummaryInfo.cpp.
References llvm::ProfileSummary::getFromMD(), llvm::Module::getProfileSummary(), and hasProfileSummary().
Referenced by annotateAllFunctions(), and ProfileSummaryInfo().