Add support for the switch instruction to the CWriter
[oota-llvm.git] / lib / Analysis / LoopInfo.cpp
index a54d659dc8e893aeba8b4d51d0725fb977ca900e..d7d8a5b9e56d1744f87f6936143c0421b8dde37a 100644 (file)
@@ -68,6 +68,10 @@ void Loop::print(std::ostream &OS) const {
     getSubLoops()[i]->print(OS);
 }
 
+void Loop::dump() const {
+  print(std::cerr);
+}
+
 
 //===----------------------------------------------------------------------===//
 // LoopInfo implementation
@@ -242,12 +246,9 @@ void Loop::addBasicBlockToLoop(BasicBlock *NewBB, LoopInfo &LI) {
 void Loop::changeExitBlock(BasicBlock *Old, BasicBlock *New) {
   assert(Old != New && "Cannot changeExitBlock to the same thing!");
   assert(Old && New && "Cannot changeExitBlock to or from a null node!");
-  std::vector<BasicBlock*>::iterator I = 
-    std::find(ExitBlocks.begin(), ExitBlocks.end(), Old);
-  assert(I != ExitBlocks.end() && "Old exit block not found!");
-  *I = New;
-
-  I = std::find(I+1, ExitBlocks.end(), Old);
+  assert(hasExitBlock(Old) && "Old exit block not found!");
+  std::vector<BasicBlock*>::iterator
+    I = std::find(ExitBlocks.begin(), ExitBlocks.end(), Old);
   while (I != ExitBlocks.end()) {
     *I = New;
     I = std::find(I+1, ExitBlocks.end(), Old);