[llvm] [Scalar] Avoid repeated hash lookups (NFC) (PR #129989)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 5 21:55:38 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/129989
None
>From 862b1587f83f5729c34ab15549826a1d4e8ebc5b Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 5 Mar 2025 09:03:50 -0800
Subject: [PATCH] [Scalar] Avoid repeated hash lookups (NFC)
---
llvm/lib/Transforms/Scalar/GuardWidening.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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