summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2017-02-15 23:48:38 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2017-02-15 23:48:38 +0000
commit08eb081ac32420a9a2d9019cda836284b0e73eab (patch)
treeab9c9a1000951cbd247bdd877790bee174b36234 /llvm
parent3963ba3e48a4ac8c681235d6d83b48574e6cff31 (diff)
downloadbcm5719-llvm-08eb081ac32420a9a2d9019cda836284b0e73eab.tar.gz
bcm5719-llvm-08eb081ac32420a9a2d9019cda836284b0e73eab.zip
PMB: Add an importing WPD pass to the start of the ThinLTO backend pipeline.
Differential Revision: https://reviews.llvm.org/D30008 llvm-svn: 295260
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/IPO/PassManagerBuilder.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
index bfc6bbdb816..1913b50405b 100644
--- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -830,8 +830,22 @@ void PassManagerBuilder::populateThinLTOPassManager(
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);
OpenPOWER on IntegriCloud