[PATCH] D38154: [PassManager] Run global opts after the inliner

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 2 17:49:29 PDT 2017


mehdi_amini added a comment.

In https://reviews.llvm.org/D38154#886504, @chandlerc wrote:

> Mehdi, would you feel comfortable with this as-is?


Sure.

I put a suggestion inline though, because of interaction with `-flto=thin`



================
Comment at: lib/Transforms/IPO/PassManagerBuilder.cpp:532
+    MPM.add(createGlobalDCEPass());
+  }
+
----------------
What about moving this a little bit below and replace:

```
  // If we are planning to perform ThinLTO later, let's not bloat the code with
  // unrolling/vectorization/... now. We'll first run the inliner + CGSCC passes
  // during ThinLTO and perform the rest of the optimizations afterward.
  if (PrepareForThinLTO) {
    // Reduce the size of the IR as much as possible.
    MPM.add(createGlobalOptimizerPass());
    // Rename anon globals to be able to export them in the summary.
    MPM.add(createNameAnonGlobalPass());
    return;
  }
```

with:

```
  if (RunInliner) {
    MPM.add(createGlobalOptimizerPass());
    MPM.add(createGlobalDCEPass());
  }

  // If we are planning to perform ThinLTO later, let's not bloat the code with
  // unrolling/vectorization/... now. We'll first run the inliner + CGSCC passes
  // during ThinLTO and perform the rest of the optimizations afterward.
  if (PrepareForThinLTO) {
    // Rename anon globals to be able to export them in the summary.
    MPM.add(createNameAnonGlobalPass());
    return;
  }
```

to avoid running two times the `GlobalOptimizer`


https://reviews.llvm.org/D38154





More information about the llvm-commits mailing list