[lld] e1adf90 - [LLD] [COFF] Avoid doing repeated fuzzy symbol lookup for each iteration. NFC.
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 19 12:32:48 PDT 2021
Author: Martin Storsjö
Date: 2021-06-19T22:32:37+03:00
New Revision: e1adf90826a57b674eee79b071fb46c1f5683cd0
URL: https://github.com/llvm/llvm-project/commit/e1adf90826a57b674eee79b071fb46c1f5683cd0
DIFF: https://github.com/llvm/llvm-project/commit/e1adf90826a57b674eee79b071fb46c1f5683cd0.diff
LOG: [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
Added:
Modified:
lld/COFF/Driver.cpp
Removed:
################################################################################
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 97b3c9029e34f..5eab3fbbde069 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<Undefined>(s);
- if (!unmangled)
+ if (!unmangled || unmangled->getWeakAlias())
return "";
// Otherwise, see if a similar, mangled symbol exists in the symbol table.
More information about the llvm-commits
mailing list