[Mlir-commits] [mlir] 51ae78a - [MLIR][Affine][NFC] affine.store op verifier message fix and check

Uday Bondhugula llvmlistbot at llvm.org
Wed Nov 10 12:22:47 PST 2021


Author: Uday Bondhugula
Date: 2021-11-11T01:52:23+05:30
New Revision: 51ae78a6d67940c3cf65c1176cb2ea61d11f3989

URL: https://github.com/llvm/llvm-project/commit/51ae78a6d67940c3cf65c1176cb2ea61d11f3989
DIFF: https://github.com/llvm/llvm-project/commit/51ae78a6d67940c3cf65c1176cb2ea61d11f3989.diff

LOG: [MLIR][Affine][NFC] affine.store op verifier message fix and check

Fix typo in affine.store op verifier message and test case.

Differential Revision: https://reviews.llvm.org/D113360

Added: 
    

Modified: 
    mlir/lib/Dialect/Affine/IR/AffineOps.cpp
    mlir/test/Dialect/Affine/invalid.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index 1acb0a565daeb..9f24cfcb714e4 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -2384,11 +2384,11 @@ static void print(OpAsmPrinter &p, AffineStoreOp op) {
 }
 
 LogicalResult verify(AffineStoreOp op) {
-  // First operand must have same type as memref element type.
+  // The value to store must have the same type as memref element type.
   auto memrefType = op.getMemRefType();
   if (op.getValueToStore().getType() != memrefType.getElementType())
     return op.emitOpError(
-        "first operand must have same type memref element type");
+        "value to store must have the same type as memref element type");
 
   if (failed(verifyMemoryOpIndexing(
           op.getOperation(),

diff  --git a/mlir/test/Dialect/Affine/invalid.mlir b/mlir/test/Dialect/Affine/invalid.mlir
index 2264f51145707..a3a709231cd35 100644
--- a/mlir/test/Dialect/Affine/invalid.mlir
+++ b/mlir/test/Dialect/Affine/invalid.mlir
@@ -142,6 +142,15 @@ func @affine_store_missing_l_square(%C: memref<4096x4096xf32>) {
 
 // -----
 
+func @affine_store_wrong_value_type(%C: memref<f32>) {
+  %c0 = arith.constant 0 : i32
+  // expected-error at +1 {{value to store must have the same type as memref element type}}
+  "affine.store"(%c0, %C) : (i32, memref<f32>) -> ()
+  return
+}
+
+// -----
+
 func @affine_min(%arg0 : index, %arg1 : index, %arg2 : index) {
   // expected-error at +1 {{operand count and affine map dimension and symbol count must match}}
   %0 = affine.min affine_map<(d0) -> (d0)> (%arg0, %arg1)


        


More information about the Mlir-commits mailing list