[llvm] [NFCI][WPD]Use unique string saver to store type id (PR #106932)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 20 13:47:39 PST 2024
================
@@ -327,7 +327,20 @@ template <> struct MappingTraits<ModuleSummaryIndex> {
if (!io.outputting())
CustomMappingTraits<GlobalValueSummaryMapTy>::fixAliaseeLinks(
index.GlobalValueMap);
- io.mapOptional("TypeIdMap", index.TypeIdMap);
+
+ if (io.outputting()) {
+ io.mapOptional("TypeIdMap", index.TypeIdMap);
+ } else {
+ TypeIdSummaryMapTy TypeIdMap;
+ io.mapOptional("TypeIdMap", TypeIdMap);
+ for (auto &[TypeGUID, TypeIdSummaryMap] : TypeIdMap) {
+ // Save type id references in index and point TypeIdMap to use the
+ // references owned by index.
+ StringRef KeyRef = index.TypeIdSaver.save(TypeIdSummaryMap.first);
+ index.TypeIdMap.insert({TypeGUID, {KeyRef, TypeIdSummaryMap.second}});
----------------
teresajohnson wrote:
ah. ok yeah I missed the fact that you don't have the index there.
https://github.com/llvm/llvm-project/pull/106932
More information about the llvm-commits
mailing list