[PATCH] D119909: [ELF] Parallelize initializeLocalSymbols and postpone postParse

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 22 01:43:22 PST 2022


ikudrin added a comment.

In D119909#3336805 <https://reviews.llvm.org/D119909#3336805>, @MaskRay wrote:

> Replace `getSpecificAllocSingleton<SymbolUnion>().Allocate(firstGlobal);` with `localSymStorage`.
>
> 1.02x as fast when linking clang
> 1.04x as fast when linking chrome
>
> I plan to commit the change separately to decrease diff, but for single threading there is no observable difference for performance.

Do you know where the performance gain comes from? Can the same optimization be useful elsewhere? Can `localSymStorage` be `std::unique_ptr<SymbolUnion>` to avoid the low-level manipulations with the alignment?



================
Comment at: lld/ELF/InputFiles.cpp:1160
+
+void elf::initializeLocalSymbols(ELFFileBase *file) {
+  switch (config->ekind) {
----------------
`initializeLocalSymbols()` is very similar to `postParseObjectFile()` from D119908. I believe they should be defined in the same way: both in `InputFiles.cpp` after methods they call or both in `Driver.cpp`, as static functions before `LinkerDriver::link()`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119909/new/

https://reviews.llvm.org/D119909



More information about the llvm-commits mailing list