[llvm] [IR] Avoid repeated hash lookups (NFC) (PR #138430)
via llvm-commits
llvm-commits at lists.llvm.org
Sat May 3 18:04:01 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/138430.diff
1 Files Affected:
- (modified) llvm/lib/IR/DroppedVariableStats.cpp (+1-2)
``````````diff
diff --git a/llvm/lib/IR/DroppedVariableStats.cpp b/llvm/lib/IR/DroppedVariableStats.cpp
index 9e221bf585f1a..b8c0dd6e7b1dc 100644
--- a/llvm/lib/IR/DroppedVariableStats.cpp
+++ b/llvm/lib/IR/DroppedVariableStats.cpp
@@ -117,8 +117,7 @@ void DroppedVariableStats::removeVarFromAllSets(VarID Var, const Function *F) {
bool DroppedVariableStats::isScopeChildOfOrEqualTo(const DIScope *Scope,
const DIScope *DbgValScope) {
while (Scope != nullptr) {
- if (VisitedScope.find(Scope) == VisitedScope.end()) {
- VisitedScope.insert(Scope);
+ if (VisitedScope.insert(Scope).second) {
if (Scope == DbgValScope) {
VisitedScope.clear();
return true;
``````````
</details>
https://github.com/llvm/llvm-project/pull/138430
More information about the llvm-commits
mailing list