[all-commits] [llvm/llvm-project] 1872f0: [flang][HLFIR] Add SeparateAllocatableAssign pass ...
khaki3 via All-commits
all-commits at lists.llvm.org
Tue Jun 2 04:55:28 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1872f06d60f35133bbc06e047c763b490c2d31be
https://github.com/llvm/llvm-project/commit/1872f06d60f35133bbc06e047c763b490c2d31be
Author: khaki3 <47756807+khaki3 at users.noreply.github.com>
Date: 2026-06-02 (Tue, 02 Jun 2026)
Changed paths:
M flang/include/flang/Optimizer/HLFIR/Passes.td
M flang/lib/Optimizer/HLFIR/Transforms/CMakeLists.txt
M flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp
A flang/lib/Optimizer/HLFIR/Transforms/SeparateAllocatableAssign.cpp
M flang/lib/Optimizer/Passes/Pipelines.cpp
M flang/test/Driver/mlir-debug-pass-pipeline.f90
M flang/test/Driver/mlir-pass-pipeline.f90
M flang/test/Fir/basic-program.fir
A flang/test/HLFIR/opt-bufferization-dealloc-conflict.fir
A flang/test/HLFIR/separate-allocatable-assign.fir
M flang/test/Integration/OpenMP/workshare-axpy.f90
Log Message:
-----------
[flang][HLFIR] Add SeparateAllocatableAssign pass (#197814)
Example:
```fortran
!$acc kernels
B = A ! A, B allocatable
!$acc end kernels
```
In this code, `B = A` lowers to `hlfir.assign ... realloc`, which
becomes a `_FortranAAssign` runtime call inside the compute region — the
allocation can't be separated from the copy, and it crashes when `B` is
unallocated.
Fix: add `SeparateAllocatableAssign`, which splits the realloc assign
into an explicit conditional [re-]allocation followed by a plain
`hlfir.assign`, exposing the allocation as plain FIR. For variable RHS
it skips aliasing cases (`a = a(:n)`) by loading the LHS `fir.box` and
querying `fir::AliasAnalysis` on the data. For `hlfir.expr` RHS it
leaves ordering to bufferization, and fixes
`ElementalAssignBufferization` to stop fusing an elemental across a
deallocation.
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