[llvm] [Bitcode] Avoid repeated hash lookups (NFC) (PR #107708)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 7 09:57:34 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/107708
None
>From 2c3655539bc9e8d2b9620a21746368d14e5a5f38 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 7 Sep 2024 09:50:17 -0700
Subject: [PATCH] [Bitcode] Avoid repeated hash lookups (NFC)
---
llvm/lib/Bitcode/Reader/MetadataLoader.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
index 7d7b224a17d3b8..5b3b63c2d1e4eb 100644
--- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
+++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
@@ -536,9 +536,8 @@ class MetadataLoader::MetadataLoaderImpl {
DenseSet<DILocalScope *> Visited;
while (S && !isa<DISubprogram>(S)) {
S = dyn_cast_or_null<DILocalScope>(S->getScope());
- if (Visited.contains(S))
+ if (!Visited.insert(S).second)
break;
- Visited.insert(S);
}
ParentSubprogram[InitialScope] = llvm::dyn_cast_or_null<DISubprogram>(S);
More information about the llvm-commits
mailing list