[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 memory. `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
Loading
Please register or sign in to comment