[PATCH] D78845: [COFF] Add a fastpath for /INCLUDE: in .drective sections

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 24 17:53:57 PDT 2020


rnk created this revision.
rnk added reviewers: aganea, hans.
Herald added a project: LLVM.

This speeds up linking chrome.dll with PGO instrumentation by 13%
(154271ms -> 134033ms).

LLVM's Option library is very slow. In particular, it allocates at least
one large-ish heap object (Arg) for every argument. When PGO
instrumentation is enabled, all the __profd_* symbols are added to the
@llvm.used list, which compiles down to these /INCLUDE: directives. This
means we have O(#symbols) directives to parse in the section, so we end
up allocating an Arg for every function symbol in the object file. This
is unnecessary.

To address the issue and speed up the link, extend the fast path that we
already have for /EXPORT:, which has similar scaling issues.

I promise that I took a hard look at optimizing the Option library, but
its data structures are very general and would need a lot of cleanup. We
have accumulated lots of optional features (option groups, aliases,
multiple values) over the years, and these are now properties of every
parsed argument, when the vast majority of arguments do not use these
features.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78845

Files:
  lld/COFF/Driver.cpp
  lld/COFF/Driver.h
  lld/COFF/DriverUtils.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78845.260041.patch
Type: text/x-patch
Size: 4037 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200425/aa9f86d9/attachment.bin>


More information about the llvm-commits mailing list