[PATCH] D19096: ThinLTO/ModuleLinker: add a flag to not always pull-in linkonce when performing importing

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 12:10:47 PDT 2016


tejohnson added inline comments.

================
Comment at: lib/Transforms/IPO/FunctionImport.cpp:424
@@ +423,3 @@
+    // Instruct the linker that the client will take care of linkonce resolution
+    unsigned Flags = Linker::Flags::DontForceLinkLinkonceODR;
+
----------------
joker.eph wrote:
> joker.eph wrote:
> > tejohnson wrote:
> > > This should be passed down from the client, not hardwired here. E.g. this resolution is not yet done in gold. E.g. pass down to importFunctions() or to FunctionImporter constructor.
> > Will update
> I've been trying to add a flag to `ComputeCrossModuleImport` to force-import referenced discardable function, but it is very intrusive to handle.
> I also tried to do it as a post-pass, but this does not work (it really can't).
> 
> Passing the flag to the FunctionImporter is wrong: this conflicts with the Import/Export list, so I don't want to go this route.
> 
> At this point, the easiest route is to force turn linkonce into weak unconditionally in clients.
> 
> Passing the flag to the FunctionImporter is wrong: this conflicts with the Import/Export list, so I don't want to go this route.

Why? I thought the very reason for adding the flag was because some clients don't currently do the linkonce resolution (and therefore can't do optimization based on the import/export list in the thin link step). 

Otherwise there was no reason to add a flag and change addLazyFor to check that instead of whether we are doing importing.


http://reviews.llvm.org/D19096





More information about the llvm-commits mailing list