[flang-commits] [PATCH] D153252: [flang][hlfir] Simplify hlfir::convertToValue

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon Jun 19 00:59:16 PDT 2023


jeanPerier created this revision.
jeanPerier added reviewers: vzakhari, tblah, clementval.
Herald added subscribers: sunshaoce, mehdi_amini.
Herald added projects: Flang, All.
jeanPerier requested review of this revision.
Herald added a subscriber: jdoerfert.

Use hlfir::loadTrivialScalars to dereference pointer, allocatables, and
load numerical and logical scalars.

This has a small fallout on tests:

- load is done on the HLFIR entity (#0 of hlfir.declare) and not the

FIR one (#1). This makes no difference at the FIR level (#1 and #0 only
differs to account for assumed and explicit shape lower bounds).

- loadTrivialScalars get rids of allocatable fir.box for monomoprhic scalars (it is not needed). This exposed a bug in lowering of MERGE with a polymorphic and a monomorphic argument: when the monomorphic is not a fir.box, the polymorphic fir.class should not be reboxed but its address should be read.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153252

Files:
  flang/lib/Optimizer/Builder/HLFIRTools.cpp
  flang/lib/Optimizer/Builder/IntrinsicCall.cpp
  flang/test/Lower/HLFIR/calls-character-singleton-result.f90
  flang/test/Lower/HLFIR/calls-f77.f90
  flang/test/Lower/HLFIR/convert-mbox-to-value.f90
  flang/test/Lower/HLFIR/expr-as-inquired.f90
  flang/test/Lower/HLFIR/expr-value.f90
  flang/test/Lower/HLFIR/forall.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153252.532556.patch
Type: text/x-patch
Size: 18888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230619/140b7451/attachment-0001.bin>


More information about the flang-commits mailing list