[flang-commits] [flang] [flang][OpenMP] Don't privatize pre-determined symbols declare by nested `BLOCK`s (PR #152652)
Kareem Ergawy via flang-commits
flang-commits at lists.llvm.org
Mon Aug 11 00:22:48 PDT 2025
================
@@ -553,8 +553,16 @@ void DataSharingProcessor::collectSymbols(
return sym->test(semantics::Symbol::Flag::OmpImplicit);
}
- if (collectPreDetermined)
- return sym->test(semantics::Symbol::Flag::OmpPreDetermined);
+ 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
+ // 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 prvatize it within the OpenMP construct.
+ return visitor.isSymbolDefineBy(sym, eval) &&
+ sym->test(semantics::Symbol::Flag::OmpPreDetermined);
----------------
ergawy wrote:
It breaks 2 tests:
```
Flang :: Lower/OpenMP/implicit-dsa.f90
Flang :: Lower/OpenMP/target.f90
```
So I will do that in a follow up PR.
https://github.com/llvm/llvm-project/pull/152652
More information about the flang-commits
mailing list