[all-commits] [llvm/llvm-project] e81681: [flang] add option to generate runtime type info a...

jeanPerier via All-commits all-commits at lists.llvm.org
Fri Jun 27 04:00:50 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e816817bbb2889a42d8d984736971635d77816f3
      https://github.com/llvm/llvm-project/commit/e816817bbb2889a42d8d984736971635d77816f3
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2025-06-27 (Fri, 27 Jun 2025)

  Changed paths:
    M flang/include/flang/Evaluate/tools.h
    M flang/include/flang/Optimizer/CodeGen/CodeGen.h
    M flang/include/flang/Optimizer/Passes/CommandLineOpts.h
    M flang/include/flang/Optimizer/Support/Utils.h
    M flang/include/flang/Semantics/runtime-type-info.h
    M flang/lib/Evaluate/tools.cpp
    M flang/lib/Lower/Bridge.cpp
    M flang/lib/Lower/ConvertVariable.cpp
    M flang/lib/Optimizer/CodeGen/CodeGen.cpp
    M flang/lib/Optimizer/Passes/CommandLineOpts.cpp
    M flang/lib/Optimizer/Passes/Pipelines.cpp
    M flang/lib/Optimizer/Transforms/PolymorphicOpConversion.cpp
    A flang/test/Integration/skip-external-rtti-definition.F90
    M flang/test/Lower/select-type-2.f90
    M flang/test/Lower/select-type.f90

  Log Message:
  -----------
  [flang] add option to generate runtime type info as external (#145901)

So far flang generates runtime derived type info global definitions (as
opposed to declarations) for all the types used in the current
compilation unit even when the derived types are defined in other
compilation units. It is using linkonce_odr to achieve derived type
descriptor address "uniqueness" aspect needed to match two derived type
inside the runtime.

This comes at a big compile time cost because of all the extra globals
and their definitions in apps with many and complex derived types.

This patch adds and experimental option to only generate the rtti
definition for the types defined in the current compilation unit and to
only generate external declaration for the derived type descriptor
object of types defined elsewhere.

Note that objects compiled with this option are not compatible with
object files compiled without because files compiled without it may drop
the rtti for type they defined if it is not used in the compilation unit
because of the linkonce_odr aspect.

I am adding the option so that we can better measure the extra cost of
the current approach on apps and allow speeding up some compilation
where devirtualization does not matter (and the build config links to
all module file object anyway).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list