LLVM  4.0.0
ModuleSummaryAnalysis.cpp
Go to the documentation of this file.
1 //===- ModuleSummaryAnalysis.cpp - Module summary index builder -----------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This pass builds a ModuleSummaryIndex object for the module, to be written
11 // to bitcode or LLVM assembly.
12 //
13 //===----------------------------------------------------------------------===//
14 
16 #include "llvm/ADT/MapVector.h"
17 #include "llvm/ADT/SetVector.h"
18 #include "llvm/ADT/Triple.h"
23 #include "llvm/Analysis/LoopInfo.h"
26 #include "llvm/IR/CallSite.h"
27 #include "llvm/IR/Dominators.h"
28 #include "llvm/IR/InstIterator.h"
29 #include "llvm/IR/IntrinsicInst.h"
32 #include "llvm/Pass.h"
33 using namespace llvm;
34 
35 #define DEBUG_TYPE "module-summary-analysis"
36 
37 // Walk through the operands of a given User via worklist iteration and populate
38 // the set of GlobalValue references encountered. Invoked either on an
39 // Instruction or a GlobalVariable (which walks its initializer).
40 static void findRefEdges(const User *CurUser, SetVector<ValueInfo> &RefEdges,
43  Worklist.push_back(CurUser);
44 
45  while (!Worklist.empty()) {
46  const User *U = Worklist.pop_back_val();
47 
48  if (!Visited.insert(U).second)
49  continue;
50 
51  ImmutableCallSite CS(U);
52 
53  for (const auto &OI : U->operands()) {
54  const User *Operand = dyn_cast<User>(OI);
55  if (!Operand)
56  continue;
57  if (isa<BlockAddress>(Operand))
58  continue;
59  if (auto *GV = dyn_cast<GlobalValue>(Operand)) {
60  // We have a reference to a global value. This should be added to
61  // the reference set unless it is a callee. Callees are handled
62  // specially by WriteFunction and are added to a separate list.
63  if (!(CS && CS.isCallee(&OI)))
64  RefEdges.insert(GV);
65  continue;
66  }
67  Worklist.push_back(Operand);
68  }
69  }
70 }
71 
72 static CalleeInfo::HotnessType getHotness(uint64_t ProfileCount,
73  ProfileSummaryInfo *PSI) {
74  if (!PSI)
76  if (PSI->isHotCount(ProfileCount))
78  if (PSI->isColdCount(ProfileCount))
81 }
82 
83 static bool isNonRenamableLocal(const GlobalValue &GV) {
84  return GV.hasSection() && GV.hasLocalLinkage();
85 }
86 
87 static void
90  ProfileSummaryInfo *PSI, bool HasLocalsInUsed,
91  DenseSet<GlobalValue::GUID> &CantBePromoted) {
92  // Summary not currently supported for anonymous functions, they should
93  // have been named.
94  assert(F.hasName());
95 
96  unsigned NumInsts = 0;
97  // Map from callee ValueId to profile count. Used to accumulate profile
98  // counts for all static calls to a given callee.
99  MapVector<ValueInfo, CalleeInfo> CallGraphEdges;
100  SetVector<ValueInfo> RefEdges;
102  ICallPromotionAnalysis ICallAnalysis;
103 
104  bool HasInlineAsmMaybeReferencingInternal = false;
106  for (const BasicBlock &BB : F)
107  for (const Instruction &I : BB) {
108  if (isa<DbgInfoIntrinsic>(I))
109  continue;
110  ++NumInsts;
111  findRefEdges(&I, RefEdges, Visited);
112  auto CS = ImmutableCallSite(&I);
113  if (!CS)
114  continue;
115 
116  const auto *CI = dyn_cast<CallInst>(&I);
117  // Since we don't know exactly which local values are referenced in inline
118  // assembly, conservatively mark the function as possibly referencing
119  // a local value from inline assembly to ensure we don't export a
120  // reference (which would require renaming and promotion of the
121  // referenced value).
122  if (HasLocalsInUsed && CI && CI->isInlineAsm())
123  HasInlineAsmMaybeReferencingInternal = true;
124 
125  auto *CalledValue = CS.getCalledValue();
126  auto *CalledFunction = CS.getCalledFunction();
127  // Check if this is an alias to a function. If so, get the
128  // called aliasee for the checks below.
129  if (auto *GA = dyn_cast<GlobalAlias>(CalledValue)) {
130  assert(!CalledFunction && "Expected null called function in callsite for alias");
131  CalledFunction = dyn_cast<Function>(GA->getBaseObject());
132  }
133  // Check if this is a direct call to a known function or a known
134  // intrinsic, or an indirect call with profile data.
135  if (CalledFunction) {
136  if (CalledFunction->isIntrinsic()) {
137  if (CalledFunction->getIntrinsicID() != Intrinsic::type_test)
138  continue;
139  // Produce a summary from type.test intrinsics. We only summarize
140  // type.test intrinsics that are used other than by an llvm.assume
141  // intrinsic. Intrinsics that are assumed are relevant only to the
142  // devirtualization pass, not the type test lowering pass.
143  bool HasNonAssumeUses = llvm::any_of(CI->uses(), [](const Use &CIU) {
144  auto *AssumeCI = dyn_cast<CallInst>(CIU.getUser());
145  if (!AssumeCI)
146  return true;
147  Function *F = AssumeCI->getCalledFunction();
148  return !F || F->getIntrinsicID() != Intrinsic::assume;
149  });
150  if (HasNonAssumeUses) {
151  auto *TypeMDVal = cast<MetadataAsValue>(CI->getArgOperand(1));
152  if (auto *TypeId = dyn_cast<MDString>(TypeMDVal->getMetadata()))
153  TypeTests.insert(GlobalValue::getGUID(TypeId->getString()));
154  }
155  }
156  // We should have named any anonymous globals
157  assert(CalledFunction->hasName());
158  auto ScaledCount = BFI ? BFI->getBlockProfileCount(&BB) : None;
159  auto Hotness = ScaledCount ? getHotness(ScaledCount.getValue(), PSI)
161 
162  // Use the original CalledValue, in case it was an alias. We want
163  // to record the call edge to the alias in that case. Eventually
164  // an alias summary will be created to associate the alias and
165  // aliasee.
166  CallGraphEdges[cast<GlobalValue>(CalledValue)].updateHotness(Hotness);
167  } else {
168  // Skip inline assembly calls.
169  if (CI && CI->isInlineAsm())
170  continue;
171  // Skip direct calls.
172  if (!CS.getCalledValue() || isa<Constant>(CS.getCalledValue()))
173  continue;
174 
175  uint32_t NumVals, NumCandidates;
176  uint64_t TotalCount;
177  auto CandidateProfileData =
179  &I, NumVals, TotalCount, NumCandidates);
180  for (auto &Candidate : CandidateProfileData)
181  CallGraphEdges[Candidate.Value].updateHotness(
182  getHotness(Candidate.Count, PSI));
183  }
184  }
185 
186  bool NonRenamableLocal = isNonRenamableLocal(F);
187  bool NotEligibleForImport =
188  NonRenamableLocal || HasInlineAsmMaybeReferencingInternal ||
189  // Inliner doesn't handle variadic functions.
190  // FIXME: refactor this to use the same code that inliner is using.
191  F.isVarArg();
192  GlobalValueSummary::GVFlags Flags(F.getLinkage(), NotEligibleForImport,
193  /* LiveRoot = */ false);
194  auto FuncSummary = llvm::make_unique<FunctionSummary>(
195  Flags, NumInsts, RefEdges.takeVector(), CallGraphEdges.takeVector(),
196  TypeTests.takeVector());
197  if (NonRenamableLocal)
198  CantBePromoted.insert(F.getGUID());
199  Index.addGlobalValueSummary(F.getName(), std::move(FuncSummary));
200 }
201 
202 static void
204  DenseSet<GlobalValue::GUID> &CantBePromoted) {
205  SetVector<ValueInfo> RefEdges;
207  findRefEdges(&V, RefEdges, Visited);
208  bool NonRenamableLocal = isNonRenamableLocal(V);
209  GlobalValueSummary::GVFlags Flags(V.getLinkage(), NonRenamableLocal,
210  /* LiveRoot = */ false);
211  auto GVarSummary =
212  llvm::make_unique<GlobalVarSummary>(Flags, RefEdges.takeVector());
213  if (NonRenamableLocal)
214  CantBePromoted.insert(V.getGUID());
215  Index.addGlobalValueSummary(V.getName(), std::move(GVarSummary));
216 }
217 
218 static void
220  DenseSet<GlobalValue::GUID> &CantBePromoted) {
221  bool NonRenamableLocal = isNonRenamableLocal(A);
222  GlobalValueSummary::GVFlags Flags(A.getLinkage(), NonRenamableLocal,
223  /* LiveRoot = */ false);
224  auto AS = llvm::make_unique<AliasSummary>(Flags, ArrayRef<ValueInfo>{});
225  auto *Aliasee = A.getBaseObject();
226  auto *AliaseeSummary = Index.getGlobalValueSummary(*Aliasee);
227  assert(AliaseeSummary && "Alias expects aliasee summary to be parsed");
228  AS->setAliasee(AliaseeSummary);
229  if (NonRenamableLocal)
230  CantBePromoted.insert(A.getGUID());
231  Index.addGlobalValueSummary(A.getName(), std::move(AS));
232 }
233 
234 // Set LiveRoot flag on entries matching the given value name.
236  auto SummaryList =
238  if (SummaryList == Index.end())
239  return;
240  for (auto &Summary : SummaryList->second)
241  Summary->setLiveRoot();
242 }
243 
245  const Module &M,
246  std::function<BlockFrequencyInfo *(const Function &F)> GetBFICallback,
247  ProfileSummaryInfo *PSI) {
248  ModuleSummaryIndex Index;
249 
250  // Identify the local values in the llvm.used and llvm.compiler.used sets,
251  // which should not be exported as they would then require renaming and
252  // promotion, but we may have opaque uses e.g. in inline asm. We collect them
253  // here because we use this information to mark functions containing inline
254  // assembly calls as not importable.
257  // First collect those in the llvm.used set.
258  collectUsedGlobalVariables(M, Used, /*CompilerUsed*/ false);
259  // Next collect those in the llvm.compiler.used set.
260  collectUsedGlobalVariables(M, Used, /*CompilerUsed*/ true);
261  DenseSet<GlobalValue::GUID> CantBePromoted;
262  for (auto *V : Used) {
263  if (V->hasLocalLinkage()) {
264  LocalsUsed.insert(V);
265  CantBePromoted.insert(V->getGUID());
266  }
267  }
268 
269  // Compute summaries for all functions defined in module, and save in the
270  // index.
271  for (auto &F : M) {
272  if (F.isDeclaration())
273  continue;
274 
275  BlockFrequencyInfo *BFI = nullptr;
276  std::unique_ptr<BlockFrequencyInfo> BFIPtr;
277  if (GetBFICallback)
278  BFI = GetBFICallback(F);
279  else if (F.getEntryCount().hasValue()) {
280  LoopInfo LI{DominatorTree(const_cast<Function &>(F))};
281  BranchProbabilityInfo BPI{F, LI};
282  BFIPtr = llvm::make_unique<BlockFrequencyInfo>(F, BPI, LI);
283  BFI = BFIPtr.get();
284  }
285 
286  computeFunctionSummary(Index, M, F, BFI, PSI, !LocalsUsed.empty(),
287  CantBePromoted);
288  }
289 
290  // Compute summaries for all variables defined in module, and save in the
291  // index.
292  for (const GlobalVariable &G : M.globals()) {
293  if (G.isDeclaration())
294  continue;
295  computeVariableSummary(Index, G, CantBePromoted);
296  }
297 
298  // Compute summaries for all aliases defined in module, and save in the
299  // index.
300  for (const GlobalAlias &A : M.aliases())
301  computeAliasSummary(Index, A, CantBePromoted);
302 
303  for (auto *V : LocalsUsed) {
304  auto *Summary = Index.getGlobalValueSummary(*V);
305  assert(Summary && "Missing summary for global value");
306  Summary->setNotEligibleToImport();
307  }
308 
309  // The linker doesn't know about these LLVM produced values, so we need
310  // to flag them as live in the index to ensure index-based dead value
311  // analysis treats them as live roots of the analysis.
312  setLiveRoot(Index, "llvm.used");
313  setLiveRoot(Index, "llvm.compiler.used");
314  setLiveRoot(Index, "llvm.global_ctors");
315  setLiveRoot(Index, "llvm.global_dtors");
316  setLiveRoot(Index, "llvm.global.annotations");
317 
318  if (!M.getModuleInlineAsm().empty()) {
319  // Collect the local values defined by module level asm, and set up
320  // summaries for these symbols so that they can be marked as NoRename,
321  // to prevent export of any use of them in regular IR that would require
322  // renaming within the module level asm. Note we don't need to create a
323  // summary for weak or global defs, as they don't need to be flagged as
324  // NoRename, and defs in module level asm can't be imported anyway.
325  // Also, any values used but not defined within module level asm should
326  // be listed on the llvm.used or llvm.compiler.used global and marked as
327  // referenced from there.
329  Triple(M.getTargetTriple()), M.getModuleInlineAsm(),
330  [&M, &Index, &CantBePromoted](StringRef Name,
332  // Symbols not marked as Weak or Global are local definitions.
335  return;
336  GlobalValue *GV = M.getNamedValue(Name);
337  if (!GV)
338  return;
339  assert(GV->isDeclaration() && "Def in module asm already has definition");
341  /* NotEligibleToImport */ true,
342  /* LiveRoot */ true);
343  CantBePromoted.insert(GlobalValue::getGUID(Name));
344  // Create the appropriate summary type.
345  if (isa<Function>(GV)) {
346  std::unique_ptr<FunctionSummary> Summary =
347  llvm::make_unique<FunctionSummary>(
348  GVFlags, 0, ArrayRef<ValueInfo>{},
351  Index.addGlobalValueSummary(Name, std::move(Summary));
352  } else {
353  std::unique_ptr<GlobalVarSummary> Summary =
354  llvm::make_unique<GlobalVarSummary>(GVFlags,
356  Index.addGlobalValueSummary(Name, std::move(Summary));
357  }
358  });
359  }
360 
361  for (auto &GlobalList : Index) {
362  assert(GlobalList.second.size() == 1 &&
363  "Expected module's index to have one summary per GUID");
364  auto &Summary = GlobalList.second[0];
365  bool AllRefsCanBeExternallyReferenced =
366  llvm::all_of(Summary->refs(), [&](const ValueInfo &VI) {
367  return !CantBePromoted.count(VI.getValue()->getGUID());
368  });
369  if (!AllRefsCanBeExternallyReferenced) {
370  Summary->setNotEligibleToImport();
371  continue;
372  }
373 
374  if (auto *FuncSummary = dyn_cast<FunctionSummary>(Summary.get())) {
375  bool AllCallsCanBeExternallyReferenced = llvm::all_of(
376  FuncSummary->calls(), [&](const FunctionSummary::EdgeTy &Edge) {
377  auto GUID = Edge.first.isGUID() ? Edge.first.getGUID()
378  : Edge.first.getValue()->getGUID();
379  return !CantBePromoted.count(GUID);
380  });
381  if (!AllCallsCanBeExternallyReferenced)
382  Summary->setNotEligibleToImport();
383  }
384  }
385 
386  return Index;
387 }
388 
389 AnalysisKey ModuleSummaryIndexAnalysis::Key;
390 
394  auto &FAM = AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
396  M,
397  [&FAM](const Function &F) {
398  return &FAM.getResult<BlockFrequencyAnalysis>(
399  *const_cast<Function *>(&F));
400  },
401  &PSI);
402 }
403 
405 INITIALIZE_PASS_BEGIN(ModuleSummaryIndexWrapperPass, "module-summary-analysis",
406  "Module Summary Analysis", false, true)
410  "Module Summary Analysis", false, true)
411 
413  return new ModuleSummaryIndexWrapperPass();
414 }
415 
417  : ModulePass(ID) {
419 }
420 
422  auto &PSI = *getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI();
423  Index = buildModuleSummaryIndex(
424  M,
425  [this](const Function &F) {
426  return &(this->getAnalysis<BlockFrequencyInfoWrapperPass>(
427  *const_cast<Function *>(&F))
428  .getBFI());
429  },
430  &PSI);
431  return false;
432 }
433 
435  Index.reset();
436  return false;
437 }
438 
440  AU.setPreservesAll();
443 }
ArrayRef< InstrProfValueData > getPromotionCandidatesForInstruction(const Instruction *I, uint32_t &NumVals, uint64_t &TotalCount, uint32_t &NumCandidates)
Returns reference to array of InstrProfValueData for the given instruction I.
const NoneType None
Definition: None.h:23
LinkageTypes getLinkage() const
Definition: GlobalValue.h:429
static void findRefEdges(const User *CurUser, SetVector< ValueInfo > &RefEdges, SmallPtrSet< const User *, 8 > &Visited)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
bool hasName() const
Definition: Value.h:236
bool hasValue() const
Definition: Optional.h:125
GlobalVariable * collectUsedGlobalVariables(const Module &M, SmallPtrSetImpl< GlobalValue * > &Set, bool CompilerUsed)
Given "llvm.used" or "llvm.compiler.used" as a global name, collect the initializer elements of that ...
Definition: Module.cpp:528
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:52
GUID getGUID() const
Return a 64-bit global unique ID constructed from global value name (i.e.
Definition: GlobalValue.h:473
This is the interface to build a ModuleSummaryIndex for a module.
Implements a dense probed hash-table based set.
Definition: DenseSet.h:202
bool isColdCount(uint64_t C)
Returns true if count C is considered cold.
Analysis providing profile information.
This class represents a function call, abstracting a target machine's calling convention.
module summary Module Summary false
This class implements a map that also provides access to all stored values in a deterministic order...
Definition: MapVector.h:32
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
Definition: STLExtras.h:736
void initializeModuleSummaryIndexWrapperPassPass(PassRegistry &)
bool isHotCount(uint64_t C)
Returns true if F is a hot function.
ModuleSummaryIndex buildModuleSummaryIndex(const Module &M, std::function< BlockFrequencyInfo *(const Function &F)> GetBFICallback, ProfileSummaryInfo *PSI)
Direct function to compute a ModuleSummaryIndex from a given module.
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:191
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
Definition: PassSupport.h:53
struct fuzzer::@269 Flags
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
bool hasSection() const
Definition: GlobalValue.h:255
A Use represents the edge between a Value definition and its users.
Definition: Use.h:56
Legacy analysis pass which computes BlockFrequencyInfo.
LLVM_NODISCARD bool empty() const
Definition: SmallVector.h:60
#define F(x, y, z)
Definition: MD5.cpp:51
bool insert(const value_type &X)
Insert a new element into the SetVector.
Definition: SetVector.h:136
std::pair< ValueInfo, CalleeInfo > EdgeTy
<CalleeValueInfo, CalleeInfo> call edge pair.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
module summary analysis
Optional< uint64_t > getEntryCount() const
Get the entry count for this function.
Definition: Function.cpp:1287
Class to hold module path string table and global value map, and encapsulate methods for operating on...
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Definition: Dominators.h:96
INITIALIZE_PASS_BEGIN(ModuleSummaryIndexWrapperPass,"module-summary-analysis","Module Summary Analysis", false, true) INITIALIZE_PASS_END(ModuleSummaryIndexWrapperPass
bool doFinalization(Module &M) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
static void computeAliasSummary(ModuleSummaryIndex &Index, const GlobalAlias &A, DenseSet< GlobalValue::GUID > &CantBePromoted)
Interface to identify indirect call promotion candidates.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs...ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Definition: PassManager.h:653
LLVM Basic Block Representation.
Definition: BasicBlock.h:51
An analysis pass based on the new PM to deliver ProfileSummaryInfo.
const const_gvsummary_iterator findGlobalValueSummaryList(StringRef ValueName) const
Get the list of global value summary objects for a given value name.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Definition: SmallPtrSet.h:368
Represent the analysis usage information of a pass.
bool any_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
Definition: STLExtras.h:743
const GlobalObject * getBaseObject() const
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE,"Assign register bank of generic virtual registers", false, false) RegBankSelect
op_range operands()
Definition: User.h:213
static GUID getGUID(StringRef GlobalName)
Return a 64-bit global unique ID constructed from global value name (i.e.
Definition: GlobalValue.h:469
LLVM_NODISCARD bool empty() const
Definition: SmallPtrSet.h:98
static void computeVariableSummary(ModuleSummaryIndex &Index, const GlobalVariable &V, DenseSet< GlobalValue::GUID > &CantBePromoted)
VectorType takeVector()
Clear the MapVector and return the underlying vector.
Definition: MapVector.h:46
void addGlobalValueSummary(StringRef ValueName, std::unique_ptr< GlobalValueSummary > Summary)
Add a global value summary for a value of the given name.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
Struct to hold value either by GUID or GlobalValue*.
static bool isNonRenamableLocal(const GlobalValue &GV)
Analysis pass which computes BlockFrequencyInfo.
Vector takeVector()
Clear the SetVector and return the underlying vector.
Definition: SetVector.h:67
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
Definition: SmallPtrSet.h:425
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:843
const DataFlowGraph & G
Definition: RDFGraph.cpp:206
LLVM_NODISCARD T pop_back_val()
Definition: SmallVector.h:382
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
Definition: Function.h:146
Result run(Module &M, ModuleAnalysisManager &AM)
void setPreservesAll()
Set by analyses that do not transform their input at all.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Basic Alias true
Analysis providing branch probability information.
size_type count(const ValueT &V) const
Return 1 if the specified key is in the set, 0 otherwise.
Definition: DenseSet.h:81
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
Definition: Globals.cpp:188
ImmutableCallSite - establish a view to a call site for examination.
Definition: CallSite.h:665
module summary Module Summary Analysis
#define I(x, y, z)
Definition: MD5.cpp:54
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:235
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Definition: Casting.h:287
Rename collisions when linking (static functions).
Definition: GlobalValue.h:56
bool hasLocalLinkage() const
Definition: GlobalValue.h:415
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ModulePass * createModuleSummaryIndexWrapperPass()
static void CollectAsmSymbols(const Triple &TheTriple, StringRef InlineAsm, function_ref< void(StringRef, object::BasicSymbolRef::Flags)> AsmSymbol)
Parse inline ASM and collect the symbols that are defined or referenced in the current module...
gvsummary_iterator end()
A vector that has set insertion semantics.
Definition: SetVector.h:41
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on...
static void setLiveRoot(ModuleSummaryIndex &Index, StringRef Name)
GlobalValueSummary * getGlobalValueSummary(const GlobalValue &GV, bool PerModuleIndex=true) const
Returns the first GlobalValueSummary for GV, asserting that there is only one if PerModuleIndex.
Group flags (Linkage, NotEligibleToImport, etc.) as a bitfield.
print Print MemDeps of function
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
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.
static void computeFunctionSummary(ModuleSummaryIndex &Index, const Module &M, const Function &F, BlockFrequencyInfo *BFI, ProfileSummaryInfo *PSI, bool HasLocalsInUsed, DenseSet< GlobalValue::GUID > &CantBePromoted)
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:64
static CalleeInfo::HotnessType getHotness(uint64_t ProfileCount, ProfileSummaryInfo *PSI)
Legacy wrapper pass to provide the ModuleSummaryIndex object.
bool isCallee(Value::const_user_iterator UI) const
isCallee - Determine whether the passed iterator points to the callee operand's Use.
Definition: CallSite.h:134
An analysis over an "outer" IR unit that provides access to an analysis manager over an "inner" IR un...
Definition: PassManager.h:905