diff --git a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp index 21f78cf96c70e..f79c774ceb3e9 100644 --- a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp +++ b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp @@ -142,8 +142,8 @@ static llvm::SmallBitVector getDroppedDims(ArrayRef reducedShape, size_t idx = mixedSizes.size() - size.index() - 1; // Rank-reduced dims must have a static unit dimension. bool isStaticUnitSize = - size.value().is() && - llvm::cast(size.value().get()).getInt() == 1; + isa(size.value()) && + llvm::cast(cast(size.value())).getInt() == 1; if (shapePos < 0) { // There are no more dims in the reduced shape. All remaining sizes must diff --git a/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp index 9797b73f534a9..1abcacd6d6db3 100644 --- a/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp @@ -761,8 +761,8 @@ struct PadOpInterface RankedTensorType srcType = padOp.getSourceType(); auto toValue = [&](OpFoldResult ofr) { - if (ofr.is()) - return ofr.get(); + if (auto value = dyn_cast(ofr)) + return value; return rewriter .create(loc, *getConstantIntValue(ofr)) .getResult(); diff --git a/mlir/lib/Dialect/Tensor/Transforms/IndependenceTransforms.cpp b/mlir/lib/Dialect/Tensor/Transforms/IndependenceTransforms.cpp index a89ce20048dff..4655fa3cf0d23 100644 --- a/mlir/lib/Dialect/Tensor/Transforms/IndependenceTransforms.cpp +++ b/mlir/lib/Dialect/Tensor/Transforms/IndependenceTransforms.cpp @@ -21,9 +21,9 @@ using namespace mlir::tensor; static FailureOr makeIndependent(OpBuilder &b, Location loc, OpFoldResult ofr, ValueRange independencies) { - if (ofr.is()) + if (isa(ofr)) return ofr; - Value value = ofr.get(); + Value value = cast(ofr); AffineMap boundMap; ValueDimList mapOperands; if (failed(ValueBoundsConstraintSet::computeIndependentBound( @@ -80,14 +80,14 @@ FailureOr tensor::buildIndependentOp(OpBuilder &b, tensor::PadOp padOp, for (int64_t i = 0, e = padOp.getResultType().getRank(); i < e; ++i) { // offset = ub(low_padding) - low_padding OpFoldResult prevLow = padOp.getMixedLowPad()[i]; - if (prevLow.is()) { + if (isa(prevLow)) { offsets.push_back(b.getIndexAttr(0)); } else { offsets.push_back( b.create( loc, b.getAffineDimExpr(0) - b.getAffineDimExpr(1), - std::initializer_list{newMixedLow[i].get(), - prevLow.get()}) + std::initializer_list{cast(newMixedLow[i]), + cast(prevLow)}) .getResult()); } // size = reified result size