[PATCH] D104529: [LLD] [COFF] Avoid doing repeated fuzzy symbol lookup for each iteration. NFC.

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 18 06:05:04 PDT 2021


mstorsjo created this revision.
mstorsjo added a reviewer: rnk.
mstorsjo requested review of this revision.
Herald added a project: LLVM.

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.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104529

Files:
  lld/COFF/Driver.cpp


Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -549,7 +549,7 @@
 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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104529.352988.patch
Type: text/x-patch
Size: 496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210618/f1ad0906/attachment.bin>


More information about the llvm-commits mailing list