Fix thinko.
Starting value of second loop's induction variable can not be lower
then starting value of original loop's induction variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41280 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp
index 1bc2dca..a01798b 100644
--- a/lib/Transforms/Scalar/LoopIndexSplit.cpp
+++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp
@@ -748,7 +748,7 @@
//[*] Calculate True loop's new Exit Value in loop preheader.
// TL_ExitValue = min(SplitValue, ExitValue)
//[*] Calculate False loop's new Start Value in loop preheader.
- // FL_StartValue = min(SplitValue, TrueLoop.StartValue)
+ // FL_StartValue = max(SplitValue, TrueLoop.StartValue)
Value *TL_ExitValue = NULL;
Value *FL_StartValue = NULL;
if (isa<ConstantInt>(SD.SplitValue)) {
@@ -770,8 +770,8 @@
ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT,
SD.SplitValue, StartValue, "lsplit.sv",
TL_PHTerminator);
- FL_StartValue = new SelectInst(C2, SD.SplitValue, StartValue,
- "lsplit.sv", TL_Preheader->getTerminator());
+ FL_StartValue = new SelectInst(C2, StartValue, SD.SplitValue,
+ "lsplit.sv", TL_PHTerminator);
}
//[*] Clone loop. Avoid true destination of split condition and