Skip to content

Commit 932b9c6

Browse files
committed
[NFC][mlir][memref] refine debug message about memref::SubViewOp.
1 parent c5972da commit 932b9c6

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2917,27 +2917,32 @@ static bool haveCompatibleStrides(MemRefType t1, MemRefType t2,
29172917
}
29182918

29192919
static LogicalResult produceSubViewErrorMsg(SliceVerificationResult result,
2920-
Operation *op, Type expectedType) {
2920+
SubViewOp op, Type expectedType) {
29212921
auto memrefType = llvm::cast<ShapedType>(expectedType);
29222922
switch (result) {
29232923
case SliceVerificationResult::Success:
29242924
return success();
29252925
case SliceVerificationResult::RankTooLarge:
29262926
return op->emitError("expected result rank to be smaller or equal to ")
2927-
<< "the source rank. ";
2927+
<< "the source rank, but got:" << op.getType();
29282928
case SliceVerificationResult::SizeMismatch:
29292929
return op->emitError("expected result type to be ")
29302930
<< expectedType
2931-
<< " or a rank-reduced version. (mismatch of result sizes) ";
2931+
<< " or a rank-reduced version. (mismatch of result sizes), but got:"
2932+
<< op.getType();
29322933
case SliceVerificationResult::ElemTypeMismatch:
29332934
return op->emitError("expected result element type to be ")
2934-
<< memrefType.getElementType();
2935+
<< memrefType.getElementType() << ", but got:" << op.getType();
29352936
case SliceVerificationResult::MemSpaceMismatch:
2936-
return op->emitError("expected result and source memory spaces to match.");
2937+
return op->emitError(
2938+
"expected result and source memory spaces to match, but got:")
2939+
<< op.getType();
29372940
case SliceVerificationResult::LayoutMismatch:
29382941
return op->emitError("expected result type to be ")
29392942
<< expectedType
2940-
<< " or a rank-reduced version. (mismatch of result layout) ";
2943+
<< " or a rank-reduced version. (mismatch of result layout), but "
2944+
"got:"
2945+
<< op.getType();
29412946
}
29422947
llvm_unreachable("unexpected subview verification result");
29432948
}

0 commit comments

Comments
 (0)