[Mlir-commits] [mlir] 09b0e08 - [mlir] Print bad size in AttrSizedOperandSegments
Brian Gesiak
llvmlistbot at llvm.org
Sat Dec 12 10:13:18 PST 2020
Author: Brian Gesiak
Date: 2020-12-12T13:12:31-05:00
New Revision: 09b0e0884a3ea561f11a97644a9cf6c15eac6ec0
URL: https://github.com/llvm/llvm-project/commit/09b0e0884a3ea561f11a97644a9cf6c15eac6ec0
DIFF: https://github.com/llvm/llvm-project/commit/09b0e0884a3ea561f11a97644a9cf6c15eac6ec0.diff
LOG: [mlir] Print bad size in AttrSizedOperandSegments
When printing verification errors for ops with the incorrect number of
operand segments, print the required number as well as the actual
number. Split off from D93005.
Differential Revision: https://reviews.llvm.org/D93145
Added:
Modified:
mlir/test/IR/traits.mlir
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
Removed:
################################################################################
diff --git a/mlir/test/IR/traits.mlir b/mlir/test/IR/traits.mlir
index c023db338a73..e3604b7b5387 100644
--- a/mlir/test/IR/traits.mlir
+++ b/mlir/test/IR/traits.mlir
@@ -448,7 +448,7 @@ func @failedResultSizeAttrWrongTotalSize() {
// -----
func @failedResultSizeAttrWrongCount() {
- // expected-error @+1 {{'result_segment_sizes' attribute for specifying result segments must have 4 elements}}
+ // expected-error @+1 {{'result_segment_sizes' attribute for specifying result segments must have 4 elements, but got 3}}
%0:4 = "test.attr_sized_results"() {result_segment_sizes = dense<[2, 1, 1]>: vector<3xi32>} : () -> (i32, i32, i32, i32)
}
diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index 04bc10d338d7..c97aa043bb6c 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -2211,7 +2211,7 @@ void OpOperandAdaptorEmitter::addVerification() {
auto numElements = sizeAttr.getType().cast<::mlir::ShapedType>().getNumElements();
if (numElements != {1})
return emitError(loc, "'{0}' attribute for specifying {2} segments "
- "must have {1} elements");
+ "must have {1} elements, but got ") << numElements;
}
)";
More information about the Mlir-commits
mailing list