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

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 25 14:50:25 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:

Oh. I didn't realize we ran CIR simplification based on the opt level. I guess it makes sense in a way, but I'm not thrilled with the idea that this is happening in the front end. This relates to the suggestion I made elsewhere that maybe we should be moving the lowering and transforms out of the clang component.

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


More information about the cfe-commits mailing list