[llvm] [clang] [clang][llvm][fatlto] Avoid cloning modules in FatLTO (PR #72180)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 27 14:43:15 PST 2023


================
@@ -810,7 +810,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
   // Only enable CGProfilePass when using integrated assembler, since
   // non-integrated assemblers don't recognize .cgprofile section.
   PTO.CallGraphProfile = !CodeGenOpts.DisableIntegratedAS;
-  PTO.UnifiedLTO = CodeGenOpts.UnifiedLTO;
+  PTO.UnifiedLTO = CodeGenOpts.UnifiedLTO || CodeGenOpts.FatLTO;
----------------
ilovepi wrote:

Ah, I remember why I did this now.  The code in `Driver/Toolchains/Clang.cpp` set things nicely from `clang`, but didn't handle `cc1`. I believe that is because these are both CodeGenOpts defined in the TableGen files.

This feels like it ought to be simple, but the driver bits have never been that intuitive to me. I *think* if I wanted to handle this directly, then I'd need to supply the implementation for both FatLTO and UnifiedLTO instead of relying on the TableGened impl, which seems worse than the current version. 

Do you have any thoughts on a nicer way to avoid the redundant code here?  Maybe we don't need the changes to `Driver/Toolchains/Clang.cpp`?

https://github.com/llvm/llvm-project/pull/72180


More information about the cfe-commits mailing list