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