[flang-commits] [flang] [Flang][Driver] Emit module summary for LTO (PR #164302)

Tarun Prabhu via flang-commits flang-commits at lists.llvm.org
Mon Oct 20 18:00:25 PDT 2025


================
@@ -1019,11 +1019,15 @@ void CodeGenAction::runOptimizationPipeline(llvm::raw_pwrite_stream &os) {
 
   // Create the pass manager.
   llvm::ModulePassManager mpm;
+  // The module summary should be emitted by default for regular LTO
+  // except for ld64 targets.
+  bool emitSummary = (opts.PrepareForThinLTO || opts.PrepareForFullLTO) &&
+                     (triple.getVendor() != llvm::Triple::Apple);
+
+  if (emitSummary && !opts.PrepareForThinLTO)
----------------
tarunprabhu wrote:

I don't follow the logic here. If `PrepareForThinLTO` is `false`, then metadata named "ThinLTO" is added with a value of 0. Admittedly, I am not very familiar with the details of the LTO implementation in LLVM, so maybe I am missing something obvious.

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


More information about the flang-commits mailing list