Skip to content

Commit de26ca3

Browse files
authored
[CIR][NFC] Use free op create functions in CirGenExprComplex (#1972)
Use the op create function in the CirGenExprComplex file after the restructure
1 parent 5b0bef4 commit de26ca3

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -928,23 +928,22 @@ mlir::Value ComplexExprEmitter::VisitAbstractConditionalOperator(
928928
Expr *cond = e->getCond()->IgnoreParens();
929929
mlir::Value condValue = cgf.evaluateExprAsBool(cond);
930930

931-
return builder
932-
.create<cir::TernaryOp>(
933-
loc, condValue,
934-
/*thenBuilder=*/
935-
[&](mlir::OpBuilder &b, mlir::Location loc) {
936-
eval.begin(cgf);
937-
mlir::Value trueValue = Visit(e->getTrueExpr());
938-
b.create<cir::YieldOp>(loc, trueValue);
939-
eval.end(cgf);
940-
},
941-
/*elseBuilder=*/
942-
[&](mlir::OpBuilder &b, mlir::Location loc) {
943-
eval.begin(cgf);
944-
mlir::Value falseValue = Visit(e->getFalseExpr());
945-
b.create<cir::YieldOp>(loc, falseValue);
946-
eval.end(cgf);
947-
})
931+
return cir::TernaryOp::create(
932+
builder, loc, condValue,
933+
/*trueBuilder=*/
934+
[&](mlir::OpBuilder &b, mlir::Location loc) {
935+
eval.begin(cgf);
936+
mlir::Value trueValue = Visit(e->getTrueExpr());
937+
cir::YieldOp::create(b, loc, trueValue);
938+
eval.end(cgf);
939+
},
940+
/*falseBuilder=*/
941+
[&](mlir::OpBuilder &b, mlir::Location loc) {
942+
eval.begin(cgf);
943+
mlir::Value falseValue = Visit(e->getFalseExpr());
944+
cir::YieldOp::create(b, loc, falseValue);
945+
eval.end(cgf);
946+
})
948947
.getResult();
949948
}
950949

0 commit comments

Comments
 (0)