diff options
author | Vitaly Buka <vitalybuka@google.com> | 2025-03-07 14:48:00 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-07 14:48:00 -0800 |
commit | e4a6e2eb7176e677eb9a9c45913a284d374d60c5 (patch) | |
tree | 1efb24938f07cb8b40e20f01480b2d047f45a4ed /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 356bbb0b2527ba929ac239596b361d257a411d2a (diff) | |
download | llvm-e4a6e2eb7176e677eb9a9c45913a284d374d60c5.zip llvm-e4a6e2eb7176e677eb9a9c45913a284d374d60c5.tar.gz llvm-e4a6e2eb7176e677eb9a9c45913a284d374d60c5.tar.bz2 |
[NFC][IR] Remove redundant .empty() check (#130352)
Preparation for CFI Index refactoring,
which will fix O(N^2) in ThinLTO indexing.
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index a3556af..bddc2cd 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -5064,33 +5064,29 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() { getReferencedTypeIds(FS, ReferencedTypeIds); } - if (!Index.cfiFunctionDefs().empty()) { - for (auto &S : Index.cfiFunctionDefs()) { - if (DefOrUseGUIDs.contains( - GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(S)))) { - NameVals.push_back(StrtabBuilder.add(S)); - NameVals.push_back(S.size()); - } - } - if (!NameVals.empty()) { - Stream.EmitRecord(bitc::FS_CFI_FUNCTION_DEFS, NameVals); - NameVals.clear(); + for (auto &S : Index.cfiFunctionDefs()) { + if (DefOrUseGUIDs.contains( + GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(S)))) { + NameVals.push_back(StrtabBuilder.add(S)); + NameVals.push_back(S.size()); } } + if (!NameVals.empty()) { + Stream.EmitRecord(bitc::FS_CFI_FUNCTION_DEFS, NameVals); + NameVals.clear(); + } - if (!Index.cfiFunctionDecls().empty()) { - for (auto &S : Index.cfiFunctionDecls()) { - if (DefOrUseGUIDs.contains( - GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(S)))) { - NameVals.push_back(StrtabBuilder.add(S)); - NameVals.push_back(S.size()); - } - } - if (!NameVals.empty()) { - Stream.EmitRecord(bitc::FS_CFI_FUNCTION_DECLS, NameVals); - NameVals.clear(); + for (auto &S : Index.cfiFunctionDecls()) { + if (DefOrUseGUIDs.contains( + GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(S)))) { + NameVals.push_back(StrtabBuilder.add(S)); + NameVals.push_back(S.size()); } } + if (!NameVals.empty()) { + Stream.EmitRecord(bitc::FS_CFI_FUNCTION_DECLS, NameVals); + NameVals.clear(); + } // Walk the GUIDs that were referenced, and write the // corresponding type id records. |