[all-commits] [llvm/llvm-project] 3d63d2: [flang] Do not pass derived type by descriptor whe...

jeanPerier via All-commits all-commits at lists.llvm.org
Wed Apr 20 01:01:27 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3d63d2111c3e8ee2c897caa6d71429e3bf183e2d
      https://github.com/llvm/llvm-project/commit/3d63d2111c3e8ee2c897caa6d71429e3bf183e2d
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2022-04-20 (Wed, 20 Apr 2022)

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

  Log Message:
  -----------
  [flang] Do not pass derived type by descriptor when not needed

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.

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




More information about the All-commits mailing list