@@ -1315,7 +1315,7 @@ using GVSummaryPtrSet = std::unordered_set<GlobalValueSummary *>;
13151315// / Map of a type GUID to type id string and summary (multimap used
13161316// / in case of GUID conflicts).
13171317using TypeIdSummaryMapTy =
1318- std::multimap<GlobalValue::GUID, std::pair<std::string , TypeIdSummary>>;
1318+ std::multimap<GlobalValue::GUID, std::pair<StringRef , TypeIdSummary>>;
13191319
13201320// / The following data structures summarize type metadata information.
13211321// / For type metadata overview see https://llvm.org/docs/TypeMetadata.html.
@@ -1351,6 +1351,9 @@ class ModuleSummaryIndex {
13511351 // / Holds strings for combined index, mapping to the corresponding module ID.
13521352 ModulePathStringTableTy ModulePathStringTable;
13531353
1354+ BumpPtrAllocator TypeIdSaverAlloc;
1355+ UniqueStringSaver TypeIdSaver;
1356+
13541357 // / Mapping from type identifier GUIDs to type identifier and its summary
13551358 // / information. Produced by thin link.
13561359 TypeIdSummaryMapTy TypeIdMap;
@@ -1359,7 +1362,7 @@ class ModuleSummaryIndex {
13591362 // / with that type identifier's metadata. Produced by per module summary
13601363 // / analysis and consumed by thin link. For more information, see description
13611364 // / above where TypeIdCompatibleVtableInfo is defined.
1362- std::map<std::string , TypeIdCompatibleVtableInfo, std::less<>>
1365+ std::map<StringRef , TypeIdCompatibleVtableInfo, std::less<>>
13631366 TypeIdCompatibleVtableMap;
13641367
13651368 // / Mapping from original ID to GUID. If original ID can map to multiple
@@ -1455,8 +1458,9 @@ class ModuleSummaryIndex {
14551458 // See HaveGVs variable comment.
14561459 ModuleSummaryIndex (bool HaveGVs, bool EnableSplitLTOUnit = false ,
14571460 bool UnifiedLTO = false )
1458- : HaveGVs(HaveGVs), EnableSplitLTOUnit(EnableSplitLTOUnit),
1459- UnifiedLTO (UnifiedLTO), Saver(Alloc) {}
1461+ : TypeIdSaver(TypeIdSaverAlloc), HaveGVs(HaveGVs),
1462+ EnableSplitLTOUnit (EnableSplitLTOUnit), UnifiedLTO(UnifiedLTO),
1463+ Saver(Alloc) {}
14601464
14611465 // Current version for the module summary in bitcode files.
14621466 // The BitcodeSummaryVersion should be bumped whenever we introduce changes
@@ -1829,8 +1833,8 @@ class ModuleSummaryIndex {
18291833 for (auto &[GUID, TypeIdPair] : make_range (TidIter))
18301834 if (TypeIdPair.first == TypeId)
18311835 return TypeIdPair.second ;
1832- auto It = TypeIdMap.insert (
1833- { GlobalValue::getGUID (TypeId), { std::string (TypeId), TypeIdSummary ()}});
1836+ auto It = TypeIdMap.insert ({ GlobalValue::getGUID (TypeId),
1837+ {TypeIdSaver. save (TypeId), TypeIdSummary ()}});
18341838 return It->second .second ;
18351839 }
18361840
@@ -1859,7 +1863,7 @@ class ModuleSummaryIndex {
18591863 // / the ThinLTO backends.
18601864 TypeIdCompatibleVtableInfo &
18611865 getOrInsertTypeIdCompatibleVtableSummary (StringRef TypeId) {
1862- return TypeIdCompatibleVtableMap[std::string (TypeId)];
1866+ return TypeIdCompatibleVtableMap[TypeIdSaver. save (TypeId)];
18631867 }
18641868
18651869 // / For the given \p TypeId, this returns the TypeIdCompatibleVtableMap
0 commit comments