[all-commits] [llvm/llvm-project] 01b5f5: [COFF] Add a fastpath for /INCLUDE: in .drective s...

Reid Kleckner via All-commits all-commits at lists.llvm.org
Tue Apr 28 10:36:17 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 01b5f521408d943dcb05455c5168ae19bcfaa98a
      https://github.com/llvm/llvm-project/commit/01b5f521408d943dcb05455c5168ae19bcfaa98a
  Author: Reid Kleckner <rnk at google.com>
  Date:   2020-04-28 (Tue, 28 Apr 2020)

  Changed paths:
    M lld/COFF/Driver.cpp
    M lld/COFF/Driver.h
    M lld/COFF/DriverUtils.cpp

  Log Message:
  -----------
  [COFF] Add a fastpath for /INCLUDE: in .drective sections

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.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D78845




More information about the All-commits mailing list