[all-commits] [llvm/llvm-project] 99d9a7: [flang] move ASSOCIATED intrinsic optional TARGET ...

jeanPerier via All-commits all-commits at lists.llvm.org
Fri Mar 31 00:12:16 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 99d9a700d3b69007429b583e0c2d37992f15d146
      https://github.com/llvm/llvm-project/commit/99d9a700d3b69007429b583e0c2d37992f15d146
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2023-03-31 (Fri, 31 Mar 2023)

  Changed paths:
    M flang/include/flang/Lower/CustomIntrinsicCall.h
    M flang/lib/Lower/ConvertExpr.cpp
    M flang/lib/Lower/CustomIntrinsicCall.cpp
    M flang/lib/Optimizer/Builder/IntrinsicCall.cpp
    M flang/test/Lower/Intrinsics/associated.f90

  Log Message:
  -----------
  [flang] move ASSOCIATED intrinsic optional TARGET handling

ASSOCIATED intrinsic TARGET handling is weird for OPTIONAL, because as
opposed to other intrinsic arguments, OPTIONAL allocatable and pointers
may be absent when passed to it, and a diassociated pointer TARGET is not
the same as when TARGET is not provided. Hence, it needs custom
handling in lowering.

The handling was done late (in genIntrinsicCall, without the semantic
context), and assumed it would be possible to retrieve the optionality
aspects, but this is brittle, and hard to share with HLFIR.
Move it in CustomIntrinsicCall that is intended to deal with these
corner case.

Also avoid using fir.box<None> as the related fir.if result, and used
the correct fir.box/fir.class type for the target: using a fir.box<None>
here is risky since fir.box<None> are now meant for scalar TYPE(*), and
the TARGET may be ranked.

Move the introduction of the fir.box<None> around the runtime (when
assumed rank are supported, these will become !fir.box<!fir.array<..xNone>>).

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




More information about the All-commits mailing list