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

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 12 03:32:07 PDT 2022


awarzynski added a comment.

I did a bit of digging and realised that MLIR llvm::cl options are lazily constructed on demand <https://github.com/llvm/llvm-project/blob/3d0e0e1027203fe5e89104ad81ee7bb53e525f95/llvm/include/llvm/Support/ManagedStatic.h#L76-L79> (see the definition of options <https://github.com/llvm/llvm-project/blob/3d0e0e1027203fe5e89104ad81ee7bb53e525f95/mlir/lib/Pass/PassManagerOptions.cpp#L83> in PassManagerOptions.cpp). This means that:

- Flang and LLVM global options are always visible and displayed when passing `-mllvm -help`,
- MLIR global options are only visible when explicitly initialised and displayed when passing `-mmlir -help`.

Since Flang and LLVM global options are always visible, llvm::cl will display them alongside MLIR options when using `-mmlir -help`. In other words,  `-mmlir -help` is a superset of `--mllvm -help`. This is not ideal, but we'd need to refactor all option definitions in Flang and LLVM to improve this. I suggesting leaving this for later.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123297/new/

https://reviews.llvm.org/D123297



More information about the cfe-commits mailing list