[Mlir-commits] [mlir] [mlir][tensor] Check the EmptyOp's dynamicSize to be non-negative (PR #65577)

Kohei Yamaguchi llvmlistbot at llvm.org
Thu Sep 7 18:22:39 PDT 2023


================
@@ -621,6 +621,18 @@ LogicalResult EmptyOp::verify() {
     return emitOpError("incorrect number of dynamic sizes, has ")
            << getDynamicSizes().size() << ", expected "
            << getType().getNumDynamicDims();
+
+  if (getDynamicSizes().size() > 0) {
+    if (llvm::any_of(getDynamicSizes(), [](Value operand) {
+          APInt constSizeArg;
+          if (!matchPattern(operand, m_ConstantInt(&constSizeArg))) {
----------------
sott0n wrote:

Thank you for teaching me about IR's verifier.

> This is why the guidelines to write verifier is to stick to information local to an operation (think “what I see when I print this operation alone”). Looking through operands or results is extremely unusual and should be avoided.

I understand it, so i will remove this checker from verifier.

https://github.com/llvm/llvm-project/pull/65577


More information about the Mlir-commits mailing list