[lld] fd87188 - [wasm] Avoid repeated hash lookups (NFC) (#122626)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 12 11:06:59 PST 2025


Author: Kazu Hirata
Date: 2025-01-12T11:06:56-08:00
New Revision: fd87188c2bbbdd283b286daea2b9bd5c6605f7e1

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

LOG: [wasm] Avoid repeated hash lookups (NFC) (#122626)

Added: 
    

Modified: 
    lld/wasm/SymbolTable.cpp

Removed: 
    


################################################################################
diff  --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp
index f57359083d242f..6309cf35fe5523 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<DefinedFunction *>(make<SymbolUnion>());
   sym->isUsedInRegularObj = true;


        


More information about the llvm-commits mailing list