[llvm] 1add318 - [IR] Avoid repeated hash lookups (NFC) (#138430)

via llvm-commits llvm-commits at lists.llvm.org
Sun May 4 00:24:42 PDT 2025


Author: Kazu Hirata
Date: 2025-05-04T00:24:39-07:00
New Revision: 1add318c176b92f5daba46b3a099aff60aa8d8c8

URL: https://github.com/llvm/llvm-project/commit/1add318c176b92f5daba46b3a099aff60aa8d8c8
DIFF: https://github.com/llvm/llvm-project/commit/1add318c176b92f5daba46b3a099aff60aa8d8c8.diff

LOG: [IR] Avoid repeated hash lookups (NFC) (#138430)

Added: 
    

Modified: 
    llvm/lib/IR/DroppedVariableStats.cpp

Removed: 
    


################################################################################
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;


        


More information about the llvm-commits mailing list