[Mlir-commits] [mlir] [MLIR][ROCDL] Convert `math::fpowi` to ROCDL call (PR #122640)

Jakub Kuderski llvmlistbot at llvm.org
Mon Jan 13 10:29:49 PST 2025


================
@@ -57,9 +57,12 @@ struct OpToFuncCallLowering : public ConvertOpToLLVMPattern<SourceOp> {
         std::is_base_of<OpTrait::OneResult<SourceOp>, SourceOp>::value,
         "expected single result op");
 
-    static_assert(std::is_base_of<OpTrait::SameOperandsAndResultType<SourceOp>,
-                                  SourceOp>::value,
-                  "expected op with same operand and result types");
+    if constexpr (!std::is_base_of<OpTrait::SameOperandsAndResultType<SourceOp>,
+                                   SourceOp>::value) {
+      if (op->getResultTypes().front() != op->getOperand(0).getType())
+        return rewriter.notifyMatchFailure(
+            op, "expected op with same operand and result types");
----------------
kuhar wrote:

IMO, this should be an assertion. Also, we should assert that there's exactly one result and at least one operand.

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


More information about the Mlir-commits mailing list