This is an archive of the discontinued LLVM Phabricator instance.

[ELF][LTO] Cache symbol table of lazy BitcodeFile

Authored by MaskRay on Dec 29 2021, 9:18 PM.



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
make parseLazy save symbols[i] so that the non-lazy state does not need to
re-insert to the global symbol table. Avoiding a redundant likely
results in some memory saving.

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 if BitcodeCompiler::add does not transfer the ownership
of f.obj in checkError(ltoObj->add(std::move(f.obj), resols));.

Diff Detail

Event Timeline

MaskRay created this revision.Dec 29 2021, 9:18 PM
MaskRay requested review of this revision.Dec 29 2021, 9:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 29 2021, 9:18 PM
tejohnson accepted this revision.Dec 30 2021, 9:03 AM


Reduced memory usage of the large app I looked at by 64M (0.6%)

This revision is now accepted and ready to land.Dec 30 2021, 9:03 AM
This revision was automatically updated to reflect the committed changes.