mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 00:21:03 +00:00
Add an isOne() utility function to ScalarEvolution, similar to isZero()
and similar to ConstantInt's isOne(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72003 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -127,6 +127,11 @@ bool SCEV::isZero() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SCEV::isOne() const {
|
||||
if (const SCEVConstant *SC = dyn_cast<SCEVConstant>(this))
|
||||
return SC->getValue()->isOne();
|
||||
return false;
|
||||
}
|
||||
|
||||
SCEVCouldNotCompute::SCEVCouldNotCompute() : SCEV(scCouldNotCompute) {}
|
||||
SCEVCouldNotCompute::~SCEVCouldNotCompute() {}
|
||||
@@ -3392,7 +3397,7 @@ HowManyLessThans(const SCEV *LHS, const SCEV *RHS,
|
||||
const SCEVConstant *CStep = dyn_cast<SCEVConstant>(Step);
|
||||
if (!CStep || CStep->isZero())
|
||||
return UnknownValue;
|
||||
if (CStep->getValue()->getValue() == 1) {
|
||||
if (CStep->isOne()) {
|
||||
// With unit stride, the iteration never steps past the limit value.
|
||||
} else if (CStep->getValue()->getValue().isStrictlyPositive()) {
|
||||
if (const SCEVConstant *CLimit = dyn_cast<SCEVConstant>(RHS)) {
|
||||
|
Reference in New Issue
Block a user