[PATCH] D79390: [Support] Sink LLD's parallel algorithm wrappers to support
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 4 22:04:11 PDT 2020
MaskRay added a comment.
> Add range overloads
> Use the sequential algorithm directly when 1 thread is requested (skips task grouping)
> Fix the index type of for_each_n to size_t. Nobody in LLVM was using any other parameter, and it made overload resolution hard for for_each_n(par, 0, foo.size(), ...) because 0 is int, not size_t.
These changes all look good to me. I have a question regarding the intended usage:
================
Comment at: lld/COFF/LLDMapFile.cpp:77
std::vector<std::string> str(syms.size());
- parallelForEachN((size_t)0, syms.size(), [&](size_t i) {
+ parallel::for_each_n(parallel::par, (size_t)0, syms.size(), [&](size_t i) {
raw_string_ostream os(str[i]);
----------------
Isn't `parallel::par` redundant? Can we just use
`parallel::for_each_n((size_t)0, syms.size(), [&](size_t i) { ... })` ?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79390/new/
https://reviews.llvm.org/D79390
More information about the llvm-commits
mailing list