mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 18:24:23 +00:00
Get even more accurate on the casting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32478 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1567,8 +1567,7 @@ SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) {
|
|||||||
ConstantInt *CompVal = RHSC->getValue();
|
ConstantInt *CompVal = RHSC->getValue();
|
||||||
const Type *RealTy = ExitCond->getOperand(0)->getType();
|
const Type *RealTy = ExitCond->getOperand(0)->getType();
|
||||||
CompVal = dyn_cast<ConstantInt>(
|
CompVal = dyn_cast<ConstantInt>(
|
||||||
ConstantExpr::getIntegerCast(CompVal, RealTy,
|
ConstantExpr::getBitCast(CompVal, RealTy));
|
||||||
CompVal->getType()->isSigned()));
|
|
||||||
if (CompVal) {
|
if (CompVal) {
|
||||||
// Form the constant range.
|
// Form the constant range.
|
||||||
ConstantRange CompRange(Cond, CompVal);
|
ConstantRange CompRange(Cond, CompVal);
|
||||||
@ -1577,12 +1576,10 @@ SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) {
|
|||||||
// range.
|
// range.
|
||||||
if (CompRange.getLower()->getType()->isSigned()) {
|
if (CompRange.getLower()->getType()->isSigned()) {
|
||||||
const Type *NewTy = RHSC->getValue()->getType();
|
const Type *NewTy = RHSC->getValue()->getType();
|
||||||
Constant *NewL =
|
Constant *NewL = ConstantExpr::getBitCast(CompRange.getLower(),
|
||||||
ConstantExpr::getIntegerCast(CompRange.getLower(), NewTy,
|
NewTy);
|
||||||
CompRange.getLower()->getType()->isSigned());
|
Constant *NewU = ConstantExpr::getBitCast(CompRange.getUpper(),
|
||||||
Constant *NewU =
|
NewTy);
|
||||||
ConstantExpr::getIntegerCast(CompRange.getUpper(), NewTy,
|
|
||||||
CompRange.getUpper()->getType()->isSigned());
|
|
||||||
CompRange = ConstantRange(NewL, NewU);
|
CompRange = ConstantRange(NewL, NewU);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user