2017-09-19 15:40:11 +08:00
|
|
|
; RUN: opt -O1 -S -mtriple=amdgcn-unknown-amdhsa -amdgpu-internalize-symbols < %s | FileCheck -check-prefix=ALL -check-prefix=OPT %s
|
|
|
|
; RUN: opt -O0 -S -mtriple=amdgcn-unknown-amdhsa -amdgpu-internalize-symbols < %s | FileCheck -check-prefix=ALL -check-prefix=OPTNONE %s
|
2017-01-31 05:05:18 +08:00
|
|
|
|
2017-09-19 15:40:11 +08:00
|
|
|
; OPT-NOT: gvar_unused
|
|
|
|
; OPTNONE: gvar_unused
|
2017-01-31 05:05:18 +08:00
|
|
|
@gvar_unused = addrspace(1) global i32 undef, align 4
|
2017-09-19 15:40:11 +08:00
|
|
|
|
|
|
|
; ALL: gvar_used
|
2017-01-31 05:05:18 +08:00
|
|
|
@gvar_used = addrspace(1) global i32 undef, align 4
|
|
|
|
|
2018-08-31 14:02:36 +08:00
|
|
|
; OPT: define internal fastcc void @func_used_noinline(
|
|
|
|
; OPT-NONE: define fastcc void @func_used_noinline(
|
2017-09-20 12:25:58 +08:00
|
|
|
define fastcc void @func_used_noinline(i32 addrspace(1)* %out, i32 %tid) #1 {
|
2017-09-19 15:40:11 +08:00
|
|
|
entry:
|
|
|
|
store volatile i32 %tid, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2018-08-31 14:02:36 +08:00
|
|
|
; OPTNONE: define fastcc void @func_used_alwaysinline(
|
2017-09-19 15:40:11 +08:00
|
|
|
; OPT-NOT: @func_used_alwaysinline
|
2017-09-20 12:25:58 +08:00
|
|
|
define fastcc void @func_used_alwaysinline(i32 addrspace(1)* %out, i32 %tid) #2 {
|
2017-01-31 05:05:18 +08:00
|
|
|
entry:
|
2017-09-19 15:40:11 +08:00
|
|
|
store volatile i32 %tid, i32 addrspace(1)* %out
|
2017-01-31 05:05:18 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2018-08-31 14:02:36 +08:00
|
|
|
; OPTNONE: define void @func_unused(
|
2017-09-19 15:40:11 +08:00
|
|
|
; OPT-NOT: @func_unused
|
2017-09-20 12:25:58 +08:00
|
|
|
define void @func_unused(i32 addrspace(1)* %out, i32 %tid) #1 {
|
2017-01-31 05:05:18 +08:00
|
|
|
entry:
|
2017-09-19 15:40:11 +08:00
|
|
|
store volatile i32 %tid, i32 addrspace(1)* %out
|
2017-01-31 05:05:18 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-09-19 15:40:11 +08:00
|
|
|
; ALL: define amdgpu_kernel void @kernel_unused(
|
|
|
|
define amdgpu_kernel void @kernel_unused(i32 addrspace(1)* %out) #1 {
|
|
|
|
entry:
|
|
|
|
store volatile i32 1, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; ALL: define amdgpu_kernel void @main_kernel()
|
|
|
|
; ALL: tail call i32 @llvm.amdgcn.workitem.id.x
|
|
|
|
; ALL: tail call fastcc void @func_used_noinline
|
|
|
|
; ALL: store volatile
|
|
|
|
; ALL: ret void
|
2017-01-31 05:05:18 +08:00
|
|
|
define amdgpu_kernel void @main_kernel() {
|
|
|
|
entry:
|
2017-09-19 15:40:11 +08:00
|
|
|
%tid = tail call i32 @llvm.amdgcn.workitem.id.x()
|
|
|
|
tail call fastcc void @func_used_noinline(i32 addrspace(1)* @gvar_used, i32 %tid)
|
|
|
|
tail call fastcc void @func_used_alwaysinline(i32 addrspace(1)* @gvar_used, i32 %tid)
|
2017-01-31 05:05:18 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @llvm.amdgcn.workitem.id.x() #0
|
|
|
|
|
|
|
|
attributes #0 = { nounwind readnone }
|
2017-09-20 12:25:58 +08:00
|
|
|
attributes #1 = { noinline nounwind }
|
|
|
|
attributes #2 = { alwaysinline nounwind }
|