aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-04-21 20:18:36 +0000
committerDan Gohman <gohman@apple.com>2009-04-21 20:18:36 +0000
commit578ccf81e5b94965e3ce8b4eadb6834e39f5f41d (patch)
treea7eb49d0dc6de05f54e2a0c9f0b7ada436ce6b5e /lib/Analysis/ScalarEvolution.cpp
parent4558f481b83a3c14ad5f1077b053a748a3203059 (diff)
When turning (ashr(shl(x, n), n)) into sext(trunc(x)), the width of the
type to truncate to should be the number of bits of the value that are preserved, not the number that are clobbered with sign-extension. This fixes regressions in ldecod. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69704 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 ace063a399..0aa673f355 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -2015,7 +2015,7 @@ SCEVHandle ScalarEvolutionsImpl::createSCEV(Value *V) {
if (Instruction *L = dyn_cast<Instruction>(U->getOperand(0)))
if (L->getOpcode() == Instruction::Shl &&
L->getOperand(1) == U->getOperand(1)) {
- uint64_t Amt = CI->getZExtValue();
+ uint64_t Amt = getTypeSizeInBits(U->getType()) - CI->getZExtValue();
return
SE.getSignExtendExpr(SE.getTruncateExpr(getSCEV(L->getOperand(0)),
IntegerType::get(Amt)),