[flang-commits] [flang] [Flang][OpenMP] Dont add PreDetermined Flag if symbol is privatized already (PR #70931)
David Truby via flang-commits
flang-commits at lists.llvm.org
Mon Nov 6 06:09:54 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
----------------
DavidTruby wrote:
I don't seem to be able to add a comment any lower than this on github for some reason, but I think you can remove these four lines after adding the above?
https://github.com/llvm/llvm-project/pull/70931
More information about the flang-commits
mailing list