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 | 90d612e536ea5a4dea4a94bd3cad1ed3433102dc (patch) | |
| tree | 02263653cbd77efc4a5c18710888e5ce64403b98 /llvm/lib | |
| parent | 6fa36b42460bca4f99d5fee64977faad29e95741 (diff) | |
| download | bcm5719-llvm-90d612e536ea5a4dea4a94bd3cad1ed3433102dc.tar.gz bcm5719-llvm-90d612e536ea5a4dea4a94bd3cad1ed3433102dc.zip | |
Use ScalarEvolution's new GetMinSignBits and GetMinLeadingZeros
in the loop backedge-taken count computation of the maximum
possible trip count.
llvm-svn: 73805
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 2dab2f367de..465807ecacb 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/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. |

