diff options
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index b8444bc86d7..0d23bcaab56 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -3903,12 +3903,13 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() { NameVals.clear(); } - if (!Index.typeIds().empty()) { - for (auto &S : Index.typeIds()) { - // Skip if not referenced in any GV summary within this index file. - if (!ReferencedTypeIds.count(GlobalValue::getGUID(S.first))) - continue; - writeTypeIdSummaryRecord(NameVals, StrtabBuilder, S.first, S.second); + // Walk the GUIDs that were referenced, and write the + // corresponding type id records. + for (auto &T : ReferencedTypeIds) { + auto TidIter = Index.typeIds().equal_range(T); + for (auto It = TidIter.first; It != TidIter.second; ++It) { + writeTypeIdSummaryRecord(NameVals, StrtabBuilder, It->second.first, + It->second.second); Stream.EmitRecord(bitc::FS_TYPE_ID, NameVals); NameVals.clear(); } |