[flang-commits] [PATCH] D123990: [flang] Do not pass derived type by descriptor when not needed

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Apr 19 01:56:13 PDT 2022


jeanPerier created this revision.
jeanPerier added reviewers: klausler, schweitz, clementval, rogfer01.
jeanPerier added a project: Flang.
Herald added subscribers: mehdi_amini, jdoerfert.
Herald added a project: All.
jeanPerier requested review of this revision.

A missing "!" in the call interface lowering caused all derived type
arguments without length parameters that require and explicit interface
to be passed via fir.box (runtime descriptor).

This was not the intent: there is no point passing a simple derived type
scalars or explicit shapes by descriptor just because they have an attribute
like TARGET. This would actually be problematic with existing code that is
not always 100% compliant: some code implicitly calls procedures with
TARGET dummy attributes (this is not something a compiler can enforce
if the call and procedure definition are not in the same file).

Add a Scope::IsDerivedTypeWithLengthParameter to avoid passing derived
types with only kind parameters by descriptor. There is no point, the
callee knows about the kind parameter values.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123990

Files:
  flang/include/flang/Semantics/scope.h
  flang/lib/Lower/CallInterface.cpp
  flang/lib/Semantics/scope.cpp
  flang/test/Lower/default-initialization.f90
  flang/test/Lower/dummy-argument-derived.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123990.423560.patch
Type: text/x-patch
Size: 10101 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220419/a14b49c2/attachment.bin>


More information about the flang-commits mailing list