[PATCH] D95222: [LTOBackend] Return module when Parallelism Level == 1.

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 22 14:37:04 PST 2021


tejohnson added a comment.

In D95222#2516447 <https://reviews.llvm.org/D95222#2516447>, @fhahn wrote:

> In D95222#2516413 <https://reviews.llvm.org/D95222#2516413>, @tejohnson wrote:
>
>> Where/how is the returned module used in that case? How do you avoid having it accessed later in the parallel code gen case?
>
> We should be able to use the returned module in the ParallelismLevel == 1 case, where we just pass a reference of the module to `codegen`. I think this behavior is needed for D94487 <https://reviews.llvm.org/D94487> (llvm/lib/LTO/LTOCodeGenerator.cpp around line 608). This is a bit fragile/messy unfortunately, but I think we need it to preserve the existing libLTO behavior. It is also similar to the behavior of the previously used `splitCodeGen` `https://github.com/llvm/llvm-project/blob/master/llvm/lib/CodeGen/ParallelCG.cpp#L49`. But perhaps there's a better way to factor this out.

I see where it is resetting MergedModule at line 608 in that patch, but not where it is used afterwards. It seems a bit fragile to me that the MergedModule would be valid when parallel code gen is off and not when it is. Does anything break if MergedModule is not set again after calling backend()?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95222



More information about the llvm-commits mailing list