1; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -amdgpu-promote-alloca < %s | FileCheck %s
2
3; Do not promote an alloca with users of vector/aggregate type.
4
5; CHECK-LABEL: @test_insertelement(
6; CHECK:  %alloca = alloca i16
7; CHECK-NEXT:  insertelement <2 x i16*> undef, i16* %alloca, i32 0
8define amdgpu_kernel void @test_insertelement() #0 {
9entry:
10  %alloca = alloca i16, align 4
11  %in = insertelement <2 x i16*> undef, i16* %alloca, i32 0
12  store <2 x i16*> %in, <2 x i16*>* undef, align 4
13  ret void
14}
15
16; CHECK-LABEL: @test_insertvalue(
17; CHECK:  %alloca = alloca i16
18; CHECK-NEXT:  insertvalue { i16* } undef, i16* %alloca, 0
19define amdgpu_kernel void @test_insertvalue() #0 {
20entry:
21  %alloca = alloca i16, align 4
22  %in = insertvalue { i16* } undef, i16* %alloca, 0
23  store { i16* } %in, { i16* }* undef, align 4
24  ret void
25}
26
27; CHECK-LABEL: @test_insertvalue_array(
28; CHECK:  %alloca = alloca i16
29; CHECK-NEXT:  insertvalue [2 x i16*] undef, i16* %alloca, 0
30define amdgpu_kernel void @test_insertvalue_array() #0 {
31entry:
32  %alloca = alloca i16, align 4
33  %in = insertvalue [2 x i16*] undef, i16* %alloca, 0
34  store [2 x i16*] %in, [2 x i16*]* undef, align 4
35  ret void
36}
37
38attributes #0 = { nounwind }
39