Go to the documentation of this file.
60 #define DEBUG_TYPE "module-summary-analysis"
68 cl::desc(
"Force all edges in the function summary to cold"),
71 "all-non-critical",
"All non-critical edges."),
77 cl::desc(
"File to emit dot graph of new summary into."));
92 bool HasBlockAddress =
false;
94 if (Visited.
insert(CurUser).second)
95 Worklist.push_back(CurUser);
97 while (!Worklist.empty()) {
99 const auto *CB = dyn_cast<CallBase>(U);
101 for (
const auto &OI : U->
operands()) {
102 const User *Operand = dyn_cast<User>(OI);
105 if (isa<BlockAddress>(Operand)) {
106 HasBlockAddress =
true;
109 if (
auto *GV = dyn_cast<GlobalValue>(Operand)) {
113 if (!(CB && CB->isCallee(&OI)))
114 RefEdges.
insert(Index.getOrInsertValueInfo(GV));
117 if (Visited.
insert(Operand).second)
118 Worklist.push_back(Operand);
121 return HasBlockAddress;
144 std::vector<uint64_t>
Args;
147 auto *CI = dyn_cast<ConstantInt>(
Arg);
148 if (!CI || CI->getBitWidth() > 64) {
149 VCalls.
insert({Guid, Call.Offset});
152 Args.push_back(CI->getZExtValue());
167 case Intrinsic::type_test: {
168 auto *TypeMDVal = cast<MetadataAsValue>(CI->
getArgOperand(1));
169 auto *TypeId = dyn_cast<MDString>(TypeMDVal->getMetadata());
179 return !isa<AssumeInst>(CIU.getUser());
181 if (HasNonAssumeUses)
187 for (
auto &Call : DevirtCalls)
189 TypeTestAssumeConstVCalls);
194 case Intrinsic::type_checked_load: {
195 auto *TypeMDVal = cast<MetadataAsValue>(CI->
getArgOperand(2));
196 auto *TypeId = dyn_cast<MDString>(TypeMDVal->getMetadata());
204 bool HasNonCallUses =
false;
206 HasNonCallUses, CI, DT);
211 for (
auto &Call : DevirtCalls)
213 TypeCheckedLoadConstVCalls);
223 if (
const auto *LI = dyn_cast<LoadInst>(
I))
224 return !LI->isVolatile();
230 if (
const auto *
SI = dyn_cast<StoreInst>(
I))
231 return !
SI->isVolatile();
245 return isa<UnreachableInst>(
F.getEntryBlock().getTerminator());
258 unsigned NumInsts = 0;
265 TypeCheckedLoadVCalls;
267 TypeCheckedLoadConstVCalls;
274 std::vector<const Instruction *> NonVolatileLoads;
275 std::vector<const Instruction *> NonVolatileStores;
277 bool HasInlineAsmMaybeReferencingInternal =
false;
278 bool HasIndirBranchToBlockAddress =
false;
279 bool HasUnknownCall =
false;
280 bool MayThrow =
false;
286 if (
BB.hasAddressTaken()) {
288 if (!isa<CallBrInst>(*U)) {
289 HasIndirBranchToBlockAddress =
true;
295 if (
I.isDebugOrPseudoInst())
307 NonVolatileLoads.push_back(&
I);
311 NonVolatileStores.push_back(&
I);
318 Value *Stored =
I.getOperand(0);
319 if (
auto *GV = dyn_cast<GlobalValue>(Stored))
322 RefEdges.
insert(Index.getOrInsertValueInfo(GV));
323 else if (
auto *U = dyn_cast<User>(Stored))
329 const auto *CB = dyn_cast<CallBase>(&
I);
336 const auto *CI = dyn_cast<CallInst>(&
I);
342 if (HasLocalsInUsedOrAsm && CI && CI->isInlineAsm())
343 HasInlineAsmMaybeReferencingInternal =
true;
345 auto *CalledValue = CB->getCalledOperand();
346 auto *CalledFunction = CB->getCalledFunction();
347 if (CalledValue && !CalledFunction) {
348 CalledValue = CalledValue->stripPointerCasts();
350 CalledFunction = dyn_cast<Function>(CalledValue);
354 if (
auto *GA = dyn_cast<GlobalAlias>(CalledValue)) {
355 assert(!CalledFunction &&
"Expected null called function in callsite for alias");
356 CalledFunction = dyn_cast<Function>(GA->getAliaseeObject());
360 if (CalledFunction) {
361 if (CI && CalledFunction->isIntrinsic()) {
363 CI, TypeTests, TypeTestAssumeVCalls, TypeCheckedLoadVCalls,
364 TypeTestAssumeConstVCalls, TypeCheckedLoadConstVCalls, DT);
368 assert(CalledFunction->hasName());
370 auto Hotness = ScaledCount ?
getHotness(ScaledCount.getValue(), PSI)
379 auto &
ValueInfo = CallGraphEdges[Index.getOrInsertValueInfo(
380 cast<GlobalValue>(CalledValue))];
387 ValueInfo.updateRelBlockFreq(BBFreq, EntryFreq);
390 HasUnknownCall =
true;
392 if (CI && CI->isInlineAsm())
395 if (!CalledValue || isa<Constant>(CalledValue))
402 if (
auto *MD =
I.getMetadata(LLVMContext::MD_callees)) {
403 for (
auto &
Op : MD->operands()) {
406 CallGraphEdges[Index.getOrInsertValueInfo(
Callee)];
412 auto CandidateProfileData =
414 &
I, NumVals, TotalCount, NumCandidates);
415 for (
auto &Candidate : CandidateProfileData)
416 CallGraphEdges[Index.getOrInsertValueInfo(Candidate.Value)]
417 .updateHotness(
getHotness(Candidate.Count, PSI));
421 Index.addBlockCount(
F.size());
423 std::vector<ValueInfo> Refs;
425 auto AddRefEdges = [&](
const std::vector<const Instruction *> &Instrs,
428 for (
const auto *
I : Instrs) {
437 AddRefEdges(NonVolatileLoads, LoadRefEdges, Visited);
449 AddRefEdges(NonVolatileStores, StoreRefEdges, StoreCache);
454 for (
auto &
VI : StoreRefEdges)
458 unsigned RefCnt = RefEdges.
size();
462 for (
auto &
VI : LoadRefEdges)
465 unsigned FirstWORef = RefEdges.
size();
466 for (
auto &
VI : StoreRefEdges)
470 for (; RefCnt < FirstWORef; ++RefCnt)
471 Refs[RefCnt].setReadOnly();
473 for (; RefCnt < Refs.size(); ++RefCnt)
474 Refs[RefCnt].setWriteOnly();
480 for (
auto &
I :
F.getImportGUIDs())
481 CallGraphEdges[Index.getOrInsertValueInfo(
I)].updateHotness(
487 bool NotEligibleForImport = NonRenamableLocal ||
488 HasInlineAsmMaybeReferencingInternal ||
489 HasIndirBranchToBlockAddress;
491 F.getLinkage(),
F.getVisibility(), NotEligibleForImport,
492 false,
F.isDSOLocal(),
F.canBeOmittedFromSymbolTable());
494 F.hasFnAttribute(Attribute::ReadNone),
495 F.hasFnAttribute(Attribute::ReadOnly),
496 F.hasFnAttribute(Attribute::NoRecurse),
F.returnDoesNotAlias(),
499 F.getAttributes().hasFnAttr(Attribute::NoInline),
500 F.hasFnAttribute(Attribute::AlwaysInline),
501 F.hasFnAttribute(Attribute::NoUnwind), MayThrow, HasUnknownCall,
503 std::vector<FunctionSummary::ParamAccess> ParamAccesses;
504 if (
auto *SSI = GetSSICallback(
F))
505 ParamAccesses = SSI->getParamAccesses(Index);
506 auto FuncSummary = std::make_unique<FunctionSummary>(
507 Flags, NumInsts, FunFlags, 0,
std::move(Refs),
512 if (NonRenamableLocal)
513 CantBePromoted.
insert(
F.getGUID());
514 Index.addGlobalValueSummary(
F,
std::move(FuncSummary));
526 if (
I->getType()->isPointerTy()) {
527 auto Fn = dyn_cast<Function>(
I->stripPointerCasts());
530 if (Fn && Fn->getName() !=
"__cxa_pure_virtual")
531 VTableFuncs.push_back({Index.getOrInsertValueInfo(Fn), StartingOffset});
538 if (
auto *
C = dyn_cast<ConstantStruct>(
I)) {
539 StructType *STy = dyn_cast<StructType>(
C->getType());
547 StartingOffset + Offset,
M, Index, VTableFuncs);
549 }
else if (
auto *
C = dyn_cast<ConstantArray>(
I)) {
552 uint64_t EltSize =
DL.getTypeAllocSize(EltTy);
555 StartingOffset +
i * EltSize,
M, Index, VTableFuncs);
573 for (
auto &
P : VTableFuncs) {
577 assert(
P.VTableOffset >= PrevOffset);
578 PrevOffset =
P.VTableOffset;
593 cast<ConstantAsMetadata>(
Type->getOperand(0))->getValue())
596 if (
auto *TypeId = dyn_cast<MDString>(
TypeID))
597 Index.getOrInsertTypeIdCompatibleVtableSummary(TypeId->getString())
598 .push_back({Offset, Index.getOrInsertValueInfo(&V)});
609 bool HasBlockAddress =
findRefEdges(Index, &V, RefEdges, Visited);
618 if (!Index.enableSplitLTOUnit()) {
621 if (!Types.empty()) {
631 bool CanBeInternalized =
636 Constant ?
false : CanBeInternalized,
638 auto GVarSummary = std::make_unique<GlobalVarSummary>(Flags, VarFlags,
640 if (NonRenamableLocal)
643 GVarSummary->setNotEligibleToImport();
644 if (!VTableFuncs.empty())
645 GVarSummary->setVTableFuncs(VTableFuncs);
646 Index.addGlobalValueSummary(V,
std::move(GVarSummary));
654 A.getLinkage(), A.getVisibility(), NonRenamableLocal,
655 false, A.isDSOLocal(), A.canBeOmittedFromSymbolTable());
656 auto AS = std::make_unique<AliasSummary>(Flags);
657 auto *Aliasee = A.getAliaseeObject();
658 auto AliaseeVI = Index.getValueInfo(Aliasee->getGUID());
659 assert(AliaseeVI &&
"Alias expects aliasee summary to be available");
660 assert(AliaseeVI.getSummaryList().size() == 1 &&
661 "Expected a single entry per aliasee in per-module index");
662 AS->setAliasee(AliaseeVI, AliaseeVI.getSummaryList()[0].get());
663 if (NonRenamableLocal)
664 CantBePromoted.
insert(A.getGUID());
665 Index.addGlobalValueSummary(A,
std::move(AS));
671 for (
auto &Summary :
VI.getSummaryList())
672 Summary->setLive(
true);
681 bool EnableSplitLTOUnit =
false;
682 if (
auto *MD = mdconst::extract_or_null<ConstantInt>(
683 M.getModuleFlag(
"EnableSplitLTOUnit")))
684 EnableSplitLTOUnit = MD->getZExtValue();
699 for (
auto *V : Used) {
700 if (V->hasLocalLinkage()) {
702 CantBePromoted.
insert(V->getGUID());
706 bool HasLocalInlineAsmSymbol =
false;
707 if (!
M.getModuleInlineAsm().empty()) {
723 HasLocalInlineAsmSymbol =
true;
735 if (
Function *
F = dyn_cast<Function>(GV)) {
736 std::unique_ptr<FunctionSummary> Summary =
737 std::make_unique<FunctionSummary>(
740 F->hasFnAttribute(Attribute::ReadNone),
741 F->hasFnAttribute(Attribute::ReadOnly),
742 F->hasFnAttribute(Attribute::NoRecurse),
743 F->returnDoesNotAlias(),
745 F->hasFnAttribute(Attribute::AlwaysInline),
746 F->hasFnAttribute(Attribute::NoUnwind),
758 Index.addGlobalValueSummary(*GV,
std::move(Summary));
760 std::unique_ptr<GlobalVarSummary> Summary =
761 std::make_unique<GlobalVarSummary>(
764 false,
false, cast<GlobalVariable>(GV)->
isConstant(),
767 Index.addGlobalValueSummary(*GV,
std::move(Summary));
772 bool IsThinLTO =
true;
774 mdconst::extract_or_null<ConstantInt>(
M.getModuleFlag(
"ThinLTO")))
775 IsThinLTO = MD->getZExtValue();
780 if (
F.isDeclaration())
785 std::unique_ptr<BlockFrequencyInfo> BFIPtr;
787 BFI = GetBFICallback(
F);
788 else if (
F.hasProfileData()) {
791 BFIPtr = std::make_unique<BlockFrequencyInfo>(
F, BPI, LI);
796 !LocalsUsed.
empty() || HasLocalInlineAsmSymbol,
797 CantBePromoted, IsThinLTO, GetSSICallback);
804 if (
G.isDeclaration())
814 for (
auto *V : LocalsUsed) {
815 auto *Summary = Index.getGlobalValueSummary(*V);
816 assert(Summary &&
"Missing summary for global value");
817 Summary->setNotEligibleToImport();
829 for (
auto &GlobalList : Index) {
831 if (GlobalList.second.SummaryList.empty())
834 assert(GlobalList.second.SummaryList.size() == 1 &&
835 "Expected module's index to have one summary per GUID");
836 auto &Summary = GlobalList.second.SummaryList[0];
838 Summary->setNotEligibleToImport();
842 bool AllRefsCanBeExternallyReferenced =
844 return !CantBePromoted.count(VI.getGUID());
846 if (!AllRefsCanBeExternallyReferenced) {
847 Summary->setNotEligibleToImport();
851 if (
auto *FuncSummary = dyn_cast<FunctionSummary>(Summary.get())) {
854 return !CantBePromoted.count(Edge.first.getGUID());
856 if (!AllCallsCanBeExternallyReferenced)
857 Summary->setNotEligibleToImport();
867 Index.exportToDot(OSDot, {});
897 "Module Summary Analysis",
false,
true)
914 auto *PSI = &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI();
919 return &(this->getAnalysis<BlockFrequencyInfoWrapperPass>(
925 return NeedSSI ? &getAnalysis<StackSafetyInfoWrapperPass>(
965 "Module summary info",
false,
true)
This is an optimization pass for GlobalISel generic memory operations.
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
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
A parsed version of the target data layout string in and methods for querying it.
INITIALIZE_PASS_BEGIN(ModuleSummaryIndexWrapperPass, "module-summary-analysis", "Module Summary Analysis", false, true) INITIALIZE_PASS_END(ModuleSummaryIndexWrapperPass
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
ImmutablePass class - This class is used to provide information that does not need to be run.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
LinkageTypes getLinkage() const
LocationClass< Ty > location(Ty &L)
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Legacy analysis pass which computes BlockFrequencyInfo.
size_type size() const
Determine the number of elements in the SetVector.
cl::opt< std::string > ModuleSummaryDotFile("module-summary-dot-file", cl::init(""), cl::Hidden, cl::value_desc("filename"), cl::desc("File to emit dot graph of new summary into."))
Legacy wrapper pass to provide the ModuleSummaryIndex object.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
detail::enumerator< R > enumerate(R &&TheRange)
Given an input range, returns a new range whose values are are pair (A,B) such that A is the 0-based ...
FunctionSummary::ForceSummaryHotnessType ForceSummaryEdgesCold
MDNode * getMetadata(unsigned KindID) const
Get the current metadata attachments for the given kind, if any.
ModuleSummaryIndexWrapperPass()
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
FunctionAnalysisManager FAM
The instances of the Type class are immutable: once they are created, they are never changed.
bool needsParamAccessSummary(const Module &M)
ImmutablePass * createImmutableModuleSummaryIndexWrapperPass(const ModuleSummaryIndex *Index)
Optional< uint64_t > getProfileCount(const CallBase &CallInst, BlockFrequencyInfo *BFI, bool AllowSynthetic=false) const
Returns the profile count for CallInst.
@ DefaultVisibility
The GV is visible.
This class implements a map that also provides access to all stored values in a deterministic order.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
LLVM_NODISCARD T pop_back_val()
Class to represent array types.
std::pair< iterator, bool > insert(const ValueT &V)
static void addIntrinsicToSummary(const CallInst *CI, SetVector< GlobalValue::GUID > &TypeTests, SetVector< FunctionSummary::VFuncId > &TypeTestAssumeVCalls, SetVector< FunctionSummary::VFuncId > &TypeCheckedLoadVCalls, SetVector< FunctionSummary::ConstVCall > &TypeTestAssumeConstVCalls, SetVector< FunctionSummary::ConstVCall > &TypeCheckedLoadConstVCalls, DominatorTree &DT)
If this intrinsic call requires that we add information to the function summary, do so via the non-co...
StackSafetyInfo wrapper for the new pass manager.
GlobalVariable * collectUsedGlobalVariables(const Module &M, SmallVectorImpl< GlobalValue * > &Vec, bool CompilerUsed)
Given "llvm.used" or "llvm.compiler.used" as a global name, collect the initializer elements of that ...
static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser, SetVector< ValueInfo > &RefEdges, SmallPtrSet< const User *, 8 > &Visited)
LLVM Basic Block Representation.
Group flags (Linkage, NotEligibleToImport, etc.) as a bitfield.
static void computeVTableFuncs(ModuleSummaryIndex &Index, const GlobalVariable &V, const Module &M, VTableFuncList &VTableFuncs)
static void computeFunctionSummary(ModuleSummaryIndex &Index, const Module &M, const Function &F, BlockFrequencyInfo *BFI, ProfileSummaryInfo *PSI, DominatorTree &DT, bool HasLocalsInUsedOrAsm, DenseSet< GlobalValue::GUID > &CantBePromoted, bool IsThinLTO, std::function< const StackSafetyInfo *(const Function &F)> GetSSICallback)
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
bool remove(const value_type &X)
Remove an item from the set vector.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
bool isColdCount(uint64_t C) const
Returns true if count C is considered cold.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
uint64_t getNumElements() const
bool hasAppendingLinkage() const
static CalleeInfo::HotnessType getHotness(uint64_t ProfileCount, ProfileSummaryInfo *PSI)
std::pair< ValueInfo, CalleeInfo > EdgeTy
<CalleeValueInfo, CalleeInfo> call edge pair.
(vector float) vec_cmpeq(*A, *B) C
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation or the function signa...
Analysis providing branch probability information.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Represent the analysis usage information of a pass.
ForceSummaryHotnessType
Types for -force-summary-edges-cold debugging option.
iterator_range< use_iterator > uses()
Result run(Module &M, ModuleAnalysisManager &AM)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
static void addVCallToSet(DevirtCallSite Call, GlobalValue::GUID Guid, SetVector< FunctionSummary::VFuncId > &VCalls, SetVector< FunctionSummary::ConstVCall > &ConstVCalls)
Determine whether this call has all constant integer arguments (excluding "this") and summarize it to...
ImmutableModuleSummaryIndexWrapperPass(const ModuleSummaryIndex *Index=nullptr)
@ InternalLinkage
Rename collisions when linking (static functions).
Analysis pass which computes BlockFrequencyInfo.
static GUID getGUID(StringRef GlobalName)
Return a 64-bit global unique ID constructed from global value name (i.e.
static bool isNonRenamableLocal(const GlobalValue &GV)
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Struct that holds a reference to a particular GUID in a global value summary.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Analysis providing profile information.
Implements a dense probed hash-table based set.
cl::opt< FunctionSummary::ForceSummaryHotnessType, true > FSEC("force-summary-edges-cold", cl::Hidden, cl::location(ForceSummaryEdgesCold), cl::desc("Force all edges in the function summary to cold"), cl::values(clEnumValN(FunctionSummary::FSHT_None, "none", "None."), clEnumValN(FunctionSummary::FSHT_AllNonCritical, "all-non-critical", "All non-critical edges."), clEnumValN(FunctionSummary::FSHT_All, "all", "All edges.")))
bool hasAvailableExternallyLinkage() const
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
This is an important base class in LLVM.
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
bool isHotCount(uint64_t C) const
Returns true if count C is considered hot.
Used to lazily calculate structure layout information for a target machine, based on the DataLayout s...
VisibilityTypes getVisibility() const
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
static bool isConstant(const MachineInstr &MI)
A special type used by analysis passes to provide an address that identifies that particular analysis...
std::vector< VirtFuncOffset > VTableFuncList
List of functions referenced by a particular vtable definition.
initializer< Ty > init(const Ty &Val)
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
unsigned getElementContainingOffset(uint64_t Offset) const
Given a valid byte offset into the structure, returns the structure index that contains it.
static void computeVariableSummary(ModuleSummaryIndex &Index, const GlobalVariable &V, DenseSet< GlobalValue::GUID > &CantBePromoted, const Module &M, SmallVectorImpl< MDNode * > &Types)
A call site that could be devirtualized.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StandardInstrumentations SI(Debug, VerifyEach)
bool hasLocalLinkage() const
VectorType takeVector()
Clear the MapVector and return the underlying vector.
void initializeModuleSummaryIndexWrapperPassPass(PassRegistry &)
print Print MemDeps of function
void initializeImmutableModuleSummaryIndexWrapperPassPass(PassRegistry &)
static void setLiveRoot(ModuleSummaryIndex &Index, StringRef Name)
A Module instance is used to store all the information related to an LLVM module.
static bool isNonVolatileStore(const Instruction *I)
Interface to access stack safety analysis results for single function.
Flags specific to function summaries.
bool insert(const value_type &X)
Insert a new element into the SetVector.
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
An analysis pass based on the new PM to deliver ProfileSummaryInfo.
bool canBeOmittedFromSymbolTable() const
True if GV can be left out of the object symbol table.
StackSafetyInfo wrapper for the legacy pass manager.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Class to represent struct types.
StringRef - Represent a constant reference to a string, i.e.
static void findFuncPointers(const Constant *I, uint64_t StartingOffset, const Module &M, ModuleSummaryIndex &Index, VTableFuncList &VTableFuncs)
Find function pointers referenced within the given vtable initializer (or subset of an initializer) I...
bool doFinalization(Module &M) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
static void recordTypeIdCompatibleVtableReferences(ModuleSummaryIndex &Index, const GlobalVariable &V, SmallVectorImpl< MDNode * > &Types)
Record vtable definition V for each type metadata it references.
A raw_ostream that writes to a file descriptor.
amdgpu Simplify well known AMD library false FunctionCallee Callee
bool isInterposable() const
Return true if this global's definition can be substituted with an arbitrary definition at link time ...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
ModulePass * createModuleSummaryIndexWrapperPass()
void setPreservesAll()
Set by analyses that do not transform their input at all.
bool hasDLLExportStorageClass() const
void findDevirtualizableCallsForTypeCheckedLoad(SmallVectorImpl< DevirtCallSite > &DevirtCalls, SmallVectorImpl< Instruction * > &LoadedPtrs, SmallVectorImpl< Instruction * > &Preds, bool &HasNonCallUses, const CallInst *CI, DominatorTree &DT)
Given a call to the intrinsic @llvm.type.checked.load, find all devirtualizable call sites based on t...
ArrayRef< Type * > elements() const
uint64_t getElementOffset(unsigned Idx) const
GUID getGUID() const
Return a 64-bit global unique ID constructed from global value name (i.e.
ModuleSummaryIndex buildModuleSummaryIndex(const Module &M, std::function< BlockFrequencyInfo *(const Function &F)> GetBFICallback, ProfileSummaryInfo *PSI, std::function< const StackSafetyInfo *(const Function &F)> GetSSICallback=[](const Function &F) -> const StackSafetyInfo *{ return nullptr;})
Direct function to compute a ModuleSummaryIndex from a given module.
static bool mustBeUnreachableFunction(const Function &F)
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
static bool isNonVolatileLoad(const Instruction *I)
Class to hold module path string table and global value map, and encapsulate methods for operating on...
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
Value * getArgOperand(unsigned i) const
LLVM_NODISCARD bool empty() const
VCallVisibility getVCallVisibility() const
static BlockAddress * get(Function *F, BasicBlock *BB)
Return a BlockAddress for the specified function and basic block.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
A container for analyses that lazily runs them and caches their results.
An analysis over an "outer" IR unit that provides access to an analysis manager over an "inner" IR un...
This class represents a function call, abstracting a target machine's calling convention.
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
Vector takeVector()
Clear the SetVector and return the underlying vector.
AnalysisUsage & addRequired()
Legacy wrapper pass to provide the ModuleSummaryIndex object.
TypeID
Definitions of all of the base types for the Type system.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Class to represent profile counts.
A vector that has set insertion semantics.
LLVM Value Representation.
Type * getElementType() const
void findDevirtualizableCallsForTypeTest(SmallVectorImpl< DevirtCallSite > &DevirtCalls, SmallVectorImpl< CallInst * > &Assumes, const CallInst *CI, DominatorTree &DT)
Given a call to the intrinsic @llvm.type.test, find all devirtualizable call sites based on the call ...
static void computeAliasSummary(ModuleSummaryIndex &Index, const GlobalAlias &A, DenseSet< GlobalValue::GUID > &CantBePromoted)
A Use represents the edge between a Value definition and its users.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
static void CollectAsmSymbols(const Module &M, function_ref< void(StringRef, object::BasicSymbolRef::Flags)> AsmSymbol)
Parse inline ASM and collect the symbols that are defined or referenced in the current module.