[llvm-commits] CVS: llvm/lib/Analysis/LoopInfo.cpp

Owen Anderson resistor at mac.com
Fri Jun 9 11:33:44 PDT 2006



Changes in directory llvm/lib/Analysis:

LoopInfo.cpp updated: 1.70 -> 1.71
---
Log message:

Make Loop able to verify that it is in LCSSA-form, and have the LCSSA pass assert
on this.


---
Diffs of the changes:  (+16 -0)

 LoopInfo.cpp |   16 ++++++++++++++++
 1 files changed, 16 insertions(+)


Index: llvm/lib/Analysis/LoopInfo.cpp
diff -u llvm/lib/Analysis/LoopInfo.cpp:1.70 llvm/lib/Analysis/LoopInfo.cpp:1.71
--- llvm/lib/Analysis/LoopInfo.cpp:1.70	Wed Jun  7 17:00:26 2006
+++ llvm/lib/Analysis/LoopInfo.cpp	Fri Jun  9 13:33:30 2006
@@ -479,6 +479,22 @@
   return 0;
 }
 
+/// isLCSSAForm - Return true if the Loop is in LCSSA form
+bool Loop::isLCSSAForm() const {  
+  for (Loop::block_iterator BB = block_begin(), E = block_end();
+       BB != E; ++BB) {
+    for (BasicBlock::iterator I = (*BB)->begin(), E = (*BB)->end(); I != E; ++I)
+      for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E;
+           ++UI) {
+        BasicBlock *UserBB = cast<Instruction>(*UI)->getParent();
+        if (!isa<PHINode>(*UI) && !contains(UserBB)) {
+          return false;
+        }
+      }
+  }
+  
+  return true;
+}
 
 //===-------------------------------------------------------------------===//
 // APIs for updating loop information after changing the CFG






More information about the llvm-commits mailing list