Keep track of exit value operand number when operands are swapped.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47082 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp
index 683a038..2d30eb6 100644
--- a/lib/Transforms/Scalar/LoopIndexSplit.cpp
+++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp
@@ -1163,8 +1163,13 @@
   if (ExitCondition->getPredicate() == ICmpInst::ICMP_SGT
       || ExitCondition->getPredicate() == ICmpInst::ICMP_UGT
       || ExitCondition->getPredicate() == ICmpInst::ICMP_SGE
-      || ExitCondition->getPredicate() == ICmpInst::ICMP_UGE)
+      || ExitCondition->getPredicate() == ICmpInst::ICMP_UGE) {
     ExitCondition->swapOperands();
+    if (ExitValueNum)
+      ExitValueNum = 0;
+    else
+      ExitValueNum = 1;
+  }
 
   switch (ExitCondition->getPredicate()) {
   case ICmpInst::ICMP_SGT: