[PATCH] D79390: [Support] Sink LLD's parallel algorithm wrappers to support

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 11:20:16 PDT 2020


rnk updated this revision to Diff 262175.
rnk added a comment.
Herald added subscribers: Kayjukh, frgossen, grosul1, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, jpienaar, rriddle, mehdi_amini, eraman.
Herald added a reviewer: rriddle.

- Drop policy parameter

While doing this, I may have re-discovered the reason that the committee
designed the APIs this way. With the parameter, you can use ADL to write this:

  sort(parallel::par, vec.begin(), vec.end(), ...);
  for_each(parallel::par, vec.begin(), vec.end(), ...);

You can even do `using namespace (llvm|std)::parallel;` and write this:

  sort(par, vec.begin(), vec.end(), ...);

If you drop the policy parameter, using the llvm::parallel namespace becomes
almost impossible because it makes every unqualified call to `sort` ambiguous.

WDYT? I would be happy to go back and rewrite all the code to this:

  sort([llvm::]parallel::par, ...);

As in, drop the "parallel::" prefix from "parallel::sort(...)", and rely on
ADL. Maybe that is too tricky, though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79390

Files:
  lld/COFF/Driver.cpp
  lld/COFF/ICF.cpp
  lld/COFF/LLDMapFile.cpp
  lld/COFF/MapFile.cpp
  lld/COFF/PDB.cpp
  lld/COFF/Writer.cpp
  lld/Common/ErrorHandler.cpp
  lld/Common/Filesystem.cpp
  lld/ELF/Driver.cpp
  lld/ELF/ICF.cpp
  lld/ELF/LinkerScript.cpp
  lld/ELF/MapFile.cpp
  lld/ELF/OutputSections.cpp
  lld/ELF/SyntheticSections.cpp
  lld/ELF/Writer.cpp
  lld/include/lld/Common/Threads.h
  lld/lib/ReaderWriter/MachO/LayoutPass.cpp
  lld/wasm/Driver.cpp
  lld/wasm/OutputSections.cpp
  lld/wasm/Writer.cpp
  llvm/include/llvm/Support/Parallel.h
  llvm/unittests/Support/ParallelTest.cpp
  mlir/docs/Diagnostics.md
  mlir/lib/Pass/Pass.cpp
  mlir/lib/Transforms/Inliner.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79390.262175.patch
Type: text/x-patch
Size: 31493 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200505/fbc36bb7/attachment.bin>


More information about the llvm-commits mailing list