[Flang][OpenMP] Fix for atomic lowering with HLFIR
Atomic update operation is modelled in OpenMP dialect as an operation that takes a reference to the operation being updated. It also contains a region that will perform the update. The block argument represents the loaded value from the update location and the Yield operation is the value that should be stored for the update. OpenMP FIR lowering binds the value loaded from the update address to the SymbolAddress. HLFIR lowering does not permit SymbolAddresses to be a value. To work around this, the lowering is now performed in two steps. First the body of the atomic update is lowered into an SCF execute_region operation. Then this is copied into the omp.atomic_update as a second step that performs the following: -> Create an omp.atomic_update with the block argument of the correct type. -> Copy the operations from the SCF execute_region. Convert the scf.yield to an omp.yield. -> Remove the loads of the update location and replace all uses with the block argument. Reviewed By: tblah, razvanlupusoru Differential Revision: https://reviews.llvm.org/D158294
Loading
Please sign in to comment