It's easy to handle SLE/SGE when the loop has a unit stride.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60748 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky
2008-12-09 07:25:04 +00:00
parent ba4dacc875
commit 0bed364307
2 changed files with 29 additions and 1 deletions

View File

@@ -2924,8 +2924,12 @@ bool ScalarEvolutionsImpl::potentialInfiniteLoop(SCEV *Stride, SCEV *RHS,
if (!R)
return true;
if (isSigned)
if (isSigned) {
if (SC->getValue()->isOne())
return R->getValue()->isMaxValue(true);
return true; // XXX: because we don't have an sdiv scev.
}
// If negative, it wraps around every iteration, but we don't care about that.
APInt S = SC->getValue()->getValue().abs();