1 ; RUN: opt -S -mtriple=amdgcn-- -amdgpu-replace-lds-use-with-pointer -amdgpu-enable-lds-replace-with-pointer=true < %s | FileCheck %s
5 ; None of lds are pointer-replaced since they are all used in global scope in one or the other way.
8 ; CHECK: @lds = internal addrspace(3) global [4 x i32] undef, align 4
9 ; CHECK: @lds.1 = addrspace(3) global i16 undef, align 2
10 ; CHECK: @lds.2 = addrspace(3) global i32 undef, align 4
11 ; CHECK: @lds.3 = internal unnamed_addr addrspace(3) global [1 x i8] undef, align 1
12 @lds = internal addrspace(3) global [4 x i32] undef, align 4
13 @lds.1 = addrspace(3) global i16 undef, align 2
14 @lds.2 = addrspace(3) global i32 undef, align 4
15 @lds.3 = internal unnamed_addr addrspace(3) global [1 x i8] undef, align 1
17 ; CHECK: @global_var = addrspace(1) global float* addrspacecast (float addrspace(3)* bitcast ([4 x i32] addrspace(3)* @lds to float addrspace(3)*) to float*), align 8
18 ; CHECK: @llvm.used = appending global [1 x i8*] [i8* addrspacecast (i8 addrspace(3)* bitcast (i16 addrspace(3)* @lds.1 to i8 addrspace(3)*) to i8*)], section "llvm.metadata"
19 ; CHECK: @llvm.compiler.used = appending global [1 x i8*] [i8* addrspacecast (i8 addrspace(3)* bitcast (i32 addrspace(3)* @lds.2 to i8 addrspace(3)*) to i8*)], section "llvm.metadata"
20 ; CHECK: @alias.to.lds.3 = alias [1 x i8], [1 x i8] addrspace(3)* @lds.3
21 @global_var = addrspace(1) global float* addrspacecast ([4 x i32] addrspace(3)* @lds to float*), align 8
22 @llvm.used = appending global [1 x i8*] [i8* addrspacecast (i8 addrspace(3)* bitcast (i16 addrspace(3)* @lds.1 to i8 addrspace(3)*) to i8*)], section "llvm.metadata"
23 @llvm.compiler.used = appending global [1 x i8*] [i8* addrspacecast (i8 addrspace(3)* bitcast (i32 addrspace(3)* @lds.2 to i8 addrspace(3)*) to i8*)], section "llvm.metadata"
24 @alias.to.lds.3 = alias [1 x i8], [1 x i8] addrspace(3)* @lds.3
27 ; CHECK-NOT: @lds.1.ptr
28 ; CHECK-NOT: @lds.2.ptr
29 ; CHECK-NOT: @lds.3.ptr
33 ; CHECK: %gep = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* @lds, i32 0, i32 0
34 ; CHECK: %ld1 = load i16, i16 addrspace(3)* @lds.1
35 ; CHECK: %ld2 = load i32, i32 addrspace(3)* @lds.2
36 ; CHECK: %gep2 = getelementptr inbounds [1 x i8], [1 x i8] addrspace(3)* @lds.3, i32 0, i32 0
39 %gep = getelementptr inbounds [4 x i32], [4 x i32] addrspace(3)* @lds, i32 0, i32 0
40 %ld1 = load i16, i16 addrspace(3)* @lds.1
41 %ld2 = load i32, i32 addrspace(3)* @lds.2
42 %gep2 = getelementptr inbounds [1 x i8], [1 x i8] addrspace(3)* @lds.3, i32 0, i32 0
46 define protected amdgpu_kernel void @k0() {
48 ; CHECK: call void @f0()