From a93ab1fb59da5caec1a7bd12732096d1c31830a6 Mon Sep 17 00:00:00 2001 From: Kazu Hirata <kazu@google.com> Date: Thu, 20 Mar 2025 09:45:17 -0700 Subject: [PATCH] [lld] Avoid repeated map lookups (NFC) --- lld/COFF/Writer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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";