1 ; RUN: opt -S -mtriple=amdgcn-- -amdgpu-lower-ctor-dtor < %s | FileCheck %s
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 -filetype=obj -o - < %s | llvm-readelf -s - 2>&1 | FileCheck %s -check-prefix=CHECK-VIS
4 @llvm.global_ctors = appending addrspace(1) global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 1, void ()* @foo, i8* null }]
5 @llvm.global_dtors = appending addrspace(1) global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 1, void ()* @bar, i8* null }]
7 ; CHECK-LABEL: amdgpu_kernel void @amdgcn.device.init() #0
8 ; CHECK-NEXT: call void @foo
10 ; CHECK-LABEL: amdgpu_kernel void @amdgcn.device.fini() #1
11 ; CHECK-NEXT: call void @bar
13 ; CHECK-VIS: FUNC GLOBAL PROTECTED {{.*}} amdgcn.device.init
14 ; CHECK-VIS: OBJECT GLOBAL DEFAULT {{.*}} amdgcn.device.init.kd
15 ; CHECK-VIS: FUNC GLOBAL PROTECTED {{.*}} amdgcn.device.fini
16 ; CHECK-VIS: OBJECT GLOBAL DEFAULT {{.*}} amdgcn.device.fini.kd
18 define internal void @foo() {
22 define internal void @bar() {
26 ; CHECK: attributes #0 = { "device-init" }
27 ; CHECK: attributes #1 = { "device-fini" }