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

Tarun Prabhu via flang-commits flang-commits at lists.llvm.org
Wed Oct 22 10:14:47 PDT 2025


================
@@ -1019,24 +1019,40 @@ void CodeGenAction::runOptimizationPipeline(llvm::raw_pwrite_stream &os) {
 
   // Create the pass manager.
   llvm::ModulePassManager mpm;
-  if (opts.PrepareForFatLTO) {
-    // 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;
+  // The module summary should be emitted by default for regular LTO
+  // except for ld64 targets.
+  bool emitSummary = (opts.PrepareForThinLTO || opts.PrepareForFullLTO) &&
----------------
tarunprabhu wrote:

I was thinking that since `emitSummary` is ignored in the `if (opts.PrepareForThinLTO)` branch on line 1038, the code should look like this for now:

```
bool emitSummary = opts.PrepareForFullLTO &&
                       triple.getVendor() != llvm::Triple::Apple;
```

When support for summaries with ThinLTO is implemented, it can become:

```
bool emitSummary = (opts.PrepareForThinLTO || opts.PrepareForFullLTO) &&
                       triple.getVendor() != llvm::Triple::Apple;
```

However, since you intend to work on enabling summaries for thin LTO right away (if I understand you correctly), it should be ok to leave this code as it is. Otherwise, it can be a bit confusing. 

What do you think?

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


More information about the flang-commits mailing list