aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-04 19:52:50 +0000
committerDan Gohman <gohman@apple.com>2010-08-04 19:52:50 +0000
commitddd3a8899a31f858097bc482082a74b3f684b426 (patch)
treef2206c12fe92452989848d4755f97330baa67831 /lib/Analysis/ScalarEvolution.cpp
parent9f6a6862be09df9f1e90b0560e52da7d15935f24 (diff)
Fix a minor bug which resulted in intermediate calculations
using wider types than are necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110241 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 1dc8e83b12..9aaafafe05 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -1896,7 +1896,7 @@ const SCEV *ScalarEvolution::getUDivExpr(const SCEV *LHS,
// TODO: Generalize this to non-constants by using known-bits information.
const Type *Ty = LHS->getType();
unsigned LZ = RHSC->getValue()->getValue().countLeadingZeros();
- unsigned MaxShiftAmt = getTypeSizeInBits(Ty) - LZ;
+ unsigned MaxShiftAmt = getTypeSizeInBits(Ty) - LZ - 1;
// For non-power-of-two values, effectively round the value up to the
// nearest power of two.
if (!RHSC->getValue()->getValue().isPowerOf2())