aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/LoopPass.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-06-29 23:13:42 +0000
committerDevang Patel <dpatel@apple.com>2007-06-29 23:13:42 +0000
commit1a957d563fe894c797e0eba00bf069fbe7ecba77 (patch)
tree693e5005e405924415c28d5ef87b5e53ae44e4e3 /lib/Analysis/LoopPass.cpp
parentd933fa9507e1af7a0e27546d19c77dd8cc65f6e0 (diff)
Add loop info verification mechanism.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37822 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LoopPass.cpp')
-rw-r--r--lib/Analysis/LoopPass.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp
index ab64c3cf92..a5496a01f0 100644
--- a/lib/Analysis/LoopPass.cpp
+++ b/lib/Analysis/LoopPass.cpp
@@ -157,6 +157,18 @@ void LPPassManager::getAnalysisUsage(AnalysisUsage &Info) const {
Info.setPreservesAll();
}
+/// verifyLoopInfo - Verify loop nest.
+void LPPassManager::verifyLoopInfo() {
+ assert (LI && "Loop Info is missing");
+
+ for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) {
+ Loop *L = *I;
+ assert (L->getHeader() && "Loop header is missing");
+ assert (L->getLoopPreheader() && "Loop preheader is missing");
+ assert (L->getLoopLatch() && "Loop latch is missing");
+ }
+}
+
/// run - Execute all of the passes scheduled for execution. Keep track of
/// whether any of the passes modifies the function, and if so, return true.
bool LPPassManager::runOnFunction(Function &F) {
@@ -202,6 +214,7 @@ bool LPPassManager::runOnFunction(Function &F) {
LoopPass *LP = dynamic_cast<LoopPass *>(P);
assert (LP && "Invalid LPPassManager member");
LP->runOnLoop(CurrentLoop, *this);
+ verifyLoopInfo();
StopPassTimer(P);
if (Changed)
@@ -302,4 +315,3 @@ void LoopPass::assignPassManager(PMStack &PMS,
LPPM->add(this);
}
-