[flang-commits] [flang] [Flang][OpenMP] Make implicitly captured scalars fully firstprivatized (PR #147442)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Tue Jul 8 13:04:26 PDT 2025


================
@@ -2444,7 +2473,15 @@ void OmpAttributeVisitor::CreateImplicitSymbols(const Symbol *symbol) {
       useLastDeclSymbol();
       PRINT_IMPLICIT_RULE("3) enclosing context");
     } else if (targetDir) {
-      // TODO 4) not mapped target variable -> firstprivate
+      // 4) not mapped target variable  -> firstprivate
+      //    - i.e. implicit, but meets OpenMP specification rules for
+      //    firstprivate "promotion"
+      if (enableDelayedPrivatizationStaging && symbol &&
+          IsTargetCaptureImplicitlyFirstPrivatizeable(*symbol, prevDSA)) {
+        prevDSA.set(Symbol::Flag::OmpImplicit);
+        prevDSA.set(Symbol::Flag::OmpFirstPrivate);
+        makeSymbol(prevDSA);
+      }
----------------
luporl wrote:

Please add this line, to keep debug messages consistent:
`PRINT_IMPLICIT_RULE("4) not mapped target variable  -> firstprivate");`

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


More information about the flang-commits mailing list