[DAGCombiner] Eliminate dead stores to stack.
[llvm-complete.git] / test / CodeGen / AMDGPU / promote-alloca-lifetime.ll
blobbd4571a9616bea693c94bb0fca0809ba0d8f8e5c
1 ; RUN: opt -S -mtriple=amdgcn-unknown-amdhsa -amdgpu-promote-alloca %s | FileCheck -check-prefix=OPT %s
3 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #0
4 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #0
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)*
10 define amdgpu_kernel void @use_lifetime_promotable_lds(i32 addrspace(1)* %arg) #2 {
11 bb:
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
22 attributes #0 = { argmemonly nounwind }
23 attributes #1 = { nounwind readnone }
24 attributes #2 = { nounwind }