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

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 2 18:02:03 PDT 2017


chandlerc added inline comments.


================
Comment at: lib/Transforms/IPO/PassManagerBuilder.cpp:532
+    MPM.add(createGlobalDCEPass());
+  }
+
----------------
mehdi_amini wrote:
> 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`
+1


https://reviews.llvm.org/D38154





More information about the llvm-commits mailing list