[Mlir-commits] [mlir] [mlir][memref]: Added OOB value bound check to ViewOp (PR #183985)

Matthias Springer llvmlistbot at llvm.org
Sun Mar 1 00:58:46 PST 2026


================
@@ -127,3 +127,214 @@ func.func @memref_subview(%m: memref<?xf32>, %sz: index) -> index {
   %1 = "test.reify_bound"(%0) {dim = 0} : (memref<?xf32, strided<[1], offset: 2>>) -> (index)
   return %1 : index
 }
+
+// -----
+
+// CHECK-LABEL: func @memref_view_static_sizes(
+//       CHECK:   %[[c64:.*]] = arith.constant 64 : index
+//       CHECK:   %[[c4:.*]] = arith.constant 4 : index
+//       CHECK:   return %[[c64]], %[[c4]]
+func.func @memref_view_static_sizes(%raw: memref<2048xi8>, %shift: index) -> (index, index) {
+  %0 = memref.view %raw[%shift][] : memref<2048xi8> to memref<64x4xf32>
+  %1 = "test.reify_bound"(%0) {dim = 0} : (memref<64x4xf32>) -> (index)
+  %2 = "test.reify_bound"(%0) {dim = 1} : (memref<64x4xf32>) -> (index)
+  return %1, %2 : index, index
+}
+
+// -----
+
+// CHECK-LABEL: func @memref_view_dynamic_sizes(
+//       CHECK:   %[[view:.*]] = memref.view
+//       CHECK:   return {{.*}}, {{.*}} : index, index
----------------
matthias-springer wrote:

Can you fill in the `{{.*}}` here?

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


More information about the Mlir-commits mailing list