diff options
author | Kazu Hirata <kazu@google.com> | 2024-08-23 14:19:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-23 14:19:48 -0700 |
commit | 3b703d479ff37883242acc20fed317ed8a5466dc (patch) | |
tree | 2c5859a5953d399aece05c42cd020bdbb22e0dea /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 64afbf0cbe2e7b77cc0e139cb9ccd086a7f9b930 (diff) | |
download | llvm-3b703d479ff37883242acc20fed317ed8a5466dc.zip llvm-3b703d479ff37883242acc20fed317ed8a5466dc.tar.gz llvm-3b703d479ff37883242acc20fed317ed8a5466dc.tar.bz2 |
[Bitcode] Use DenseSet instead of std::set (NFC) (#105851)
DefOrUseGUIDs is used only for membership checking purposes. We don't
need std::set's strengths like iterators staying valid or the ability
to traverse in a sorted order.
While I am at it, this patch replaces count with contains for slightly
increased readability.
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 03d0537..20737c0 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -4628,7 +4628,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() { NameVals.clear(); }; - std::set<GlobalValue::GUID> DefOrUseGUIDs; + DenseSet<GlobalValue::GUID> DefOrUseGUIDs; forEachSummary([&](GVInfo I, bool IsAliasee) { GlobalValueSummary *S = I.second; assert(S); @@ -4777,7 +4777,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() { if (!Index.cfiFunctionDefs().empty()) { for (auto &S : Index.cfiFunctionDefs()) { - if (DefOrUseGUIDs.count( + if (DefOrUseGUIDs.contains( GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(S)))) { NameVals.push_back(StrtabBuilder.add(S)); NameVals.push_back(S.size()); @@ -4791,7 +4791,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() { if (!Index.cfiFunctionDecls().empty()) { for (auto &S : Index.cfiFunctionDecls()) { - if (DefOrUseGUIDs.count( + if (DefOrUseGUIDs.contains( GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(S)))) { NameVals.push_back(StrtabBuilder.add(S)); NameVals.push_back(S.size()); |