[Mlir-commits] [mlir] [mlir][memref] Rewrite scalar `memref.copy` through reinterpret_cast into load/store (PR #186118)

Andrzej WarzyƄski llvmlistbot at llvm.org
Fri Mar 13 02:42:13 PDT 2026


================
@@ -0,0 +1,321 @@
+// RUN: mlir-opt -memref-bypass-reinterpret-cast %s -split-input-file
+// | FileCheck %s
+
+//===----------------------------------------------------------------------===//
+// Positive tests
+//===----------------------------------------------------------------------===//
+
+// CHECK-LABEL: func.func private @concat_zero_offset()
+func.func private @concat_zero_offset() {
+  // CHECK: %[[SRC:.*]] = memref.alloc() : memref<1x1xf32>
+  %alloc = memref.alloc() : memref<1x1xf32>
+  // CHECK: %[[DST:.*]] = memref.alloc() : memref<1x108xf32>
+  %alloc_0 = memref.alloc() : memref<1x108xf32>
----------------
banach-space wrote:

>From https://mlir.llvm.org/getting_started/TestingGuide/#filecheck-best-practices
> Tests should be minimal, and only check what is absolutely necessary.

You can simplify this and other tests by passing these as input arguments to `@concat_zero_offset()`:
```mlir
func.func private @concat_zero_offset(%dest: memref<1x108xf32>, %val_to_store: memref<1x1xf32>) 
```

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


More information about the Mlir-commits mailing list