xref: /llvm-project/llvm/test/CodeGen/AMDGPU/merge-store-crash.ll (revision 9e9907f1cfa424366fba58d9520f9305b537cec9)
1; RUN: llc -mtriple=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck %s
2; RUN: llc -mtriple=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck %s
3
4; This is used to crash in LiveIntervalAnalysis via SILoadStoreOptimizer
5; while fixing up the merge of two ds_write instructions.
6
7@tess_lds = external addrspace(3) global [8192 x i32]
8
9; CHECK-LABEL: {{^}}main:
10; CHECK-DAG: ds_write_b32
11; CHECK-DAG: ds_write_b32
12; CHECK-DAG: v_mov_b32_e32 v1, v0
13; CHECK: tbuffer_store_format_xyzw v[0:3],
14define amdgpu_vs void @main(i32 inreg %arg) {
15main_body:
16  %tmp = load float, ptr addrspace(3) undef, align 4
17  %tmp1 = load float, ptr addrspace(3) undef, align 4
18  store float %tmp, ptr addrspace(3) null, align 4
19  %tmp2 = bitcast float %tmp to i32
20  %tmp3 = add nuw nsw i32 0, 1
21  %tmp4 = zext i32 %tmp3 to i64
22  %tmp5 = getelementptr [8192 x i32], ptr addrspace(3) @tess_lds, i64 0, i64 %tmp4
23  store float %tmp1, ptr addrspace(3) %tmp5, align 4
24  %tmp7 = bitcast float %tmp1 to i32
25  %tmp8 = insertelement <4 x i32> undef, i32 %tmp2, i32 0
26  %tmp9 = insertelement <4 x i32> %tmp8, i32 %tmp7, i32 1
27  %tmp10 = insertelement <4 x i32> %tmp9, i32 undef, i32 2
28  %tmp11 = insertelement <4 x i32> %tmp10, i32 undef, i32 3
29  call void @llvm.amdgcn.struct.ptr.tbuffer.store.v4i32(<4 x i32> %tmp11, ptr addrspace(8) undef, i32 0, i32 0, i32 %arg, i32 78, i32 3) #2
30  ret void
31}
32
33declare void @llvm.amdgcn.struct.ptr.tbuffer.store.v4i32(<4 x i32>, ptr addrspace(8), i32, i32, i32, i32 immarg, i32 immarg) #0
34
35attributes #0 = { nounwind willreturn writeonly }
36