[Flang][OpenMP] Refactor to properly fix privatisation of loop bounds
authorKiran Chandramohan <kiran.chandramohan@arm.com>
Mon, 5 Jun 2023 15:43:37 +0000 (15:43 +0000)
committerKiran Chandramohan <kiran.chandramohan@arm.com>
Mon, 5 Jun 2023 16:04:24 +0000 (16:04 +0000)
commitca81808cc31074198663eb4beb904f490598d14f
treead1adc75586bad9ca7b3cd401ac0a09e4d970710
parent4cb5e436ae713579cfee00cfc8e516cf965b91e9
[Flang][OpenMP] Refactor to properly fix privatisation of loop bounds

The OpenMP loop Operations have the bounds attached to them. If the
loop bounds are privatised then the privatisation has to happen
before the loop operation is created. To do this the privatisation
is split into two steps. The first step performs cloning and
firstprivate handling, the second step performs lastprivate handling.

This also reverts the changes in the temporary fix (D127137).

Fixes https://github.com/flang-compiler/f18-llvm-project/issues/1171#issuecomment-1143880545
Fixes https://github.com/flang-compiler/f18-llvm-project/issues/1171#issuecomment-1119997442

Fixes #60872

Reviewed By: NimishMishra

Differential Revision: https://reviews.llvm.org/D151504
flang/lib/Lower/Bridge.cpp
flang/lib/Lower/OpenMP.cpp
flang/test/Lower/OpenMP/parallel-lastprivate-clause-scalar.f90
flang/test/Lower/OpenMP/parallel-private-clause-fixes.f90
flang/test/Lower/OpenMP/parallel-wsloop-firstpriv.f90
flang/test/Lower/OpenMP/parallel-wsloop.f90
flang/test/Lower/OpenMP/single.f90