[all-commits] [llvm/llvm-project] 87cd6f: [flang][hlfir] Lower post f77 user calls

jeanPerier via All-commits all-commits at lists.llvm.org
Wed Feb 1 02:44:12 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 87cd6f934650c2403d776be0cc7f5c065479f77d
      https://github.com/llvm/llvm-project/commit/87cd6f934650c2403d776be0cc7f5c065479f77d
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2023-02-01 (Wed, 01 Feb 2023)

  Changed paths:
    M flang/include/flang/Lower/CallInterface.h
    M flang/include/flang/Optimizer/Builder/HLFIRTools.h
    M flang/lib/Lower/CallInterface.cpp
    M flang/lib/Lower/ConvertCall.cpp
    M flang/lib/Lower/ConvertExprToHLFIR.cpp
    M flang/lib/Optimizer/Builder/HLFIRTools.cpp
    M flang/lib/Optimizer/Dialect/FIROps.cpp
    M flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
    A flang/test/Lower/HLFIR/calls-assumed-shape.f90
    A flang/test/Lower/HLFIR/calls-optional.f90
    M flang/test/Lower/HLFIR/elemental-intrinsics.f90

  Log Message:
  -----------
  [flang][hlfir] Lower post f77 user calls

In lowering to HLFIR, deal with user calls involving a mix of:
 - dummy with VALUE
 - Polymorphism
 - contiguous dummy
 - assumed shape dummy
 - OPTIONAL arguments
 - NULL() passed to OPTIONAL arguments.
 - elemental calls

Does not deal with assumed ranked dummy arguments.

This patch unifies the preparation of all arguments that must be passed
in memory and are not passed as allocatable/pointers.

For optionals, the same argument preparation is done, except the utility
that generates the IR for the argument preparation is called inside a
fir.if.

The addressing of array arguments in elemental calls is delayed so that
it can also happen during this argument preparation, and be placed in
the fir.if when the array may be absent.

Structure helpers are added to convey a prepared dummy argument and the
data that may be needed to do the clean-up after the call (temporary
storage deallocation or copy-out). And a utility is added to wrap
the preparation code inside a fir.if and convey these values through
the fir.if.

Certain aspects of this patch brings the HLFIR lowering support beyond
what the current lowering to FIR supports (e.g. handling of NULL(), handling
of optional in elemental calls, handling of copy-in/copy-out involving
polymorphic entities).

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




More information about the All-commits mailing list