[flang-commits] [flang] [flang][OpenMP] Try to unify induction var privatization for sequential loops inside parallel regions. (PR #91116)

Kareem Ergawy via flang-commits flang-commits at lists.llvm.org
Wed May 8 03:07:55 PDT 2024


================
@@ -344,7 +353,6 @@ void DataSharingProcessor::collectSymbols(
     assert(curScope && "couldn't find current scope");
     if (isPrivatizable(*sym) && !symbolsInNestedRegions.contains(sym) &&
         !privatizedSymbols.contains(sym) &&
-        !sym->test(Fortran::semantics::Symbol::Flag::OmpPreDetermined) &&
----------------
ergawy wrote:

Thanks for the clarification. I understand the context for that change better now.

> Right now it would probably be easier to refactor genLoopVars, to somehow pass the loop variables to the DataSharingProcessor, so that privatization happens only there.

I have a different proposal which I implemented in the latest commit on the PR. To keep the different lists of symbols (default, implicit, explicit) accurate, I created one more list of symbols to aggregate all symbols to be privatized including the pre-determined ones. And then, we would have a single `privatize` method to go over the aggregated list.

The problem with invoking the `DataSharingProcessor` from `genLoopVars` is that I think we will have to instantiate it from `genLoopVars`. I think instantiating and controlling instances of the DSP should be localized to the OMP constructs that need it in `Lower/OpenMP.cpp`.

Let me know if you disagree with the current approach.

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


More information about the flang-commits mailing list