[PATCH] D123297: [flang][driver] Add support for -mmlir

Diana Picus via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 7 05:00:19 PDT 2022

rovka added a comment.

I don't know the command line library that well, so I have this curiosity: what happens if LLVM and MLIR have 2 different options with the same name? Do we get a compile time error? Or is there a risk that someone might -mllvm -XYZ and it would end up in MLIR's XYZ option instead, because we're processing the MLIR options after the LLVM ones?

Comment at: flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:15
+#include "mlir/IR/MLIRContext.h"
+#include "mlir/Pass/PassManager.h"
 #include "flang/Frontend/CompilerInstance.h"
Nit: Should these come after the llvm/ headers? (So it's alphabetical except for flang, which may go first)

Comment at: flang/test/Driver/mllvm_vs_mmlir.f90:17
+! MLLVM: flang (LLVM option parsing) [options]
+! MLLVM: --print-ir-after-all
+! MLLVM-NOT: --mlir-{{.*}}
Is this the most llvm-ish option we have? I'm concerned that MLIR might also decide to add an option that sounds like this (and for sure -print-ir-before-all is mentioned in the [[ https://mlir.llvm.org/getting_started/Debugging/ |  MLIR docs ]]).

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list