[clang] [CIR] Upstream TernaryOp (PR #137184)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 24 15:39:03 PDT 2025


================
@@ -1246,6 +1246,59 @@ def SelectOp : CIR_Op<"select", [Pure,
   }];
 }
 
+//===----------------------------------------------------------------------===//
+// TernaryOp
+//===----------------------------------------------------------------------===//
+
+def TernaryOp : CIR_Op<"ternary",
+      [DeclareOpInterfaceMethods<RegionBranchOpInterface>,
+       RecursivelySpeculatable, AutomaticAllocationScope, NoRegionArguments]> {
+  let summary = "The `cond ? a : b` C/C++ ternary operation";
----------------
andykaylor wrote:

This is wrong. At least in the incubator, we use `cir.select` to implement the ternary operator.

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


More information about the cfe-commits mailing list