[all-commits] [llvm/llvm-project] 223038: [flang][cuda] Split realloc for host-accessible CU...

Valentin Clement (バレンタイン クレメン) via All-commits all-commits at lists.llvm.org
Fri Sep 18 23:07:43 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 223038799f33d911ee40001be87ada922b2e8d22
      https://github.com/llvm/llvm-project/commit/223038799f33d911ee40001be87ada922b2e8d22
  Author: Valentin Clement (バレンタイン クレメン) <clementval at gmail.com>
  Date:   2026-09-18 (Fri, 18 Sep 2026)

  Changed paths:
    M flang/include/flang/Optimizer/Builder/MutableBox.h
    M flang/include/flang/Optimizer/Dialect/CUF/CUFOps.td
    M flang/lib/Optimizer/Builder/MutableBox.cpp
    M flang/lib/Optimizer/HLFIR/Transforms/SeparateAllocatableAssign.cpp
    M flang/test/HLFIR/opt-bufferization-dealloc-conflict.fir
    M flang/test/HLFIR/separate-allocatable-assign.fir

  Log Message:
  -----------
  [flang][cuda] Split realloc for host-accessible CUDA Fortran allocatable assigns (#224195)

Allow SeparateAllocatableAssign to peel reallocation off hlfir.assign
for
managed, pinned, and unified allocatables, using cuf.alloc/cuf.free so
the
CUDA Fortran allocator is honored. Device (and other
non-host-accessible)
storage still keeps the runtime realloc path as well as derived-type.

Drop the extra op-level MemFree on cuf.free so OptimizedBufferization
can
see the freed pointer. Without that, a valueless Free effect between the
elemental and the assign forced a temporary for cases such as
`a = int(ran*100)` on a managed allocatable in the example below.

```
subroutine foo(n, a, ran)
  integer :: n
  real, managed, allocatable :: a(:)
  real, allocatable :: ran(:)
  allocate(a(n))
  allocate(ran(n))
  call random_number(ran)
  a = int(ran*100)
end subroutine
```



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