[flang-commits] [flang] [flang][mlir] Add flang to mlir lowering for groupprivate (PR #180934)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Tue Jun 9 08:08:50 PDT 2026


================
@@ -116,6 +119,12 @@ llvm::raw_ostream &operator<<(
     x.printClauseSet(os, dtgt);
     os << ')';
   }
+  if (const OmpClauseSet &gp{x.ompGroupprivate()}; gp.count()) {
----------------
skatrak wrote:

This is fine, but as it's currently implemented in `OmpAttributeVisitor::Pre(const parser::OmpGroupprivateDirective &)`, no `groupprivate` information will be printed here for a symbol appearing in a clause-less `groupprivate` directive.

What I'm thinking in regards to this is that the `OmpAttributeVisitor` should unconditionally add a `device_type` clause for `groupprivate` symbols, regardless of whether that clause is present. It would be `any` by default, which is correct, so here (and in .mod files) we'd print that information.

`PutOpenMPDeclarativeDirectives` could be slightly simplified as well based on `decls->ompGroupprivate()` not being empty, just like for `declare_target` and keep handling consistent there as well.

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


More information about the flang-commits mailing list