aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-05 22:39:58 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-05 22:39:58 +0000
commit315d05542cbe0e5fe769122324328b268ce4497c (patch)
tree03d6902ffaa788255e936494fb609ae4a67322f2 /lib/Analysis/ScalarEvolution.cpp
parent953fa0455e1917e2d91a5bfdad246d75831c5f29 (diff)
Finally get the casting right in this file. Also, remove some unnecessary
casting because sdiv doesn't require operand signs to match any more. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32240 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 4c1fa10cc8..6e6d302324 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -560,7 +560,7 @@ SCEVHandle SCEVAddRecExpr::evaluateAtIteration(SCEVHandle It) const {
SCEVHandle SCEVTruncateExpr::get(const SCEVHandle &Op, const Type *Ty) {
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op))
return SCEVUnknown::get(
- ConstantExpr::getTruncOrBitCast(SC->getValue(), Ty));
+ ConstantExpr::getTrunc(SC->getValue(), Ty));
// If the input value is a chrec scev made out of constants, truncate
// all of the constants.
@@ -584,7 +584,7 @@ SCEVHandle SCEVTruncateExpr::get(const SCEVHandle &Op, const Type *Ty) {
SCEVHandle SCEVZeroExtendExpr::get(const SCEVHandle &Op, const Type *Ty) {
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op))
return SCEVUnknown::get(
- ConstantExpr::getZExtOrBitCast(SC->getValue(), Ty));
+ ConstantExpr::getZeroExtend(SC->getValue(), Ty));
// FIXME: If the input value is a chrec scev, and we can prove that the value
// did not overflow the old, smaller, value, we can zero extend all of the
@@ -999,11 +999,6 @@ SCEVHandle SCEVSDivExpr::get(const SCEVHandle &LHS, const SCEVHandle &RHS) {
if (SCEVConstant *LHSC = dyn_cast<SCEVConstant>(LHS)) {
Constant *LHSCV = LHSC->getValue();
Constant *RHSCV = RHSC->getValue();
- if (LHSCV->getType()->isUnsigned())
- LHSCV = ConstantExpr::getBitCast(LHSCV,
- LHSCV->getType()->getSignedVersion());
- if (RHSCV->getType()->isUnsigned())
- RHSCV = ConstantExpr::getBitCast(RHSCV, LHSCV->getType());
return SCEVUnknown::get(ConstantExpr::getSDiv(LHSCV, RHSCV));
}
}
@@ -1376,12 +1371,16 @@ SCEVHandle ScalarEvolutionsImpl::createSCEV(Value *V) {
break;
case Instruction::Trunc:
+ // We must prevent boolean types such as setne, etc. from entering here
+ // because we don't want to pass SCEVUnknown to the TruncateExpr.
if (I->getType()->isInteger() && I->getOperand(0)->getType()->isInteger())
return SCEVTruncateExpr::get(getSCEV(I->getOperand(0)),
I->getType()->getUnsignedVersion());
break;
case Instruction::ZExt:
+ // We must prevent boolean types such as setne, etc. from entering here
+ // because we don't want to pass SCEVUnknown to the ZExtExpr.
if (I->getType()->isInteger() && I->getOperand(0)->getType()->isInteger())
return SCEVZeroExtendExpr::get(getSCEV(I->getOperand(0)),
I->getType()->getUnsignedVersion());