mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-22 10:29:35 +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:
parent
ac70ceafbc
commit
eb3948be16
@ -2707,8 +2707,31 @@ SCEVHandle ScalarEvolution::getSCEVAtScope(SCEV *V, const Loop *L) {
|
||||
return UnknownValue;
|
||||
}
|
||||
|
||||
//assert(0 && "Unknown SCEV type!");
|
||||
return UnknownValue;
|
||||
if (SCEVZeroExtendExpr *Cast = dyn_cast<SCEVZeroExtendExpr>(V)) {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user