[all-commits] [llvm/llvm-project] 583d49: [flang][hlfir] Lower vector subscripted RHS design...

jeanPerier via All-commits all-commits at lists.llvm.org
Wed May 3 00:25:07 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 583d492c630655dc0cd57ad167dec03e6c5d211c
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2023-05-03 (Wed, 03 May 2023)

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

  Log Message:
  [flang][hlfir] Lower vector subscripted RHS designators

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

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.

Differential Revision: https://reviews.llvm.org/D149480

More information about the All-commits mailing list