[flang-commits] [PATCH] D154057: [flang][hlfir] Codegen of hlfir.region_assign where LHS conflicts

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Jun 29 02:32:50 PDT 2023


jeanPerier created this revision.
jeanPerier added reviewers: tblah, vzakhari, clementval.
jeanPerier added a project: Flang.
Herald added subscribers: sunshaoce, mehdi_amini, jdoerfert.
Herald added a project: All.
jeanPerier requested review of this revision.

When the analysis of hlfir.region_assign determined that the LHS region
evaluation may be impacted by the assignment effects, all LHS must be
fully evaluated and saved before any assignment is done.

This patch adds TemporaryStorage variants to save address, including
vector subscripted entities addresses whose shape must be saved.
It uses the DescriptorStack runtime to deal with complex cases inside
forall. For the sake of simplicity, this is also used for vector
subscripted LHS outside of foralls (each element address is saved as
a descriptor on this stack. This is a bit suboptimal, but it is a safe
start that will work with all kinds of type (polymorphic, PDTs...)
without further work). Another approach would be to saved only the
values that are conflicting in the LHS computation, but this would
require a much more complex analysis of the LHS region DAG.

Depends on D154033 <https://reviews.llvm.org/D154033>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154057

Files:
  flang/include/flang/Optimizer/Builder/Runtime/TemporaryStack.h
  flang/include/flang/Optimizer/Builder/TemporaryStorage.h
  flang/lib/Optimizer/Builder/Runtime/TemporaryStack.cpp
  flang/lib/Optimizer/Builder/TemporaryStorage.cpp
  flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp
  flang/test/HLFIR/order_assignments/lhs-conflicts-codegen.fir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154057.535691.patch
Type: text/x-patch
Size: 39819 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230629/7ce7dcb6/attachment-0001.bin>


More information about the flang-commits mailing list