summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
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
commite14efcc9f40d0ef0ed2ed4d5afd6e718b7cb5c5d (patch)
treea74eedf6430dec1761db27cf712a6e5e3a4eb1cc /llvm/lib/Analysis
parenta8e8bc24b360fdc32338dd3ab687fdce19c0a9af (diff)
downloadbcm5719-llvm-e14efcc9f40d0ef0ed2ed4d5afd6e718b7cb5c5d.tar.gz
bcm5719-llvm-e14efcc9f40d0ef0ed2ed4d5afd6e718b7cb5c5d.zip
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. llvm-svn: 69704
Diffstat (limited to 'llvm/lib/Analysis')
-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 ace063a399c..0aa673f355e 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/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)),
OpenPOWER on IntegriCloud