[all-commits] [llvm/llvm-project] 6c9bce: [flang][OpenMP] Fix privatization when critical is...

Leandro Lupori via All-commits all-commits at lists.llvm.org
Thu Jun 6 01:33:04 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6c9bce88a876f48eb8ab4df172bb86375b29a87f
      https://github.com/llvm/llvm-project/commit/6c9bce88a876f48eb8ab4df172bb86375b29a87f
  Author: Leandro Lupori <leandro.lupori at linaro.org>
  Date:   2024-06-06 (Thu, 06 Jun 2024)

  Changed paths:
    M flang/lib/Lower/OpenMP/DataSharingProcessor.h
    M flang/test/Lower/OpenMP/critical.f90

  Log Message:
  -----------
  [flang][OpenMP] Fix privatization when critical is present (#94441)

When a critical construct is present inside another construct where
privatizations may occur, such as a parallel construct, some
privatizations are skipped if the corresponding symbols are defined
inside the critical section only (see the example below).

This happens because, while critical constructs have a "body", they
don't have a separate scope (which makes sense, since no
privatizations can occur in them). Because of this, in semantics
phase, it's not possible to insert a new host association symbol,
but instead the symbol from the enclosing context is used directly.

This makes symbol collection in DataSharingProcessor consider the
new symbol to be defined by the critical construct, instead of by
the enclosing one, which causes the privatization to be skipped.

Example:
```
!$omp parallel default(firstprivate)
  !$omp critical
     i = 200
  !$omp end critical
!$omp end parallel
```

This patch fixes this by identifying constructs where
privatizations may not happen and skipping them during the
collection of nested symbols. Currently, this seems to happen only
with critical constructs, but others can be easily added to the
skip list, if needed.

Fixes https://github.com/llvm/llvm-project/issues/75767



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list