aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopInfo.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-09-03 16:31:42 +0000
committerDan Gohman <gohman@apple.com>2009-09-03 16:31:42 +0000
commit4c1bdcf5d7778ef8a135de1bb5c57a47c5192b14 (patch)
tree5cc1faa2a840cd6aa6220f98839b09eb560523ef /llvm/lib/Analysis/LoopInfo.cpp
parentc26e0f626b979f01869372a3a0b92d4d9ce5e625 (diff)
downloadllvm-4c1bdcf5d7778ef8a135de1bb5c57a47c5192b14.zip
llvm-4c1bdcf5d7778ef8a135de1bb5c57a47c5192b14.tar.gz
llvm-4c1bdcf5d7778ef8a135de1bb5c57a47c5192b14.tar.bz2
Add a verifyAnalysis to LoopInfo, LoopSimplify, and LCSSA form that verify
that these passes are properly preserved. Fix several transformation passes that claimed to preserve LoopSimplify form but weren't. llvm-svn: 80926
Diffstat (limited to 'llvm/lib/Analysis/LoopInfo.cpp')
-rw-r--r--llvm/lib/Analysis/LoopInfo.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp
index 4245702..94dc154 100644
--- a/llvm/lib/Analysis/LoopInfo.cpp
+++ b/llvm/lib/Analysis/LoopInfo.cpp
@@ -300,6 +300,9 @@ bool Loop::isLoopSimplifyForm() const {
///
void
Loop::getUniqueExitBlocks(SmallVectorImpl<BasicBlock *> &ExitBlocks) const {
+ assert(isLoopSimplifyForm() &&
+ "getUniqueExitBlocks assumes the loop is in canonical form!");
+
// Sort the blocks vector so that we can use binary search to do quick
// lookups.
SmallVector<BasicBlock *, 128> LoopBBs(block_begin(), block_end());
@@ -371,6 +374,13 @@ bool LoopInfo::runOnFunction(Function &) {
return false;
}
+void LoopInfo::verifyAnalysis() const {
+ for (iterator I = begin(), E = end(); I != E; ++I) {
+ assert(!(*I)->getParentLoop() && "Top-level loop has a parent!");
+ (*I)->verifyLoop();
+ }
+}
+
void LoopInfo::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequired<DominatorTree>();