[Mlir-commits] [mlir] [MLIR][MemRef] Fix AllocOp/AllocaOp flattening domination violation (PR #188980)

Hocky Yudhiono llvmlistbot at llvm.org
Thu Apr 2 04:42:48 PDT 2026


================
@@ -108,34 +108,19 @@ static Value getTargetMemref(Operation *op) {
 }
 
 template <typename T>
-static void castAllocResult(T oper, T newOper, Location loc,
-                            PatternRewriter &rewriter) {
-  memref::ExtractStridedMetadataOp stridedMetadata =
-      memref::ExtractStridedMetadataOp::create(rewriter, loc, oper);
+static void castAllocResult(T oper, T newOper, PatternRewriter &rewriter,
+                            ArrayRef<OpFoldResult> sizes,
+                            ArrayRef<OpFoldResult> strides) {
   rewriter.replaceOpWithNewOp<memref::ReinterpretCastOp>(
       oper, cast<MemRefType>(oper.getType()), newOper,
-      /*offset=*/rewriter.getIndexAttr(0),
-      stridedMetadata.getConstifiedMixedSizes(),
-      stridedMetadata.getConstifiedMixedStrides());
+      /*offset=*/rewriter.getIndexAttr(0), sizes, strides);
----------------
hockyy wrote:

```suggestion 
      offset, sizes, strides);
```
I think there was an error here in the old code as well, although not idiomatic, i think offset should follow the old alloc? So maybe we need to do this?

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


More information about the Mlir-commits mailing list