@@ -1315,7 +1315,7 @@ using GVSummaryPtrSet = std::unordered_set<GlobalValueSummary *>;
1315
1315
// / Map of a type GUID to type id string and summary (multimap used
1316
1316
// / in case of GUID conflicts).
1317
1317
using TypeIdSummaryMapTy =
1318
- std::multimap<GlobalValue::GUID, std::pair<std::string , TypeIdSummary>>;
1318
+ std::multimap<GlobalValue::GUID, std::pair<StringRef , TypeIdSummary>>;
1319
1319
1320
1320
// / The following data structures summarize type metadata information.
1321
1321
// / For type metadata overview see https://llvm.org/docs/TypeMetadata.html.
@@ -1351,6 +1351,9 @@ class ModuleSummaryIndex {
1351
1351
// / Holds strings for combined index, mapping to the corresponding module ID.
1352
1352
ModulePathStringTableTy ModulePathStringTable;
1353
1353
1354
+ BumpPtrAllocator TypeIdSaverAlloc;
1355
+ UniqueStringSaver TypeIdSaver;
1356
+
1354
1357
// / Mapping from type identifier GUIDs to type identifier and its summary
1355
1358
// / information. Produced by thin link.
1356
1359
TypeIdSummaryMapTy TypeIdMap;
@@ -1359,7 +1362,7 @@ class ModuleSummaryIndex {
1359
1362
// / with that type identifier's metadata. Produced by per module summary
1360
1363
// / analysis and consumed by thin link. For more information, see description
1361
1364
// / above where TypeIdCompatibleVtableInfo is defined.
1362
- std::map<std::string , TypeIdCompatibleVtableInfo, std::less<>>
1365
+ std::map<StringRef , TypeIdCompatibleVtableInfo, std::less<>>
1363
1366
TypeIdCompatibleVtableMap;
1364
1367
1365
1368
// / Mapping from original ID to GUID. If original ID can map to multiple
@@ -1455,8 +1458,9 @@ class ModuleSummaryIndex {
1455
1458
// See HaveGVs variable comment.
1456
1459
ModuleSummaryIndex (bool HaveGVs, bool EnableSplitLTOUnit = false ,
1457
1460
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) {}
1460
1464
1461
1465
// Current version for the module summary in bitcode files.
1462
1466
// The BitcodeSummaryVersion should be bumped whenever we introduce changes
@@ -1829,8 +1833,8 @@ class ModuleSummaryIndex {
1829
1833
for (auto &[GUID, TypeIdPair] : make_range (TidIter))
1830
1834
if (TypeIdPair.first == TypeId)
1831
1835
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 ()}});
1834
1838
return It->second .second ;
1835
1839
}
1836
1840
@@ -1859,7 +1863,7 @@ class ModuleSummaryIndex {
1859
1863
// / the ThinLTO backends.
1860
1864
TypeIdCompatibleVtableInfo &
1861
1865
getOrInsertTypeIdCompatibleVtableSummary (StringRef TypeId) {
1862
- return TypeIdCompatibleVtableMap[std::string (TypeId)];
1866
+ return TypeIdCompatibleVtableMap[TypeIdSaver. save (TypeId)];
1863
1867
}
1864
1868
1865
1869
// / For the given \p TypeId, this returns the TypeIdCompatibleVtableMap
0 commit comments