33 cl::desc(
"A count is hot if it exceeds the minimum count to"
34 " reach this percentile of total counts."));
38 cl::desc(
"A count is cold if it is below the minimum count"
39 " to reach this percentile of total counts."));
43 uint64_t Percentile) {
45 return Entry.
Cutoff < Percentile;
47 auto It = std::lower_bound(DS.begin(), DS.end(), Percentile,
Compare);
59 void ProfileSummaryInfo::computeSummary() {
79 return FunctionCount &&
isHotCount(FunctionCount.getValue());
98 return FunctionCount &&
isColdCount(FunctionCount.getValue());
102 void ProfileSummaryInfo::computeThresholds() {
107 auto &DetailedSummary = Summary->getDetailedSummary();
115 if (!HotCountThreshold)
117 return HotCountThreshold && C >= HotCountThreshold.
getValue();
121 if (!ColdCountThreshold)
123 return ColdCountThreshold && C <= ColdCountThreshold.
getValue();
145 "Profile summary info",
false,
true)
172 OS <<
"Functions in " << M.
getName() <<
" with hot/cold annotations: \n";
176 OS <<
" :hot entry ";
178 OS <<
" :cold entry ";
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
uint32_t Cutoff
The required percentile of counts.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
A Module instance is used to store all the information related to an LLVM module. ...
bool isColdCount(uint64_t C)
Returns true if count C is considered cold.
Analysis providing profile information.
bool isHotCount(uint64_t C)
Returns true if F is a hot function.
bool isFunctionEntryCold(const Function *F)
Returns true if F has cold function entry.
Result run(Module &M, ModuleAnalysisManager &)
StringRef getName() const
Get a short "name" for the module.
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
bool isHotBB(const BasicBlock *B, BlockFrequencyInfo *BFI)
Returns true if BasicBlock B is considered hot.
Metadata * getProfileSummary()
Returns profile summary metadata.
const T & getValue() const LLVM_LVALUE_FUNCTION
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
Optional< uint64_t > getEntryCount() const
Get the entry count for this function.
bool doInitialization(Module &M) override
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
static cl::opt< int > ProfileSummaryCutoffHot("profile-summary-cutoff-hot", cl::Hidden, cl::init(999000), cl::ZeroOrMore, cl::desc("A count is hot if it exceeds the minimum count to"" reach this percentile of total counts."))
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
initializer< Ty > init(const Ty &Val)
A set of analyses that are preserved following a run of a transformation pass.
static cl::opt< int > ProfileSummaryCutoffCold("profile-summary-cutoff-cold", cl::Hidden, cl::init(999999), cl::ZeroOrMore, cl::desc("A count is cold if it is below the minimum count"" to reach this percentile of total counts."))
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs...ExtraArgs)
Get the result of an analysis pass for a given IR unit.
LLVM Basic Block Representation.
An analysis pass based on the new PM to deliver ProfileSummaryInfo.
bool doFinalization(Module &M) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
bool extractProfTotalWeight(uint64_t &TotalVal) const
Retrieve total raw weight values of a branch.
ImmutablePass class - This class is used to provide information that does not need to be run...
Module.h This file contains the declarations for the Module class.
void initializeProfileSummaryInfoWrapperPassPass(PassRegistry &)
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
static ProfileSummary * getFromMD(Metadata *MD)
Construct profile summary from metdata.
bool isFunctionEntryHot(const Function *F)
Returns true if F has hot function entry.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
static uint64_t getMinCountForPercentile(SummaryEntryVector &DS, uint64_t Percentile)
TerminatorInst * getTerminator()
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
INITIALIZE_PASS(ProfileSummaryInfoWrapperPass,"profile-summary-info","Profile summary info", false, true) ProfileSummaryInfoWrapperPass
A container for analyses that lazily runs them and caches their results.
Optional< uint64_t > getBlockProfileCount(const BasicBlock *BB) const
Returns the estimated profile count of BB.
A special type used by analysis passes to provide an address that identifies that particular analysis...
std::vector< ProfileSummaryEntry > SummaryEntryVector