diff --git a/flang/include/flang/Optimizer/Support/InitFIR.h b/flang/include/flang/Optimizer/Support/InitFIR.h --- a/flang/include/flang/Optimizer/Support/InitFIR.h +++ b/flang/include/flang/Optimizer/Support/InitFIR.h @@ -21,17 +21,18 @@ #include "mlir/Pass/PassRegistry.h" #include "mlir/Transforms/LocationSnapshot.h" #include "mlir/Transforms/Passes.h" -#include "flang/Optimizer/CodeGen/CodeGen.h" namespace fir::support { -// The definitive list of dialects used by flang. -#define FLANG_DIALECT_LIST \ - mlir::AffineDialect, FIROpsDialect, FIRCodeGenDialect, \ - mlir::LLVM::LLVMDialect, mlir::acc::OpenACCDialect, \ +#define FLANG_NONCODEGEN_DIALECT_LIST \ + mlir::AffineDialect, FIROpsDialect, mlir::acc::OpenACCDialect, \ mlir::omp::OpenMPDialect, mlir::scf::SCFDialect, \ mlir::StandardOpsDialect, mlir::vector::VectorDialect +// The definitive list of dialects used by flang. +#define FLANG_DIALECT_LIST \ + FLANG_NONCODEGEN_DIALECT_LIST, FIRCodeGenDialect, mlir::LLVM::LLVMDialect + /// Register all the dialects used by flang. inline void registerDialects(mlir::DialectRegistry ®istry) { registry.insert(); @@ -70,9 +71,6 @@ mlir::registerAffineDataCopyGenerationPass(); mlir::registerConvertAffineToStandardPass(); - - // Flang passes - fir::registerOptCodeGenPasses(); } } // namespace fir::support diff --git a/flang/tools/fir-opt/fir-opt.cpp b/flang/tools/fir-opt/fir-opt.cpp --- a/flang/tools/fir-opt/fir-opt.cpp +++ b/flang/tools/fir-opt/fir-opt.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "mlir/Support/MlirOptMain.h" +#include "flang/Optimizer/CodeGen/CodeGen.h" #include "flang/Optimizer/Support/InitFIR.h" #include "flang/Optimizer/Transforms/Passes.h" @@ -19,6 +20,7 @@ int main(int argc, char **argv) { fir::support::registerMLIRPassesForFortranTools(); + fir::registerOptCodeGenPasses(); fir::registerOptTransformPasses(); DialectRegistry registry; fir::support::registerDialects(registry);