[all-commits] [llvm/llvm-project] dabac5: [ELF][LTO] Cache symbol table of lazy BitcodeFile

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Dec 30 12:03:42 PST 2021

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dabac5feecdde0441b22a19088ac7384e4763dd1
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-12-30 (Thu, 30 Dec 2021)

  Changed paths:
    M lld/ELF/InputFiles.cpp

  Log Message:
  [ELF][LTO] Cache symbol table of lazy BitcodeFile

Similar to D62188: a BitcodeFile's symbol table may be iterated twice, once in
--start-lib (lazy) state, and once in the non-lazy state. This patch
makes `parseLazy` save `symbols[i]` so that the non-lazy state does not need to
re-insert to the global symbol table. Avoiding a redundant `saver.save` may save

`Maximum resident set size (kbytes)` for a large --thinlto-index-only link:

* without the patch: 10164000
* with the patch: 10095716 (0.6% decrease)

Note: we can remove `saver.save` if `BitcodeCompiler::add` does not transfer the ownership
of `f.obj` in `checkError(ltoObj->add(std::move(f.obj), resols));`.

Reviewed By: tejohnson

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

More information about the All-commits mailing list