[Mlir-commits] [mlir] [mlir][flang] Improve handling of fortran module variables. (PR #91604)

Abid Qadeer llvmlistbot at llvm.org
Fri May 10 08:28:05 PDT 2024


abidh wrote:

> > Fortran module variables are also represented as global variable in DWARF. But to recognize that they are part of a module, their scope is set to module and not to compile unit. In summary, the scope of the variable is correct. The MLIR check is overly restrictive and this PR amends it for this specific case.
> 
> Thanks for the clarification. Ideally, we would model `DICompile` units to also have a `globals` field, but this would result in circular attribute structures. While supporting such constructs is possible, it's quite involved to get this to work and is tricky to work with.

`DICompileUnit` does have a globals field. Although it is not exposed through DIBuilder::createCompileUnit. Generally, when `DICompileUnit` is created, you don't have the list of globals. The `DICompileUnit` has `replaceGlobalVariables` to set the list of globals once they have been processed, providing a way to break circular dependency.

https://github.com/llvm/llvm-project/pull/91604


More information about the Mlir-commits mailing list