[Mlir-commits] [mlir] [mlir][memref] Remove unsafe `getType()` from ReshapeOp (PR #205105)

Longsheng Mou llvmlistbot at llvm.org
Fri Jun 26 01:32:34 PDT 2026


================
@@ -44,18 +44,19 @@ struct MemRefReshapeOpConverter : public OpRewritePattern<memref::ReshapeOp> {
     Location loc = op.getLoc();
     Value stride = nullptr;
     int64_t staticStride = 1;
+    MemRefType resultType = cast<MemRefType>(op.getType());
----------------
CoTinker wrote:

Yes, if the shape of reshape op is static, the result type is MemrefType. And this is checked before the cast.

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


More information about the Mlir-commits mailing list