[Mlir-commits] [mlir] Fix VectorEmulateNarrowType asserting on scalar type vs vector type. (PR #91613)

Benoit Jacob llvmlistbot at llvm.org
Thu May 9 09:10:53 PDT 2024


================
@@ -1119,8 +1119,9 @@ struct RewriteAlignedSubByteIntExt : OpRewritePattern<ConversionOpType> {
                                 PatternRewriter &rewriter) const override {
     // Verify the preconditions.
     Value srcValue = conversionOp.getIn();
-    auto srcVecType = cast<VectorType>(srcValue.getType());
-    auto dstVecType = cast<VectorType>(conversionOp.getType());
+    auto srcVecType = dyn_cast<VectorType>(srcValue.getType());
----------------
bjacob wrote:

> I am guessing this asserted cause this is not a VectorType

yes.

> The dyn_cast just makes it a null value. Is that handled correctly?

yes, i checked the two local helper functions consuming these values, they correctly handle null values.

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


More information about the Mlir-commits mailing list