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

Christian Ulmann llvmlistbot at llvm.org
Fri May 10 04:15:19 PDT 2024


================
@@ -1029,11 +1029,17 @@ LogicalResult ModuleTranslation::convertGlobals() {
           debugTranslation->translateGlobalVariableExpression(op.getDbgExpr());
       llvm::DIGlobalVariable *diGlobalVar = diGlobalExpr->getVariable();
       var->addDebugInfo(diGlobalExpr);
+      // For fortran, the scope hierarchy can be
+      // variable -> module -> compile unit
+      // If a variable scope points to Module then we get its parent scope so
+      // that globals get added to the compile unit.
+      llvm::DIScope *scope = diGlobalVar->getScope();
----------------
Dinistro wrote:

Nit: Maybe add a note that this is only necessary because LLVM dialect's compile units do not not support a `global` field at the moment.

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


More information about the Mlir-commits mailing list