[all-commits] [llvm/llvm-project] b668de: [flang] fix optional pointer TARGET argument lower...

jeanPerier via All-commits all-commits at lists.llvm.org
Tue Sep 20 01:18:02 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b668de2de2c2216a744454dd5144b35a68698031
      https://github.com/llvm/llvm-project/commit/b668de2de2c2216a744454dd5144b35a68698031
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2022-09-20 (Tue, 20 Sep 2022)

  Changed paths:
    M flang/lib/Lower/IntrinsicCall.cpp
    M flang/test/Lower/Intrinsics/associated.f90

  Log Message:
  -----------
  [flang] fix optional pointer TARGET argument lowering in ASSOCIATED

The TARGET argument of ASSOCIATED has a special lowering to deal with
POINTER and ALLOCATABLE optional actual arguments because they may be
dynamically absent. The previous code was doing a ternary
(mlir::SelectOp) to deal with this case, but generated invalid
code for the unused argument (loading a nullptr fir.ref<fir.box>). This
was not detected until D133779 was merged and modified how fir.load are
lowered to LLVM for fir.box types.

Replace the select by a proper if to prevent the fir.load from being
reachable in context where it should not.

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




More information about the All-commits mailing list