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