blob: f83eb56dc6edf4cb5e38d8c87f8265d32db5834d [file] [log] [blame]
Matt Arsenault0b783ef02016-01-22 19:47:54 +00001; RUN: llc -march=amdgcn -mattr=+promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
2
Mehdi Amini8c629ec2016-08-13 23:31:24 +00003declare {}* @llvm.invariant.start.p0i8(i64, i8* nocapture) #0
4declare void @llvm.invariant.end.p0i8({}*, i64, i8* nocapture) #0
Matt Arsenault0b783ef02016-01-22 19:47:54 +00005declare i8* @llvm.invariant.group.barrier(i8*) #1
6
7; GCN-LABEL: {{^}}use_invariant_promotable_lds:
8; GCN: buffer_load_dword
9; GCN: ds_write_b32
Matt Arsenault3dbeefa2017-03-21 21:39:51 +000010define amdgpu_kernel void @use_invariant_promotable_lds(i32 addrspace(1)* %arg) #2 {
Matt Arsenault0b783ef02016-01-22 19:47:54 +000011bb:
12 %tmp = alloca i32, align 4
13 %tmp1 = bitcast i32* %tmp to i8*
14 %tmp2 = getelementptr inbounds i32, i32 addrspace(1)* %arg, i64 1
15 %tmp3 = load i32, i32 addrspace(1)* %tmp2
16 store i32 %tmp3, i32* %tmp
Mehdi Amini8c629ec2016-08-13 23:31:24 +000017 %tmp4 = call {}* @llvm.invariant.start.p0i8(i64 4, i8* %tmp1) #0
18 call void @llvm.invariant.end.p0i8({}* %tmp4, i64 4, i8* %tmp1) #0
Matt Arsenault0b783ef02016-01-22 19:47:54 +000019 %tmp5 = call i8* @llvm.invariant.group.barrier(i8* %tmp1) #1
20 ret void
21}
22
23attributes #0 = { argmemonly nounwind }
24attributes #1 = { nounwind readnone }
25attributes #2 = { nounwind }