mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 23:24:34 +00:00
Implement getSCEVAtScope for SCEV cast expressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70422 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -2707,8 +2707,31 @@ SCEVHandle ScalarEvolution::getSCEVAtScope(SCEV *V, const Loop *L) {
|
|||||||
return UnknownValue;
|
return UnknownValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//assert(0 && "Unknown SCEV type!");
|
if (SCEVZeroExtendExpr *Cast = dyn_cast<SCEVZeroExtendExpr>(V)) {
|
||||||
return UnknownValue;
|
SCEVHandle Op = getSCEVAtScope(Cast->getOperand(), L);
|
||||||
|
if (Op == UnknownValue) return Op;
|
||||||
|
if (Op == Cast->getOperand())
|
||||||
|
return Cast; // must be loop invariant
|
||||||
|
return getZeroExtendExpr(Op, Cast->getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SCEVSignExtendExpr *Cast = dyn_cast<SCEVSignExtendExpr>(V)) {
|
||||||
|
SCEVHandle Op = getSCEVAtScope(Cast->getOperand(), L);
|
||||||
|
if (Op == UnknownValue) return Op;
|
||||||
|
if (Op == Cast->getOperand())
|
||||||
|
return Cast; // must be loop invariant
|
||||||
|
return getSignExtendExpr(Op, Cast->getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SCEVTruncateExpr *Cast = dyn_cast<SCEVTruncateExpr>(V)) {
|
||||||
|
SCEVHandle Op = getSCEVAtScope(Cast->getOperand(), L);
|
||||||
|
if (Op == UnknownValue) return Op;
|
||||||
|
if (Op == Cast->getOperand())
|
||||||
|
return Cast; // must be loop invariant
|
||||||
|
return getTruncateExpr(Op, Cast->getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(0 && "Unknown SCEV type!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getSCEVAtScope - Return a SCEV expression handle for the specified value
|
/// getSCEVAtScope - Return a SCEV expression handle for the specified value
|
||||||
|
Reference in New Issue
Block a user