[llvm] r309661 - [IRCE][NFC] Add assert that AddRecExpr's step is not zero

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 31 23:27:51 PDT 2017


Author: mkazantsev
Date: Mon Jul 31 23:27:51 2017
New Revision: 309661

URL: http://llvm.org/viewvc/llvm-project?rev=309661&view=rev
Log:
[IRCE][NFC] Add assert that AddRecExpr's step is not zero

We should never return zero steps, ensure this fact by adding
a sanity check when we are analyzing the induction variable.

Modified:
    llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp?rev=309661&r1=309660&r2=309661&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp Mon Jul 31 23:27:51 2017
@@ -779,6 +779,7 @@ LoopStructure::parseLoopStructure(Scalar
     if (const SCEVConstant *StepExpr =
             dyn_cast<SCEVConstant>(AR->getStepRecurrence(SE))) {
       ConstantInt *StepCI = StepExpr->getValue();
+      assert(!StepCI->isZero() && "Zero step?");
       if (StepCI->isOne() || StepCI->isMinusOne()) {
         IsIncreasing = StepCI->isOne();
         return true;




More information about the llvm-commits mailing list