From e1adf90826a57b674eee79b071fb46c1f5683cd0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20Storsj=C3=B6?= Date: Thu, 17 Jun 2021 16:28:47 +0300 Subject: [PATCH] [LLD] [COFF] Avoid doing repeated fuzzy symbol lookup for each iteration. NFC. This is run every time around in the main linker loop. Once a match has been found, stop trying to rematch such a symbol. Not sure if this has any actual measurable performance impact though (SymbolTable::findMangle() iterates over the whole symbol table for each call and does fuzzy matching on top of that) but this makes the code more reassuring to read at least. (This is in practice run for def files listing undecorated stdcall functions to be exported.) Differential Revision: https://reviews.llvm.org/D104529 --- lld/COFF/Driver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index 97b3c90..5eab3fb 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -549,7 +549,7 @@ Symbol *LinkerDriver::addUndefined(StringRef name) { StringRef LinkerDriver::mangleMaybe(Symbol *s) { // If the plain symbol name has already been resolved, do nothing. Undefined *unmangled = dyn_cast(s); - if (!unmangled) + if (!unmangled || unmangled->getWeakAlias()) return ""; // Otherwise, see if a similar, mangled symbol exists in the symbol table. -- 2.7.4