From 9750b5d5779e6efec10a93633dd1d36c5f61dbc3 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Thu, 19 Jul 2007 05:36:09 +0000 Subject: [PATCH] Set up ground work to verify preserved analysis info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40039 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Pass.h | 4 ++++ lib/VMCore/PassManager.cpp | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index a5a98f53131..3a28f913303 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -161,6 +161,10 @@ public: /// virtual void releaseMemory() {} + /// verifyAnalysis() - This member can be implemented by a analysis pass to + /// check state of analysis information. + virtual void verifyAnalysis() {} + // dumpPassStructure - Implement the -debug-passes=PassStructure option virtual void dumpPassStructure(unsigned Offset = 0); diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index af3cfb025dc..8d780e98d02 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -598,11 +598,18 @@ bool PMDataManager::preserveHigherLevelAnalysis(Pass *P) { void PMDataManager::removeNotPreservedAnalysis(Pass *P) { AnalysisUsage AnUsage; P->getAnalysisUsage(AnUsage); + const std::vector &PreservedSet = AnUsage.getPreservedSet(); + // Verify preserved analysis + for (std::map::iterator I = AvailableAnalysis.begin(), + E = AvailableAnalysis.end(); I != E; ++I) { + Pass *AP = I->second; + AP->verifyAnalysis(); + } + if (AnUsage.getPreservesAll()) return; - const std::vector &PreservedSet = AnUsage.getPreservedSet(); for (std::map::iterator I = AvailableAnalysis.begin(), E = AvailableAnalysis.end(); I != E; ) { std::map::iterator Info = I++;