[llvm-commits] [llvm] r37822 - in /llvm/trunk: include/llvm/Analysis/LoopPass.h lib/Analysis/LoopPass.cpp
Devang Patel
dpatel at apple.com
Fri Jun 29 16:13:42 PDT 2007
Author: dpatel
Date: Fri Jun 29 18:13:42 2007
New Revision: 37822
URL: http://llvm.org/viewvc/llvm-project?rev=37822&view=rev
Log:
Add loop info verification mechanism.
Modified:
llvm/trunk/include/llvm/Analysis/LoopPass.h
llvm/trunk/lib/Analysis/LoopPass.cpp
Modified: llvm/trunk/include/llvm/Analysis/LoopPass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopPass.h?rev=37822&r1=37821&r2=37822&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopPass.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopPass.h Fri Jun 29 18:13:42 2007
@@ -114,6 +114,11 @@
// queue. This allows LoopPass to change loop nest for the loop. This
// utility may send LPPassManager into infinite loops so use caution.
void redoLoop(Loop *L);
+
+private:
+ /// verifyLoopInfo - Verify loop nest.
+ void verifyLoopInfo();
+
private:
std::deque<Loop *> LQ;
bool skipThisLoop;
Modified: llvm/trunk/lib/Analysis/LoopPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopPass.cpp?rev=37822&r1=37821&r2=37822&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopPass.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopPass.cpp Fri Jun 29 18:13:42 2007
@@ -157,6 +157,18 @@
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 @@
LoopPass *LP = dynamic_cast<LoopPass *>(P);
assert (LP && "Invalid LPPassManager member");
LP->runOnLoop(CurrentLoop, *this);
+ verifyLoopInfo();
StopPassTimer(P);
if (Changed)
@@ -302,4 +315,3 @@
LPPM->add(this);
}
-
More information about the llvm-commits
mailing list