[Mlir-commits] [mlir] [mlir][tosa][linalg] Use `typeConverter->convertType<T>` (NFC) (PR #150578)
Longsheng Mou
llvmlistbot at llvm.org
Thu Jul 24 23:49:05 PDT 2025
https://github.com/CoTinker created https://github.com/llvm/llvm-project/pull/150578
Since `resultTy` might be nullptr, we should use `dyn_cast` instead of `cast`. Additionally, `typeConverter->convertType<T>` is more appropriate in this context.
>From 29dc3d028f5b60685c2f44d853667d551b96da71 Mon Sep 17 00:00:00 2001
From: Longsheng Mou <longshengmou at gmail.com>
Date: Fri, 25 Jul 2025 14:47:02 +0800
Subject: [PATCH] [mlir][tosa][linalg] Use `typeConverter->convertType<T>`
(NFC)
Since `resultTy` might be nullptr, we should use `dyn_cast` instead of `cast`. Additionally, `typeConverter->convertType<T>` is more appropriate in this context.
---
mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
index 3a205246ddd9e..b7fb7a18c7714 100644
--- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
+++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
@@ -742,7 +742,7 @@ class MaxPool2dConverter : public OpConversionPattern<tosa::MaxPool2dOp> {
bool isUnsigned = op.getType().getElementType().isUnsignedInteger();
ShapedType resultTy =
- cast<ShapedType>(getTypeConverter()->convertType(op.getType()));
+ getTypeConverter()->convertType<ShapedType>(op.getType());
if (!resultTy)
return rewriter.notifyMatchFailure(op, "failed to convert type");
Type resultETy = inputTy.getElementType();
More information about the Mlir-commits
mailing list