[LLVMdev] [Proposal] Parallelize post-IPO stage.

Shuxin Yang shuxin.llvm at gmail.com
Tue Jul 16 12:47:44 PDT 2013

I recall another reason for not adding the functionality about cloning 
functions across LLVMContexts.

Currently, LTO merges all stuff together into a "merged module" before 
IPO and post-IPO starts.

I believe this have to change in the future if we need to improve the 
scalarbility.  As with other compilers,
we only care "merged symbol table" and "merged call-graph" in some 
passes, and load some of the
merged module on-demand.

I guess function-cloning need some changes if we switch to that mode.  
So for now, we are better using
whatever we have today, instead mess around implementing something that 
are about to change in the future.

 >  2) In order to compile each partition in each separate thread (see
>>>      Section 3.2), we have to put partitions in distinct LLVMContext.
>>>      I could be wrong, but I don't find the code which is able to
>>>      perform function cloning across LLVMContext.
>>>      My workaround in the patch is to perform function cloning in
>>>     one LLVMContext (but in different Module, of course), then
>>>     save the module to disk file, and load it to memory using a
>>>     new LLVMContext.
>>>      It is bit circuitous and expensive.
>> Do you plan to fix this? What are the issues that prevented function 
>> cloning across multiple LLVMContexts?
>> Evan
> We may fix it, I don't know for sure if it is a big gain at this moment.
> If issues is that, as far as I can tell, current code base dose not 
> have functions support copying
> IR across different LLVMContext.
> For example, when it copy an instruction from src to dest,
> it check the "src", take a look of of its Type, and derive LLVMContext 
> from the Type, and use
> the same context for the dest. So, we need to change the existing code.

More information about the llvm-dev mailing list