diff options
Diffstat (limited to 'llvm/lib/Transforms/Scalar/IndVarSimplify.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index 4f939b21a2e..0566a1558b0 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -2477,11 +2477,8 @@ linearFunctionTestReplace(Loop *L, BasicBlock *ExitingBB, Count = Count.zext(CmpIndVarSize); if (UsePostInc) ++Count; - APInt NewLimit; - if (cast<SCEVConstant>(ARStep)->getValue()->isNegative()) - NewLimit = Start - Count; - else - NewLimit = Start + Count; + assert(cast<SCEVConstant>(ARStep)->getValue()->isOne()); + APInt NewLimit = Start + Count; ExitCnt = ConstantInt::get(CmpIndVar->getType(), NewLimit); } else { // We try to extend trip count first. If that doesn't work we truncate IV. |