[flang-commits] [flang] [acc][flang] lowering of acc declare on COMMON variables (PR #163676)
via flang-commits
flang-commits at lists.llvm.org
Fri Oct 17 00:55:07 PDT 2025
================
@@ -4312,6 +4354,50 @@ genDeclareInFunction(Fortran::lower::AbstractConverter &converter,
Fortran::lower::StatementContext stmtCtx;
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
+ // Inline helper to emit module-level declare for COMMON symbols in a clause.
+ auto emitCommonGlobal = [&](const Fortran::parser::AccObject &obj,
+ mlir::acc::DataClause clause,
+ auto emitCtorDtor) {
+ Fortran::semantics::Symbol &sym = getSymbolFromAccObject(obj);
+ if (!(sym.detailsIf<Fortran::semantics::CommonBlockDetails>() ||
+ Fortran::semantics::FindCommonBlockContaining(sym)))
+ return;
+
+ std::string globalName = converter.mangleName(sym);
----------------
jeanPerier wrote:
Why not using the common block name here (Fortran::semantics::FindCommonBlockContaining(sym) if sym does not have Fortran::semantics::CommonBlockDetails), that way you should never have to deal with trying to find back with which member name it may have been generated (the lookup in EquivalenceSet below).
https://github.com/llvm/llvm-project/pull/163676
More information about the flang-commits
mailing list