[flang-commits] [flang] [mlir] [MLIR][Flang][DebugInfo] Set debug info format in MLIR->IR translation (PR #95098)
Andrzej Warzyński via flang-commits
flang-commits at lists.llvm.org
Tue Jun 11 10:25:26 PDT 2024
================
@@ -81,6 +82,8 @@ using namespace Fortran::frontend;
llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
#include "llvm/Support/Extension.def"
+extern llvm::cl::opt<bool> WriteNewDbgInfoFormat;
----------------
banach-space wrote:
> LLVM flags can influence the output of the clang driver as-is right now, in the sense that LLVM flags control the behaviour of LLVM internal functions, and those functions are invoked by the driver, but there's no direct use of those flags from the driver.
Interesting. IMHO, that should not be allowed - it means that the internals of LLVM leak higher up the compilation stack. Flang will complain if the compiler is invoked with an unrecognised flag (`-write-experimental-debuginf` would qualify as such). There's a bit of context at the bottom of my comment.
> Does that sound like the right approach to you? Resulting change is something like:
Yes, that makes sense to me. Not sure why we didn't use `llvm::PrintModulePass` to begin with. Looks like a relatively new addition to LLVM, so perhaps it wasn't available when we worked on this in Flang? 🤔
Btw, if you want to pass a flag to LLVM, use `-mllvm` ;-) In fact, that should be sufficient for what you are trying to achieve here?
### Context
Since roughly ~1yr ago, we have this concept of "visibility" when defining compiler flags:
* https://reviews.llvm.org/D157150.
At that point, I made Flang reject all compilation flags that are not supported
* https://reviews.llvm.org/D157837.
That was primarily to avoid a situations where people get unexpected behaviour (e.g. "hey, I am passing this flag and nothing happens"). That also helps us quickly identify flags that are missing (if the compiler was to ignore unsupported flags, it would hard to tell what's supported and what is not). Admittedly, it can be a nuisance at times, but so far we've managed to support all users that raised issues related to this.
https://github.com/llvm/llvm-project/pull/95098
More information about the flang-commits
mailing list