[flang-commits] [flang] [llvm] [flang][OpenMP] Try to unify induction var privatization for OMP regions. (PR #91116)

Kareem Ergawy via flang-commits flang-commits at lists.llvm.org
Mon May 13 20:18:31 PDT 2024


================
@@ -289,12 +290,34 @@ void DataSharingProcessor::collectSymbolsInNestedRegions(
        eval.getNestedEvaluations()) {
     if (nestedEval.hasNestedEvaluations()) {
       if (nestedEval.isConstruct())
-        // Recursively look for OpenMP constructs within `nestedEval`'s region
         collectSymbolsInNestedRegions(nestedEval, flag, symbolsInNestedRegions);
-      else
-        converter.collectSymbolSet(nestedEval, symbolsInNestedRegions, flag,
-                                   /*collectSymbols=*/true,
-                                   /*collectHostAssociatedSymbols=*/false);
+      else {
+        bool isOrderedConstruct = [&]() {
----------------
ergawy wrote:

@kiranchandramohan @luporl just to clarify this change:
Since `omp ordered` does not have its own data-sharing environment, I think we should consider symbols referenced by an `omp ordered` construct to be separate from the symbols referenced by the parent region.

The changes here make sure that for the following input, `i` to be collected as of the symbols to be privatized for the `omp do ordered` construct:
```fortran
  !$omp do ordered
  do i = 2, 10
    !$omp ordered
    a(i) = a(i-1) + 1
    !$omp end ordered
  end do
  !$omp end do
```

https://github.com/llvm/llvm-project/pull/91116


More information about the flang-commits mailing list