[Mlir-commits] [mlir] [mlir][vector][memref] Add `alignment` attribute to memory access ops (PR #144344)

Andrzej WarzyƄski llvmlistbot at llvm.org
Mon Jul 7 00:59:26 PDT 2025


================
@@ -2005,3 +2005,21 @@ func.func @vector_store(%dest : memref<?xi8>, %vec : vector<16x16xi8>) {
   vector.store %vec, %dest[%c0] : memref<?xi8>, vector<16x16xi8>
   return
 }
+
+// -----
+
+func.func @test_invalid_negative_load_alignment(%memref: memref<4xi32>) {
+  %c0 = arith.constant 0 : index
+  // expected-error @below {{'vector.load' op attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose value is positive and whose value is a power of two > 0}}
+  %val = vector.load %memref[%c0] { alignment = -1 } : memref<4xi32>, vector<4xi32>
+  return
+}
----------------
banach-space wrote:

Please move this inside the block for `vector.load` Ops: https://github.com/llvm/llvm-project/blob/541f33e0751d60b33e75efe0cd436396f27b91ca/mlir/test/Dialect/Vector/invalid.mlir#L1985-L1994

Thanks!

Also, I suggest removing `test` and `negative` from test function name. All functions in this file are "test" function to exercise some "negative" (i.e. failing) case. Similar comment for `@test_invalid_non_power_of_2_store_alignment`.

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


More information about the Mlir-commits mailing list