[all-commits] [llvm/llvm-project] b11a42: [flang] Inline trivial scalar allocatable assignme...
khaki3 via All-commits
all-commits at lists.llvm.org
Mon Mar 2 08:10:59 PST 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b11a424e05826aadba71d9c15c4ae3821c92f713
https://github.com/llvm/llvm-project/commit/b11a424e05826aadba71d9c15c4ae3821c92f713
Author: khaki3 <47756807+khaki3 at users.noreply.github.com>
Date: 2026-03-02 (Mon, 02 Mar 2026)
Changed paths:
M flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp
M flang/test/HLFIR/assign-codegen.fir
M flang/test/Lower/OpenMP/cfg-conversion-omp.private.f90
Log Message:
-----------
[flang] Inline trivial scalar allocatable assignments in HLFIR-to-FIR (#183177)
For trivial scalar allocatable assignments (non-polymorphic,
non-character, non-array, non-temporary), inline the assignment directly
instead of calling the `_FortranAAssign` runtime. The inlined code
checks whether the allocatable is already allocated: if so, it stores
directly; otherwise, it allocates memory via `fir.allocmem`, stores, and
updates the box descriptor. The if-branch is necessary to handle both
cases:
```fortran
integer, allocatable :: k
allocate(k)
k = 42 ! already allocated: store directly
```
```fortran
integer, allocatable :: k
k = 42 ! not allocated: allocmem, store, update box
```
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