Fix cast in AffineMap::getSingleConstantValue and rename to
getSingleConstantResult.
PiperOrigin-RevId: 212544394
diff --git a/include/mlir/IR/AffineMap.h b/include/mlir/IR/AffineMap.h
index 46b64f2..9f3ffee 100644
--- a/include/mlir/IR/AffineMap.h
+++ b/include/mlir/IR/AffineMap.h
@@ -58,9 +58,9 @@
/// 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;
diff --git a/lib/IR/AffineMap.cpp b/lib/IR/AffineMap.cpp
index 37a3b45..8d56f24 100644
--- a/lib/IR/AffineMap.cpp
+++ b/lib/IR/AffineMap.cpp
@@ -43,9 +43,9 @@
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.
diff --git a/lib/IR/Statement.cpp b/lib/IR/Statement.cpp
index 1f7604f..c8d3336 100644
--- a/lib/IR/Statement.cpp
+++ b/lib/IR/Statement.cpp
@@ -336,11 +336,11 @@
}
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 {