[clang] [CIR] Upstream lowering of conditional operators to TernaryOp (PR #138156)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 3 10:28:54 PDT 2025


================
@@ -98,6 +98,14 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
 
   mlir::Value emitPromoted(const Expr *e, QualType promotionType);
 
+  mlir::Value maybePromoteBoolResult(mlir::Value value,
+                                     mlir::Type dstTy) const {
+    if (mlir::isa<cir::IntType>(dstTy))
+      return builder.createBoolToInt(value, dstTy);
+    if (mlir::isa<cir::BoolType>(dstTy))
+      return value;
+  }
----------------
erichkeane wrote:

Note the 'else' case here is problematic.  We need a return here.

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


More information about the cfe-commits mailing list