[all-commits] [llvm/llvm-project] 84564e: [flang][NFC] Cache derived type translation in low...

jeanPerier via All-commits all-commits at lists.llvm.org
Thu Feb 1 00:27:51 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 84564e1040be8df037d2e9cdbb494aef067e77a7
      https://github.com/llvm/llvm-project/commit/84564e1040be8df037d2e9cdbb494aef067e77a7
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2024-02-01 (Thu, 01 Feb 2024)

  Changed paths:
    M flang/include/flang/Lower/AbstractConverter.h
    M flang/lib/Lower/ConvertType.cpp
    A flang/test/Lower/derived-types-kind-params-2.f90

  Log Message:
  -----------
  [flang][NFC] Cache derived type translation in lowering (#80179)

Derived type translation is proving expensive in modern fortran apps
with many big derived types with dozens of components and parents.

Extending the cache that prevent recursion is proving to have little
cost on apps with small derived types and significant gain (can divide
compile time by 2) on modern fortran apps.

It is legal since the cache lifetime is less than the MLIRContext
lifetime that owns the cached mlir::Type.

Doing so also exposed that the current caching was incorrect, the type
symbol is the same for kind parametrized derived types regardless of the
kind parameters. Instances with different kinds should lower to
different MLIR types. See added test.
Using the type scopes fixes the problem.




More information about the All-commits mailing list