Fix bug I introduced yesterday :(
authorChris Lattner <sabre@nondot.org>
Fri, 28 Feb 2003 16:54:17 +0000 (16:54 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 28 Feb 2003 16:54:17 +0000 (16:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5669 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/LoopSimplify.cpp

index 3759f44f64ce9c0bc431056c0afc1b9abe9e3308..5a68dda1af3a0ac40b81320fd7c2304622ca5187 100644 (file)
@@ -307,7 +307,8 @@ void Preheaders::RewriteLoopExitBlock(Loop *L, BasicBlock *Exit) {
 
   // Replace any instances of Exit with NewBB in this and any nested loops...
   for (df_iterator<Loop*> I = df_begin(L), E = df_end(L); I != E; ++I)
-    I->changeExitBlock(Exit, NewBB);   // Update exit block information
+    if (I->hasExitBlock(Exit))
+      I->changeExitBlock(Exit, NewBB);   // Update exit block information
 
   // Update dominator information...  The blocks that dominate NewBB are the
   // intersection of the dominators of predecessors, plus the block itself.