[Mlir-commits] [mlir] [MLIR][Tensor] Fix out-of-bounds FoldEmptyTensorWithDimOp crash #111270 (PR #112196)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Oct 16 10:33:13 PDT 2024


================
@@ -979,7 +979,9 @@ struct FoldEmptyTensorWithDimOp : public OpRewritePattern<DimOp> {
     auto emptyTensorOp = dimOp.getSource().getDefiningOp<EmptyOp>();
     if (!emptyTensorOp || !maybeConstantIndex)
       return failure();
-    if (!emptyTensorOp.getType().isDynamicDim(*maybeConstantIndex))
+    auto emptyTensorType = emptyTensorOp.getType();
----------------
MaheshRavishankar wrote:

Sure, I am not commenting on the larger principle that makes sense. In this particular case I think the `tensor.dim` verifier needs to be extended to catch undefined behavior cause this is essentially the same check being duplicated everywhere to leave undefined behavior through to run time. But I dont want to make this a philosophical discussion. Lets fix the issue at hand.

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


More information about the Mlir-commits mailing list