aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-08-23 14:19:48 -0700
committerGitHub <noreply@github.com>2024-08-23 14:19:48 -0700
commit3b703d479ff37883242acc20fed317ed8a5466dc (patch)
tree2c5859a5953d399aece05c42cd020bdbb22e0dea /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parent64afbf0cbe2e7b77cc0e139cb9ccd086a7f9b930 (diff)
downloadllvm-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.cpp6
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());