[clang] [CIR] Support type deduction builder for BinaryFPToFPBuiltinOp (PR #226876)

via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 27 20:35:42 PDT 2026


https://github.com/aokblast created https://github.com/llvm/llvm-project/pull/226876

For external consumer, it would be easier to have constructor without type parameter. As a result, we add a new builder, which can deduct type from lhs directly.

As emitBinaryFPBuiltin is the only consumer for CIR Codegen, it is fine for internal usage.

>From e8071643ff18435e4cc773af5eb0d3e233970b28 Mon Sep 17 00:00:00 2001
From: ShengYi Hung <aokblast at FreeBSD.org>
Date: Sun, 27 Sep 2026 22:33:07 -0500
Subject: [PATCH] [CIR] Support type deduction builder for
 BinaryFPToFPBuiltinOp

For external consumer, it would be easier to have constructor without
type parameter. As a result, we add a new builder, which can deduct type
from lhs directly.

As emitBinaryFPBuiltin is the only consumer for CIR Codegen, it is fine
for internal usage.
---
 clang/include/clang/CIR/Dialect/IR/CIROps.td | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index c1ba78eea2835..70fa617a18913 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -7842,7 +7842,10 @@ class CIR_BinaryFPToFPBuiltinOp<string mnemonic, string llvmOpName>
     OpBuilder<(ins "mlir::Type":$result, "mlir::Value":$lhs,
                    "mlir::Value":$rhs), [{
       build($_builder, $_state, result, lhs, rhs, cir::FenvAttr{});
-    }]>
+    }]>,
+    OpBuilder<(ins "mlir::Value":$lhs, "mlir::Value":$rhs), [{
+      build($_builder, $_state, lhs, rhs, cir::FenvAttr{});
+    }]
   ];
 
   let llvmOp = llvmOpName;



More information about the cfe-commits mailing list