This is an archive of the discontinued LLVM Phabricator instance.

[flang] Do not pass derived type by descriptor when not needed
ClosedPublic

Authored by jeanPerier on Apr 19 2022, 1:56 AM.

Details

Summary

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.

Diff Detail

Event Timeline

jeanPerier created this revision.Apr 19 2022, 1:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2022, 1:56 AM
jeanPerier requested review of this revision.Apr 19 2022, 1:56 AM
This revision is now accepted and ready to land.Apr 19 2022, 1:59 AM