Skip to content

Commit 1deb65c

Browse files
AmrDeveloperlanza
authored andcommitted
[CIR][NFC] Use free op create functions in CirGenExprComplex (#1972)
Use the op create function in the CirGenExprComplex file after the restructure
1 parent 50d2b1c commit 1deb65c

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
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

clang/lib/CIR/FrontendAction/CIRGenAction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ class CIRGenConsumer : public clang::ASTConsumer {
227227
.failed()) {
228228
if (!passOptParsingFailure.empty())
229229
diagnosticsEngine.Report(diag::err_drv_cir_pass_opt_parsing)
230-
<< feOptions.ClangIRLifetimeCheckOpts;
230+
<< passOptParsingFailure;
231231
else
232232
llvm::report_fatal_error("CIR codegen: MLIR pass manager fails "
233233
"when running CIR passes!");
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
// RUN: not %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -fclangir-lifetime-check="yolo=invalid,null" -emit-cir %s -o - 2>&1 | FileCheck %s
2+
// RUN: not %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -fclangir-idiom-recognizer="idiom=invalid" -emit-cir %s -o - 2>&1 | FileCheck %s --check-prefix=IDIOM
3+
// RUN: not %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -fclangir-idiom-recognizer -fclangir-lib-opt="libopt=invalid" -emit-cir %s -o - 2>&1 | FileCheck %s --check-prefix=LIBOPT
24

3-
// CHECK: clangir pass option 'yolo=invalid,null' not recognized
5+
// CHECK: clangir pass option 'yolo=invalid,null' not recognized
6+
// IDIOM: clangir pass option 'idiom=invalid' not recognized
7+
// LIBOPT: clangir pass option 'libopt=invalid' not recognized

0 commit comments

Comments
 (0)