[PATCH] D15390: [ThinLTO] Launch importing backends in parallel threads from gold plugin

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 11 08:05:17 PST 2015


tejohnson added a comment.

In http://reviews.llvm.org/D15390#308252, @tejohnson wrote:

> Biggest change in this update is due to gold not being thread-safe
>  by default, requiring lots of refactoring to make gold callbacks in
>  single-threaded mode.
>
> Also changed from std::thread to the thread wrapper in LLVM, which
>  handles !LLVM_ENABLE_THREADS.
>
> Some test updates to test both single and multi-threaded handling.
>
> I have not refactored any of the code out of gold yet. Doing so will
>  require refactoring out other routines, such as codegenImpl and
>  its callees such as runLTOPasses, or invoking via a callback.
>  There is some overlap between the handling in these routines and
>  handling that exists currently in LTOCodeGenerator, which we could
>  refactor out of both. I'm not sure where the best place to put the
>  refactored code is, maybe lib/CodeGen (which is where splitCodeGen lives)?


It is more than just codegenImpl, but also getModuleForFile that would have to be refactored out of gold. Right now looking at the ThinLTO thread handling in gold as well as the LTO pass and codegen invocations in libLTO (LTOCodeGenerator), I don't think we gain much by refactoring this out. The actual thread handling in gold is pretty minimal, and very specific to gold. So I'd prefer to keep this in the gold plugin at least for now.


http://reviews.llvm.org/D15390





More information about the llvm-commits mailing list