[Mlir-commits] [mlir] [mlir][vector] Use notifyMatchFailure instead of assert in VectorLinearize (PR #93590)

Andrzej Warzyński llvmlistbot at llvm.org
Sun Jun 9 11:02:41 PDT 2024


================
@@ -336,9 +342,10 @@ struct LinearizeVectorExtract final
   matchAndRewrite(vector::ExtractOp extractOp, OpAdaptor adaptor,
                   ConversionPatternRewriter &rewriter) const override {
     Type dstTy = getTypeConverter()->convertType(extractOp.getType());
-    assert(!(extractOp.getVector().getType().isScalable() ||
-             cast<VectorType>(dstTy).isScalable()) &&
-           "scalable vectors are not supported.");
+    if (extractOp.getVector().getType().isScalable() ||
+        cast<VectorType>(dstTy).isScalable())
----------------
banach-space wrote:

>  So, cast(dstTy) may cause the crash.

Good point, but let's stick to one change per PR 😅 My recommendation:
1. identify a test case that would indeed crash,
2. fix the crash and use the test from 1. for a follow-up PR.

WDYT?

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


More information about the Mlir-commits mailing list