[Mlir-commits] [mlir] 2a0c084 - [mlir][MemRef] fix error message in ReinterpretCastOp::verify
Alex Zinenko
llvmlistbot at llvm.org
Tue Apr 11 08:38:14 PDT 2023
Author: Felix Schneider
Date: 2023-04-11T17:38:07+02:00
New Revision: 2a0c0849747425b570561e6bd9869843131a880d
URL: https://github.com/llvm/llvm-project/commit/2a0c0849747425b570561e6bd9869843131a880d
DIFF: https://github.com/llvm/llvm-project/commit/2a0c0849747425b570561e6bd9869843131a880d.diff
LOG: [mlir][MemRef] fix error message in ReinterpretCastOp::verify
The error message that is displayed when the offset in the MemRefType of
the Op's result is unexpected was the wrong way around, mixing up
expected and actual offset.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D148009
Added:
Modified:
mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
mlir/test/Dialect/MemRef/invalid.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
index 27f1eab09eec6..5960b9f0c5c69 100644
--- a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
+++ b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
@@ -1895,7 +1895,7 @@ LogicalResult ReinterpretCastOp::verify() {
!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
index 37ac1ca77328b..cb5977e302a99 100644
--- a/mlir/test/Dialect/MemRef/invalid.mlir
+++ b/mlir/test/Dialect/MemRef/invalid.mlir
@@ -179,7 +179,7 @@ func.func @memref_reinterpret_cast_incompatible_memory_space(%in: memref<*xf32>)
// -----
func.func @memref_reinterpret_cast_offset_mismatch(%in: memref<?xf32>) {
- // 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<?xf32> to memref<10xf32, strided<[1], offset: 2>>
@@ -209,7 +209,7 @@ func.func @memref_reinterpret_cast_offset_mismatch(%in: memref<?xf32>) {
// -----
func.func @memref_reinterpret_cast_no_map_but_offset(%in: memref<?xf32>) {
- // 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<?xf32> to memref<10xf32>
return
More information about the Mlir-commits
mailing list