Use ScalarEvolution's new GetMinSignBits and GetMinLeadingZeros

in the loop backedge-taken count computation of the maximum
possible trip count.

llvm-svn: 73805
This commit is contained in:
Dan Gohman 2009-06-20 00:32:22 +00:00
parent 6fa36b4246
commit 90d612e536
1 changed files with 6 additions and 3 deletions

View File

@ -3836,9 +3836,12 @@ HowManyLessThans(const SCEV *LHS, const SCEV *RHS,
: getUMaxExpr(RHS, Start);
// Determine the maximum constant end value.
SCEVHandle MaxEnd = isa<SCEVConstant>(End) ? End :
getConstant(isSigned ? APInt::getSignedMaxValue(BitWidth) :
APInt::getMaxValue(BitWidth));
SCEVHandle MaxEnd =
isa<SCEVConstant>(End) ? End :
getConstant(isSigned ? APInt::getSignedMaxValue(BitWidth)
.ashr(GetMinSignBits(End) - 1) :
APInt::getMaxValue(BitWidth)
.lshr(GetMinLeadingZeros(End)));
// Finally, we subtract these two values and divide, rounding up, to get
// the number of times the backedge is executed.