diff options
author | Dan Gohman <gohman@apple.com> | 2009-06-20 00:32:22 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-06-20 00:32:22 +0000 |
commit | 3964acc2f44ee02cdd4e2a54a5232537bdf3ee73 (patch) | |
tree | dd6a747cae25f0252d6a44c5e14af27a42089d27 /lib/Analysis/ScalarEvolution.cpp | |
parent | cc40f077b018e62e2e6f5dc279e3be84779569ce (diff) |
Use ScalarEvolution's new GetMinSignBits and GetMinLeadingZeros
in the loop backedge-taken count computation of the maximum
possible trip count.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73805 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 2dab2f367d..465807ecac 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -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. |