From 8417e857818e972f318bd549caabc54bdf537c26 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sun, 17 Nov 2013 03:18:05 +0000 Subject: [PATCH] [PM] Completely remove support for explicit 'require' methods on the AnalysisManager. All this method did was assert something and we have a perfectly good way to trigger that assert from the query path. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194947 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/PassManager.h | 37 ++++++-------------------------- unittests/IR/PassManagerTest.cpp | 1 - 2 files changed, 6 insertions(+), 32 deletions(-) diff --git a/include/llvm/IR/PassManager.h b/include/llvm/IR/PassManager.h index 08aac77f68a..833547a23ac 100644 --- a/include/llvm/IR/PassManager.h +++ b/include/llvm/IR/PassManager.h @@ -151,6 +151,9 @@ public: /// constructed around. template const typename PassT::Result &getResult(Module *M) { + assert(ModuleAnalysisPasses.count(PassT::ID()) && + "This analysis pass was not registered prior to being queried"); + const AnalysisResultConcept &ResultConcept = getResultImpl(PassT::ID(), M); typedef AnalysisResultModel ResultModelT; @@ -163,6 +166,9 @@ public: /// re-run the analysis to produce a valid result. template const typename PassT::Result &getResult(Function *F) { + assert(FunctionAnalysisPasses.count(PassT::ID()) && + "This analysis pass was not registered prior to being queried"); + const AnalysisResultConcept &ResultConcept = getResultImpl(PassT::ID(), F); typedef AnalysisResultModel ResultModelT; @@ -180,21 +186,6 @@ public: registerAnalysisPassImpl(llvm_move(Pass)); } - /// \brief Require that a particular analysis pass is provided by the manager. - /// - /// This allows transform passes to assert ther requirements during - /// construction and fail fast if the analysis manager doesn't provide the - /// needed facilities. - /// - /// We force the analysis manager to have these passes explicitly registered - /// first to ensure that there is exactly one place in the code responsible - /// for adding an analysis pass to the manager as all transforms will share - /// a single pass within the manager and each may not be the canonical place - /// to initialize such a pass. - template void requireAnalysisPass() { - requireAnalysisPassImpl(); - } - /// \brief Invalidate a specific analysis pass for an IR module. /// /// Note that the analysis result can disregard invalidation. @@ -334,22 +325,6 @@ private: new AnalysisPassModel(llvm_move(Pass)); } - /// \brief Module pass specific implementation of requirement declaration. - template - typename enable_if >::type - requireAnalysisPassImpl() { - assert(ModuleAnalysisPasses.count(PassT::ID()) && - "This analysis pass was not registered prior to being required"); - } - - /// \brief Function pass specific implementation of requirement declaration. - template - typename enable_if >::type - requireAnalysisPassImpl() { - assert(FunctionAnalysisPasses.count(PassT::ID()) && - "This analysis pass was not registered prior to being required"); - } - /// \brief Map type from module analysis pass ID to pass concept pointer. typedef DenseMap > > diff --git a/unittests/IR/PassManagerTest.cpp b/unittests/IR/PassManagerTest.cpp index 8eec0eca7bc..7b60e3899a0 100644 --- a/unittests/IR/PassManagerTest.cpp +++ b/unittests/IR/PassManagerTest.cpp @@ -63,7 +63,6 @@ struct TestModulePass { struct TestFunctionPass { TestFunctionPass(AnalysisManager &AM, int &RunCount, int &AnalyzedInstrCount) : AM(AM), RunCount(RunCount), AnalyzedInstrCount(AnalyzedInstrCount) { - AM.requireAnalysisPass(); } bool run(Function *F) { -- 2.34.1