[all-commits] [llvm/llvm-project] 6163d6: [Flang][OpenMP] Fix for atomic lowering with HLFIR

kiranchandramohan via All-commits all-commits at lists.llvm.org
Thu Aug 31 10:36:50 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6163d66e73cf92bf687d63aad58bf867effb9a20
      https://github.com/llvm/llvm-project/commit/6163d66e73cf92bf687d63aad58bf867effb9a20
  Author: Kiran Chandramohan <kiran.chandramohan at arm.com>
  Date:   2023-08-31 (Thu, 31 Aug 2023)

  Changed paths:
    M flang/lib/Lower/OpenMP.cpp
    A flang/test/Lower/OpenMP/atomic-update-hlfir.f90

  Log Message:
  -----------
  [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




More information about the All-commits mailing list