summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2015-12-07 19:21:11 +0000
committerTeresa Johnson <tejohnson@google.com>2015-12-07 19:21:11 +0000
commit5fcbdb717c994ca4215003e8ba349b6f0943e80b (patch)
tree82e5fb38c1364b338fc4756a1c3967695bb78feb /llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
parentf9bdb872bd8eacd1b3dbbcd7057a8ca9ffa300a4 (diff)
downloadbcm5719-llvm-5fcbdb717c994ca4215003e8ba349b6f0943e80b.tar.gz
bcm5719-llvm-5fcbdb717c994ca4215003e8ba349b6f0943e80b.zip
[ThinLTO] Support for specifying function index from pass manager
Summary: Add a field on the PassManagerBuilder that clang or gold can use to pass down a pointer to the function index in memory to use for importing when the ThinLTO backend is triggered. Add support to supply this to the function import pass. Reviewers: joker.eph, dexonsmith Subscribers: davidxl, llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D15024 llvm-svn: 254926
Diffstat (limited to 'llvm/lib/Transforms/IPO/PassManagerBuilder.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/PassManagerBuilder.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
index ec6f21e8c64..b8d1b7e78e3 100644
--- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -18,6 +18,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/FunctionInfo.h"
#include "llvm/IR/Verifier.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/Support/CommandLine.h"
@@ -108,6 +109,7 @@ PassManagerBuilder::PassManagerBuilder() {
SizeLevel = 0;
LibraryInfo = nullptr;
Inliner = nullptr;
+ FunctionIndex = nullptr;
DisableUnitAtATime = false;
DisableUnrollLoops = false;
BBVectorize = RunBBVectorization;
@@ -476,6 +478,9 @@ void PassManagerBuilder::addLTOOptimizationPasses(legacy::PassManagerBase &PM) {
// Provide AliasAnalysis services for optimizations.
addInitialAliasAnalysisPasses(PM);
+ if (FunctionIndex)
+ PM.add(createFunctionImportPass(FunctionIndex));
+
// Propagate constants at call sites into the functions they call. This
// opens opportunities for globalopt (and inlining) by substituting function
// pointers passed as arguments to direct uses of functions.
OpenPOWER on IntegriCloud