[PATCH] D133003: [ELF] Parallelize relocation scanning
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 11 11:00:25 PDT 2022
MaskRay marked an inline comment as done.
MaskRay added inline comments.
================
Comment at: lld/ELF/Relocations.cpp:1559
+ };
+ if (serial)
+ fn();
----------------
andrewng wrote:
> MaskRay wrote:
> > andrewng wrote:
> > > MaskRay wrote:
> > > > andrewng wrote:
> > > > > I wonder if it might be worthwhile using the previous code for the serial case? Although, it probably doesn't make a big difference to performance.
> > > > Use which piece of code for the serial case?
> > > I was thinking this:
> > > ```
> > > for (InputSectionBase *sec : inputSections)
> > > if (sec->isLive() && (sec->flags & SHF_ALLOC))
> > > scanner.template scanSection<ELFT>(*sec);
> > > ```
> > > But on the other hand, in terms of future development and maintenance, it's probably better to use as much of the same code for both "paths", even if there's a minor performance penalty for the serial one.
> > Yes, using the same code for both paths is better for maintenance.
> Yes, I think I agree. If it only affected the single threaded case, I wouldn't have mentioned it. But as there are specific configurations that are limited to serial I thought that it might be worth considering.
Add the comment before the `tg.execute([] {` line?
```
+ // Both the main thread and thread pool index 0 use threadIndex==0. Be
+ // careful that they don't concurrently run scanSections. When serial is
+ // true, fn() has finished at this point, so running execute is safe
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133003/new/
https://reviews.llvm.org/D133003
More information about the llvm-commits
mailing list