From: Philip Reames Date: Wed, 3 Jul 2019 18:24:06 +0000 (+0000) Subject: [LFTR] Remove falsely generalized (dead) code [NFC] X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d9219bd3001d883c7a59f0c957de5c64bc4a6f47;p=llvm [LFTR] Remove falsely generalized (dead) code [NFC] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365067 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index 4f939b21a2e..0566a1558b0 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/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(ARStep)->getValue()->isNegative()) - NewLimit = Start - Count; - else - NewLimit = Start + Count; + assert(cast(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.