[llvm] b32cf76 - [Scalar] Avoid repeated hash lookups (NFC) (#129989)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 7 00:58:49 PST 2025


Author: Kazu Hirata
Date: 2025-03-07T00:58:46-08:00
New Revision: b32cf76d8fa073b95fbb2ad5c45be117332006d3

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

LOG: [Scalar] Avoid repeated hash lookups (NFC) (#129989)

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/GuardWidening.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/GuardWidening.cpp b/llvm/lib/Transforms/Scalar/GuardWidening.cpp
index 2978b7990a6eb..3ba5b79293bcd 100644
--- a/llvm/lib/Transforms/Scalar/GuardWidening.cpp
+++ b/llvm/lib/Transforms/Scalar/GuardWidening.cpp
@@ -665,8 +665,8 @@ Value *GuardWideningImpl::freezeAndPush(Value *Orig,
       CacheOfFreezes[Def] = FI;
     }
 
-    if (CacheOfFreezes.count(Def))
-      U.set(CacheOfFreezes[Def]);
+    if (auto It = CacheOfFreezes.find(Def); It != CacheOfFreezes.end())
+      U.set(It->second);
     return true;
   };
 


        


More information about the llvm-commits mailing list