[Mlir-commits] [mlir] [mlir][memref] Fix out-of-bounds crash when reifying result dims (PR #70774)

Nicolas Vasilache llvmlistbot at llvm.org
Tue Oct 31 00:26:24 PDT 2023


================
@@ -94,6 +94,9 @@ struct DimOfReifyRankedShapedTypeOpInterface : public OpRewritePattern<OpTy> {
                                  reifiedResultShapes)))
       return failure();
     unsigned resultNumber = dimValue.getResultNumber();
+    // Do not apply pattern if the IR is invalid (dim out of bounds).
+    if (*dimIndex >= reifiedResultShapes[resultNumber].size())
+      return failure();
----------------
nicolasvasilache wrote:

can we systematically add a notifyMatchFailure for a better debugging experience of why patterns fail to apply?

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


More information about the Mlir-commits mailing list