LLVM  16.0.0git
ProfileSummaryInfo.cpp
Go to the documentation of this file.
1 //===- ProfileSummaryInfo.cpp - Global profile summary information --------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains a pass that provides access to the global profile summary
10 // information.
11 //
12 //===----------------------------------------------------------------------===//
13 
16 #include "llvm/IR/BasicBlock.h"
17 #include "llvm/IR/Instructions.h"
18 #include "llvm/IR/Module.h"
19 #include "llvm/IR/ProfileSummary.h"
20 #include "llvm/InitializePasses.h"
23 using namespace llvm;
24 
25 // Knobs for profile summary based thresholds.
26 namespace llvm {
33 } // namespace llvm
34 
36  "partial-profile", cl::Hidden, cl::init(false),
37  cl::desc("Specify the current profile is used as a partial profile."));
38 
40  "scale-partial-sample-profile-working-set-size", cl::Hidden, cl::init(true),
41  cl::desc(
42  "If true, scale the working set size of the partial sample profile "
43  "by the partial profile ratio to reflect the size of the program "
44  "being compiled."));
45 
47  "partial-sample-profile-working-set-size-scale-factor", cl::Hidden,
48  cl::init(0.008),
49  cl::desc("The scale factor used to scale the working set size of the "
50  "partial sample profile along with the partial profile ratio. "
51  "This includes the factor of the profile counter per block "
52  "and the factor to scale the working set size to use the same "
53  "shared thresholds as PGO."));
54 
55 // The profile summary metadata may be attached either by the frontend or by
56 // any backend passes (IR level instrumentation, for example). This method
57 // checks if the Summary is null and if so checks if the summary metadata is now
58 // available in the module and parses it to get the Summary object.
60  if (hasProfileSummary())
61  return;
62  // First try to get context sensitive ProfileSummary.
63  auto *SummaryMD = M->getProfileSummary(/* IsCS */ true);
64  if (SummaryMD)
65  Summary.reset(ProfileSummary::getFromMD(SummaryMD));
66 
67  if (!hasProfileSummary()) {
68  // This will actually return PSK_Instr or PSK_Sample summary.
69  SummaryMD = M->getProfileSummary(/* IsCS */ false);
70  if (SummaryMD)
71  Summary.reset(ProfileSummary::getFromMD(SummaryMD));
72  }
73  if (!hasProfileSummary())
74  return;
75  computeThresholds();
76 }
77 
79  const CallBase &Call, BlockFrequencyInfo *BFI, bool AllowSynthetic) const {
80  assert((isa<CallInst>(Call) || isa<InvokeInst>(Call)) &&
81  "We can only get profile count for call/invoke instruction.");
82  if (hasSampleProfile()) {
83  // In sample PGO mode, check if there is a profile metadata on the
84  // instruction. If it is present, determine hotness solely based on that,
85  // since the sampled entry count may not be accurate. If there is no
86  // annotated on the instruction, return None.
87  uint64_t TotalCount;
88  if (Call.extractProfTotalWeight(TotalCount))
89  return TotalCount;
90  return None;
91  }
92  if (BFI)
93  return BFI->getBlockProfileCount(Call.getParent(), AllowSynthetic);
94  return None;
95 }
96 
97 /// Returns true if the function's entry is hot. If it returns false, it
98 /// either means it is not hot or it is unknown whether it is hot or not (for
99 /// example, no profile data is available).
101  if (!F || !hasProfileSummary())
102  return false;
103  auto FunctionCount = F->getEntryCount();
104  // FIXME: The heuristic used below for determining hotness is based on
105  // preliminary SPEC tuning for inliner. This will eventually be a
106  // convenience method that calls isHotCount.
107  return FunctionCount && isHotCount(FunctionCount->getCount());
108 }
109 
110 /// Returns true if the function contains hot code. This can include a hot
111 /// function entry count, hot basic block, or (in the case of Sample PGO)
112 /// hot total call edge count.
113 /// If it returns false, it either means it is not hot or it is unknown
114 /// (for example, no profile data is available).
116  const Function *F, BlockFrequencyInfo &BFI) const {
117  if (!F || !hasProfileSummary())
118  return false;
119  if (auto FunctionCount = F->getEntryCount())
120  if (isHotCount(FunctionCount->getCount()))
121  return true;
122 
123  if (hasSampleProfile()) {
124  uint64_t TotalCallCount = 0;
125  for (const auto &BB : *F)
126  for (const auto &I : BB)
127  if (isa<CallInst>(I) || isa<InvokeInst>(I))
128  if (auto CallCount = getProfileCount(cast<CallBase>(I), nullptr))
129  TotalCallCount += *CallCount;
130  if (isHotCount(TotalCallCount))
131  return true;
132  }
133  for (const auto &BB : *F)
134  if (isHotBlock(&BB, &BFI))
135  return true;
136  return false;
137 }
138 
139 /// Returns true if the function only contains cold code. This means that
140 /// the function entry and blocks are all cold, and (in the case of Sample PGO)
141 /// the total call edge count is cold.
142 /// If it returns false, it either means it is not cold or it is unknown
143 /// (for example, no profile data is available).
145  const Function *F, BlockFrequencyInfo &BFI) const {
146  if (!F || !hasProfileSummary())
147  return false;
148  if (auto FunctionCount = F->getEntryCount())
149  if (!isColdCount(FunctionCount->getCount()))
150  return false;
151 
152  if (hasSampleProfile()) {
153  uint64_t TotalCallCount = 0;
154  for (const auto &BB : *F)
155  for (const auto &I : BB)
156  if (isa<CallInst>(I) || isa<InvokeInst>(I))
157  if (auto CallCount = getProfileCount(cast<CallBase>(I), nullptr))
158  TotalCallCount += *CallCount;
159  if (!isColdCount(TotalCallCount))
160  return false;
161  }
162  for (const auto &BB : *F)
163  if (!isColdBlock(&BB, &BFI))
164  return false;
165  return true;
166 }
167 
169  assert(hasPartialSampleProfile() && "Expect partial sample profile");
170  return !F.getEntryCount();
171 }
172 
173 template <bool isHot>
174 bool ProfileSummaryInfo::isFunctionHotOrColdInCallGraphNthPercentile(
175  int PercentileCutoff, const Function *F, BlockFrequencyInfo &BFI) const {
176  if (!F || !hasProfileSummary())
177  return false;
178  if (auto FunctionCount = F->getEntryCount()) {
179  if (isHot &&
180  isHotCountNthPercentile(PercentileCutoff, FunctionCount->getCount()))
181  return true;
182  if (!isHot &&
183  !isColdCountNthPercentile(PercentileCutoff, FunctionCount->getCount()))
184  return false;
185  }
186  if (hasSampleProfile()) {
187  uint64_t TotalCallCount = 0;
188  for (const auto &BB : *F)
189  for (const auto &I : BB)
190  if (isa<CallInst>(I) || isa<InvokeInst>(I))
191  if (auto CallCount = getProfileCount(cast<CallBase>(I), nullptr))
192  TotalCallCount += *CallCount;
193  if (isHot && isHotCountNthPercentile(PercentileCutoff, TotalCallCount))
194  return true;
195  if (!isHot && !isColdCountNthPercentile(PercentileCutoff, TotalCallCount))
196  return false;
197  }
198  for (const auto &BB : *F) {
200  return true;
201  if (!isHot && !isColdBlockNthPercentile(PercentileCutoff, &BB, &BFI))
202  return false;
203  }
204  return !isHot;
205 }
206 
207 // Like isFunctionHotInCallGraph but for a given cutoff.
209  int PercentileCutoff, const Function *F, BlockFrequencyInfo &BFI) const {
210  return isFunctionHotOrColdInCallGraphNthPercentile<true>(
212 }
213 
215  int PercentileCutoff, const Function *F, BlockFrequencyInfo &BFI) const {
216  return isFunctionHotOrColdInCallGraphNthPercentile<false>(
218 }
219 
220 /// Returns true if the function's entry is a cold. If it returns false, it
221 /// either means it is not cold or it is unknown whether it is cold or not (for
222 /// example, no profile data is available).
224  if (!F)
225  return false;
226  if (F->hasFnAttribute(Attribute::Cold))
227  return true;
228  if (!hasProfileSummary())
229  return false;
230  auto FunctionCount = F->getEntryCount();
231  // FIXME: The heuristic used below for determining coldness is based on
232  // preliminary SPEC tuning for inliner. This will eventually be a
233  // convenience method that calls isHotCount.
234  return FunctionCount && isColdCount(FunctionCount->getCount());
235 }
236 
237 /// Compute the hot and cold thresholds.
238 void ProfileSummaryInfo::computeThresholds() {
239  auto &DetailedSummary = Summary->getDetailedSummary();
241  DetailedSummary, ProfileSummaryCutoffHot);
242  HotCountThreshold =
244  ColdCountThreshold =
246  assert(ColdCountThreshold <= HotCountThreshold &&
247  "Cold count threshold cannot exceed hot count threshold!");
249  HasHugeWorkingSetSize =
250  HotEntry.NumCounts > ProfileSummaryHugeWorkingSetSizeThreshold;
251  HasLargeWorkingSetSize =
252  HotEntry.NumCounts > ProfileSummaryLargeWorkingSetSizeThreshold;
253  } else {
254  // Scale the working set size of the partial sample profile to reflect the
255  // size of the program being compiled.
256  double PartialProfileRatio = Summary->getPartialProfileRatio();
257  uint64_t ScaledHotEntryNumCounts =
258  static_cast<uint64_t>(HotEntry.NumCounts * PartialProfileRatio *
260  HasHugeWorkingSetSize =
261  ScaledHotEntryNumCounts > ProfileSummaryHugeWorkingSetSizeThreshold;
262  HasLargeWorkingSetSize =
263  ScaledHotEntryNumCounts > ProfileSummaryLargeWorkingSetSizeThreshold;
264  }
265 }
266 
268 ProfileSummaryInfo::computeThreshold(int PercentileCutoff) const {
269  if (!hasProfileSummary())
270  return None;
271  auto iter = ThresholdCache.find(PercentileCutoff);
272  if (iter != ThresholdCache.end()) {
273  return iter->second;
274  }
275  auto &DetailedSummary = Summary->getDetailedSummary();
276  auto &Entry = ProfileSummaryBuilder::getEntryForPercentile(DetailedSummary,
278  uint64_t CountThreshold = Entry.MinCount;
279  ThresholdCache[PercentileCutoff] = CountThreshold;
280  return CountThreshold;
281 }
282 
284  return HasHugeWorkingSetSize && HasHugeWorkingSetSize.value();
285 }
286 
288  return HasLargeWorkingSetSize && HasLargeWorkingSetSize.value();
289 }
290 
292  return HotCountThreshold && C >= HotCountThreshold.value();
293 }
294 
296  return ColdCountThreshold && C <= ColdCountThreshold.value();
297 }
298 
299 template <bool isHot>
300 bool ProfileSummaryInfo::isHotOrColdCountNthPercentile(int PercentileCutoff,
301  uint64_t C) const {
302  auto CountThreshold = computeThreshold(PercentileCutoff);
303  if (isHot)
304  return CountThreshold && C >= CountThreshold.value();
305  else
306  return CountThreshold && C <= CountThreshold.value();
307 }
308 
310  uint64_t C) const {
311  return isHotOrColdCountNthPercentile<true>(PercentileCutoff, C);
312 }
313 
315  uint64_t C) const {
316  return isHotOrColdCountNthPercentile<false>(PercentileCutoff, C);
317 }
318 
320  return HotCountThreshold.value_or(UINT64_MAX);
321 }
322 
324  return ColdCountThreshold.value_or(0);
325 }
326 
328  BlockFrequencyInfo *BFI) const {
329  auto Count = BFI->getBlockProfileCount(BB);
330  return Count && isHotCount(*Count);
331 }
332 
334  BlockFrequencyInfo *BFI) const {
335  auto Count = BFI->getBlockProfileCount(BB);
336  return Count && isColdCount(*Count);
337 }
338 
339 template <bool isHot>
340 bool ProfileSummaryInfo::isHotOrColdBlockNthPercentile(
341  int PercentileCutoff, const BasicBlock *BB, BlockFrequencyInfo *BFI) const {
342  auto Count = BFI->getBlockProfileCount(BB);
343  if (isHot)
344  return Count && isHotCountNthPercentile(PercentileCutoff, *Count);
345  else
346  return Count && isColdCountNthPercentile(PercentileCutoff, *Count);
347 }
348 
350  int PercentileCutoff, const BasicBlock *BB, BlockFrequencyInfo *BFI) const {
351  return isHotOrColdBlockNthPercentile<true>(PercentileCutoff, BB, BFI);
352 }
353 
355  int PercentileCutoff, const BasicBlock *BB, BlockFrequencyInfo *BFI) const {
356  return isHotOrColdBlockNthPercentile<false>(PercentileCutoff, BB, BFI);
357 }
358 
360  BlockFrequencyInfo *BFI) const {
361  auto C = getProfileCount(CB, BFI);
362  return C && isHotCount(*C);
363 }
364 
366  BlockFrequencyInfo *BFI) const {
367  auto C = getProfileCount(CB, BFI);
368  if (C)
369  return isColdCount(*C);
370 
371  // In SamplePGO, if the caller has been sampled, and there is no profile
372  // annotated on the callsite, we consider the callsite as cold.
373  return hasSampleProfile() && CB.getCaller()->hasProfileData();
374 }
375 
377  return hasProfileSummary() &&
378  Summary->getKind() == ProfileSummary::PSK_Sample &&
379  (PartialProfile || Summary->isPartialProfile());
380 }
381 
383  "Profile summary info", false, true)
384 
386  : ImmutablePass(ID) {
388 }
389 
391  PSI.reset(new ProfileSummaryInfo(M));
392  return false;
393 }
394 
396  PSI.reset();
397  return false;
398 }
399 
400 AnalysisKey ProfileSummaryAnalysis::Key;
403  return ProfileSummaryInfo(M);
404 }
405 
407  ModuleAnalysisManager &AM) {
409 
410  OS << "Functions in " << M.getName() << " with hot/cold annotations: \n";
411  for (auto &F : M) {
412  OS << F.getName();
413  if (PSI.isFunctionEntryHot(&F))
414  OS << " :hot entry ";
415  else if (PSI.isFunctionEntryCold(&F))
416  OS << " :cold entry ";
417  OS << "\n";
418  }
419  return PreservedAnalyses::all();
420 }
421 
llvm::ProfileSummaryLargeWorkingSetSizeThreshold
cl::opt< unsigned > ProfileSummaryLargeWorkingSetSizeThreshold
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
llvm::ProfileSummaryBuilder::getHotCountThreshold
static uint64_t getHotCountThreshold(const SummaryEntryVector &DS)
Definition: ProfileSummaryBuilder.cpp:166
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::ProfileSummaryInfo::isColdCallSite
bool isColdCallSite(const CallBase &CB, BlockFrequencyInfo *BFI) const
Returns true if call site CB is considered cold.
Definition: ProfileSummaryInfo.cpp:365
llvm::ProfileSummaryInfo::isColdBlockNthPercentile
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.
Definition: ProfileSummaryInfo.cpp:354
llvm::ProfileSummaryInfo::hasPartialSampleProfile
bool hasPartialSampleProfile() const
Returns true if module M has partial-profile sample profile.
Definition: ProfileSummaryInfo.cpp:376
llvm::ImmutablePass
ImmutablePass class - This class is used to provide information that does not need to be run.
Definition: Pass.h:279
llvm::AnalysisManager::getResult
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Definition: PassManager.h:774
llvm::ProfileSummaryHugeWorkingSetSizeThreshold
cl::opt< unsigned > ProfileSummaryHugeWorkingSetSizeThreshold
llvm::Function
Definition: Function.h:60
ProfileSummary.h
llvm::ProfileSummary::getFromMD
static ProfileSummary * getFromMD(Metadata *MD)
Construct profile summary from metdata.
Definition: ProfileSummary.cpp:194
llvm::ProfileSummaryInfo::hasProfileSummary
bool hasProfileSummary() const
Returns true if profile summary is available.
Definition: ProfileSummaryInfo.h:69
llvm::ProfileSummaryInfo::isFunctionEntryHot
bool isFunctionEntryHot(const Function *F) const
Returns true if F has hot function entry.
Definition: ProfileSummaryInfo.cpp:100
llvm::ProfileSummaryInfo::getOrCompHotCountThreshold
uint64_t getOrCompHotCountThreshold() const
Returns HotCountThreshold if set.
Definition: ProfileSummaryInfo.cpp:319
llvm::CallingConv::Cold
@ Cold
Attempts to make code in the caller as efficient as possible under the assumption that the call is no...
Definition: CallingConv.h:47
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:140
llvm::ProfileSummaryInfo::isHotBlock
bool isHotBlock(const BasicBlock *BB, BlockFrequencyInfo *BFI) const
Returns true if BasicBlock BB is considered hot.
Definition: ProfileSummaryInfo.cpp:327
Module.h
llvm::ProfileSummaryInfo::isFunctionEntryCold
bool isFunctionEntryCold(const Function *F) const
Returns true if F has cold function entry.
Definition: ProfileSummaryInfo.cpp:223
llvm::Optional< uint64_t >
llvm::ProfileSummaryInfo::getProfileCount
Optional< uint64_t > getProfileCount(const CallBase &CallInst, BlockFrequencyInfo *BFI, bool AllowSynthetic=false) const
Returns the profile count for CallInst.
Definition: ProfileSummaryInfo.cpp:78
llvm::Module::getProfileSummary
Metadata * getProfileSummary(bool IsCS) const
Returns profile summary metadata.
Definition: Module.cpp:644
llvm::ProfileSummaryHotCount
cl::opt< int > ProfileSummaryHotCount
ProfileCommon.h
llvm::ProfileSummaryInfo::isHotCallSite
bool isHotCallSite(const CallBase &CB, BlockFrequencyInfo *BFI) const
Returns true if the call site CB is considered hot.
Definition: ProfileSummaryInfo.cpp:359
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:55
CommandLine.h
PartialSampleProfileWorkingSetSizeScaleFactor
static cl::opt< double > PartialSampleProfileWorkingSetSizeScaleFactor("partial-sample-profile-working-set-size-scale-factor", cl::Hidden, cl::init(0.008), cl::desc("The scale factor used to scale the working set size of the " "partial sample profile along with the partial profile ratio. " "This includes the factor of the profile counter per block " "and the factor to scale the working set size to use the same " "shared thresholds as PGO."))
llvm::ProfileSummaryInfo::isFunctionHotInCallGraph
bool isFunctionHotInCallGraph(const Function *F, BlockFrequencyInfo &BFI) const
Returns true if F contains hot code.
Definition: ProfileSummaryInfo.cpp:115
llvm::BlockFrequencyInfo
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Definition: BlockFrequencyInfo.h:37
llvm::ProfileSummaryInfo::isColdCount
bool isColdCount(uint64_t C) const
Returns true if count C is considered cold.
Definition: ProfileSummaryInfo.cpp:295
llvm::PassRegistry::getPassRegistry
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Definition: PassRegistry.cpp:24
llvm::ProfileSummaryInfo::isHotCountNthPercentile
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.
Definition: ProfileSummaryInfo.cpp:309
llvm::ProfileSummaryInfoWrapperPass::doInitialization
bool doInitialization(Module &M) override
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
Definition: ProfileSummaryInfo.cpp:390
llvm::ProfileSummaryInfo::isHotBlockNthPercentile
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.
Definition: ProfileSummaryInfo.cpp:349
llvm::initializeProfileSummaryInfoWrapperPassPass
void initializeProfileSummaryInfoWrapperPassPass(PassRegistry &)
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
UINT64_MAX
#define UINT64_MAX
Definition: DataTypes.h:77
CountThreshold
static cl::opt< unsigned > CountThreshold("hexagon-cext-threshold", cl::init(3), cl::Hidden, cl::desc("Minimum number of extenders to trigger replacement"))
llvm::ProfileSummary::PSK_Sample
@ PSK_Sample
Definition: ProfileSummary.h:47
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::CallBase::getCaller
Function * getCaller()
Helper to get the caller (the parent function).
Definition: Instructions.cpp:284
llvm::ProfileSummaryInfo
Analysis providing profile information.
Definition: ProfileSummaryInfo.h:40
ScalePartialSampleProfileWorkingSetSize
cl::opt< bool > ScalePartialSampleProfileWorkingSetSize("scale-partial-sample-profile-working-set-size", cl::Hidden, cl::init(true), cl::desc("If true, scale the working set size of the partial sample profile " "by the partial profile ratio to reflect the size of the program " "being compiled."))
BasicBlock.h
llvm::cl::opt
Definition: CommandLine.h:1412
llvm::ProfileSummaryCutoffCold
cl::opt< int > ProfileSummaryCutoffCold
llvm::ProfileSummaryInfo::isFunctionHotInCallGraphNthPercentile
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.
Definition: ProfileSummaryInfo.cpp:208
llvm::ProfileSummaryInfo::isHotCount
bool isHotCount(uint64_t C) const
Returns true if count C is considered hot.
Definition: ProfileSummaryInfo.cpp:291
PercentileCutoff
static cl::opt< unsigned > PercentileCutoff("mfs-psi-cutoff", cl::desc("Percentile profile summary cutoff used to " "determine cold blocks. Unused if set to zero."), cl::init(999950), cl::Hidden)
uint64_t
ProfileSummaryInfo.h
INITIALIZE_PASS
INITIALIZE_PASS(ProfileSummaryInfoWrapperPass, "profile-summary-info", "Profile summary info", false, true) ProfileSummaryInfoWrapperPass
Definition: ProfileSummaryInfo.cpp:382
llvm::AnalysisKey
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:69
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::ProfileSummaryBuilder::getColdCountThreshold
static uint64_t getColdCountThreshold(const SummaryEntryVector &DS)
Definition: ProfileSummaryBuilder.cpp:176
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:447
llvm::ProfileSummaryInfoWrapperPass
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
Definition: ProfileSummaryInfo.h:194
llvm::DenseMapBase::find
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:150
llvm::ProfileSummaryInfo::hasSampleProfile
bool hasSampleProfile() const
Returns true if module M has sample profile.
Definition: ProfileSummaryInfo.h:72
llvm::ProfileSummaryColdCount
cl::opt< int > ProfileSummaryColdCount
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::ProfileSummaryInfoWrapperPass::doFinalization
bool doFinalization(Module &M) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
Definition: ProfileSummaryInfo.cpp:395
llvm::ProfileSummaryPrinterPass::run
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition: ProfileSummaryInfo.cpp:406
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::ProfileSummaryCutoffHot
cl::opt< int > ProfileSummaryCutoffHot
llvm::ProfileSummaryInfo::isFunctionColdInCallGraphNthPercentile
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.
Definition: ProfileSummaryInfo.cpp:214
llvm::ProfileSummaryAnalysis
An analysis pass based on the new PM to deliver ProfileSummaryInfo.
Definition: ProfileSummaryInfo.h:212
llvm::ProfileSummaryInfo::refresh
void refresh()
If no summary is present, attempt to refresh.
Definition: ProfileSummaryInfo.cpp:59
llvm::ProfileSummaryInfo::isFunctionHotnessUnknown
bool isFunctionHotnessUnknown(const Function &F) const
Returns true if the hotness of F is unknown.
Definition: ProfileSummaryInfo.cpp:168
BlockFrequencyInfo.h
llvm::AMDGPUISD::BFI
@ BFI
Definition: AMDGPUISelLowering.h:432
llvm::ProfileSummaryAnalysis::run
Result run(Module &M, ModuleAnalysisManager &)
Definition: ProfileSummaryInfo.cpp:401
llvm::ProfileSummaryInfo::hasLargeWorkingSetSize
bool hasLargeWorkingSetSize() const
Returns true if the working set size of the code is considered large.
Definition: ProfileSummaryInfo.cpp:287
llvm::ProfileSummaryInfo::hasHugeWorkingSetSize
bool hasHugeWorkingSetSize() const
Returns true if the working set size of the code is considered huge.
Definition: ProfileSummaryInfo.cpp:283
llvm::None
constexpr std::nullopt_t None
Definition: None.h:27
llvm::ProfileSummaryInfo::isFunctionColdInCallGraph
bool isFunctionColdInCallGraph(const Function *F, BlockFrequencyInfo &BFI) const
Returns true if F contains only cold code.
Definition: ProfileSummaryInfo.cpp:144
llvm::DenseMapBase::end
iterator end()
Definition: DenseMap.h:84
llvm::PreservedAnalyses::all
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: PassManager.h:158
llvm::ProfileSummaryInfo::getOrCompColdCountThreshold
uint64_t getOrCompColdCountThreshold() const
Returns ColdCountThreshold if set.
Definition: ProfileSummaryInfo.cpp:323
llvm::Function::hasProfileData
bool hasProfileData(bool IncludeSynthetic=false) const
Return true if the function is annotated with profile data.
Definition: Function.h:290
llvm::ProfileSummaryInfo::isColdBlock
bool isColdBlock(const BasicBlock *BB, BlockFrequencyInfo *BFI) const
Returns true if BasicBlock BB is considered cold.
Definition: ProfileSummaryInfo.cpp:333
Instructions.h
llvm::CallBase
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1175
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:42
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
llvm::cl::desc
Definition: CommandLine.h:413
InitializePasses.h
llvm::ProfileSummaryInfoWrapperPass::ID
static char ID
Definition: ProfileSummaryInfo.h:198
PartialProfile
static cl::opt< bool > PartialProfile("partial-profile", cl::Hidden, cl::init(false), cl::desc("Specify the current profile is used as a partial profile."))
llvm::ProfileSummaryInfo::isColdCountNthPercentile
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.
Definition: ProfileSummaryInfo.cpp:314
llvm::ProfileSummaryBuilder::getEntryForPercentile
static const ProfileSummaryEntry & getEntryForPercentile(const SummaryEntryVector &DS, uint64_t Percentile)
Find the summary entry for a desired percentile of counts.
Definition: ProfileSummaryBuilder.cpp:81