mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +00:00
Fix inferred casts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32180 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -178,7 +178,8 @@ SCEVHandle SCEVConstant::get(ConstantInt *V) {
|
|||||||
// Make sure that SCEVConstant instances are all unsigned.
|
// Make sure that SCEVConstant instances are all unsigned.
|
||||||
if (V->getType()->isSigned()) {
|
if (V->getType()->isSigned()) {
|
||||||
const Type *NewTy = V->getType()->getUnsignedVersion();
|
const Type *NewTy = V->getType()->getUnsignedVersion();
|
||||||
V = cast<ConstantInt>(ConstantExpr::getCast(V, NewTy));
|
V = cast<ConstantInt>(
|
||||||
|
ConstantExpr::getInferredCast(V, false, NewTy, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
SCEVConstant *&R = (*SCEVConstants)[V];
|
SCEVConstant *&R = (*SCEVConstants)[V];
|
||||||
@ -465,7 +466,7 @@ SCEVHandle SCEVUnknown::getIntegerSCEV(int Val, const Type *Ty) {
|
|||||||
C = ConstantInt::get(Ty, Val);
|
C = ConstantInt::get(Ty, Val);
|
||||||
else {
|
else {
|
||||||
C = ConstantInt::get(Ty->getSignedVersion(), Val);
|
C = ConstantInt::get(Ty->getSignedVersion(), Val);
|
||||||
C = ConstantExpr::getCast(C, Ty);
|
C = ConstantExpr::getInferredCast(C, true, Ty, false);
|
||||||
}
|
}
|
||||||
return SCEVUnknown::get(C);
|
return SCEVUnknown::get(C);
|
||||||
}
|
}
|
||||||
@ -511,7 +512,8 @@ static SCEVHandle PartialFact(SCEVHandle V, unsigned NumSteps) {
|
|||||||
for (; NumSteps; --NumSteps)
|
for (; NumSteps; --NumSteps)
|
||||||
Result *= Val-(NumSteps-1);
|
Result *= Val-(NumSteps-1);
|
||||||
Constant *Res = ConstantInt::get(Type::ULongTy, Result);
|
Constant *Res = ConstantInt::get(Type::ULongTy, Result);
|
||||||
return SCEVUnknown::get(ConstantExpr::getCast(Res, V->getType()));
|
return SCEVUnknown::get(
|
||||||
|
ConstantExpr::getInferredCast(Res, false, V->getType(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
const Type *Ty = V->getType();
|
const Type *Ty = V->getType();
|
||||||
@ -996,10 +998,11 @@ SCEVHandle SCEVSDivExpr::get(const SCEVHandle &LHS, const SCEVHandle &RHS) {
|
|||||||
Constant *LHSCV = LHSC->getValue();
|
Constant *LHSCV = LHSC->getValue();
|
||||||
Constant *RHSCV = RHSC->getValue();
|
Constant *RHSCV = RHSC->getValue();
|
||||||
if (LHSCV->getType()->isUnsigned())
|
if (LHSCV->getType()->isUnsigned())
|
||||||
LHSCV = ConstantExpr::getCast(LHSCV,
|
LHSCV = ConstantExpr::getInferredCast(
|
||||||
LHSCV->getType()->getSignedVersion());
|
LHSCV, false, LHSCV->getType()->getSignedVersion(), true);
|
||||||
if (RHSCV->getType()->isUnsigned())
|
if (RHSCV->getType()->isUnsigned())
|
||||||
RHSCV = ConstantExpr::getCast(RHSCV, LHSCV->getType());
|
RHSCV = ConstantExpr::getInferredCast(
|
||||||
|
RHSCV, false, LHSCV->getType(), true);
|
||||||
return SCEVUnknown::get(ConstantExpr::getSDiv(LHSCV, RHSCV));
|
return SCEVUnknown::get(ConstantExpr::getSDiv(LHSCV, RHSCV));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user