[Mlir-commits] [mlir] [mlir][tosa][linalg] Use `typeConverter->convertType<T>` (NFC) (PR #150578)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Jul 24 23:49:38 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-tosa
Author: Longsheng Mou (CoTinker)
<details>
<summary>Changes</summary>
Since `resultTy` might be nullptr, we should use `dyn_cast` instead of `cast`. Additionally, `typeConverter->convertType<T>` is more appropriate in this context.
---
Full diff: https://github.com/llvm/llvm-project/pull/150578.diff
1 Files Affected:
- (modified) mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp (+1-1)
``````````diff
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();
``````````
</details>
https://github.com/llvm/llvm-project/pull/150578
More information about the Mlir-commits
mailing list