[PATCH] D15025: [ThinLTO] Option to invoke ThinLTO backend passes and importing

Mehdi Amini via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 09:15:30 PST 2015


> On Dec 4, 2015, at 9:14 AM, Teresa Johnson <tejohnson at google.com> wrote:
> 
> tejohnson added inline comments.
> 
> ================
> Comment at: lib/CodeGen/CodeGenAction.cpp:822
> @@ +821,3 @@
> +      TheModule = std::move(Combined);
> +    }
> +
> ----------------
> joker.eph wrote:
>> tejohnson wrote:
>>> joker.eph wrote:
>>>> tejohnson wrote:
>>>>> joker.eph wrote:
>>>>>> Could we refactor this in a helper in llvm?
>>>>> I can create a new Linker interface that takes the index path, builds the index, does the link and returns the ErrorOr index.
>>>> I was thinking about a free function that would be something like: `std::unique_ptr<Module> llvm::renameModuleForThinLTO(std::unique_ptr<Module> &M, const FunctionInfoIndex &Index);`
>>>> 
>>> We also need to get the Index back so that it can be passed down to EmitBackendOutput below (to get it on the pass manager builder). So what I was thinking was create the Combined Module unique_ptr here and pass it in (as we do currently for LinkModules), and return the std::unique_ptr<FunctionInfoIndex> .
>> You pass a reference to the index, you already have it.
> Oh I see, you are just talking about the Combined module creation and LinkModules call.
> 
> I was thinking you meant refactor out the getFunctionIndexForFile + LinkModules. Just doing the module creation and LinkModules is easier, will do that.
> 

Yeah the idea is to abstract away this step that I want us to be able to do in place in some future :)

Thanks,

— 
Mehdi



More information about the cfe-commits mailing list