summaryrefslogtreecommitdiff
path: root/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp')
-rw-r--r--mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp b/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
index 6d286a31290e..a3efc6ef41a9 100644
--- a/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
+++ b/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
@@ -40,7 +40,7 @@ using namespace mlir::vector;
// Returns vector shape if the type is a vector. Returns an empty shape if it is
// not a vector.
static ArrayRef<int64_t> vectorShape(Type type) {
- auto vectorType = type.dyn_cast<VectorType>();
+ auto vectorType = dyn_cast<VectorType>(type);
return vectorType ? vectorType.getShape() : ArrayRef<int64_t>();
}
@@ -54,14 +54,14 @@ static ArrayRef<int64_t> vectorShape(Value value) {
// Broadcasts scalar type into vector type (iff shape is non-scalar).
static Type broadcast(Type type, ArrayRef<int64_t> shape) {
- assert(!type.isa<VectorType>() && "must be scalar type");
+ assert(!isa<VectorType>(type) && "must be scalar type");
return !shape.empty() ? VectorType::get(shape, type) : type;
}
// Broadcasts scalar value into vector (iff shape is non-scalar).
static Value broadcast(ImplicitLocOpBuilder &builder, Value value,
ArrayRef<int64_t> shape) {
- assert(!value.getType().isa<VectorType>() && "must be scalar value");
+ assert(!isa<VectorType>(value.getType()) && "must be scalar value");
auto type = broadcast(value.getType(), shape);
return !shape.empty() ? builder.create<BroadcastOp>(type, value) : value;
}
@@ -92,7 +92,7 @@ handleMultidimensionalVectors(ImplicitLocOpBuilder &builder,
assert(!operands.empty() && "operands must be not empty");
assert(vectorWidth > 0 && "vector width must be larger than 0");
- VectorType inputType = operands[0].getType().cast<VectorType>();
+ VectorType inputType = cast<VectorType>(operands[0].getType());
ArrayRef<int64_t> inputShape = inputType.getShape();
// If input shape matches target vector width, we can just call the
@@ -118,7 +118,7 @@ handleMultidimensionalVectors(ImplicitLocOpBuilder &builder,
for (unsigned i = 0; i < operands.size(); ++i) {
auto operand = operands[i];
- auto eltType = operand.getType().cast<VectorType>().getElementType();
+ auto eltType = cast<VectorType>(operand.getType()).getElementType();
auto expandedType = VectorType::get(expandedShape, eltType);
expandedOperands[i] =
builder.create<vector::ShapeCastOp>(expandedType, operand);
@@ -145,7 +145,7 @@ handleMultidimensionalVectors(ImplicitLocOpBuilder &builder,
}
// Stitch results together into one large vector.
- Type resultEltType = results[0].getType().cast<VectorType>().getElementType();
+ Type resultEltType = cast<VectorType>(results[0].getType()).getElementType();
Type resultExpandedType = VectorType::get(expandedShape, resultEltType);
Value result = builder.create<arith::ConstantOp>(
resultExpandedType, builder.getZeroAttr(resultExpandedType));
@@ -318,9 +318,9 @@ LogicalResult insertCasts(Operation *op, PatternRewriter &rewriter) {
// Create F32 equivalent type.
Type newType;
- if (auto shaped = origType.dyn_cast<ShapedType>()) {
+ if (auto shaped = dyn_cast<ShapedType>(origType)) {
newType = shaped.clone(rewriter.getF32Type());
- } else if (origType.isa<FloatType>()) {
+ } else if (isa<FloatType>(origType)) {
newType = rewriter.getF32Type();
} else {
return rewriter.notifyMatchFailure(op,