llvm.org GIT mirror llvm / 8317950
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290222 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 2 years ago
5 changed file(s) with 19 addition(s) and 46 deletion(s). Raw diff Collapse all Expand all
7070 /// The function importing pass
7171 class FunctionImportPass : public PassInfoMixin {
7272 public:
73 FunctionImportPass(const ModuleSummaryIndex *Index = nullptr)
74 : Index(Index) {}
7573 PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
76
77 private:
78 const ModuleSummaryIndex *Index;
7974 };
8075
8176 /// Compute all the imports and exports for every module in the Index.
123123 /// added to the per-module passes.
124124 Pass *Inliner;
125125
126 /// The module summary index to use for function importing.
127 const ModuleSummaryIndex *ModuleSummary;
128
129126 bool DisableTailCalls;
130127 bool DisableUnitAtATime;
131128 bool DisableUnrollLoops;
9494
9595 //===----------------------------------------------------------------------===//
9696 /// This pass performs iterative function importing from other modules.
97 Pass *createFunctionImportPass(const ModuleSummaryIndex *Index = nullptr);
97 Pass *createFunctionImportPass();
9898
9999 //===----------------------------------------------------------------------===//
100100 /// createFunctionInliningPass - Return a new pass object that uses a heuristic
730730 SummaryFile("summary-file",
731731 cl::desc("The summary file to use for function importing."));
732732
733 static bool doImportingForModule(Module &M, const ModuleSummaryIndex *Index) {
734 if (SummaryFile.empty() && !Index)
735 report_fatal_error("error: -function-import requires -summary-file or "
736 "file from frontend\n");
737 std::unique_ptr IndexPtr;
738 if (!SummaryFile.empty()) {
739 if (Index)
740 report_fatal_error("error: -summary-file and index from frontend\n");
741 Expected> IndexPtrOrErr =
742 getModuleSummaryIndexForFile(SummaryFile);
743 if (!IndexPtrOrErr) {
744 logAllUnhandledErrors(IndexPtrOrErr.takeError(), errs(),
745 "Error loading file '" + SummaryFile + "': ");
746 return false;
747 }
748 IndexPtr = std::move(*IndexPtrOrErr);
749 Index = IndexPtr.get();
750 }
733 static bool doImportingForModule(Module &M) {
734 if (SummaryFile.empty())
735 report_fatal_error("error: -function-import requires -summary-file\n");
736 Expected> IndexPtrOrErr =
737 getModuleSummaryIndexForFile(SummaryFile);
738 if (!IndexPtrOrErr) {
739 logAllUnhandledErrors(IndexPtrOrErr.takeError(), errs(),
740 "Error loading file '" + SummaryFile + "': ");
741 return false;
742 }
743 std::unique_ptr Index = std::move(*IndexPtrOrErr);
751744
752745 // First step is collecting the import list.
753746 FunctionImporter::ImportMapTy ImportList;
793786 namespace {
794787 /// Pass that performs cross-module function import provided a summary file.
795788 class FunctionImportLegacyPass : public ModulePass {
796 /// Optional module summary index to use for importing, otherwise
797 /// the summary-file option must be specified.
798 const ModuleSummaryIndex *Index;
799
800789 public:
801790 /// Pass identification, replacement for typeid
802791 static char ID;
804793 /// Specify pass name for debug output
805794 StringRef getPassName() const override { return "Function Importing"; }
806795
807 explicit FunctionImportLegacyPass(const ModuleSummaryIndex *Index = nullptr)
808 : ModulePass(ID), Index(Index) {}
796 explicit FunctionImportLegacyPass() : ModulePass(ID) {}
809797
810798 bool runOnModule(Module &M) override {
811799 if (skipModule(M))
812800 return false;
813801
814 return doImportingForModule(M, Index);
802 return doImportingForModule(M);
815803 }
816804 };
817805 } // anonymous namespace
818806
819807 PreservedAnalyses FunctionImportPass::run(Module &M,
820808 ModuleAnalysisManager &AM) {
821 if (!doImportingForModule(M, Index))
809 if (!doImportingForModule(M))
822810 return PreservedAnalyses::all();
823811
824812 return PreservedAnalyses::none();
829817 "Summary Based Function Import", false, false)
830818
831819 namespace llvm {
832 Pass *createFunctionImportPass(const ModuleSummaryIndex *Index = nullptr) {
833 return new FunctionImportLegacyPass(Index);
834 }
835 }
820 Pass *createFunctionImportPass() {
821 return new FunctionImportLegacyPass();
822 }
823 }
154154 SizeLevel = 0;
155155 LibraryInfo = nullptr;
156156 Inliner = nullptr;
157 ModuleSummary = nullptr;
158157 DisableUnitAtATime = false;
159158 DisableUnrollLoops = false;
160159 BBVectorize = RunBBVectorization;
669668 // Provide AliasAnalysis services for optimizations.
670669 addInitialAliasAnalysisPasses(PM);
671670
672 if (ModuleSummary)
673 PM.add(createFunctionImportPass(ModuleSummary));
674
675671 // Allow forcing function attributes as a debugging and tuning aid.
676672 PM.add(createForceFunctionAttrsLegacyPass());
677673
831827 if (VerifyInput)
832828 PM.add(createVerifierPass());
833829
834 if (ModuleSummary)
835 PM.add(createFunctionImportPass(ModuleSummary));
836
837830 populateModulePassManager(PM);
838831
839832 if (VerifyOutput)