[LFTR] Remove falsely generalized (dead) code [NFC]
authorPhilip Reames <listmail@philipreames.com>
Wed, 3 Jul 2019 18:24:06 +0000 (18:24 +0000)
committerPhilip Reames <listmail@philipreames.com>
Wed, 3 Jul 2019 18:24:06 +0000 (18:24 +0000)
llvm-svn: 365067

llvm/lib/Transforms/Scalar/IndVarSimplify.cpp

index 4f939b2..0566a15 100644 (file)
@@ -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.