aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-09-07 11:23:15 -0700
committerGitHub <noreply@github.com>2024-09-07 11:23:15 -0700
commit6f6100f19ca1fc130a9c2bd2586d136805eafa89 (patch)
tree11ceebd3031b67768fb3c82517f37710c90a54a5 /llvm/lib/Bitcode/Reader/MetadataLoader.cpp
parent51d3829d8fc5beba269629903365af75174de7f6 (diff)
downloadllvm-6f6100f19ca1fc130a9c2bd2586d136805eafa89.zip
llvm-6f6100f19ca1fc130a9c2bd2586d136805eafa89.tar.gz
llvm-6f6100f19ca1fc130a9c2bd2586d136805eafa89.tar.bz2
[Bitcode] Avoid repeated hash lookups (NFC) (#107708)
Diffstat (limited to 'llvm/lib/Bitcode/Reader/MetadataLoader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/MetadataLoader.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
index 7d7b224..5b3b63c 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);