[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 35fdbd56b7
commit 85da7543f9
1 changed files with 1 additions and 0 deletions

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;