16 #ifndef LLVM_IR_MODULESUMMARYINDEX_H 17 #define LLVM_IR_MODULESUMMARYINDEX_H 70 static constexpr int32_t ScaleShift = 8;
71 static constexpr uint64_t MaxRelBlockFreq = (1 << 29) - 1;
76 : Hotness(static_cast<
uint32_t>(Hotness)), RelBlockFreq(RelBF) {}
79 Hotness =
std::max(Hotness, static_cast<uint32_t>(OtherHotness));
93 Scaled64 Temp(BlockFreq, ScaleShift);
94 Temp /= Scaled64::get(EntryFreq);
97 SaturatingAdd<uint64_t>(Temp.toInt<uint64_t>(), RelBlockFreq);
98 Sum = std::min(Sum, uint64_t(MaxRelBlockFreq));
99 RelBlockFreq =
static_cast<uint32_t>(Sum);
161 std::map<GlobalValue::GUID, GlobalValueSummaryInfo>;
170 ValueInfo(
bool HaveGVs,
const GlobalValueSummaryMapTy::value_type *R) {
171 RefAndFlags.setPointer(R);
172 RefAndFlags.setInt(HaveGVs);
175 operator bool()
const {
return getRef(); }
180 return getRef()->second.U.GV;
184 return getRef()->second.SummaryList;
188 return haveGVs() ? getRef()->second.U.GV->getName()
189 : getRef()->second.U.Name;
192 bool haveGVs()
const {
return RefAndFlags.getInt() & 0x1; }
193 bool isReadOnly()
const {
return RefAndFlags.getInt() & 0x2; }
194 void setReadOnly() { RefAndFlags.setInt(RefAndFlags.getInt() | 0x2); }
196 const GlobalValueSummaryMapTy::value_type *
getRef()
const {
197 return RefAndFlags.getPointer();
200 bool isDSOLocal()
const;
206 OS <<
" (" << VI.
name() <<
")";
212 "Need ValueInfo with non-null Ref for comparison");
218 "Need ValueInfo with non-null Ref for comparison");
224 "Need ValueInfo with non-null Ref to compare GUIDs");
230 return ValueInfo(
false, (GlobalValueSummaryMapTy::value_type *)-8);
234 return ValueInfo(
false, (GlobalValueSummaryMapTy::value_type *)-16);
238 return V == getTombstoneKey() || V == getEmptyKey();
255 enum SummaryKind :
unsigned { AliasKind, FunctionKind, GlobalVarKind };
285 bool NotEligibleToImport,
bool Live,
bool IsLocal)
286 : Linkage(Linkage), NotEligibleToImport(NotEligibleToImport),
287 Live(Live), DSOLocal(IsLocal) {}
314 std::vector<ValueInfo> RefEdgeList;
318 : Kind(K), Flags(Flags), RefEdgeList(
std::move(Refs)) {
319 assert((K != AliasKind || Refs.empty()) &&
320 "Expect no references for AliasSummary");
392 AliaseeSummary(
nullptr), AliaseeGUID(0) {}
405 assert(AliaseeSummary &&
"Unexpected missing aliasee summary");
406 return *AliaseeSummary;
415 assert(AliaseeGUID &&
"Unexpected missing aliasee GUID");
421 if (
auto *AS = dyn_cast<AliasSummary>(
this))
422 return &AS->getAliasee();
427 if (
auto *AS = dyn_cast<AliasSummary>(
this))
428 return &AS->getAliasee();
437 using EdgeTy = std::pair<ValueInfo, CalleeInfo>;
480 TypeCheckedLoadConstVCalls;
502 GlobalValue::LinkageTypes::AvailableExternallyLinkage,
505 std::vector<ValueInfo>(), std::move(Edges),
506 std::vector<GlobalValue::GUID>(),
507 std::vector<FunctionSummary::VFuncId>(),
508 std::vector<FunctionSummary::VFuncId>(),
509 std::vector<FunctionSummary::ConstVCall>(),
510 std::vector<FunctionSummary::ConstVCall>());
527 uint64_t EntryCount = 0;
530 std::vector<EdgeTy> CallGraphEdgeList;
532 std::unique_ptr<TypeIdInfo> TIdInfo;
536 uint64_t EntryCount, std::vector<ValueInfo> Refs,
537 std::vector<EdgeTy> CGEdges,
538 std::vector<GlobalValue::GUID> TypeTests,
539 std::vector<VFuncId> TypeTestAssumeVCalls,
540 std::vector<VFuncId> TypeCheckedLoadVCalls,
541 std::vector<ConstVCall> TypeTestAssumeConstVCalls,
542 std::vector<ConstVCall> TypeCheckedLoadConstVCalls)
544 InstCount(NumInsts), FunFlags(FunFlags), EntryCount(EntryCount),
545 CallGraphEdgeList(
std::move(CGEdges)) {
546 if (!TypeTests.empty() || !TypeTestAssumeVCalls.empty() ||
547 !TypeCheckedLoadVCalls.empty() || !TypeTestAssumeConstVCalls.empty() ||
548 !TypeCheckedLoadConstVCalls.empty())
549 TIdInfo = llvm::make_unique<TypeIdInfo>(
TypeIdInfo{
550 std::move(TypeTests), std::move(TypeTestAssumeVCalls),
551 std::move(TypeCheckedLoadVCalls),
552 std::move(TypeTestAssumeConstVCalls),
553 std::move(TypeCheckedLoadConstVCalls)});
556 unsigned immutableRefCount()
const;
583 return TIdInfo->TypeTests;
592 return TIdInfo->TypeTestAssumeVCalls;
601 return TIdInfo->TypeCheckedLoadVCalls;
610 return TIdInfo->TypeTestAssumeConstVCalls;
618 return TIdInfo->TypeCheckedLoadConstVCalls;
626 TIdInfo = llvm::make_unique<TypeIdInfo>();
627 TIdInfo->TypeTests.push_back(Guid);
630 const TypeIdInfo *getTypeIdInfo()
const {
return TIdInfo.get(); };
639 return {0, uint64_t(-2)};
651 return {{0, uint64_t(-1)}, {}};
655 return {{0, uint64_t(-2)}, {}};
678 GVarFlags(
bool ReadOnly =
false) : ReadOnly(ReadOnly) {}
684 std::vector<ValueInfo> Refs)
686 VarFlags(VarFlags) {}
715 unsigned SizeM1BitWidth = 0;
722 uint64_t AlignLog2 = 0;
725 uint64_t InlineBits = 0;
770 std::map<uint64_t, WholeProgramDevirtResolution>
WPDRes;
792 std::multimap<GlobalValue::GUID, std::pair<std::string, TypeIdSummary>>;
811 std::map<GlobalValue::GUID, GlobalValue::GUID> OidGuidMap;
816 bool WithGlobalValueDeadStripping =
false;
819 bool HasSyntheticEntryCounts =
false;
826 bool SkipModuleByDistributedBackend =
false;
835 bool EnableSplitLTOUnit;
839 bool PartiallySplitLTOUnits =
false;
841 std::set<std::string> CfiFunctionDefs;
842 std::set<std::string> CfiFunctionDecls;
852 GlobalValueSummaryMapTy::value_type *
861 : HaveGVs(HaveGVs), EnableSplitLTOUnit(EnableSplitLTOUnit), Saver(Alloc) {
870 size_t size()
const {
return GlobalValueMap.size(); }
875 std::map<ValueInfo, bool> &FunctionHasParent) {
880 auto S = FunctionHasParent.emplace(V,
false);
888 assert(F !=
nullptr &&
"Expected FunctionSummary node");
890 for (
auto &
C : F->
calls()) {
892 auto S = FunctionHasParent.emplace(
C.first,
true);
895 if (!S.second && S.first->second)
899 discoverNodes(
C.first, FunctionHasParent);
901 S.first->second =
true;
910 std::map<ValueInfo, bool> FunctionHasParent;
912 for (
auto &S : *
this) {
914 if (!S.second.SummaryList.size() ||
915 !isa<FunctionSummary>(S.second.SummaryList.front().get()))
917 discoverNodes(ValueInfo(HaveGVs, &S), FunctionHasParent);
920 std::vector<FunctionSummary::EdgeTy> Edges;
922 for (
auto &
P : FunctionHasParent) {
925 Edges.push_back(std::make_pair(
P.first,
CalleeInfo{}));
932 return CallGraphRoot;
936 return WithGlobalValueDeadStripping;
939 WithGlobalValueDeadStripping =
true;
946 return SkipModuleByDistributedBackend;
949 SkipModuleByDistributedBackend =
true;
959 return !WithGlobalValueDeadStripping || GVS->
isLive();
965 ValueInfo
getValueInfo(
const GlobalValueSummaryMapTy::value_type &R)
const {
966 return ValueInfo(HaveGVs, &R);
971 auto I = GlobalValueMap.find(GUID);
972 return ValueInfo(HaveGVs,
I == GlobalValueMap.end() ? nullptr : &*
I);
977 return ValueInfo(HaveGVs, getOrInsertValuePtr(GUID));
988 auto VP = getOrInsertValuePtr(GUID);
989 VP->second.U.Name =
Name;
990 return ValueInfo(HaveGVs, VP);
996 auto VP = getOrInsertValuePtr(GV->
getGUID());
997 VP->second.U.GV = GV;
998 return ValueInfo(HaveGVs, VP);
1003 const auto I = OidGuidMap.find(OriginalID);
1004 return I == OidGuidMap.end() ? 0 :
I->second;
1015 std::unique_ptr<GlobalValueSummary> Summary) {
1016 addGlobalValueSummary(getOrInsertValueInfo(&GV), std::move(Summary));
1021 std::unique_ptr<GlobalValueSummary> Summary) {
1023 std::move(Summary));
1028 std::unique_ptr<GlobalValueSummary> Summary) {
1029 addOriginalName(VI.
getGUID(), Summary->getOriginalName());
1032 const_cast<GlobalValueSummaryMapTy::value_type *
>(VI.
getRef())
1033 ->
second.SummaryList.push_back(std::move(Summary));
1039 if (OrigGUID == 0 || ValueGUID == OrigGUID)
1041 if (OidGuidMap.count(OrigGUID) && OidGuidMap[OrigGUID] != ValueGUID)
1042 OidGuidMap[OrigGUID] = 0;
1044 OidGuidMap[OrigGUID] = ValueGUID;
1057 [&](
const std::unique_ptr<GlobalValueSummary> &Summary) {
1058 return Summary->modulePath() == ModuleId;
1060 if (Summary ==
CalleeInfo.getSummaryList().end())
1062 return Summary->get();
1068 bool PerModuleIndex =
true)
const {
1069 assert(GV.
hasName() &&
"Can't get GlobalValueSummary for GV with no name");
1070 return getGlobalValueSummary(GV.
getGUID(), PerModuleIndex);
1077 bool PerModuleIndex =
true)
const;
1081 return ModulePathStringTable;
1086 return ModulePathStringTable;
1091 return ModulePathStringTable.
lookup(ModPath).first;
1096 auto It = ModulePathStringTable.
find(ModPath);
1097 assert(It != ModulePathStringTable.
end() &&
"Module not registered");
1098 return It->second.second;
1105 NewName +=
".llvm.";
1106 NewName +=
utostr((uint64_t(ModHash[0]) << 32) |
1108 return NewName.
str();
1114 std::pair<StringRef, StringRef> Pair = Name.
split(
".llvm.");
1124 return &*ModulePathStringTable.
insert({ModPath, {ModId, Hash}}).
first;
1129 auto It = ModulePathStringTable.
find(ModPath);
1130 assert(It != ModulePathStringTable.
end() &&
"Module not registered");
1148 for (
auto It = TidIter.first; It != TidIter.second; ++It)
1149 if (It->second.first == TypeId)
1150 return It->second.second;
1151 auto It = TypeIdMap.insert(
1153 return It->second.second;
1160 for (
auto It = TidIter.first; It != TidIter.second; ++It)
1161 if (It->second.first == TypeId)
1162 return &It->second.second;
1168 void collectDefinedFunctionsForModule(
StringRef ModulePath,
1173 void collectDefinedGVSummariesPerModule(
1202 decltype(&valueInfoFromEdge)>;
1212 &valueInfoFromEdge);
1214 cast<FunctionSummary>(N.
getSummaryList().front()->getBaseObject());
1222 &valueInfoFromEdge);
1224 cast<FunctionSummary>(N.
getSummaryList().front()->getBaseObject());
1233 cast<FunctionSummary>(N.
getSummaryList().front()->getBaseObject());
1234 return F->CallGraphEdgeList.begin();
1242 cast<FunctionSummary>(N.
getSummaryList().front()->getBaseObject());
1243 return F->CallGraphEdgeList.end();
1252 std::unique_ptr<GlobalValueSummary> Root =
1255 G.SummaryList.push_back(std::move(Root));
1258 return ValueInfo(I->
haveGVs(), &
P);
1272 #endif // LLVM_IR_MODULESUMMARYINDEX_H static FunctionSummary::ConstVCall getEmptyKey()
static bool isInterposableLinkage(LinkageTypes Linkage)
Whether the definition of this global may be replaced by something non-equivalent at link time...
unsigned Live
In per-module summary, indicate that the global value must be considered a live root for index-based ...
GVarFlags(bool ReadOnly=false)
void setNotEligibleToImport()
Flag that this global value cannot be imported.
static bool classof(const GlobalValueSummary *GVS)
Check if this is an alias summary.
bool operator==(const BinaryRef &LHS, const BinaryRef &RHS)
static FunctionSummary::ConstVCall getTombstoneKey()
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
PointerIntPair< const GlobalValueSummaryMapTy::value_type *, 2, int > RefAndFlags
void setEnableSplitLTOUnit()
std::vector< std::unique_ptr< GlobalValueSummary > > GlobalValueSummaryList
uint64_t GUID
Declare a type to represent a global unique identifier for a global value.
This class represents lattice values for constants.
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
ValueInfo getValueInfo(GlobalValue::GUID GUID) const
Return a ValueInfo for GUID if it exists, otherwise return ValueInfo().
unsigned Linkage
The linkage type of the associated global value.
const GlobalValueSummary & getAliasee() const
StringRef Name
Summary string representation.
std::multimap< GlobalValue::GUID, std::pair< std::string, TypeIdSummary > > TypeIdSummaryMapTy
Map of a type GUID to type id string and summary (multimap used in case of GUID conflicts).
A Module instance is used to store all the information related to an LLVM module. ...
GlobalValueSummary * findSummaryInModule(GlobalValue::GUID ValueGUID, StringRef ModuleId) const
Find the summary for global GUID in module ModuleId, or nullptr if not found.
GlobalValueSummary * getGlobalValueSummary(const GlobalValue &GV, bool PerModuleIndex=true) const
Returns the first GlobalValueSummary for GV, asserting that there is only one if PerModuleIndex.
const GlobalValue * getValue() const
ArrayRef< VFuncId > type_test_assume_vcalls() const
Returns the list of virtual calls made by this function using llvm.assume(llvm.type.test) intrinsics that do not have all constant integer arguments.
Global variable summary information to aid decisions and implementation of importing.
Unsatisfiable type (i.e. no global has this type metadata)
Implements a dense probed hash-table based set.
void addTypeTest(GlobalValue::GUID Guid)
Add a type test to the summary.
ArrayRef< ValueInfo > refs() const
Return the list of values referenced by this global value definition.
static void discoverNodes(ValueInfo V, std::map< ValueInfo, bool > &FunctionHasParent)
Convenience function for doing a DFS on a ValueInfo.
GlobalValueSummaryMapTy::iterator gvsummary_iterator
iterator find(StringRef Key)
const StringMap< std::pair< uint64_t, ModuleHash > > & modulePaths() const
Table of modules, containing module hash and id.
GlobalValue::LinkageTypes linkage() const
Return linkage type recorded for this global value.
std::vector< VFuncId > TypeTestAssumeVCalls
List of virtual calls made by this function using (respectively) llvm.assume(llvm.type.test) or llvm.type.checked.load intrinsics that do not have all constant integer arguments.
static StringRef getOriginalNameBeforePromote(StringRef Name)
Helper to obtain the unpromoted name for a global value (or the original name if not promoted)...
const std::set< std::string > & cfiFunctionDecls() const
bool isGlobalValueLive(const GlobalValueSummary *GVS) const
Kind
Specifies which kind of type check we should emit for this byte array.
static unsigned getHashValue(ValueInfo I)
Virtual constant propagation.
const TypeIdSummary * getTypeIdSummary(StringRef TypeId) const
This returns either a pointer to the type id summary (if present in the summary map) or null (if not ...
std::map< uint64_t, WholeProgramDevirtResolution > WPDRes
Mapping from byte offset to whole-program devirt resolution for that (typeid, byte offset) pair...
StringMap< std::pair< uint64_t, ModuleHash > > & modulePaths()
Table of modules, containing hash and id.
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
bool partiallySplitLTOUnits() const
bool hasExportedFunctions(const Module &M) const
Check if the given Module has any functions available for exporting in the index. ...
static bool isSpecialKey(ValueInfo V)
void addOriginalName(GlobalValue::GUID ValueGUID, GlobalValue::GUID OrigGUID)
Add an original name for the value of the given GUID.
static bool isEqual(ValueInfo L, ValueInfo R)
const GlobalValue * GV
The GlobalValue corresponding to this summary.
uint32_t RelBlockFreq
The value stored in RelBlockFreq has to be interpreted as the digits of a scaled number with a scale ...
unsigned NotEligibleToImport
Indicate if the global value cannot be imported (e.g.
GlobalValue::GUID getGUID() const
bool skipModuleByDistributedBackend() const
amdgpu Simplify well known AMD library false Value Value const Twine & Name
ModuleInfo * getModule(StringRef ModPath)
Return module entry for module with the given ModPath.
static unsigned getHashValue(FunctionSummary::VFuncId I)
StringRef saveString(StringRef String)
const_gvsummary_iterator begin() const
static std::string getGlobalNameForLocal(StringRef Name, ModuleHash ModHash)
Convenience method for creating a promoted global name for the given value name of a local...
const TypeIdSummaryMapTy & typeIds() const
std::array< uint32_t, 5 > ModuleHash
160 bits SHA1
bool enableSplitLTOUnit() const
void setSkipModuleByDistributedBackend()
Just do a regular virtual call.
static bool canImportGlobalVar(GlobalValueSummary *S)
std::map< GlobalValue::GUID, GlobalValueSummaryInfo > GlobalValueSummaryMapTy
Map from global value GUID to corresponding summary structures.
bool hasAliaseeGUID() const
ArrayRef< GlobalValue::GUID > type_tests() const
Returns the list of type identifiers used by this function in llvm.type.test intrinsics other than by...
void setWithGlobalValueDeadStripping()
StringRef str() const
Explicit conversion to StringRef.
Uniform return value optimization.
ArrayRef< ConstVCall > type_checked_load_const_vcalls() const
Returns the list of virtual calls made by this function using llvm.type.checked.load intrinsics with ...
static NodeRef getEntryNode(ValueInfo V)
static bool isEqual(const Function &Caller, const Function &Callee)
ArrayRef< VFuncId > type_checked_load_vcalls() const
Returns the list of virtual calls made by this function using llvm.type.checked.load intrinsics that ...
std::pair< ValueInfo, CalleeInfo > EdgeTy
<CalleeValueInfo, CalleeInfo> call edge pair.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
TypeIdSummary & getOrInsertTypeIdSummary(StringRef TypeId)
Return an existing or new TypeIdSummary entry for TypeId.
ModuleSummaryIndex(bool HaveGVs, bool EnableSplitLTOUnit=false)
ModulePathStringTableTy::value_type ModuleInfo
Class to hold module path string table and global value map, and encapsulate methods for operating on...
static ChildEdgeIteratorType child_edge_begin(NodeRef N)
ArrayRef< std::unique_ptr< GlobalValueSummary > > getSummaryList() const
static ChildEdgeIteratorType child_edge_end(NodeRef N)
Analysis containing CSE Info
static bool isEqual(FunctionSummary::VFuncId L, FunctionSummary::VFuncId R)
ForceSummaryHotnessType
Types for -force-summary-edges-cold debugging option.
static unsigned getHashValue(FunctionSummary::ConstVCall I)
GlobalValueSummaryMapTy::const_iterator const_gvsummary_iterator
Type used for iterating through the global value summary map.
static FunctionSummary::VFuncId getEmptyKey()
GlobalValue::GUID getGUIDFromOriginalID(GlobalValue::GUID OriginalID) const
Return the GUID for OriginalId in the OidGuidMap.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
size_type count(StringRef Key) const
count - Return 1 if the element is in the map, 0 otherwise.
Allocate memory in an ever growing pool, as if by bump-pointer.
static bool classof(const GlobalValueSummary *GVS)
Check if this is a global variable summary.
ValueInfo(bool HaveGVs, const GlobalValueSummaryMapTy::value_type *R)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
SummaryKind getSummaryKind() const
Which kind of summary subclass this is.
const std::set< std::string > & cfiFunctionDefs() const
unsigned instCount() const
Get the instruction count recorded for this function.
std::vector< uint64_t > Args
static ValueInfo getEmptyKey()
CalleeInfo(HotnessType Hotness, uint64_t RelBF)
Class to accumulate and hold information about a callee.
Single element (last example in "Short Inline Bit Vectors")
GlobalVarSummary(GVFlags Flags, GVarFlags VarFlags, std::vector< ValueInfo > Refs)
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
void setPartiallySplitLTOUnits()
uint64_t entryCount() const
Get the synthetic entry count for this function.
const ModuleHash & getModuleHash(const StringRef ModPath) const
Get the module SHA1 hash recorded for the given module path.
GlobalValue::GUID getOriginalName() const
Returns the hash of the original name, it is identical to the GUID for externally visible symbols...
ValueTy lookup(StringRef Key) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
ValueInfo getOrInsertValueInfo(const GlobalValue *GV)
Return a ValueInfo for GV and mark it as belonging to GV.
auto find_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
All type identifier related information.
Function and variable summary information to aid decisions and implementation of importing.
static GUID getGUID(StringRef GlobalName)
Return a 64-bit global unique ID constructed from global value name (i.e.
std::vector< FunctionSummary::EdgeTy >::iterator ChildEdgeIteratorType
const_gvsummary_iterator end() const
static ValueInfo getTombstoneKey()
const std::string & getModuleIdentifier() const
Get the module identifier which is, essentially, the name of the module.
GVFlags flags() const
Get the flags for this GlobalValue (see struct GVFlags).
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void addGlobalValueSummary(StringRef ValueName, std::unique_ptr< GlobalValueSummary > Summary)
Add a global value summary for a value of the given name.
An "identifier" for a virtual function.
ArrayRef< ConstVCall > type_test_assume_const_vcalls() const
Returns the list of virtual calls made by this function using llvm.assume(llvm.type.test) intrinsics with all constant integer arguments.
void addGlobalValueSummary(ValueInfo VI, std::unique_ptr< GlobalValueSummary > Summary)
Add a global value summary for the given ValueInfo.
Struct that holds a reference to a particular GUID in a global value summary.
void setReadOnly(bool RO)
HotnessType getHotness() const
void updateHotness(const HotnessType OtherHotness)
ModuleInfo * addModule(StringRef ModPath, uint64_t ModId, ModuleHash Hash=ModuleHash{{0}})
Add a new module with the given Hash, mapped to the given ModID, and return a reference to the module...
void setHasSyntheticEntryCounts()
static bool classof(const GlobalValueSummary *GVS)
Check if this is a function summary.
const char * getHotnessName(CalleeInfo::HotnessType HT)
GlobalValueSummary * getBaseObject()
If this is an alias summary, returns the summary of the aliased object (a global variable or function...
void setDSOLocal(bool Local)
static ChildIteratorType child_end(NodeRef N)
Module.h This file contains the declarations for the Module class.
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
Single implementation devirtualization.
ValueInfo getOrInsertValueInfo(GlobalValue::GUID GUID, StringRef Name)
Return a ValueInfo for GUID setting value Name.
uint64_t getModuleId(const StringRef ModPath) const
Get the module ID recorded for the given module path.
Alias summary information.
static NodeRef getEntryNode(ModuleSummaryIndex *I)
std::string utostr(uint64_t X, bool isNeg=false)
FunctionSummary::EdgeTy & EdgeRef
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
std::string SingleImplName
static FunctionSummary makeDummyFunctionSummary(std::vector< FunctionSummary::EdgeTy > Edges)
Create an empty FunctionSummary (with specified call edges).
StringRef save(const char *S)
A specification for a virtual function call with all constant integer arguments.
LinkageTypes
An enumeration for the kinds of linkage for global values.
bool hasSyntheticEntryCounts() const
GUID getGUID() const
Return a 64-bit global unique ID constructed from global value name (i.e.
SummaryKind
Sububclass discriminator (for dyn_cast<> et al.)
ValueInfo getValueInfo(const GlobalValueSummaryMapTy::value_type &R) const
Return a ValueInfo for the index value_type (convenient when iterating index).
ValueInfo getOrInsertValueInfo(GlobalValue::GUID GUID)
Return a ValueInfo for GUID.
bool withGlobalValueDeadStripping() const
FFlags fflags() const
Get function summary flags.
GlobalValueSummary(SummaryKind K, GVFlags Flags, std::vector< ValueInfo > Refs)
std::set< std::string > & cfiFunctionDefs()
bool operator!=(uint64_t V1, const APInt &V2)
Test a byte array (first example)
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer...
FunctionSummary calculateCallGraphRoot()
std::map< std::vector< uint64_t >, ByArg > ResByArg
Resolutions for calls with all constant integer arguments (excluding the first argument, "this"), where the key is the argument vector.
StringRef modulePath() const
Get the path to the module containing this function.
void setLinkage(GlobalValue::LinkageTypes Linkage)
Sets the linkage to the value determined by global summary-based optimization.
unsigned DSOLocal
Indicates that the linker resolved the symbol to a definition from within the same linkage unit...
void addGlobalValueSummary(const GlobalValue &GV, std::unique_ptr< GlobalValueSummary > Summary)
Add a global value summary for a value.
GVFlags(GlobalValue::LinkageTypes Linkage, bool NotEligibleToImport, bool Live, bool IsLocal)
Convenience Constructors.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
ArrayRef< EdgeTy > calls() const
Return the list of <CalleeValueInfo, CalleeInfo> pairs.
void setOriginalName(GlobalValue::GUID Name)
Initialize the original name hash in this summary.
static NodeRef valueInfoFromEdge(FunctionSummary::EdgeTy &P)
Flags specific to function summaries.
Inlined bit vector ("Short Inline Bit Vectors")
Function summary information to aid decisions and implementation of importing.
GlobalValueSummary & getAliasee()
void setModulePath(StringRef ModPath)
Set the path to the module containing this function, for use in the combined index.
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
bool notEligibleToImport() const
Return true if this global value can't be imported.
FunctionSummary(GVFlags Flags, unsigned NumInsts, FFlags FunFlags, uint64_t EntryCount, std::vector< ValueInfo > Refs, std::vector< EdgeTy > CGEdges, std::vector< GlobalValue::GUID > TypeTests, std::vector< VFuncId > TypeTestAssumeVCalls, std::vector< VFuncId > TypeCheckedLoadVCalls, std::vector< ConstVCall > TypeTestAssumeConstVCalls, std::vector< ConstVCall > TypeCheckedLoadConstVCalls)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
std::set< std::string > & cfiFunctionDecls()
void setAliaseeGUID(GlobalValue::GUID GUID)
bool operator<(int64_t V1, const APSInt &V2)
void setEntryCount(uint64_t EC)
Set the synthetic entry count for this function.
ScaledNumber< uint64_t > Scaled64
static FunctionSummary::VFuncId getTombstoneKey()
static ChildIteratorType child_begin(NodeRef N)
Just do a regular virtual call.
void setAliasee(GlobalValueSummary *Aliasee)
GVarFlags varflags() const
Group flags (Linkage, NotEligibleToImport, etc.) as a bitfield.
This class implements an extremely fast bulk output stream that can only output to a stream...
gvsummary_iterator begin()
const GlobalValue::GUID & getAliaseeGUID() const
StringRef - Represent a constant reference to a string, i.e.
const GlobalValueSummaryMapTy::value_type * getRef() const
AliasSummary(GVFlags Flags)
static bool isEqual(FunctionSummary::ConstVCall L, FunctionSummary::ConstVCall R)
GlobalValueSummaryInfo(bool HaveGVs)
GraphTraits definition to build SCC for the index.
static NodeRef edge_dest(EdgeRef E)
unsigned ReturnDoesNotAlias
void updateRelBlockFreq(uint64_t BlockFreq, uint64_t EntryFreq)
Update RelBlockFreq from BlockFreq and EntryFreq.
GlobalValueSummaryList SummaryList
List of global value summary structures for a particular value held in the GlobalValueMap.
Unique return value optimization.
std::vector< GlobalValue::GUID > TypeTests
List of type identifiers used by this function in llvm.type.test intrinsics referenced by something o...
static FunctionSummary ExternalNode
A dummy node to reference external functions that aren't in the index.
std::vector< ConstVCall > TypeTestAssumeConstVCalls
List of virtual calls made by this function using (respectively) llvm.assume(llvm.type.test) or llvm.type.checked.load intrinsics with all constant integer arguments.