1; RUN: opt -S -mtriple=amdgcn-unknown-amdhsa -amdgpu-promote-alloca %s | FileCheck -check-prefix=OPT %s
2
3declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #0
4declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #0
5
6; OPT-LABEL: @use_lifetime_promotable_lds(
7; OPT-NOT: alloca i32
8; OPT-NOT: llvm.lifetime
9; OPT: store i32 %tmp3, i32 addrspace(3)*
10define amdgpu_kernel void @use_lifetime_promotable_lds(i32 addrspace(1)* %arg) #2 {
11bb:
12  %tmp = alloca i32, align 4
13  %tmp1 = bitcast i32* %tmp to i8*
14  call void @llvm.lifetime.start.p0i8(i64 4, i8* %tmp1)
15  %tmp2 = getelementptr inbounds i32, i32 addrspace(1)* %arg, i64 1
16  %tmp3 = load i32, i32 addrspace(1)* %tmp2
17  store i32 %tmp3, i32* %tmp
18  call void @llvm.lifetime.end.p0i8(i64 4, i8* %tmp1)
19  ret void
20}
21
22attributes #0 = { argmemonly nounwind }
23attributes #1 = { nounwind readnone }
24attributes #2 = { nounwind }
25