Index: flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp =================================================================== --- flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -19,6 +19,7 @@ #include "flang/Frontend/FrontendActions.h" #include "flang/Frontend/FrontendPluginRegistry.h" +#include "mlir/IR/AsmState.h" #include "mlir/IR/MLIRContext.h" #include "mlir/Pass/PassManager.h" #include "clang/Driver/Options.h" @@ -142,6 +143,7 @@ if (!flang->getFrontendOpts().mlirArgs.empty()) { mlir::registerMLIRContextCLOptions(); mlir::registerPassManagerCLOptions(); + mlir::registerAsmPrinterCLOptions(); unsigned numArgs = flang->getFrontendOpts().mlirArgs.size(); auto args = std::make_unique(numArgs + 2); args[0] = "flang (MLIR option parsing)"; Index: flang/test/Driver/asm-printer-mlir-opts.f90 =================================================================== --- /dev/null +++ flang/test/Driver/asm-printer-mlir-opts.f90 @@ -0,0 +1,7 @@ +! Verify that AsmPrinter `-mmlir` options such as `-mlir-print-local-scope` are available to the driver. + + +! RUN: %flang_fc1 -mmlir --help | FileCheck %s --check-prefix=MLIR + +! MLIR: flang (MLIR option parsing) [options] +! MLIR: --mlir-print-local-scope