- if (!PreCondLHS->getType()->isInteger()) return false;
+ if (PreCondLHS->getType()->isInteger()) return false;
return LHS == getSCEV(PreCondLHS) && RHS == getSCEV(PreCondRHS);
}
return LHS == getSCEV(PreCondLHS) && RHS == getSCEV(PreCondRHS);
}
// First, we get the value of the LHS in the first iteration: n
SCEVHandle Start = AddRec->getOperand(0);
// First, we get the value of the LHS in the first iteration: n
SCEVHandle Start = AddRec->getOperand(0);
- // Then, we get the value of the LHS in the first iteration in which the
- // above condition doesn't hold. This equals to max(m,n).
if (executesAtLeastOnce(L, isSigned,
if (executesAtLeastOnce(L, isSigned,
- SE.getMinusSCEV(AddRec->getOperand(0), One), RHS))
+ SE.getMinusSCEV(AddRec->getOperand(0), One), RHS)) {
+ // Since we know that the condition is true in order to enter the loop,
+ // we know that it will run exactly m-n times.
return SE.getMinusSCEV(RHS, Start);
return SE.getMinusSCEV(RHS, Start);
+ } else {
+ // Then, we get the value of the LHS in the first iteration in which the
+ // above condition doesn't hold. This equals to max(m,n).
SCEVHandle End = isSigned ? SE.getSMaxExpr(RHS, Start)
: SE.getUMaxExpr(RHS, Start);
SCEVHandle End = isSigned ? SE.getSMaxExpr(RHS, Start)
: SE.getUMaxExpr(RHS, Start);