[all-commits] [llvm/llvm-project] de528f: [Flang] Extracting internal constants from scalar ...

Mats Petersson via All-commits all-commits at lists.llvm.org
Tue Jun 25 07:42:25 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: de528ffb17ebce96e0bc4dde1749146c41ca1d0d
      https://github.com/llvm/llvm-project/commit/de528ffb17ebce96e0bc4dde1749146c41ca1d0d
  Author: Mats Petersson <mats.petersson at arm.com>
  Date:   2024-06-25 (Tue, 25 Jun 2024)

  Changed paths:
    M flang/include/flang/Optimizer/Transforms/Passes.h
    M flang/include/flang/Optimizer/Transforms/Passes.td
    M flang/include/flang/Tools/CLOptions.inc
    M flang/lib/Optimizer/Transforms/CMakeLists.txt
    A flang/lib/Optimizer/Transforms/ConstantArgumentGlobalisation.cpp
    M flang/test/Fir/boxproc.fir
    M flang/test/Lower/character-local-variables.f90
    A flang/test/Transforms/constant-argument-globalisation-2.fir
    A flang/test/Transforms/constant-argument-globalisation.fir

  Log Message:
  -----------
  [Flang] Extracting internal constants from scalar literals (#73829)

Constants actual arguments in function/subroutine calls are currently
lowered as allocas + store. This can sometimes inhibit LTO and the
constant will not be propagated to the called function. Particularly in
cases where the function/subroutine call happens inside a condition.

This patch changes the lowering of these constant actual arguments to a
global constant + fir.address_of_op. This lowering makes it easier for
LTO to propagate the constant.

The optimization must be enabled explicitly to run. Use -mmlir
--enable-constant-argument-globalisation to enable.

---------

Co-authored-by: Dmitriy Smirnov <dmitriy.smirnov at arm.com>



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