[flang-commits] [PATCH] D134174: [flang] fix optional pointer TARGET argument lowering in ASSOCIATED

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon Sep 19 03:59:42 PDT 2022


jeanPerier created this revision.
jeanPerier added reviewers: clementval, PeteSteinfeld.
jeanPerier added a project: Flang.
Herald added subscribers: bzcheeseman, mehdi_amini, rriddle, jdoerfert.
Herald added a project: All.
jeanPerier requested review of this revision.
Herald added a subscriber: stephenneuendorffer.

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 <https://reviews.llvm.org/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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134174

Files:
  flang/lib/Lower/IntrinsicCall.cpp
  flang/test/Lower/Intrinsics/associated.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134174.461179.patch
Type: text/x-patch
Size: 9204 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220919/7c504765/attachment-0001.bin>


More information about the flang-commits mailing list