[llvm] [WebAssembly] Avoid repeated hash lookups (NFC) (PR #112124)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 12 22:28:17 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/112124

None

>From 79e6c768402e45212ec8a05442f0920d9735ba28 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 12 Oct 2024 22:24:05 -0700
Subject: [PATCH] [WebAssembly] Avoid repeated hash lookups (NFC)

---
 .../Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
index b999f83507f4ce..493e391964ac14 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
@@ -575,8 +575,9 @@ Function *WebAssemblyLowerEmscriptenEHSjLj::getInvokeWrapper(CallBase *CI) {
   FunctionType *CalleeFTy = CI->getFunctionType();
 
   std::string Sig = getSignature(CalleeFTy);
-  if (InvokeWrappers.contains(Sig))
-    return InvokeWrappers[Sig];
+  auto It = InvokeWrappers.find(Sig);
+  if (It != InvokeWrappers.end())
+    return It->second;
 
   // Put the pointer to the callee as first argument
   ArgTys.push_back(PointerType::getUnqual(CalleeFTy));



More information about the llvm-commits mailing list