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

Kareem Ergawy via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 01:08:14 PDT 2024


================
@@ -1489,6 +1488,7 @@ genSimdOp(Fortran::lower::AbstractConverter &converter,
           Fortran::lower::pft::Evaluation &eval, mlir::Location loc,
           const List<Clause> &clauses) {
   fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
+  symTable.pushScope();
----------------
ergawy wrote:

Yes, in the `DataSharingProcessor` we `assert` whether a symbols with the same name was already in same scope that we use for the `eval` being processed.

If you have a combined construct like: `omp target simd`, each sub-construct will have its own data-sharing environment (a separate instance of the DSP). `i` will be `map_entries` element on the target, so it exists in the scope of the `target` sub-construct. However, we also need to privatize `i` for the `simd` construct and use the private copy. This is what was being done before already but we just didn't check whether the symbols exists in the current scope or not when we privatized loop variables.

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


More information about the llvm-commits mailing list