summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitdb764c6e3bf3d9f3be4e658e8218b45bc774ab95 (patch)
treea353224f796f26986710dd502df27cfe376e6cd5 /llvm/lib/Analysis/ScalarEvolution.cpp
parent23922873066c22cdf5c06b2ceb5cd2d75846ecb6 (diff)
downloadbcm5719-llvm-db764c6e3bf3d9f3be4e658e8218b45bc774ab95.tar.gz
bcm5719-llvm-db764c6e3bf3d9f3be4e658e8218b45bc774ab95.zip
Fix a minor bug which resulted in intermediate calculations
using wider types than are necessary. llvm-svn: 110241
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 1dc8e83b124..9aaafafe052 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/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())
OpenPOWER on IntegriCloud