| Matt Arsenault | 8b17567 | 2016-02-02 19:32:42 +0000 | [diff] [blame] | 1 | ; RUN: llc -O0 -march=amdgcn -mtriple=amdgcn-unknown-amdhsa -mattr=+promote-alloca < %s | FileCheck -check-prefix=NOOPTS -check-prefix=ALL %s |
| 2 | ; RUN: llc -O1 -march=amdgcn -mtriple=amdgcn-unknown-amdhsa -mattr=+promote-alloca < %s | FileCheck -check-prefix=OPTS -check-prefix=ALL %s |
| 3 | |
| 4 | ; ALL-LABEL: {{^}}promote_alloca_i32_array_array: |
| 5 | ; NOOPTS: workgroup_group_segment_byte_size = 0{{$}} |
| 6 | ; NOOPTS-NOT ds_write |
| 7 | ; OPTS: ds_write |
| 8 | define void @promote_alloca_i32_array_array(i32 addrspace(1)* %out, i32 %index) #0 { |
| 9 | entry: |
| 10 | %alloca = alloca [2 x [2 x i32]] |
| 11 | %gep0 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %alloca, i32 0, i32 0, i32 0 |
| 12 | %gep1 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %alloca, i32 0, i32 0, i32 1 |
| 13 | store i32 0, i32* %gep0 |
| 14 | store i32 1, i32* %gep1 |
| 15 | %gep2 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %alloca, i32 0, i32 0, i32 %index |
| 16 | %load = load i32, i32* %gep2 |
| 17 | store i32 %load, i32 addrspace(1)* %out |
| 18 | ret void |
| 19 | } |
| 20 | |
| 21 | ; ALL-LABEL: {{^}}optnone_promote_alloca_i32_array_array: |
| 22 | ; ALL: workgroup_group_segment_byte_size = 0{{$}} |
| 23 | ; ALL-NOT ds_write |
| 24 | define void @optnone_promote_alloca_i32_array_array(i32 addrspace(1)* %out, i32 %index) #1 { |
| 25 | entry: |
| 26 | %alloca = alloca [2 x [2 x i32]] |
| 27 | %gep0 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %alloca, i32 0, i32 0, i32 0 |
| 28 | %gep1 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %alloca, i32 0, i32 0, i32 1 |
| 29 | store i32 0, i32* %gep0 |
| 30 | store i32 1, i32* %gep1 |
| 31 | %gep2 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %alloca, i32 0, i32 0, i32 %index |
| 32 | %load = load i32, i32* %gep2 |
| 33 | store i32 %load, i32 addrspace(1)* %out |
| 34 | ret void |
| 35 | } |
| 36 | |
| 37 | attributes #0 = { nounwind } |
| 38 | attributes #1 = { nounwind optnone noinline } |