Index: llvm/trunk/include/llvm/Transforms/IPO.h =================================================================== --- llvm/trunk/include/llvm/Transforms/IPO.h +++ llvm/trunk/include/llvm/Transforms/IPO.h @@ -95,7 +95,7 @@ //===----------------------------------------------------------------------===// /// This pass performs iterative function importing from other modules. -Pass *createFunctionImportPass(const ModuleSummaryIndex *Index = nullptr); +Pass *createFunctionImportPass(); //===----------------------------------------------------------------------===// /// createFunctionInliningPass - Return a new pass object that uses a heuristic Index: llvm/trunk/include/llvm/Transforms/IPO/FunctionImport.h =================================================================== --- llvm/trunk/include/llvm/Transforms/IPO/FunctionImport.h +++ llvm/trunk/include/llvm/Transforms/IPO/FunctionImport.h @@ -71,12 +71,7 @@ /// The function importing pass class FunctionImportPass : public PassInfoMixin { public: - FunctionImportPass(const ModuleSummaryIndex *Index = nullptr) - : Index(Index) {} PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); - -private: - const ModuleSummaryIndex *Index; }; /// Compute all the imports and exports for every module in the Index. Index: llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h =================================================================== --- llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h +++ llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h @@ -124,9 +124,6 @@ /// added to the per-module passes. Pass *Inliner; - /// The module summary index to use for function importing. - const ModuleSummaryIndex *ModuleSummary; - bool DisableTailCalls; bool DisableUnitAtATime; bool DisableUnrollLoops; Index: llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp =================================================================== --- llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp +++ llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp @@ -731,24 +731,17 @@ 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 IndexPtr; - if (!SummaryFile.empty()) { - if (Index) - report_fatal_error("error: -summary-file and index from frontend\n"); - Expected> 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> IndexPtrOrErr = + getModuleSummaryIndexForFile(SummaryFile); + if (!IndexPtrOrErr) { + logAllUnhandledErrors(IndexPtrOrErr.takeError(), errs(), + "Error loading file '" + SummaryFile + "': "); + return false; } + std::unique_ptr Index = std::move(*IndexPtrOrErr); // First step is collecting the import list. FunctionImporter::ImportMapTy ImportList; @@ -794,10 +787,6 @@ 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 @@ /// 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 @@ "Summary Based Function Import", false, false) namespace llvm { -Pass *createFunctionImportPass(const ModuleSummaryIndex *Index = nullptr) { - return new FunctionImportLegacyPass(Index); +Pass *createFunctionImportPass() { + return new FunctionImportLegacyPass(); } } Index: llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp =================================================================== --- llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp +++ llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -155,7 +155,6 @@ SizeLevel = 0; LibraryInfo = nullptr; Inliner = nullptr; - ModuleSummary = nullptr; DisableUnitAtATime = false; DisableUnrollLoops = false; BBVectorize = RunBBVectorization; @@ -670,9 +669,6 @@ // 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 @@ if (VerifyInput) PM.add(createVerifierPass()); - if (ModuleSummary) - PM.add(createFunctionImportPass(ModuleSummary)); - populateModulePassManager(PM); if (VerifyOutput)