[all-commits] [llvm/llvm-project] 270d3f: [COFF] Add and use a zero-copy tokenizer for .drectve

Reid Kleckner via All-commits all-commits at lists.llvm.org
Sat May 2 10:47:19 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 270d3faf6e0d09ec00ba51b46241534bc6455256
      https://github.com/llvm/llvm-project/commit/270d3faf6e0d09ec00ba51b46241534bc6455256
  Author: Reid Kleckner <rnk at google.com>
  Date:   2020-05-02 (Sat, 02 May 2020)

  Changed paths:
    M lld/COFF/DriverUtils.cpp
    M llvm/include/llvm/Support/CommandLine.h
    M llvm/lib/Support/CommandLine.cpp

  Log Message:
  -----------
  [COFF] Add and use a zero-copy tokenizer for .drectve

This generalizes the main Windows command line tokenizer to be able to
produce StringRef substrings as well as freshly copied C strings. The
implementation is still shared with the normal tokenizer, which is
important, because we have unit tests for that.

.drective sections can be very long. They can potentially list up to
every symbol in the object file by name. It is worth avoiding these
string copies.

This saves a lot of memory when linking chrome.dll with PGO
instrumentation:

             BEFORE      AFTER      % IMP
peak memory: 6657.76MB   4983.54MB  -25%
real:        4m30.875s   2m26.250s  -46%

The time improvement may not be real, my machine was noisy while running
this, but that the peak memory usage improvement should be real.

This change may also help apps that heavily use dllexport annotations,
because those also use linker directives in object files. Apps that do
not use many directives are unlikely to be affected.

Reviewed By: thakis

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




More information about the All-commits mailing list