brintos

brintos / llvm-project-archived public Read only

0
0
Text · 832 B · ed7c640 Raw
34 lines · plain
1! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s2 3! Check if finalization works with a return statement4 5subroutine sub16  integer, device :: a(10)7  return8end9 10! CHECK: func.func @_QPsub1()11! CHECK: %[[DECL:.*]]:2 = hlfir.declare12! CHECK: cuf.free %[[DECL]]#0 : !fir.ref<!fir.array<10xi32>>13! CHECK: return14! CHECK: }15 16subroutine sub217  integer, device, allocatable :: a(:)18  return19end20 21! CHECK-LABEL: func.func @_QPsub2()22! CHECK: fir.if23! CHECK: cuf.deallocate 24! CHECK: cuf.free25 26program main27  integer, allocatable, device :: a(:)28  return29end30 31! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "MAIN"}32! CHECK: cuf.alloc !fir.box<!fir.heap<!fir.array<?xi32>>> {bindc_name = "a", data_attr = #cuf.cuda<device>, uniq_name = "_QFEa"} -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>33! CHECK-NOT: cuf.free34