[PATCH] D46327: Move LowerTypeTestsPass after inlining in ThinLTO pipeline

Dmitry Mikulin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 1 11:39:51 PDT 2018


dmikulin created this revision.
dmikulin added reviewers: pcc, vlad.tsyrklevich, tejohnson.
Herald added subscribers: hiraditya, inglorion, mehdi_amini.

LowerTypeTestsPass runs early in the ThinLTO pipeline, which prevents post-inline optimizations to eliminate unnecessary type checks.


https://reviews.llvm.org/D46327

Files:
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp


Index: llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
===================================================================
--- llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -523,6 +523,12 @@
   if (RunPartialInlining)
     MPM.add(createPartialInliningPass());
 
+  if (ImportSummary) {
+    // Run this pass after inlining as it creates more opportunities to
+    // eliminate type checks.
+    MPM.add(createLowerTypeTestsPass(nullptr, ImportSummary));
+  }
+
   if (OptLevel > 1 && !PrepareForLTO && !PrepareForThinLTO)
     // Remove avail extern fns and globals definitions if we aren't
     // compiling an object file for later LTO. For LTO we want to preserve
@@ -877,9 +883,9 @@
     PM.add(createVerifierPass());
 
   if (ImportSummary) {
-    // These passes import type identifier resolutions for whole-program
-    // devirtualization and CFI. They must run early because other passes may
-    // disturb the specific instruction patterns that these passes look for,
+    // This pass imports type identifier resolutions for whole-program
+    // devirtualization. It must run early because other passes may
+    // disturb the specific instruction patterns that this pass looks for,
     // creating dependencies on resolutions that may not appear in the summary.
     //
     // For example, GVN may transform the pattern assume(type.test) appearing in
@@ -890,7 +896,6 @@
     // Also, WPD has access to more precise information than ICP and can
     // devirtualize more effectively, so it should operate on the IR first.
     PM.add(createWholeProgramDevirtPass(nullptr, ImportSummary));
-    PM.add(createLowerTypeTestsPass(nullptr, ImportSummary));
   }
 
   populateModulePassManager(PM);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46327.144760.patch
Type: text/x-patch
Size: 1764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180501/ac677c9f/attachment.bin>


More information about the llvm-commits mailing list