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

Mehdi Amini llvmlistbot at llvm.org
Thu Sep 7 16:15:34 PDT 2023


================
@@ -691,6 +703,9 @@ struct ReplaceEmptyTensorStaticShapeDims : OpRewritePattern<EmptyOp> {
         Value dynamicSize = op.getDynamicSizes()[ctr++];
         std::optional<int64_t> cst = getConstantIntValue(dynamicSize);
         if (cst.has_value()) {
+          // dynamic size must be non-negative.
+          if (cst.value() < 0)
+            return failure();
----------------
joker-eph wrote:

This should be enough without the verifier right?

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


More information about the Mlir-commits mailing list