[llvm] [Scalar] Avoid repeated hash lookups (NFC) (PR #112486)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 15 23:43:41 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/112486
None
>From 4d3cb294b2d8870fa67134415f47c8d28028ac67 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 15 Oct 2024 23:39:40 -0700
Subject: [PATCH] [Scalar] Avoid repeated hash lookups (NFC)
---
llvm/lib/Transforms/Scalar/Float2Int.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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