llvm-project/flang/test/Fir/CUDA/cuda-constructor.f90
Valentin Clement (バレンタイン クレメン) b15bd3fc65
[flang][cuda] Add global constructor for allocators registration (#109854)
This pass creates the constructor function to call the allocator
registration and adds it to the global_ctors.
2024-09-24 17:04:54 -07:00

13 lines
481 B
Fortran

! RUN: bbc -fcuda -emit-hlfir %s -o - | fir-opt --cuf-add-constructor | FileCheck %s
program main
real, device :: ahost(10)
end
! CHECK: llvm.func @_FortranACUFRegisterAllocator() attributes {sym_visibility = "private"}
! CHECK-LABEL: llvm.func internal @__cudaFortranConstructor() {
! CHECK: llvm.call @_FortranACUFRegisterAllocator() : () -> ()
! CHECK: llvm.return
! CHECK: }
! CHECK: llvm.mlir.global_ctors {ctors = [@__cudaFortranConstructor], priorities = [0 : i32]}