annotate llvm/test/CodeGen/AMDGPU/promote-alloca-array-allocation.ll @ 206:f17a3b42b08b

Added tag before-12 for changeset b7591485f4cd
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 07 Jun 2021 21:25:57 +0900
parents 1d019706d866
children 1f2b6ac9f198
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -amdgpu-promote-alloca < %s | FileCheck %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 ; Make sure this allocates the correct size if the alloca has a non-0
anatofuz
parents:
diff changeset
4 ; number of elements.
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 ; CHECK-LABEL: @array_alloca(
anatofuz
parents:
diff changeset
7 ; CHECK: %stack = alloca i32, i32 5, align 4
anatofuz
parents:
diff changeset
8 define amdgpu_kernel void @array_alloca(i32 addrspace(1)* nocapture %out, i32 addrspace(1)* nocapture %in) #0 {
anatofuz
parents:
diff changeset
9 entry:
anatofuz
parents:
diff changeset
10 %stack = alloca i32, i32 5, align 4
anatofuz
parents:
diff changeset
11 %ld0 = load i32, i32 addrspace(1)* %in, align 4
anatofuz
parents:
diff changeset
12 %arrayidx1 = getelementptr inbounds i32, i32* %stack, i32 %ld0
anatofuz
parents:
diff changeset
13 store i32 4, i32* %arrayidx1, align 4
anatofuz
parents:
diff changeset
14 %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %in, i32 1
anatofuz
parents:
diff changeset
15 %ld1 = load i32, i32 addrspace(1)* %arrayidx2, align 4
anatofuz
parents:
diff changeset
16 %arrayidx3 = getelementptr inbounds i32, i32* %stack, i32 %ld1
anatofuz
parents:
diff changeset
17 store i32 5, i32* %arrayidx3, align 4
anatofuz
parents:
diff changeset
18 %arrayidx10 = getelementptr inbounds i32, i32* %stack, i32 0
anatofuz
parents:
diff changeset
19 %ld2 = load i32, i32* %arrayidx10, align 4
anatofuz
parents:
diff changeset
20 store i32 %ld2, i32 addrspace(1)* %out, align 4
anatofuz
parents:
diff changeset
21 %arrayidx12 = getelementptr inbounds i32, i32* %stack, i32 1
anatofuz
parents:
diff changeset
22 %ld3 = load i32, i32* %arrayidx12
anatofuz
parents:
diff changeset
23 %arrayidx13 = getelementptr inbounds i32, i32 addrspace(1)* %out, i32 1
anatofuz
parents:
diff changeset
24 store i32 %ld3, i32 addrspace(1)* %arrayidx13
anatofuz
parents:
diff changeset
25 ret void
anatofuz
parents:
diff changeset
26 }
anatofuz
parents:
diff changeset
27
anatofuz
parents:
diff changeset
28 ; CHECK-LABEL: @array_alloca_dynamic(
anatofuz
parents:
diff changeset
29 ; CHECK: %stack = alloca i32, i32 %size, align 4
anatofuz
parents:
diff changeset
30 define amdgpu_kernel void @array_alloca_dynamic(i32 addrspace(1)* nocapture %out, i32 addrspace(1)* nocapture %in, i32 %size) #0 {
anatofuz
parents:
diff changeset
31 entry:
anatofuz
parents:
diff changeset
32 %stack = alloca i32, i32 %size, align 4
anatofuz
parents:
diff changeset
33 %ld0 = load i32, i32 addrspace(1)* %in, align 4
anatofuz
parents:
diff changeset
34 %arrayidx1 = getelementptr inbounds i32, i32* %stack, i32 %ld0
anatofuz
parents:
diff changeset
35 store i32 4, i32* %arrayidx1, align 4
anatofuz
parents:
diff changeset
36 %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %in, i32 1
anatofuz
parents:
diff changeset
37 %ld1 = load i32, i32 addrspace(1)* %arrayidx2, align 4
anatofuz
parents:
diff changeset
38 %arrayidx3 = getelementptr inbounds i32, i32* %stack, i32 %ld1
anatofuz
parents:
diff changeset
39 store i32 5, i32* %arrayidx3, align 4
anatofuz
parents:
diff changeset
40 %arrayidx10 = getelementptr inbounds i32, i32* %stack, i32 0
anatofuz
parents:
diff changeset
41 %ld2 = load i32, i32* %arrayidx10, align 4
anatofuz
parents:
diff changeset
42 store i32 %ld2, i32 addrspace(1)* %out, align 4
anatofuz
parents:
diff changeset
43 %arrayidx12 = getelementptr inbounds i32, i32* %stack, i32 1
anatofuz
parents:
diff changeset
44 %ld3 = load i32, i32* %arrayidx12
anatofuz
parents:
diff changeset
45 %arrayidx13 = getelementptr inbounds i32, i32 addrspace(1)* %out, i32 1
anatofuz
parents:
diff changeset
46 store i32 %ld3, i32 addrspace(1)* %arrayidx13
anatofuz
parents:
diff changeset
47 ret void
anatofuz
parents:
diff changeset
48 }
anatofuz
parents:
diff changeset
49
anatofuz
parents:
diff changeset
50 attributes #0 = { nounwind }