[flang-commits] [flang] [Flang][OpenMP] Dont add PreDetermined Flag if symbol is privatized already (PR #70931)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Mon Nov 6 07:47:43 PST 2023


================
@@ -1528,6 +1530,18 @@ void OmpAttributeVisitor::ResolveSeqLoopIndexInParallelOrTaskConstruct(
       break;
     }
   }
+  // If this symbol is already Private or Firstprivate in the enclosing
+  // OpenMP parallel or task then there is nothing to do here.
+  if (auto *symbol{targetIt->scope.FindSymbol(iv.source)}) {
+    if (symbol->owner() == targetIt->scope) {
+      if (symbol->test(Symbol::Flag::OmpPrivate) ||
+          symbol->test(Symbol::Flag::OmpFirstPrivate)) {
+        return;
+      }
+    }
+  }
+  // Otherwise find the symbol and make it Private for the entire enclosing
+  // parallel or task
   if (auto *symbol{ResolveOmp(iv, Symbol::Flag::OmpPrivate, targetIt->scope)}) {
     targetIt++;
     // If this object already had a DSA then it is not predetermined
----------------
kiranchandramohan wrote:

Done.

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


More information about the flang-commits mailing list