[flang-commits] [PATCH] D149480: [flang][hlfir] Lower vector subscripted RHS designators

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Apr 28 13:26:19 PDT 2023


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

Lower vector subscripted designators as values when they appear outside
of the assignment left-hand side and input IO contexts.

This matches Fortran semantics where vector subscripted designators cannot
be written to outside of the two contexts mentioned above: they are
passed/taken by value where they appear.

This patch uses the added hlfir.element_addr to lower vector designators
in lowering. But when reaching the end of the designator lowering, the
hlfir.element_addr is turned into an hlfir.elemental when lowering is
not asking for the hlfir.elemental_addr.

This approach allows lowering vector subscripted in the same way in
while visiting the designator, and only adapt to the context at the
edge.

The part where lowering uses the hlfir.elemental_addr will be
done in further patch as it requires lowering assignments in the
new hlfir.region_assign op, and there is not codegen yet for these
new operations.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149480

Files:
  flang/include/flang/Optimizer/Builder/HLFIRTools.h
  flang/lib/Lower/Bridge.cpp
  flang/lib/Lower/ConvertExprToHLFIR.cpp
  flang/lib/Optimizer/Builder/HLFIRTools.cpp
  flang/test/Lower/HLFIR/vector-subscript-as-value.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149480.518037.patch
Type: text/x-patch
Size: 35901 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230428/0b2a63ca/attachment-0001.bin>


More information about the flang-commits mailing list