[all-commits] [llvm/llvm-project] de2be3: [flang][hlfir] Use the HLFIR base of hlfir.declare...

Slava Zakharin via All-commits all-commits at lists.llvm.org
Wed Aug 16 17:56:38 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: de2be3e469f6174871d522ab6950d41282c58c7b
  Author: Slava Zakharin <szakharin at nvidia.com>
  Date:   2023-08-16 (Wed, 16 Aug 2023)

  Changed paths:
    M flang/lib/Lower/OpenACC.cpp
    M flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp
    M flang/test/HLFIR/assign-codegen.fir
    M flang/test/HLFIR/designate-codegen-complex-part.fir
    M flang/test/HLFIR/designate-codegen-component-refs.fir
    M flang/test/HLFIR/designate-codegen.fir

  Log Message:
  [flang][hlfir] Use the HLFIR base of hlfir.declare if possible.

This patch makes use of the HLFIR box produced for hlfir.declare
in place of the FIR box (the memref of hlfir.declare) when possible.

This makes the representation a little bit more clear, because
all accesses are made via a single box.
This reduces the life range of the original box, because the new
temporary box produced by embox/rebox is used from now.
Apparently, this works around some issues in the current HLFIR codegen,
for example, look at the LIT tests changes around fir.array_coor
produced by hlfir.designate codegen - using the FIR box for fir.array_coor
might result in using incorrect lbounds.
Apparently, this change enables more intrinsics simplifications
because the SimplifyIntrinsicsPass looks for explicit embox/rebox
in findBoxDef() to decide whether to apply the optimization.
This change also provides better association of the base addresses
referenced by OpenACC clauses with the corresponding boxes
that might be used explicitly in OpenACC regions (e.g. for reading
the lbounds).

Reviewed By: razvanlupusoru, clementval

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

More information about the All-commits mailing list