diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2016-12-21 00:50:12 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-12-21 00:50:12 +0000 |
| commit | 598bd2a26271c69850fb8a8c0e172620a1a030c9 (patch) | |
| tree | 4dda31c8003a86e16fd195321bee4a94445048f0 /llvm/lib | |
| parent | cf33b053fe84ce099602e662cd211ec346f6c106 (diff) | |
| download | bcm5719-llvm-598bd2a26271c69850fb8a8c0e172620a1a030c9.tar.gz bcm5719-llvm-598bd2a26271c69850fb8a8c0e172620a1a030c9.zip | |
IPO: Remove the ModuleSummary argument to the FunctionImport pass. NFCI.
No existing client is passing a non-null value here. This will come back
in a slightly different form as part of the type identifier summary work.
Differential Revision: https://reviews.llvm.org/D28006
llvm-svn: 290222
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/IPO/FunctionImport.cpp | 42 | ||||
| -rw-r--r-- | llvm/lib/Transforms/IPO/PassManagerBuilder.cpp | 7 |
2 files changed, 15 insertions, 34 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index d65ff079e42..c57435e284a 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -731,24 +731,17 @@ static cl::opt<std::string> SummaryFile("summary-file", cl::desc("The summary file to use for function importing.")); -static bool doImportingForModule(Module &M, const ModuleSummaryIndex *Index) { - if (SummaryFile.empty() && !Index) - report_fatal_error("error: -function-import requires -summary-file or " - "file from frontend\n"); - std::unique_ptr<ModuleSummaryIndex> IndexPtr; - if (!SummaryFile.empty()) { - if (Index) - report_fatal_error("error: -summary-file and index from frontend\n"); - Expected<std::unique_ptr<ModuleSummaryIndex>> IndexPtrOrErr = - getModuleSummaryIndexForFile(SummaryFile); - if (!IndexPtrOrErr) { - logAllUnhandledErrors(IndexPtrOrErr.takeError(), errs(), - "Error loading file '" + SummaryFile + "': "); - return false; - } - IndexPtr = std::move(*IndexPtrOrErr); - Index = IndexPtr.get(); +static bool doImportingForModule(Module &M) { + if (SummaryFile.empty()) + report_fatal_error("error: -function-import requires -summary-file\n"); + Expected<std::unique_ptr<ModuleSummaryIndex>> IndexPtrOrErr = + getModuleSummaryIndexForFile(SummaryFile); + if (!IndexPtrOrErr) { + logAllUnhandledErrors(IndexPtrOrErr.takeError(), errs(), + "Error loading file '" + SummaryFile + "': "); + return false; } + std::unique_ptr<ModuleSummaryIndex> Index = std::move(*IndexPtrOrErr); // First step is collecting the import list. FunctionImporter::ImportMapTy ImportList; @@ -794,10 +787,6 @@ static bool doImportingForModule(Module &M, const ModuleSummaryIndex *Index) { namespace { /// Pass that performs cross-module function import provided a summary file. class FunctionImportLegacyPass : public ModulePass { - /// Optional module summary index to use for importing, otherwise - /// the summary-file option must be specified. - const ModuleSummaryIndex *Index; - public: /// Pass identification, replacement for typeid static char ID; @@ -805,21 +794,20 @@ public: /// Specify pass name for debug output StringRef getPassName() const override { return "Function Importing"; } - explicit FunctionImportLegacyPass(const ModuleSummaryIndex *Index = nullptr) - : ModulePass(ID), Index(Index) {} + explicit FunctionImportLegacyPass() : ModulePass(ID) {} bool runOnModule(Module &M) override { if (skipModule(M)) return false; - return doImportingForModule(M, Index); + return doImportingForModule(M); } }; } // anonymous namespace PreservedAnalyses FunctionImportPass::run(Module &M, ModuleAnalysisManager &AM) { - if (!doImportingForModule(M, Index)) + if (!doImportingForModule(M)) return PreservedAnalyses::all(); return PreservedAnalyses::none(); @@ -830,7 +818,7 @@ INITIALIZE_PASS(FunctionImportLegacyPass, "function-import", "Summary Based Function Import", false, false) namespace llvm { -Pass *createFunctionImportPass(const ModuleSummaryIndex *Index = nullptr) { - return new FunctionImportLegacyPass(Index); +Pass *createFunctionImportPass() { + return new FunctionImportLegacyPass(); } } diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp index a663eedc4f4..264bc3260b8 100644 --- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -155,7 +155,6 @@ PassManagerBuilder::PassManagerBuilder() { SizeLevel = 0; LibraryInfo = nullptr; Inliner = nullptr; - ModuleSummary = nullptr; DisableUnitAtATime = false; DisableUnrollLoops = false; BBVectorize = RunBBVectorization; @@ -670,9 +669,6 @@ void PassManagerBuilder::addLTOOptimizationPasses(legacy::PassManagerBase &PM) { // Provide AliasAnalysis services for optimizations. addInitialAliasAnalysisPasses(PM); - if (ModuleSummary) - PM.add(createFunctionImportPass(ModuleSummary)); - // Allow forcing function attributes as a debugging and tuning aid. PM.add(createForceFunctionAttrsLegacyPass()); @@ -832,9 +828,6 @@ void PassManagerBuilder::populateThinLTOPassManager( if (VerifyInput) PM.add(createVerifierPass()); - if (ModuleSummary) - PM.add(createFunctionImportPass(ModuleSummary)); - populateModulePassManager(PM); if (VerifyOutput) |

