[lld] 690b8b4 - [lld] Avoid repeated map lookups (NFC) (#132327)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 21 02:24:46 PDT 2025


Author: Kazu Hirata
Date: 2025-03-21T17:24:43+08:00
New Revision: 690b8b4e942e28988fc35bfd13ddc69db20b8de9

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

LOG: [lld] Avoid repeated map lookups (NFC) (#132327)

Added: 
    

Modified: 
    lld/COFF/Writer.cpp

Removed: 
    


################################################################################
diff  --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp
index f488721106e15..6ed1f884a9636 100644
--- a/lld/COFF/Writer.cpp
+++ b/lld/COFF/Writer.cpp
@@ -1278,8 +1278,7 @@ void Writer::createImportTables() {
       continue;
 
     std::string dll = StringRef(file->dllName).lower();
-    if (ctx.config.dllOrder.count(dll) == 0)
-      ctx.config.dllOrder[dll] = ctx.config.dllOrder.size();
+    ctx.config.dllOrder.try_emplace(dll, ctx.config.dllOrder.size());
 
     if (file->impSym && !isa<DefinedImportData>(file->impSym))
       Fatal(ctx) << file->symtab.printSymbol(file->impSym) << " was replaced";


        


More information about the llvm-commits mailing list