xref: /llvm-project/llvm/test/CodeGen/AMDGPU/resource-usage-dead-function.ll (revision c897c13dde3bb413e723317c0579781fb6045a8b)
1; RUN: sed 's/CODE_OBJECT_VERSION/400/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -o - | FileCheck -check-prefixes=GCN,ALL %s
2; RUN: sed 's/CODE_OBJECT_VERSION/500/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -o - | FileCheck -check-prefixes=GCN-V5,ALL %s
3; RUN: sed 's/CODE_OBJECT_VERSION/600/g' %s | llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -o - | FileCheck -check-prefixes=GCN-V5,ALL %s
4
5; Make sure there's no assertion when trying to report the resource
6; usage for a function which becomes dead during codegen.
7
8@gv.fptr0 = external hidden unnamed_addr addrspace(4) constant ptr, align 4
9
10; GCN-LABEL: unreachable:
11; Function info:
12; codeLenInByte = 4
13define internal fastcc void @unreachable() {
14  %fptr = load ptr, ptr addrspace(4) @gv.fptr0
15  call void %fptr()
16  unreachable
17}
18
19
20; GCN-LABEL: entry:
21; GCN-NOT: s_swappc_b64
22; GCN: s_endpgm
23
24; GCN-NOT: .amdhsa_uses_dynamic_stack
25; GCN-V5: .amdhsa_uses_dynamic_stack
26; ALL: .set entry.private_seg_size, 0
27; ALL: .set entry.has_dyn_sized_stack, 0
28define amdgpu_kernel void @entry() {
29bb0:
30  br i1 false, label %bb1, label %bb2
31
32bb1:
33  tail call fastcc void @unreachable()
34  unreachable
35
36bb2:
37  ret void
38}
39
40!llvm.module.flags = !{!0}
41!0 = !{i32 1, !"amdhsa_code_object_version", i32 CODE_OBJECT_VERSION}
42