[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.

llvm-svn: 309661
This commit is contained in:
Max Kazantsev 2017-08-01 06:27:51 +00:00
parent 855ab9f801
commit 3d9db69707

View File

@ -779,6 +779,7 @@ LoopStructure::parseLoopStructure(ScalarEvolution &SE, BranchProbabilityInfo &BP
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;