Fix cast in AffineMap::getSingleConstantValue and rename to

getSingleConstantResult.

PiperOrigin-RevId: 212544394
This commit is contained in:
Uday Bondhugula 2018-09-11 16:29:24 -07:00 committed by jpienaar
parent 8ad7e2b8fa
commit e5608ae32b
3 changed files with 7 additions and 7 deletions

View File

@ -58,9 +58,9 @@ public:
/// Returns true if this affine map is a single result constant function.
bool isSingleConstant() const;
/// Returns the constant value that is the result of this map.
/// This methods asserts that the map has a single constant result.
int64_t getSingleConstantValue() const;
/// Returns the constant result of this map. This methods asserts that the map
/// has a single constant result.
int64_t getSingleConstantResult() const;
// Prints affine map to 'os'.
void print(raw_ostream &os) const;

View File

@ -43,9 +43,9 @@ bool AffineMap::isSingleConstant() const {
return getNumResults() == 1 && isa<AffineConstantExpr>(getResult(0));
}
int64_t AffineMap::getSingleConstantValue() const {
int64_t AffineMap::getSingleConstantResult() const {
assert(isSingleConstant() && "map must have a single constant result");
return dyn_cast<AffineConstantExpr>(getResult(0))->getValue();
return cast<AffineConstantExpr>(getResult(0))->getValue();
}
/// Simplify add expression. Return nullptr if it can't be simplified.

View File

@ -336,11 +336,11 @@ bool ForStmt::hasConstantUpperBound() const {
}
int64_t ForStmt::getConstantLowerBound() const {
return lbMap->getSingleConstantValue();
return lbMap->getSingleConstantResult();
}
int64_t ForStmt::getConstantUpperBound() const {
return ubMap->getSingleConstantValue();
return ubMap->getSingleConstantResult();
}
Optional<uint64_t> ForStmt::getConstantTripCount() const {