[Mlir-commits] [mlir] [NFC][mlir][memref] refine debug message about memref::SubViewOp. (PR #145469)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Jun 23 23:47:00 PDT 2025
https://github.com/lipracer created https://github.com/llvm/llvm-project/pull/145469
None
>From 39ec4427ad4558ece6cc6b4fde8bab3b36ba7bae Mon Sep 17 00:00:00 2001
From: chenlonglong <chenlonglong at willingcore.com>
Date: Tue, 24 Jun 2025 06:29:19 +0000
Subject: [PATCH] [NFC][mlir][memref] refine debug message about
memref::SubViewOp.
---
mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
index d56b32193765e..3b001b9d1ea78 100644
--- a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
+++ b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
@@ -2917,27 +2917,32 @@ static bool haveCompatibleStrides(MemRefType t1, MemRefType t2,
}
static LogicalResult produceSubViewErrorMsg(SliceVerificationResult result,
- Operation *op, Type expectedType) {
+ SubViewOp op, Type expectedType) {
auto memrefType = llvm::cast<ShapedType>(expectedType);
switch (result) {
case SliceVerificationResult::Success:
return success();
case SliceVerificationResult::RankTooLarge:
return op->emitError("expected result rank to be smaller or equal to ")
- << "the source rank. ";
+ << "the source rank, but got:" << op.getType();
case SliceVerificationResult::SizeMismatch:
return op->emitError("expected result type to be ")
<< expectedType
- << " or a rank-reduced version. (mismatch of result sizes) ";
+ << " or a rank-reduced version. (mismatch of result sizes), but got:"
+ << op.getType();
case SliceVerificationResult::ElemTypeMismatch:
return op->emitError("expected result element type to be ")
- << memrefType.getElementType();
+ << memrefType.getElementType() << ", but got:" << op.getType();
case SliceVerificationResult::MemSpaceMismatch:
- return op->emitError("expected result and source memory spaces to match.");
+ return op->emitError(
+ "expected result and source memory spaces to match, but got:")
+ << op.getType();
case SliceVerificationResult::LayoutMismatch:
return op->emitError("expected result type to be ")
<< expectedType
- << " or a rank-reduced version. (mismatch of result layout) ";
+ << " or a rank-reduced version. (mismatch of result layout), but "
+ "got:"
+ << op.getType();
}
llvm_unreachable("unexpected subview verification result");
}
More information about the Mlir-commits
mailing list