[all-commits] [llvm/llvm-project] b0935f: [flang][hlfir] custom intrinsic handling for scala...

Tom Eccles via All-commits all-commits at lists.llvm.org
Tue Jul 18 04:04:47 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b0935fc4f82b5fe592eeaafc4b5954d01b37a49d
      https://github.com/llvm/llvm-project/commit/b0935fc4f82b5fe592eeaafc4b5954d01b37a49d
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2023-07-18 (Tue, 18 Jul 2023)

  Changed paths:
    M flang/lib/Lower/ConvertCall.cpp
    A flang/test/Lower/HLFIR/custom-intrinsic.f90

  Log Message:
  -----------
  [flang][hlfir] custom intrinsic handling for scalar arguments

This should produce the same results as the FIR lowering

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


  Commit: 09880ef6c977aa0c83bccc5e475f0fb8986dd7db
      https://github.com/llvm/llvm-project/commit/09880ef6c977aa0c83bccc5e475f0fb8986dd7db
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2023-07-18 (Tue, 18 Jul 2023)

  Changed paths:
    M flang/lib/Lower/ConvertCall.cpp
    M flang/test/Lower/HLFIR/custom-intrinsic.f90

  Log Message:
  -----------
  [flang][hlfir] add support for elemental intrinsics with custom handling

Only minimal argument processing is needed here because they will be
lowered properly either by the elemental intrinsic call builder or the
lowering of the scalar call inside the elemental kernel.

Dynamically optional arrays are coming in the next patch.

Depends On: D155291

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


  Commit: db7b665c5c7136d21665555916785129460b5860
      https://github.com/llvm/llvm-project/commit/db7b665c5c7136d21665555916785129460b5860
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2023-07-18 (Tue, 18 Jul 2023)

  Changed paths:
    M flang/lib/Lower/ConvertCall.cpp
    M flang/test/Lower/HLFIR/custom-intrinsic.f90

  Log Message:
  -----------
  [flang][hlfir] support dynamically optional array arguments to intrinsics with custom handling

The previous code path created the elemental kernel by generating a
scalar intrinsic call using pre-prepared arguments using genIntrinsicRefCore,
which then generated the intrinsic call using genIntrinsicCall().

The problem with this approach was that the dynamically optional
arguments were marked as having no argLowering, which meant that they
were unconditionally passed by value without any check to see if they
were present.

It would be nice to put an if operation in the path for !argLowering,
doing something similar to genOptionalValue(). However, this can't be
done because it isn't clear what value should be used for the default.
If zero was used (like in genOptionalValue) this could effect the result
of MIN or MAX.

Instead, this patch re-uses the implementation for scalar dynamically
optional arguments (in non-elemental calls). This does the correct
thing, entirely ignoring absent optional arguments.

Depends On: D155292

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


  Commit: 75f459d555a46a337c9f77948392fa9d750ea555
      https://github.com/llvm/llvm-project/commit/75f459d555a46a337c9f77948392fa9d750ea555
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2023-07-18 (Tue, 18 Jul 2023)

  Changed paths:
    M flang/lib/Lower/ConvertCall.cpp

  Log Message:
  -----------
  [flang][hlfir][NFC] catch dynamically optional args with no lowering

These should be lowered with genOptionalValue as in D154897, but I
haven't found any cases where this code path is actually hit (flang
tests, gfortran test suite), so I don't think it would be testable.
Adding an assertion for if this code path ever becomes live.

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


Compare: https://github.com/llvm/llvm-project/compare/eb5d79876a09...75f459d555a4


More information about the All-commits mailing list