[all-commits] [llvm/llvm-project] b4643b: [flang][cuda] Do not use cuf.alloc for derived-typ...

Valentin Clement (バレンタイン クレメン) via All-commits all-commits at lists.llvm.org
Wed Sep 30 15:46:22 PDT 2026


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

  Changed paths:
    M flang/lib/Lower/ConvertVariable.cpp
    M flang/test/Lower/CUDA/cuda-derived.cuf

  Log Message:
  -----------
  [flang][cuda] Do not use cuf.alloc for derived-type function results (#227863)

Local variables of a derived type with device allocatable components
are allocated in managed memory with cuf.alloc/cuf.free. This also
applied to function results, but the storage of a derived-type function
result is replaced by the caller-provided buffer in the AbstractResult
pass. Allocating it with cuf.alloc is therefore incorrect, and the
matching cuf.free would release memory that is returned to the caller.

Skip function results in needCUDAAlloc so that they are lowered to a
regular fir.alloca. Explicit device/managed/shared/pinned attributes
on the symbol are still honored.



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