fix a bug where we unswitched the wrong way
authorChris Lattner <sabre@nondot.org>
Thu, 16 Feb 2006 01:24:41 +0000 (01:24 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 16 Feb 2006 01:24:41 +0000 (01:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26225 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopUnswitch.cpp

index 46705f33885940a744e283070223cb7af16c5e30..d36e59d9eca0e9d4fb9a889275b8ebcc8493efa2 100644 (file)
@@ -197,9 +197,9 @@ static bool IsTrivialUnswitchCondition(Loop *L, Value *Cond,
     // side-effects.  If so, determine the value of Cond that causes it to do
     // this.
     if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(0)))) {
-      if (Val) *Val = ConstantBool::True;
-    } else if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(1)))) {
       if (Val) *Val = ConstantBool::False;
+    } else if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(1)))) {
+      if (Val) *Val = ConstantBool::True;
     }
   } else if (SwitchInst *SI = dyn_cast<SwitchInst>(HeaderTerm)) {
     // If this isn't a switch on Cond, we can't handle it.