From e684090733fc5801d98fbae3876e745eb4d97244 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 11 Jan 2025 17:55:29 -0800 Subject: [PATCH] [wasm] Avoid repeated hash lookups (NFC) --- lld/wasm/SymbolTable.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp index f57359083d242fe..6309cf35fe5523a 100644 --- a/lld/wasm/SymbolTable.cpp +++ b/lld/wasm/SymbolTable.cpp @@ -1009,8 +1009,8 @@ void SymbolTable::handleWeakUndefines() { } DefinedFunction *SymbolTable::createUndefinedStub(const WasmSignature &sig) { - if (stubFunctions.count(sig)) - return stubFunctions[sig]; + if (auto it = stubFunctions.find(sig); it != stubFunctions.end()) + return it->second; LLVM_DEBUG(dbgs() << "createUndefinedStub: " << toString(sig) << "\n"); auto *sym = reinterpret_cast(make()); sym->isUsedInRegularObj = true;