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