[all-commits] [llvm/llvm-project] 64b591: [flang][hlfir] Add hlfir.region_assign and its hlf...

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

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

  Changed paths:
    M flang/include/flang/Optimizer/HLFIR/HLFIROps.h
    M flang/include/flang/Optimizer/HLFIR/HLFIROps.td
    M flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
    M flang/test/HLFIR/invalid.fir
    A flang/test/HLFIR/region-assign.fir

  Log Message:
  [flang][hlfir] Add hlfir.region_assign and its hlfir.yield terminator

hlfir.region_assign is a Region based version of hlfir.assign: the
right-hand side and left-hand-side are evaluated in their own region,
and an optional region can be added to implement user defined

This will be used for:
 - assignments inside where and forall
 - user defined assignments
 - assignments to vector subscripted entities.


Forall and Where lowering requires solving an expression/assignment
evaluation scheduling problem based on data dependencies between the
variables being assigned and the one used in the expressions.
Keeping left-hand side and right-hand side in their own region will
make it really easy to analyse the dependency and move around the
expression evaluation as a whole. Operation DAGs are hard to scissor out
when the LHS and RHS evaluation are lowered in the same block. The pass
dealing with further forall/where lowering in HLFIR will need to
succeed. It is not acceptable for them to fail splitting the RHS/LHS
evaluation code. Keeping them in independent block is an approach that
cannot fail.

For user defined assignments, having a region allows implementing all
the call details in lowering, and even to allow inlining of the user
assignment, before it is decided if a temporary for the LHS or RHS is
required or not.

The operation description mention "hlfir.elemental_addr" (operation that
will be used for vector subscripted LHS) and "ordered assignment trees"
(concept/inetrface that will be used to represent forall/where structure
in HLFIR). These will be pushed in follow-up patch, but I do not want t
scissor out the descriptions.

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

More information about the All-commits mailing list