[flang-commits] [flang] [flang] Add the MLIR pass pipelines for dumping (PR #183144)
via flang-commits
flang-commits at lists.llvm.org
Thu Feb 26 06:07:51 PST 2026
================
@@ -207,6 +214,23 @@ bool executeCompilerInvocation(CompilerInstance *flang) {
// Honor -mmlir. This should happen AFTER plugins have been loaded!
if (!flang->getFrontendOpts().mlirArgs.empty()) {
+ // Register MLIR and FIR passes so that --mlir-print-ir-before=<pass> works.
+ // This must happen BEFORE registerPassManagerCLOptions() because that
+ // function creates the PassNameCLParser which snapshots the pass registry
+ // during initialization.
+ mlir::registerCSEPass();
+ mlir::registerCanonicalizerPass();
+ mlir::registerInlinerPass();
+ mlir::registerSCFToControlFlowPass();
+ mlir::registerConvertMathToFuncs();
+ mlir::registerConvertComplexToStandardPass();
+ mlir::registerConvertMathToLLVMPass();
+ mlir::LLVM::registerLLVMAddComdats();
+ mlir::registerReconcileUnrealizedCastsPass();
+ fir::registerOptCodeGenPasses();
+ fir::registerOptTransformPasses();
+ hlfir::registerHLFIRPasses();
+ flangomp::registerFlangOpenMPPasses();
----------------
tmjbios wrote:
OOoh. That's a great question - thanks. I hadn't looked at fir-opt. I'm sure I could do something to commonize this. Let me play with this for a day or so.
https://github.com/llvm/llvm-project/pull/183144
More information about the flang-commits
mailing list