[PATCH] D30008: PMB: Add an importing WPD pass to the start of the ThinLTO backend pipeline.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 16:00:16 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL295260: PMB: Add an importing WPD pass to the start of the ThinLTO backend pipeline. (authored by pcc).

Changed prior to commit:
  https://reviews.llvm.org/D30008?vs=88613&id=88620#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30008

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


Index: llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -830,8 +830,22 @@
   if (VerifyInput)
     PM.add(createVerifierPass());
 
-  if (Summary)
+  if (Summary) {
+    // 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,
+    // creating dependencies on resolutions that may not appear in the summary.
+    //
+    // For example, GVN may transform the pattern assume(type.test) appearing in
+    // two basic blocks into assume(phi(type.test, type.test)), which would
+    // transform a dependency on a WPD resolution into a dependency on a type
+    // identifier resolution for CFI.
+    //
+    // 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(PassSummaryAction::Import, Summary));
     PM.add(createLowerTypeTestsPass(PassSummaryAction::Import, Summary));
+  }
 
   populateModulePassManager(PM);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30008.88620.patch
Type: text/x-patch
Size: 1307 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170216/5a10d23f/attachment.bin>


More information about the llvm-commits mailing list