[Mlir-commits] [mlir] [mlir][math] Fix intrinsic conversions to LLVM for 0D-vector types (PR #141020)

Kunwar Grover llvmlistbot at llvm.org
Wed May 28 05:50:07 PDT 2025


================
@@ -84,6 +84,15 @@ struct IntOpWithFlagLowering : public ConvertOpToLLVMPattern<MathOp> {
 
     auto loc = op.getLoc();
     auto resultType = op.getResult().getType();
+    const auto &typeConverter = *this->getTypeConverter();
+    if (!LLVM::isCompatibleType(resultType)) {
+      resultType = typeConverter.convertType(resultType);
+      if (!resultType)
+        return failure();
+    }
+    if (operandType != resultType)
+      return rewriter.notifyMatchFailure(
+          op, "compatible result type doesn't match operand type");
----------------
Groverkss wrote:

There is no need to check compatibility. You should always use the type converter here. Note how other places do it https://github.com/llvm/llvm-project/blob/main/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp#L1149

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


More information about the Mlir-commits mailing list