diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp --- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp +++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp @@ -2384,11 +2384,11 @@ } 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 --- a/mlir/test/Dialect/Affine/invalid.mlir +++ b/mlir/test/Dialect/Affine/invalid.mlir @@ -142,6 +142,15 @@ // ----- +func @affine_store_wrong_value_type(%C: memref) { + %c0 = arith.constant 0 : i32 + // expected-error@+1 {{value to store must have the same type as memref element type}} + "affine.store"(%c0, %C) : (i32, memref) -> () + return +} + +// ----- + func @affine_min(%arg0 : index, %arg1 : index, %arg2 : index) { // expected-error@+1 {{operand count and affine map dimension and symbol count must match}} %0 = affine.min affine_map<(d0) -> (d0)> (%arg0, %arg1)