[flang-commits] [flang] [flang][OpenMP] don't privatise loop index marked shared (PR #108176)
Leandro Lupori via flang-commits
flang-commits at lists.llvm.org
Thu Sep 12 06:47:04 PDT 2024
================
@@ -2173,7 +2178,7 @@ void OmpAttributeVisitor::CreateImplicitSymbols(
// TODO 5) dummy arg in orphaned taskgen construct -> firstprivate
if (prevDSA == Symbol::Flag::OmpShared) {
// 6) shared in enclosing context -> shared
- makeSharedSymbol();
+ makeSharedSymbol(/*setFlag=*/false);
----------------
luporl wrote:
OK, I guess adding `OmpShared` in all cases would require considerable extra work.
It would also break this patch's assumption, that `OmpShared` means a `shared` clause was used.
So why don't we set `OmpShared` only in the `if (dsa.has_value())` case?
This should handle all situations properly:
- `!$omp parallel shared(i)` - don't privatise
- `!$omp parallel` | `!$omp parallel default(shared)` - privatise (assuming the standard disallows `default` to override predetermined loop induction variables DSA)
Then a symbol with `OmpShared` would always mean it was explicitly made shared.
https://github.com/llvm/llvm-project/pull/108176
More information about the flang-commits
mailing list