diff options
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 96e1d49..837f883 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -3688,20 +3688,19 @@ void ModuleBitcodeWriterBase::writeModuleLevelReferences( // been initialized from a DenseSet. llvm::sort(NameVals.begin() + SizeBeforeRefs, NameVals.end()); - if (!VTableFuncs.empty()) { + if (VTableFuncs.empty()) + Stream.EmitRecord(bitc::FS_PERMODULE_GLOBALVAR_INIT_REFS, NameVals, + FSModRefsAbbrev); + else { // VTableFuncs pairs should already be sorted by offset. for (auto &P : VTableFuncs) { NameVals.push_back(VE.getValueID(P.FuncVI.getValue())); NameVals.push_back(P.VTableOffset); } - } - if (VTableFuncs.empty()) - Stream.EmitRecord(bitc::FS_PERMODULE_GLOBALVAR_INIT_REFS, NameVals, - FSModRefsAbbrev); - else Stream.EmitRecord(bitc::FS_PERMODULE_VTABLE_GLOBALVAR_INIT_REFS, NameVals, FSModVTableRefsAbbrev); + } NameVals.clear(); } @@ -3854,14 +3853,12 @@ void ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() { NameVals.clear(); } - if (!Index->typeIdCompatibleVtableMap().empty()) { - for (auto &S : Index->typeIdCompatibleVtableMap()) { - writeTypeIdCompatibleVtableSummaryRecord(NameVals, StrtabBuilder, S.first, - S.second, VE); - Stream.EmitRecord(bitc::FS_TYPE_ID_METADATA, NameVals, - TypeIdCompatibleVtableAbbrev); - NameVals.clear(); - } + for (auto &S : Index->typeIdCompatibleVtableMap()) { + writeTypeIdCompatibleVtableSummaryRecord(NameVals, StrtabBuilder, S.first, + S.second, VE); + Stream.EmitRecord(bitc::FS_TYPE_ID_METADATA, NameVals, + TypeIdCompatibleVtableAbbrev); + NameVals.clear(); } Stream.ExitBlock(); |