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

Pranav Bhandarkar via flang-commits flang-commits at lists.llvm.org
Mon Jul 28 09:08:21 PDT 2025


================
@@ -2365,6 +2402,67 @@ static bool IsSymbolStaticStorageDuration(const Symbol &symbol) {
       (ultSym.flags().test(Symbol::Flag::InCommonBlock));
 }
 
+static bool IsTargetCaptureImplicitlyFirstprivatizeable(const Symbol &symbol,
+    const Symbol::Flags &dsa, const Symbol::Flags &dataSharingAttributeFlags,
+    const Symbol::Flags &dataMappingAttributeFlags,
+    std::map<parser::OmpVariableCategory::Value,
+        parser::OmpDefaultmapClause::ImplicitBehavior>
+        defaultMap) {
+  if (!defaultMap.empty()) {
----------------
bhandarkar-pranav wrote:

< minor >: Could you please add a comment here to suggest that we exit early if we are dealing with a scalar and the defaultmap clause has set the implicit mapping behavior to something other than firstprivate.

Helps readability because the compound conditional is quite long.

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


More information about the flang-commits mailing list