[llvm] 9128077 - [Scalar] Avoid repeated hash lookups (NFC) (#112486)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 06:41:22 PDT 2024


Author: Kazu Hirata
Date: 2024-10-16T06:41:19-07:00
New Revision: 9128077c88f0112b4a5b1f64922247793250001b

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

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/Float2Int.cpp b/llvm/lib/Transforms/Scalar/Float2Int.cpp
index 98ecbe400543e1..9d23c899430095 100644
--- a/llvm/lib/Transforms/Scalar/Float2Int.cpp
+++ b/llvm/lib/Transforms/Scalar/Float2Int.cpp
@@ -398,9 +398,9 @@ bool Float2IntPass::validateAndTransform(const DataLayout &DL) {
 }
 
 Value *Float2IntPass::convert(Instruction *I, Type *ToTy) {
-  if (ConvertedInsts.contains(I))
+  if (auto It = ConvertedInsts.find(I); It != ConvertedInsts.end())
     // Already converted this instruction.
-    return ConvertedInsts[I];
+    return It->second;
 
   SmallVector<Value*,4> NewOperands;
   for (Value *V : I->operands()) {


        


More information about the llvm-commits mailing list