Skip to content

Commit 846858d

Browse files
committed
run SCFPreparePass cir pass always when lowering throughMLIR
1 parent c589c7c commit 846858d

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

clang/include/clang/CIR/CIRToCIRPasses.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ mlir::LogicalResult runCIRToCIRPasses(
3434
llvm::StringRef lifetimeOpts, bool enableIdiomRecognizer,
3535
llvm::StringRef idiomRecognizerOpts, bool enableLibOpt,
3636
llvm::StringRef libOptOpts, std::string &passOptParsingFailure,
37-
bool enableCIRSimplify, bool flattenCIR, bool emitMLIR,
37+
bool enableCIRSimplify, bool flattenCIR, bool throughMLIR,
3838
bool enableCallConvLowering, bool enableMem2reg);
3939

4040
} // namespace cir

clang/lib/CIR/CodeGen/CIRPasses.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ mlir::LogicalResult runCIRToCIRPasses(
2828
llvm::StringRef lifetimeOpts, bool enableIdiomRecognizer,
2929
llvm::StringRef idiomRecognizerOpts, bool enableLibOpt,
3030
llvm::StringRef libOptOpts, std::string &passOptParsingFailure,
31-
bool enableCIRSimplify, bool flattenCIR, bool emitCore,
31+
bool enableCIRSimplify, bool flattenCIR, bool throughMLIR,
3232
bool enableCallConvLowering, bool enableMem2Reg) {
3333

3434
llvm::TimeTraceScope scope("CIR To CIR Passes");
@@ -81,7 +81,7 @@ mlir::LogicalResult runCIRToCIRPasses(
8181
if (enableMem2Reg)
8282
pm.addPass(mlir::createMem2Reg());
8383

84-
if (emitCore)
84+
if (throughMLIR)
8585
pm.addPass(mlir::createSCFPreparePass());
8686

8787
// FIXME: once CIRCodenAction fixes emission other than CIR we

clang/lib/CIR/FrontendAction/CIRGenAction.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,17 +210,14 @@ class CIRGenConsumer : public clang::ASTConsumer {
210210
action == CIRGenAction::OutputType::EmitMLIR &&
211211
feOptions.MLIRTargetDialect == clang::frontend::MLIR_CIR_FLAT;
212212

213-
bool emitCore = action == CIRGenAction::OutputType::EmitMLIR &&
214-
feOptions.MLIRTargetDialect == clang::frontend::MLIR_CORE;
215-
216213
// Setup and run CIR pipeline.
217214
std::string passOptParsingFailure;
218215
if (runCIRToCIRPasses(
219216
mlirMod, mlirCtx.get(), C, !feOptions.ClangIRDisableCIRVerifier,
220217
feOptions.ClangIRLifetimeCheck, lifetimeOpts,
221218
feOptions.ClangIRIdiomRecognizer, idiomRecognizerOpts,
222219
feOptions.ClangIRLibOpt, libOptOpts, passOptParsingFailure,
223-
codeGenOptions.OptimizationLevel > 0, flattenCIR, emitCore,
220+
codeGenOptions.OptimizationLevel > 0, flattenCIR, !feOptions.ClangIRDirectLowering,
224221
enableCCLowering, feOptions.ClangIREnableMem2Reg)
225222
.failed()) {
226223
if (!passOptParsingFailure.empty())

0 commit comments

Comments
 (0)