diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp --- a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp +++ b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp @@ -1895,7 +1895,7 @@ !ShapedType::isDynamic(expectedOffset) && resultOffset != expectedOffset) return emitError("expected result type with offset = ") - << resultOffset << " instead of " << expectedOffset; + << expectedOffset << " instead of " << resultOffset; // Match strides in result memref type and in static_strides attribute. for (auto [idx, resultStride, expectedStride] : diff --git a/mlir/test/Dialect/MemRef/invalid.mlir b/mlir/test/Dialect/MemRef/invalid.mlir --- a/mlir/test/Dialect/MemRef/invalid.mlir +++ b/mlir/test/Dialect/MemRef/invalid.mlir @@ -179,7 +179,7 @@ // ----- func.func @memref_reinterpret_cast_offset_mismatch(%in: memref) { - // expected-error @+1 {{expected result type with offset = 2 instead of 1}} + // expected-error @+1 {{expected result type with offset = 1 instead of 2}} %out = memref.reinterpret_cast %in to offset: [1], sizes: [10], strides: [1] : memref to memref<10xf32, strided<[1], offset: 2>> @@ -209,7 +209,7 @@ // ----- func.func @memref_reinterpret_cast_no_map_but_offset(%in: memref) { - // expected-error @+1 {{expected result type with offset = 0 instead of 2}} + // expected-error @+1 {{expected result type with offset = 2 instead of 0}} %out = memref.reinterpret_cast %in to offset: [2], sizes: [10], strides: [1] : memref to memref<10xf32> return