[Mlir-commits] [mlir] [mlir] Convert TensorType and BaseMemRefType to interfaces (PR #133053)

Matthias Springer llvmlistbot at llvm.org
Wed Mar 26 02:21:33 PDT 2025


================
@@ -77,9 +77,9 @@ struct CastOpInterface
     // Case 3: Ranked tensor -> ranked tensor. The offsets and strides do not
     // change.
     auto rankedResultType = cast<RankedTensorType>(castOp.getType());
-    return MemRefType::get(
+    return llvm::cast<BaseMemRefType>(MemRefType::get(
----------------
matthias-springer wrote:

Why is the cast necessary here? (And in other places.) I expected that `MemRefType` inherits from `BaseMemRefType` (talking about the auto-generated C++ classes). Is that not the case?

(Same how you can assign a `MemRefType` to a `ShapedType` variable, I think...)


https://github.com/llvm/llvm-project/pull/133053


More information about the Mlir-commits mailing list