[PATCH] D31101: [ThinLTO] Use clang's existing code gen handling for ThinLTO backends

Teresa Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 30 13:37:59 PDT 2017


tejohnson added inline comments.


================
Comment at: lib/CodeGen/BackendUtil.cpp:1007
   else
     AsmHelper.EmitAssembly(Action, std::move(OS));
 
----------------
tejohnson wrote:
> I just noticed that EmitAssembly does a lot more than just emission - it is also setting up an optimization pipeline in CreatePasses, which we don't want to do in the ThinLTO backend case as we already do the opt in LTO. Which makes me think that the simplest and most consistent solution, especially if as in discussed in D31114 we'll be using the LTO API for emitting object and assembly code, is to use LTO for all file emission in the ThinLTO backend case. It would mean extending lto::Config to be able to flag when we want to emit-llvm or emit-llvm-bc, and invoke the appropriate module writer/printer instead of normal codegen. That way -emit-llvm* will always get output corresponding to the native object/assembly in the ThinLTO backend case. WDYT?
I have a new patch set that will do just this that I am uploading momentarily


https://reviews.llvm.org/D31101





More information about the cfe-commits mailing list