diff --git a/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp b/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp index 17670b013127..0e0d7166ab88 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp @@ -928,23 +928,22 @@ mlir::Value ComplexExprEmitter::VisitAbstractConditionalOperator( Expr *cond = e->getCond()->IgnoreParens(); mlir::Value condValue = cgf.evaluateExprAsBool(cond); - return builder - .create( - loc, condValue, - /*thenBuilder=*/ - [&](mlir::OpBuilder &b, mlir::Location loc) { - eval.begin(cgf); - mlir::Value trueValue = Visit(e->getTrueExpr()); - b.create(loc, trueValue); - eval.end(cgf); - }, - /*elseBuilder=*/ - [&](mlir::OpBuilder &b, mlir::Location loc) { - eval.begin(cgf); - mlir::Value falseValue = Visit(e->getFalseExpr()); - b.create(loc, falseValue); - eval.end(cgf); - }) + return cir::TernaryOp::create( + builder, loc, condValue, + /*trueBuilder=*/ + [&](mlir::OpBuilder &b, mlir::Location loc) { + eval.begin(cgf); + mlir::Value trueValue = Visit(e->getTrueExpr()); + cir::YieldOp::create(b, loc, trueValue); + eval.end(cgf); + }, + /*falseBuilder=*/ + [&](mlir::OpBuilder &b, mlir::Location loc) { + eval.begin(cgf); + mlir::Value falseValue = Visit(e->getFalseExpr()); + cir::YieldOp::create(b, loc, falseValue); + eval.end(cgf); + }) .getResult(); }