[Mlir-commits] [mlir] [MLIR] Add a utility pass to linearize `memref` (PR #136797)

Andrzej WarzyƄski llvmlistbot at llvm.org
Thu Apr 24 08:44:24 PDT 2025


================
@@ -0,0 +1,225 @@
+// RUN: mlir-opt --flatten-memref %s --split-input-file --verify-diagnostics | FileCheck %s
+
+func.func @load_scalar_from_memref(%input: memref<4x8xf32, strided<[8, 1], offset: 100>>) -> f32 {
+  %c1 = arith.constant 1 : index
+  %c2 = arith.constant 2 : index
+  %value = memref.load %input[%c1, %c2] : memref<4x8xf32, strided<[8, 1], offset: 100>>
+  return %value : f32
+}
+// CHECK: func @load_scalar_from_memref
----------------
banach-space wrote:

[nit] Use `CHECK-LABEL` for function names: https://llvm.org/docs/CommandGuide/FileCheck.html#the-check-label-directive

Given that you are using `--split-input-file`, it won't make a massive difference (in terms of the actual testing). But it will make the tests easier to parse.

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


More information about the Mlir-commits mailing list