[all-commits] [llvm/llvm-project] de3529: [flang][lowering] Implement component-wise initial...

hcx via All-commits all-commits at lists.llvm.org
Mon Jun 1 05:47:39 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: de3529386e1e773f0186755b83bbc12e7884f863
      https://github.com/llvm/llvm-project/commit/de3529386e1e773f0186755b83bbc12e7884f863
  Author: hcx <hechenxi at bosc.ac.cn>
  Date:   2026-06-01 (Mon, 01 Jun 2026)

  Changed paths:
    M flang/lib/Lower/ConvertVariable.cpp
    M flang/test/Lower/HLFIR/structure-constructor.f90
    M flang/test/Lower/OpenMP/private-derived-type.f90
    M flang/test/Lower/call-copy-in-out.f90
    A flang/test/Lower/component-wise-init.f90
    M flang/test/Lower/default-initialization.f90
    M flang/test/Lower/derived-type-finalization.f90
    M flang/test/Lower/derived-type-temp.f90
    M flang/test/Lower/forall/forall-allocatable-2.f90
    M flang/test/Lower/pointer-default-init.f90

  Log Message:
  -----------
  [flang][lowering] Implement component-wise initialization for derived types (#187465)

Currently, the compiler defaults to a full `memcpy` when initializing
derived types.

This patch introduces component-wise initialization for pointer /
allocatable components, avoiding unnecessary initialization data
generation and redundant copies.

Ineligible cases continue to use the existing `memcpy` initialization
path.

RFC: https://discourse.llvm.org/t/rfc-automatic-static-promotion-of-large-local-variables-in-flang/89539

Key changes:

- In `flang/lib/Lower/ConvertVariable.cpp`:
- Add `genDerivedTypeComponentInit` for component-wise derived type
initialization.
- Add `isEligibleForComponentWiseInit` to guard the new initialization
path.
- Add `genInlinedInitWithMemcpy` to factor out the existing full
`memcpy` initialization logic.
- Update `defaultInitializeAtRuntime` to select the appropriate
initialization path.
- Add and update regression tests.

---------

Co-authored-by: ict-ql <168183727+ict-ql at users.noreply.github.com>
Co-authored-by: buggfg <wangyingying at bosc.ac.cn>



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