[flang-commits] [flang] [flang][OpenMP] Don't privatize implicit symbols declare by nested `BLOCK`s (PR #152973)
Kareem Ergawy via flang-commits
flang-commits at lists.llvm.org
Mon Aug 18 01:07:07 PDT 2025
================
@@ -550,17 +558,20 @@ void DataSharingProcessor::collectSymbols(
return false;
}
- return sym->test(semantics::Symbol::Flag::OmpImplicit);
- }
-
- if (collectPreDetermined) {
- // Collect pre-determined symbols only if they are defined by the current
- // OpenMP evaluation. If `sym` is not defined by the current OpenMP
+ // Collect implicit symbols only if they are not defined by a nested
+ // `DeclarationConstruct`. If `sym` is not defined by the current OpenMP
// evaluation then it is defined by a block nested within the OpenMP
// construct. This, in turn, means that the private allocation for the
// symbol will be emitted as part of the nested block and there is no need
// to privatize it within the OpenMP construct.
- return visitor.isSymbolDefineBy(sym, eval) &&
+ return !visitor.isSymbolDefineByNestedDeclaration(sym) &&
+ sym->test(semantics::Symbol::Flag::OmpImplicit);
+ }
+
+ if (collectPreDetermined) {
+ // Similar to implicit symbols, collect pre-determined symbols only if
+ // they are not defined by a nested `DeclarationConstruct`
+ return !visitor.isSymbolDefineByNestedDeclaration(sym) &&
sym->test(semantics::Symbol::Flag::OmpPreDetermined);
----------------
ergawy wrote:
Opened https://github.com/llvm/llvm-project/pull/154070.
https://github.com/llvm/llvm-project/pull/152973
More information about the flang-commits
mailing list