1 ; RUN: llc -O0 -march=amdgcn -mtriple=amdgcn-unknown-amdhsa -mcpu=kaveri -mattr=-code-object-v3,+promote-alloca < %s | FileCheck -check-prefix=NOOPTS -check-prefix=ALL %s
2 ; RUN: llc -O1 -march=amdgcn -mtriple=amdgcn-unknown-amdhsa -mcpu=kaveri -mattr=-code-object-v3,+promote-alloca < %s | FileCheck -check-prefix=OPTS -check-prefix=ALL %s
4 ; ALL-LABEL: {{^}}promote_alloca_i32_array_array:
5 ; NOOPTS: workgroup_group_segment_byte_size = 0{{$}}
8 define amdgpu_kernel void @promote_alloca_i32_array_array(i32 addrspace(1)* %out, i32 %index) #0 {
10 %alloca = alloca [2 x [2 x i32]], addrspace(5)
11 %gep0 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]] addrspace(5)* %alloca, i32 0, i32 0, i32 0
12 %gep1 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]] addrspace(5)* %alloca, i32 0, i32 0, i32 1
13 store i32 0, i32 addrspace(5)* %gep0
14 store i32 1, i32 addrspace(5)* %gep1
15 %gep2 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]] addrspace(5)* %alloca, i32 0, i32 0, i32 %index
16 %load = load i32, i32 addrspace(5)* %gep2
17 store i32 %load, i32 addrspace(1)* %out
21 ; ALL-LABEL: {{^}}optnone_promote_alloca_i32_array_array:
22 ; ALL: workgroup_group_segment_byte_size = 0{{$}}
24 define amdgpu_kernel void @optnone_promote_alloca_i32_array_array(i32 addrspace(1)* %out, i32 %index) #1 {
26 %alloca = alloca [2 x [2 x i32]], addrspace(5)
27 %gep0 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]] addrspace(5)* %alloca, i32 0, i32 0, i32 0
28 %gep1 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]] addrspace(5)* %alloca, i32 0, i32 0, i32 1
29 store i32 0, i32 addrspace(5)* %gep0
30 store i32 1, i32 addrspace(5)* %gep1
31 %gep2 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]] addrspace(5)* %alloca, i32 0, i32 0, i32 %index
32 %load = load i32, i32 addrspace(5)* %gep2
33 store i32 %load, i32 addrspace(1)* %out
37 attributes #0 = { nounwind "amdgpu-flat-work-group-size"="64,64" }
38 attributes #1 = { nounwind optnone noinline "amdgpu-flat-work-group-size"="64,64" }