1; RUN: llc -march=amdgcn < %s | FileCheck -check-prefix=ALL -check-prefix=GCN %s
2; RUN: llc -mtriple=amdgcn-amd-amdhsa < %s | FileCheck -check-prefix=ALL -check-prefix=HSA %s
3; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=ALL -check-prefix=EG %s
4
5; This test makes sure we do not double count global values when they are
6; used in different basic blocks.
7
8; GCN: .long 47180
9; GCN-NEXT: .long 32900
10
11; EG: .long 166120
12; EG-NEXT: .long 1
13; ALL: {{^}}test:
14
15; HSA: granulated_lds_size = 0
16; HSA: workgroup_group_segment_byte_size = 4
17
18; GCN: ; LDSByteSize: 4 bytes/workgroup (compile time only)
19@lds = internal unnamed_addr addrspace(3) global i32 undef, align 4
20
21define amdgpu_kernel void @test(i32 addrspace(1)* %out, i32 %cond) {
22entry:
23  %0 = icmp eq i32 %cond, 0
24  br i1 %0, label %if, label %else
25
26if:
27  store i32 1, i32 addrspace(3)* @lds
28  br label %endif
29
30else:
31  store i32 2, i32 addrspace(3)* @lds
32  br label %endif
33
34endif:
35  ret void
36}
37