[Mlir-commits] [mlir] fb8204b - [mlir][ods] Fix ops with both attribute-sized operands and results
Lei Zhang
llvmlistbot at llvm.org
Tue May 19 17:30:03 PDT 2020
Author: Kuangyuan Chen
Date: 2020-05-19T20:29:54-04:00
New Revision: fb8204b210315807d6c18709c008a358d730aeff
URL: https://github.com/llvm/llvm-project/commit/fb8204b210315807d6c18709c008a358d730aeff
DIFF: https://github.com/llvm/llvm-project/commit/fb8204b210315807d6c18709c008a358d730aeff.diff
LOG: [mlir][ods] Fix ops with both attribute-sized operands and results
Enclose verifier code for AttrSizedOperandSegments and AttrSizedResultSegments
in a nested code block to avoid symbol collision.
Differential Revision: https://reviews.llvm.org/D80250
Added:
Modified:
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
Removed:
################################################################################
diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index fc66313c323a..8709760e2c6b 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -1464,11 +1464,13 @@ void OpEmitter::genVerifier() {
auto &body = method.body();
const char *checkAttrSizedValueSegmentsCode = R"(
- auto sizeAttr = getAttrOfType<DenseIntElementsAttr>("{0}");
- auto numElements = sizeAttr.getType().cast<ShapedType>().getNumElements();
- if (numElements != {1}) {{
- return emitOpError("'{0}' attribute for specifying {2} segments "
- "must have {1} elements");
+ {
+ auto sizeAttr = getAttrOfType<DenseIntElementsAttr>("{0}");
+ auto numElements = sizeAttr.getType().cast<ShapedType>().getNumElements();
+ if (numElements != {1}) {{
+ return emitOpError("'{0}' attribute for specifying {2} segments "
+ "must have {1} elements");
+ }
}
)";
More information about the Mlir-commits
mailing list