[flang-commits] [flang] [flang][OpenMP] Fix LASTPRIVATE for iteration variables (PR #69773)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Mon Oct 23 13:58:09 PDT 2023


kiranchandramohan wrote:

> The update of the original loop variable is still performed only if `lastprivate(loop_variable)` is present. But the private copy is now being updated, in the last iteration, whenever a `lastprivate` clause is present, even if it doesn't include the loop variable. Do you think it's better to omit the store in this case? I've noticed that this store (and the load after it, for loop variables) is usually optimized out, when llvm bitcode is generated, and only the store to the original variable remains.

OK. That is fine.


> If I understand correctly, this is a suggested optimization for a future patch, correct?
> This would be especially useful when support for `lastprivate` with `collapse` is added. Otherwise, we would need to test the loop variables of each nested loop.

Yes, it is something for future work.

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


More information about the flang-commits mailing list