LLVM  15.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.
32 
34  "partial-profile", cl::Hidden, cl::init(false),
35  cl::desc("Specify the current profile is used as a partial profile."));
36 
38  "scale-partial-sample-profile-working-set-size", cl::Hidden, cl::init(true),
39  cl::desc(
40  "If true, scale the working set size of the partial sample profile "
41  "by the partial profile ratio to reflect the size of the program "
42  "being compiled."));
43 
45  "partial-sample-profile-working-set-size-scale-factor", cl::Hidden,
46  cl::init(0.008),
47  cl::desc("The scale factor used to scale the working set size of the "
48  "partial sample profile along with the partial profile ratio. "
49  "This includes the factor of the profile counter per block "
50  "and the factor to scale the working set size to use the same "
51  "shared thresholds as PGO."));
52 
53 // The profile summary metadata may be attached either by the frontend or by
54 // any backend passes (IR level instrumentation, for example). This method
55 // checks if the Summary is null and if so checks if the summary metadata is now
56 // available in the module and parses it to get the Summary object.
58  if (hasProfileSummary())
59  return;
60  // First try to get context sensitive ProfileSummary.
61  auto *SummaryMD = M->getProfileSummary(/* IsCS */ true);
62  if (SummaryMD)
63  Summary.reset(ProfileSummary::getFromMD(SummaryMD));
64 
65  if (!hasProfileSummary()) {
66  // This will actually return PSK_Instr or PSK_Sample summary.
67  SummaryMD = M->getProfileSummary(/* IsCS */ false);
68  if (SummaryMD)
69  Summary.reset(ProfileSummary::getFromMD(SummaryMD));
70  }
71  if (!hasProfileSummary())
72  return;
73  computeThresholds();
74 }
75 
77  const CallBase &Call, BlockFrequencyInfo *BFI, bool AllowSynthetic) const {
78  assert((isa<CallInst>(Call) || isa<InvokeInst>(Call)) &&
79  "We can only get profile count for call/invoke instruction.");
80  if (hasSampleProfile()) {
81  // In sample PGO mode, check if there is a profile metadata on the
82  // instruction. If it is present, determine hotness solely based on that,
83  // since the sampled entry count may not be accurate. If there is no
84  // annotated on the instruction, return None.
85  uint64_t TotalCount;
86  if (Call.extractProfTotalWeight(TotalCount))
87  return TotalCount;
88  return None;
89  }
90  if (BFI)
91  return BFI->getBlockProfileCount(Call.getParent(), AllowSynthetic);
92  return None;
93 }
94 
95 /// Returns true if the function's entry is hot. If it returns false, it
96 /// either means it is not hot or it is unknown whether it is hot or not (for
97 /// example, no profile data is available).
99  if (!F || !hasProfileSummary())
100  return false;
101  auto FunctionCount = F->getEntryCount();
102  // FIXME: The heuristic used below for determining hotness is based on
103  // preliminary SPEC tuning for inliner. This will eventually be a
104  // convenience method that calls isHotCount.
105  return FunctionCount && isHotCount(FunctionCount->getCount());
106 }
107 
108 /// Returns true if the function contains hot code. This can include a hot
109 /// function entry count, hot basic block, or (in the case of Sample PGO)
110 /// hot total call edge count.
111 /// If it returns false, it either means it is not hot or it is unknown
112 /// (for example, no profile data is available).
114  const Function *F, BlockFrequencyInfo &BFI) const {
115  if (!F || !hasProfileSummary())
116  return false;
117  if (auto FunctionCount = F->getEntryCount())
118  if (isHotCount(FunctionCount->getCount()))
119  return true;
120 
121  if (hasSampleProfile()) {
122  uint64_t TotalCallCount = 0;
123  for (const auto &BB : *F)
124  for (const auto &I : BB)
125  if (isa<CallInst>(I) || isa<InvokeInst>(I))
126  if (auto CallCount = getProfileCount(cast<CallBase>(I), nullptr))
127  TotalCallCount += CallCount.getValue();
128  if (isHotCount(TotalCallCount))
129  return true;
130  }
131  for (const auto &BB : *F)
132  if (isHotBlock(&BB, &BFI))
133  return true;
134  return false;
135 }
136 
137 /// Returns true if the function only contains cold code. This means that
138 /// the function entry and blocks are all cold, and (in the case of Sample PGO)
139 /// the total call edge count is cold.
140 /// If it returns false, it either means it is not cold or it is unknown
141 /// (for example, no profile data is available).
143  const Function *F, BlockFrequencyInfo &BFI) const {
144  if (!F || !hasProfileSummary())
145  return false;
146  if (auto FunctionCount = F->getEntryCount())
147  if (!isColdCount(FunctionCount->getCount()))
148  return false;
149 
150  if (hasSampleProfile()) {
151  uint64_t TotalCallCount = 0;
152  for (const auto &BB : *F)
153  for (const auto &I : BB)
154  if (isa<CallInst>(I) || isa<InvokeInst>(I))
155  if (auto CallCount = getProfileCount(cast<CallBase>(I), nullptr))
156  TotalCallCount += CallCount.getValue();
157  if (!isColdCount(TotalCallCount))
158  return false;
159  }
160  for (const auto &BB : *F)
161  if (!isColdBlock(&BB, &BFI))
162  return false;
163  return true;
164 }
165 
167  assert(hasPartialSampleProfile() && "Expect partial sample profile");
168  return !F.getEntryCount().hasValue();
169 }
170 
171 template <bool isHot>
172 bool ProfileSummaryInfo::isFunctionHotOrColdInCallGraphNthPercentile(
173  int PercentileCutoff, const Function *F, BlockFrequencyInfo &BFI) const {
174  if (!F || !hasProfileSummary())
175  return false;
176  if (auto FunctionCount = F->getEntryCount()) {
177  if (isHot &&
178  isHotCountNthPercentile(PercentileCutoff, FunctionCount->getCount()))
179  return true;
180  if (!isHot &&
181  !isColdCountNthPercentile(PercentileCutoff, FunctionCount->getCount()))
182  return false;
183  }
184  if (hasSampleProfile()) {
185  uint64_t TotalCallCount = 0;
186  for (const auto &BB : *F)
187  for (const auto &I : BB)
188  if (isa<CallInst>(I) || isa<InvokeInst>(I))
189  if (auto CallCount = getProfileCount(cast<CallBase>(I), nullptr))
190  TotalCallCount += CallCount.getValue();
191  if (isHot && isHotCountNthPercentile(PercentileCutoff, TotalCallCount))
192  return true;
193  if (!isHot && !isColdCountNthPercentile(PercentileCutoff, TotalCallCount))
194  return false;
195  }
196  for (const auto &BB : *F) {
198  return true;
199  if (!isHot && !isColdBlockNthPercentile(PercentileCutoff, &BB, &BFI))
200  return false;
201  }
202  return !isHot;
203 }
204 
205 // Like isFunctionHotInCallGraph but for a given cutoff.
207  int PercentileCutoff, const Function *F, BlockFrequencyInfo &BFI) const {
208  return isFunctionHotOrColdInCallGraphNthPercentile<true>(
210 }
211 
213  int PercentileCutoff, const Function *F, BlockFrequencyInfo &BFI) const {
214  return isFunctionHotOrColdInCallGraphNthPercentile<false>(
216 }
217 
218 /// Returns true if the function's entry is a cold. If it returns false, it
219 /// either means it is not cold or it is unknown whether it is cold or not (for
220 /// example, no profile data is available).
222  if (!F)
223  return false;
224  if (F->hasFnAttribute(Attribute::Cold))
225  return true;
226  if (!hasProfileSummary())
227  return false;
228  auto FunctionCount = F->getEntryCount();
229  // FIXME: The heuristic used below for determining coldness is based on
230  // preliminary SPEC tuning for inliner. This will eventually be a
231  // convenience method that calls isHotCount.
232  return FunctionCount && isColdCount(FunctionCount->getCount());
233 }
234 
235 /// Compute the hot and cold thresholds.
236 void ProfileSummaryInfo::computeThresholds() {
237  auto &DetailedSummary = Summary->getDetailedSummary();
239  DetailedSummary, ProfileSummaryCutoffHot);
240  HotCountThreshold =
242  ColdCountThreshold =
244  assert(ColdCountThreshold <= HotCountThreshold &&
245  "Cold count threshold cannot exceed hot count threshold!");
247  HasHugeWorkingSetSize =
248  HotEntry.NumCounts > ProfileSummaryHugeWorkingSetSizeThreshold;
249  HasLargeWorkingSetSize =
250  HotEntry.NumCounts > ProfileSummaryLargeWorkingSetSizeThreshold;
251  } else {
252  // Scale the working set size of the partial sample profile to reflect the
253  // size of the program being compiled.
254  double PartialProfileRatio = Summary->getPartialProfileRatio();
255  uint64_t ScaledHotEntryNumCounts =
256  static_cast<uint64_t>(HotEntry.NumCounts * PartialProfileRatio *
258  HasHugeWorkingSetSize =
259  ScaledHotEntryNumCounts > ProfileSummaryHugeWorkingSetSizeThreshold;
260  HasLargeWorkingSetSize =
261  ScaledHotEntryNumCounts > ProfileSummaryLargeWorkingSetSizeThreshold;
262  }
263 }
264 
266 ProfileSummaryInfo::computeThreshold(int PercentileCutoff) const {
267  if (!hasProfileSummary())
268  return None;
269  auto iter = ThresholdCache.find(PercentileCutoff);
270  if (iter != ThresholdCache.end()) {
271  return iter->second;
272  }
273  auto &DetailedSummary = Summary->getDetailedSummary();
274  auto &Entry = ProfileSummaryBuilder::getEntryForPercentile(DetailedSummary,
276  uint64_t CountThreshold = Entry.MinCount;
277  ThresholdCache[PercentileCutoff] = CountThreshold;
278  return CountThreshold;
279 }
280 
282  return HasHugeWorkingSetSize && HasHugeWorkingSetSize.getValue();
283 }
284 
286  return HasLargeWorkingSetSize && HasLargeWorkingSetSize.getValue();
287 }
288 
290  return HotCountThreshold && C >= HotCountThreshold.getValue();
291 }
292 
294  return ColdCountThreshold && C <= ColdCountThreshold.getValue();
295 }
296 
297 template <bool isHot>
298 bool ProfileSummaryInfo::isHotOrColdCountNthPercentile(int PercentileCutoff,
299  uint64_t C) const {
300  auto CountThreshold = computeThreshold(PercentileCutoff);
301  if (isHot)
302  return CountThreshold && C >= CountThreshold.getValue();
303  else
304  return CountThreshold && C <= CountThreshold.getValue();
305 }
306 
308  uint64_t C) const {
309  return isHotOrColdCountNthPercentile<true>(PercentileCutoff, C);
310 }
311 
313  uint64_t C) const {
314  return isHotOrColdCountNthPercentile<false>(PercentileCutoff, C);
315 }
316 
318  return HotCountThreshold.getValueOr(UINT64_MAX);
319 }
320 
322  return ColdCountThreshold.getValueOr(0);
323 }
324 
326  BlockFrequencyInfo *BFI) const {
327  auto Count = BFI->getBlockProfileCount(BB);
328  return Count && isHotCount(*Count);
329 }
330 
332  BlockFrequencyInfo *BFI) const {
333  auto Count = BFI->getBlockProfileCount(BB);
334  return Count && isColdCount(*Count);
335 }
336 
337 template <bool isHot>
338 bool ProfileSummaryInfo::isHotOrColdBlockNthPercentile(
339  int PercentileCutoff, const BasicBlock *BB, BlockFrequencyInfo *BFI) const {
340  auto Count = BFI->getBlockProfileCount(BB);
341  if (isHot)
342  return Count && isHotCountNthPercentile(PercentileCutoff, *Count);
343  else
344  return Count && isColdCountNthPercentile(PercentileCutoff, *Count);
345 }
346 
348  int PercentileCutoff, const BasicBlock *BB, BlockFrequencyInfo *BFI) const {
349  return isHotOrColdBlockNthPercentile<true>(PercentileCutoff, BB, BFI);
350 }
351 
353  int PercentileCutoff, const BasicBlock *BB, BlockFrequencyInfo *BFI) const {
354  return isHotOrColdBlockNthPercentile<false>(PercentileCutoff, BB, BFI);
355 }
356 
358  BlockFrequencyInfo *BFI) const {
359  auto C = getProfileCount(CB, BFI);
360  return C && isHotCount(*C);
361 }
362 
364  BlockFrequencyInfo *BFI) const {
365  auto C = getProfileCount(CB, BFI);
366  if (C)
367  return isColdCount(*C);
368 
369  // In SamplePGO, if the caller has been sampled, and there is no profile
370  // annotated on the callsite, we consider the callsite as cold.
371  return hasSampleProfile() && CB.getCaller()->hasProfileData();
372 }
373 
375  return hasProfileSummary() &&
376  Summary->getKind() == ProfileSummary::PSK_Sample &&
377  (PartialProfile || Summary->isPartialProfile());
378 }
379 
381  "Profile summary info", false, true)
382 
384  : ImmutablePass(ID) {
386 }
387 
389  PSI.reset(new ProfileSummaryInfo(M));
390  return false;
391 }
392 
394  PSI.reset();
395  return false;
396 }
397 
398 AnalysisKey ProfileSummaryAnalysis::Key;
401  return ProfileSummaryInfo(M);
402 }
403 
405  ModuleAnalysisManager &AM) {
407 
408  OS << "Functions in " << M.getName() << " with hot/cold annotations: \n";
409  for (auto &F : M) {
410  OS << F.getName();
411  if (PSI.isFunctionEntryHot(&F))
412  OS << " :hot entry ";
413  else if (PSI.isFunctionEntryCold(&F))
414  OS << " :cold entry ";
415  OS << "\n";
416  }
417  return PreservedAnalyses::all();
418 }
419 
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:160
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
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:363
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:352
llvm::ProfileSummaryInfo::hasPartialSampleProfile
bool hasPartialSampleProfile() const
Returns true if module M has partial-profile sample profile.
Definition: ProfileSummaryInfo.cpp:374
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:780
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:68
llvm::ProfileSummaryInfo::isFunctionEntryHot
bool isFunctionEntryHot(const Function *F) const
Returns true if F has hot function entry.
Definition: ProfileSummaryInfo.cpp:98
llvm::ProfileSummaryInfo::getOrCompHotCountThreshold
uint64_t getOrCompHotCountThreshold() const
Returns HotCountThreshold if set.
Definition: ProfileSummaryInfo.cpp:317
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:139
llvm::ProfileSummaryInfo::isHotBlock
bool isHotBlock(const BasicBlock *BB, BlockFrequencyInfo *BFI) const
Returns true if BasicBlock BB is considered hot.
Definition: ProfileSummaryInfo.cpp:325
Module.h
llvm::ProfileSummaryInfo::isFunctionEntryCold
bool isFunctionEntryCold(const Function *F) const
Returns true if F has cold function entry.
Definition: ProfileSummaryInfo.cpp:221
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:76
ProfileSummaryCutoffCold
cl::opt< int > ProfileSummaryCutoffCold
llvm::CallingConv::Cold
@ Cold
Definition: CallingConv.h:48
llvm::Module::getProfileSummary
Metadata * getProfileSummary(bool IsCS) const
Returns profile summary metadata.
Definition: Module.cpp:641
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:357
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:113
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:293
llvm::PassRegistry::getPassRegistry
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Definition: PassRegistry.cpp:31
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:307
llvm::ProfileSummaryInfoWrapperPass::doInitialization
bool doInitialization(Module &M) override
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
Definition: ProfileSummaryInfo.cpp:388
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:347
llvm::initializeProfileSummaryInfoWrapperPassPass
void initializeProfileSummaryInfoWrapperPassPass(PassRegistry &)
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::Optional::getValueOr
constexpr T getValueOr(U &&value) const &
Definition: Optional.h:289
UINT64_MAX
#define UINT64_MAX
Definition: DataTypes.h:77
ProfileSummaryHugeWorkingSetSizeThreshold
cl::opt< unsigned > ProfileSummaryHugeWorkingSetSizeThreshold
llvm::ProfileSummary::PSK_Sample
@ PSK_Sample
Definition: ProfileSummary.h:47
llvm::None
const NoneType None
Definition: None.h:24
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:282
llvm::ProfileSummaryInfo
Analysis providing profile information.
Definition: ProfileSummaryInfo.h:39
CountThreshold
static cl::opt< unsigned > CountThreshold("hexagon-cext-threshold", cl::init(3), cl::Hidden, cl::ZeroOrMore, cl::desc("Minimum number of extenders to trigger replacement"))
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:1392
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:206
llvm::ProfileSummaryInfo::isHotCount
bool isHotCount(uint64_t C) const
Returns true if count C is considered hot.
Definition: ProfileSummaryInfo.cpp:289
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:380
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:170
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:432
llvm::ProfileSummaryInfoWrapperPass
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
Definition: ProfileSummaryInfo.h:193
llvm::DenseMapBase::find
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:152
llvm::ProfileSummaryInfo::hasSampleProfile
bool hasSampleProfile() const
Returns true if module M has sample profile.
Definition: ProfileSummaryInfo.h:71
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:393
llvm::Optional::getValue
constexpr const T & getValue() const &
Definition: Optional.h:279
llvm::ProfileSummaryPrinterPass::run
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition: ProfileSummaryInfo.cpp:404
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
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:212
llvm::ProfileSummaryAnalysis
An analysis pass based on the new PM to deliver ProfileSummaryInfo.
Definition: ProfileSummaryInfo.h:211
llvm::ProfileSummaryInfo::refresh
void refresh()
If no summary is present, attempt to refresh.
Definition: ProfileSummaryInfo.cpp:57
ProfileSummaryHotCount
cl::opt< int > ProfileSummaryHotCount
llvm::ProfileSummaryInfo::isFunctionHotnessUnknown
bool isFunctionHotnessUnknown(const Function &F) const
Returns true if the hotness of F is unknown.
Definition: ProfileSummaryInfo.cpp:166
BlockFrequencyInfo.h
llvm::AMDGPUISD::BFI
@ BFI
Definition: AMDGPUISelLowering.h:429
llvm::ProfileSummaryAnalysis::run
Result run(Module &M, ModuleAnalysisManager &)
Definition: ProfileSummaryInfo.cpp:399
llvm::ProfileSummaryInfo::hasLargeWorkingSetSize
bool hasLargeWorkingSetSize() const
Returns true if the working set size of the code is considered large.
Definition: ProfileSummaryInfo.cpp:285
llvm::ProfileSummaryInfo::hasHugeWorkingSetSize
bool hasHugeWorkingSetSize() const
Returns true if the working set size of the code is considered huge.
Definition: ProfileSummaryInfo.cpp:281
llvm::ProfileSummaryInfo::isFunctionColdInCallGraph
bool isFunctionColdInCallGraph(const Function *F, BlockFrequencyInfo &BFI) const
Returns true if F contains only cold code.
Definition: ProfileSummaryInfo.cpp:142
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:321
llvm::Function::hasProfileData
bool hasProfileData(bool IncludeSynthetic=false) const
Return true if the function is annotated with profile data.
Definition: Function.h:290
ProfileSummaryColdCount
cl::opt< int > ProfileSummaryColdCount
llvm::ProfileSummaryInfo::isColdBlock
bool isColdBlock(const BasicBlock *BB, BlockFrequencyInfo *BFI) const
Returns true if BasicBlock BB is considered cold.
Definition: ProfileSummaryInfo.cpp:331
ProfileSummaryLargeWorkingSetSizeThreshold
cl::opt< unsigned > ProfileSummaryLargeWorkingSetSizeThreshold
Instructions.h
ProfileSummaryCutoffHot
cl::opt< int > ProfileSummaryCutoffHot
llvm::CallBase
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1174
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:405
InitializePasses.h
llvm::ProfileSummaryInfoWrapperPass::ID
static char ID
Definition: ProfileSummaryInfo.h:197
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:312
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:79