diff --git a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp --- a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp +++ b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp @@ -512,7 +512,8 @@ if (!MI) break; - if (IsSMRD != SIInstrInfo::isSMRD(*MI)) + if (IsSMRD ? !SIInstrInfo::isSMRD(*MI) + : (!SIInstrInfo::isVMEM(*MI) && !SIInstrInfo::isFLAT(*MI))) break; addClauseInst(*MI); diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.image.load.1d.d16.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.image.load.1d.d16.ll --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.image.load.1d.d16.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.image.load.1d.d16.ll @@ -29,8 +29,6 @@ ; GFX8-PACKED-NEXT: s_mov_b32 s5, s7 ; GFX8-PACKED-NEXT: s_mov_b32 s6, s8 ; GFX8-PACKED-NEXT: s_mov_b32 s7, s9 -; GFX8-PACKED-NEXT: s_nop 0 -; GFX8-PACKED-NEXT: s_nop 0 ; GFX8-PACKED-NEXT: image_load v0, v0, s[0:7] dmask:0x1 unorm d16 ; GFX8-PACKED-NEXT: s_waitcnt vmcnt(0) ; GFX8-PACKED-NEXT: ; return to shader part epilog @@ -92,8 +90,6 @@ ; GFX8-PACKED-NEXT: s_mov_b32 s5, s7 ; GFX8-PACKED-NEXT: s_mov_b32 s6, s8 ; GFX8-PACKED-NEXT: s_mov_b32 s7, s9 -; GFX8-PACKED-NEXT: s_nop 0 -; GFX8-PACKED-NEXT: s_nop 0 ; GFX8-PACKED-NEXT: image_load v0, v0, s[0:7] dmask:0x2 unorm d16 ; GFX8-PACKED-NEXT: s_waitcnt vmcnt(0) ; GFX8-PACKED-NEXT: ; return to shader part epilog @@ -155,8 +151,6 @@ ; GFX8-PACKED-NEXT: s_mov_b32 s5, s7 ; GFX8-PACKED-NEXT: s_mov_b32 s6, s8 ; GFX8-PACKED-NEXT: s_mov_b32 s7, s9 -; GFX8-PACKED-NEXT: s_nop 0 -; GFX8-PACKED-NEXT: s_nop 0 ; GFX8-PACKED-NEXT: image_load v0, v0, s[0:7] dmask:0x4 unorm d16 ; GFX8-PACKED-NEXT: s_waitcnt vmcnt(0) ; GFX8-PACKED-NEXT: ; return to shader part epilog @@ -218,8 +212,6 @@ ; GFX8-PACKED-NEXT: s_mov_b32 s5, s7 ; GFX8-PACKED-NEXT: s_mov_b32 s6, s8 ; GFX8-PACKED-NEXT: s_mov_b32 s7, s9 -; GFX8-PACKED-NEXT: s_nop 0 -; GFX8-PACKED-NEXT: s_nop 0 ; GFX8-PACKED-NEXT: image_load v0, v0, s[0:7] dmask:0x8 unorm d16 ; GFX8-PACKED-NEXT: s_waitcnt vmcnt(0) ; GFX8-PACKED-NEXT: ; return to shader part epilog @@ -284,8 +276,6 @@ ; GFX8-PACKED-NEXT: s_mov_b32 s5, s7 ; GFX8-PACKED-NEXT: s_mov_b32 s6, s8 ; GFX8-PACKED-NEXT: s_mov_b32 s7, s9 -; GFX8-PACKED-NEXT: s_nop 0 -; GFX8-PACKED-NEXT: s_nop 0 ; GFX8-PACKED-NEXT: image_load v0, v0, s[0:7] dmask:0x3 unorm d16 ; GFX8-PACKED-NEXT: s_waitcnt vmcnt(0) ; GFX8-PACKED-NEXT: ; return to shader part epilog @@ -350,8 +340,6 @@ ; GFX8-PACKED-NEXT: s_mov_b32 s5, s7 ; GFX8-PACKED-NEXT: s_mov_b32 s6, s8 ; GFX8-PACKED-NEXT: s_mov_b32 s7, s9 -; GFX8-PACKED-NEXT: s_nop 0 -; GFX8-PACKED-NEXT: s_nop 0 ; GFX8-PACKED-NEXT: image_load v0, v0, s[0:7] dmask:0x5 unorm d16 ; GFX8-PACKED-NEXT: s_waitcnt vmcnt(0) ; GFX8-PACKED-NEXT: ; return to shader part epilog @@ -416,8 +404,6 @@ ; GFX8-PACKED-NEXT: s_mov_b32 s5, s7 ; GFX8-PACKED-NEXT: s_mov_b32 s6, s8 ; GFX8-PACKED-NEXT: s_mov_b32 s7, s9 -; GFX8-PACKED-NEXT: s_nop 0 -; GFX8-PACKED-NEXT: s_nop 0 ; GFX8-PACKED-NEXT: image_load v0, v0, s[0:7] dmask:0x9 unorm d16 ; GFX8-PACKED-NEXT: s_waitcnt vmcnt(0) ; GFX8-PACKED-NEXT: ; return to shader part epilog @@ -482,8 +468,6 @@ ; GFX8-PACKED-NEXT: s_mov_b32 s5, s7 ; GFX8-PACKED-NEXT: s_mov_b32 s6, s8 ; GFX8-PACKED-NEXT: s_mov_b32 s7, s9 -; GFX8-PACKED-NEXT: s_nop 0 -; GFX8-PACKED-NEXT: s_nop 0 ; GFX8-PACKED-NEXT: image_load v0, v0, s[0:7] dmask:0x6 unorm d16 ; GFX8-PACKED-NEXT: s_waitcnt vmcnt(0) ; GFX8-PACKED-NEXT: ; return to shader part epilog @@ -558,8 +542,6 @@ ; GFX8-PACKED-NEXT: s_mov_b32 s5, s7 ; GFX8-PACKED-NEXT: s_mov_b32 s6, s8 ; GFX8-PACKED-NEXT: s_mov_b32 s7, s9 -; GFX8-PACKED-NEXT: s_nop 0 -; GFX8-PACKED-NEXT: s_nop 0 ; GFX8-PACKED-NEXT: image_load v[0:1], v0, s[0:7] dmask:0xf unorm d16 ; GFX8-PACKED-NEXT: s_waitcnt vmcnt(0) ; GFX8-PACKED-NEXT: ; return to shader part epilog @@ -622,8 +604,6 @@ ; GFX8-PACKED-NEXT: s_mov_b32 s5, s7 ; GFX8-PACKED-NEXT: s_mov_b32 s6, s8 ; GFX8-PACKED-NEXT: s_mov_b32 s7, s9 -; GFX8-PACKED-NEXT: s_nop 0 -; GFX8-PACKED-NEXT: s_nop 0 ; GFX8-PACKED-NEXT: image_load v[0:1], v0, s[0:7] dmask:0x1 unorm tfe d16 ; GFX8-PACKED-NEXT: s_waitcnt vmcnt(0) ; GFX8-PACKED-NEXT: v_mov_b32_e32 v0, v1 @@ -691,8 +671,6 @@ ; GFX8-PACKED-NEXT: s_mov_b32 s5, s7 ; GFX8-PACKED-NEXT: s_mov_b32 s6, s8 ; GFX8-PACKED-NEXT: s_mov_b32 s7, s9 -; GFX8-PACKED-NEXT: s_nop 0 -; GFX8-PACKED-NEXT: s_nop 0 ; GFX8-PACKED-NEXT: image_load v[0:1], v0, s[0:7] dmask:0x3 unorm tfe d16 ; GFX8-PACKED-NEXT: s_waitcnt vmcnt(0) ; GFX8-PACKED-NEXT: v_mov_b32_e32 v0, v1 @@ -768,8 +746,6 @@ ; GFX8-PACKED-NEXT: s_mov_b32 s5, s7 ; GFX8-PACKED-NEXT: s_mov_b32 s6, s8 ; GFX8-PACKED-NEXT: s_mov_b32 s7, s9 -; GFX8-PACKED-NEXT: s_nop 0 -; GFX8-PACKED-NEXT: s_nop 0 ; GFX8-PACKED-NEXT: image_load v[0:1], v0, s[0:7] dmask:0x10 unorm tfe d16 ; GFX8-PACKED-NEXT: s_waitcnt vmcnt(0) ; GFX8-PACKED-NEXT: v_mov_b32_e32 v0, v1 diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.image.store.2d.d16.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.image.store.2d.d16.ll --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.image.store.2d.d16.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.image.store.2d.d16.ll @@ -26,8 +26,6 @@ ; PACKED-NEXT: s_mov_b32 s5, s7 ; PACKED-NEXT: s_mov_b32 s6, s8 ; PACKED-NEXT: s_mov_b32 s7, s9 -; PACKED-NEXT: s_nop 0 -; PACKED-NEXT: s_nop 0 ; PACKED-NEXT: image_store v2, v[0:1], s[0:7] dmask:0x1 unorm ; PACKED-NEXT: s_endpgm call void @llvm.amdgcn.image.store.2d.f16.i32(half %data, i32 1, i32 %s, i32 %t, <8 x i32> %rsrc, i32 0, i32 0) @@ -59,8 +57,6 @@ ; PACKED-NEXT: s_mov_b32 s5, s7 ; PACKED-NEXT: s_mov_b32 s6, s8 ; PACKED-NEXT: s_mov_b32 s7, s9 -; PACKED-NEXT: s_nop 0 -; PACKED-NEXT: s_nop 0 ; PACKED-NEXT: image_store v2, v[0:1], s[0:7] dmask:0x3 unorm ; PACKED-NEXT: s_endpgm call void @llvm.amdgcn.image.store.2d.v2f16.i32(<2 x half> %in, i32 3, i32 %s, i32 %t, <8 x i32> %rsrc, i32 0, i32 0) @@ -102,8 +98,6 @@ ; PACKED-NEXT: s_mov_b32 s5, s7 ; PACKED-NEXT: s_mov_b32 s6, s8 ; PACKED-NEXT: s_mov_b32 s7, s9 -; PACKED-NEXT: s_nop 0 -; PACKED-NEXT: s_nop 0 ; PACKED-NEXT: image_store v[2:3], v[0:1], s[0:7] dmask:0xf unorm ; PACKED-NEXT: s_endpgm call void @llvm.amdgcn.image.store.2d.v4f16.i32(<4 x half> %in, i32 15, i32 %s, i32 %t, <8 x i32> %rsrc, i32 0, i32 0) diff --git a/llvm/test/CodeGen/AMDGPU/break-vmem-soft-clauses.mir b/llvm/test/CodeGen/AMDGPU/break-vmem-soft-clauses.mir --- a/llvm/test/CodeGen/AMDGPU/break-vmem-soft-clauses.mir +++ b/llvm/test/CodeGen/AMDGPU/break-vmem-soft-clauses.mir @@ -308,7 +308,6 @@ ; GCN-LABEL: name: valu_inst_breaks_clause ; GCN: $vgpr0 = FLAT_LOAD_DWORD $vgpr2_vgpr3, 0, 0, 0, 0, implicit $exec, implicit $flat_scr ; GCN-NEXT: $vgpr8 = V_MOV_B32_e32 0, implicit $exec - ; XNACK-NEXT: S_NOP 0 ; GCN-NEXT: $vgpr2 = FLAT_LOAD_DWORD $vgpr4_vgpr5, 0, 0, 0, 0, implicit $exec, implicit $flat_scr ; GCN-NEXT: S_ENDPGM 0 @@ -327,7 +326,6 @@ ; GCN-LABEL: name: salu_inst_breaks_clause ; GCN: $vgpr0 = FLAT_LOAD_DWORD $vgpr2_vgpr3, 0, 0, 0, 0, implicit $exec, implicit $flat_scr ; GCN-NEXT: $sgpr8 = S_MOV_B32 0 - ; XNACK-NEXT: S_NOP 0 ; GCN-NEXT: $vgpr2 = FLAT_LOAD_DWORD $vgpr4_vgpr5, 0, 0, 0, 0, implicit $exec, implicit $flat_scr ; GCN-NEXT: S_ENDPGM 0 @@ -345,7 +343,6 @@ ; GCN-LABEL: name: ds_inst_breaks_clause ; GCN: $vgpr0 = FLAT_LOAD_DWORD $vgpr2_vgpr3, 0, 0, 0, 0, implicit $exec, implicit $flat_scr ; GCN-NEXT: $vgpr8 = DS_READ_B32 $vgpr9, 0, 0, implicit $m0, implicit $exec - ; XNACK-NEXT: S_NOP 0 ; GCN-NEXT: $vgpr2 = FLAT_LOAD_DWORD $vgpr4_vgpr5, 0, 0, 0, 0, implicit $exec, implicit $flat_scr ; GCN-NEXT: S_ENDPGM 0 diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.image.sample.d16.dim.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.image.sample.d16.dim.ll --- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.image.sample.d16.dim.ll +++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.image.sample.d16.dim.ll @@ -19,7 +19,6 @@ ; GFX81-NEXT: s_mov_b64 s[12:13], exec ; GFX81-NEXT: s_wqm_b64 exec, exec ; GFX81-NEXT: s_and_b64 exec, exec, s[12:13] -; GFX81-NEXT: s_nop 0 ; GFX81-NEXT: image_sample v0, v[0:1], s[0:7], s[8:11] dmask:0x1 d16 ; GFX81-NEXT: s_waitcnt vmcnt(0) ; GFX81-NEXT: ; return to shader part epilog @@ -73,12 +72,9 @@ ; GFX81-NEXT: v_mov_b32_e32 v5, s13 ; GFX81-NEXT: v_mov_b32_e32 v3, v2 ; GFX81-NEXT: s_and_b64 exec, exec, s[14:15] -; GFX81-NEXT: s_nop 0 ; GFX81-NEXT: image_sample v[2:3], v[0:1], s[0:7], s[8:11] dmask:0x1 tfe d16 ; GFX81-NEXT: s_waitcnt vmcnt(0) ; GFX81-NEXT: v_mov_b32_e32 v0, v2 -; GFX81-NEXT: s_nop 0 -; GFX81-NEXT: s_nop 0 ; GFX81-NEXT: flat_store_dword v[4:5], v3 ; GFX81-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) ; GFX81-NEXT: ; return to shader part epilog @@ -173,8 +169,6 @@ ; GFX81: ; %bb.0: ; %main_body ; GFX81-NEXT: v_mov_b32_e32 v4, 0 ; GFX81-NEXT: v_mov_b32_e32 v5, v4 -; GFX81-NEXT: s_nop 0 -; GFX81-NEXT: s_nop 0 ; GFX81-NEXT: image_sample_c_d v[4:5], v[0:3], s[0:7], s[8:11] dmask:0x3 tfe d16 ; GFX81-NEXT: s_waitcnt vmcnt(0) ; GFX81-NEXT: v_mov_b32_e32 v0, v4 @@ -231,7 +225,6 @@ ; GFX81-NEXT: s_mov_b64 s[12:13], exec ; GFX81-NEXT: s_wqm_b64 exec, exec ; GFX81-NEXT: s_and_b64 exec, exec, s[12:13] -; GFX81-NEXT: s_nop 0 ; GFX81-NEXT: image_sample_b v[0:1], v[0:2], s[0:7], s[8:11] dmask:0xf d16 ; GFX81-NEXT: s_waitcnt vmcnt(0) ; GFX81-NEXT: ; return to shader part epilog @@ -288,7 +281,6 @@ ; GFX81-NEXT: v_mov_b32_e32 v4, v3 ; GFX81-NEXT: v_mov_b32_e32 v5, v3 ; GFX81-NEXT: s_and_b64 exec, exec, s[12:13] -; GFX81-NEXT: s_nop 0 ; GFX81-NEXT: image_sample_b v[3:5], v[0:2], s[0:7], s[8:11] dmask:0xf tfe d16 ; GFX81-NEXT: s_waitcnt vmcnt(0) ; GFX81-NEXT: v_mov_b32_e32 v0, v3 diff --git a/llvm/test/CodeGen/AMDGPU/memory_clause.ll b/llvm/test/CodeGen/AMDGPU/memory_clause.ll --- a/llvm/test/CodeGen/AMDGPU/memory_clause.ll +++ b/llvm/test/CodeGen/AMDGPU/memory_clause.ll @@ -8,16 +8,13 @@ ; GCN-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x2c ; GCN-NEXT: v_mov_b32_e32 v17, 0 ; GCN-NEXT: v_lshlrev_b32_e32 v16, 4, v0 -; GCN-NEXT: s_nop 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) -; GCN-NEXT: s_nop 0 ; GCN-NEXT: global_load_dwordx4 v[0:3], v[16:17], s[2:3] ; GCN-NEXT: global_load_dwordx4 v[4:7], v[16:17], s[2:3] offset:16 ; GCN-NEXT: global_load_dwordx4 v[8:11], v[16:17], s[2:3] offset:32 ; GCN-NEXT: global_load_dwordx4 v[12:15], v[16:17], s[2:3] offset:48 ; GCN-NEXT: s_nop 0 ; GCN-NEXT: s_waitcnt vmcnt(3) -; GCN-NEXT: s_nop 0 ; GCN-NEXT: global_store_dwordx4 v[16:17], v[0:3], s[4:5] ; GCN-NEXT: s_waitcnt vmcnt(3) ; GCN-NEXT: global_store_dwordx4 v[16:17], v[4:7], s[4:5] offset:16 @@ -74,8 +71,6 @@ ; GCN-NEXT: v_mov_b32_e32 v5, s5 ; GCN-NEXT: v_mov_b32_e32 v6, s6 ; GCN-NEXT: v_mov_b32_e32 v7, s7 -; GCN-NEXT: s_nop 0 -; GCN-NEXT: s_nop 0 ; GCN-NEXT: global_store_dwordx4 v[12:13], v[0:3], off ; GCN-NEXT: global_store_dwordx4 v[12:13], v[4:7], off offset:16 ; GCN-NEXT: v_mov_b32_e32 v0, s12 @@ -85,8 +80,6 @@ ; GCN-NEXT: v_mov_b32_e32 v1, s13 ; GCN-NEXT: v_mov_b32_e32 v2, s14 ; GCN-NEXT: v_mov_b32_e32 v3, s15 -; GCN-NEXT: s_nop 0 -; GCN-NEXT: s_nop 0 ; GCN-NEXT: global_store_dwordx4 v[12:13], v[8:11], off offset:32 ; GCN-NEXT: global_store_dwordx4 v[12:13], v[0:3], off offset:48 ; GCN-NEXT: s_endpgm @@ -116,8 +109,6 @@ ; GCN-NEXT: v_lshlrev_b32_e32 v2, 4, v2 ; GCN-NEXT: v_add_u32_e32 v0, v0, v2 ; GCN-NEXT: v_add_u32_e32 v1, v1, v2 -; GCN-NEXT: s_nop 0 -; GCN-NEXT: s_nop 0 ; GCN-NEXT: buffer_load_dword v6, v0, s[0:3], 0 offen offset:20 ; GCN-NEXT: buffer_load_dword v7, v0, s[0:3], 0 offen offset:24 ; GCN-NEXT: buffer_load_dword v8, v0, s[0:3], 0 offen offset:28 @@ -134,11 +125,9 @@ ; GCN-NEXT: buffer_load_dword v4, v0, s[0:3], 0 offen offset:8 ; GCN-NEXT: buffer_load_dword v5, v0, s[0:3], 0 offen offset:12 ; GCN-NEXT: s_nop 0 -; GCN-NEXT: s_nop 0 ; GCN-NEXT: buffer_load_dword v0, v0, s[0:3], 0 offen offset:16 ; GCN-NEXT: s_nop 0 ; GCN-NEXT: s_waitcnt vmcnt(4) -; GCN-NEXT: s_nop 0 ; GCN-NEXT: buffer_store_dword v2, v1, s[0:3], 0 offen ; GCN-NEXT: s_waitcnt vmcnt(4) ; GCN-NEXT: buffer_store_dword v3, v1, s[0:3], 0 offen offset:4 @@ -192,20 +181,15 @@ ; GCN-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x34 ; GCN-NEXT: v_mov_b32_e32 v1, 0 ; GCN-NEXT: v_lshlrev_b32_e32 v0, 3, v0 -; GCN-NEXT: s_nop 0 ; GCN-NEXT: s_waitcnt lgkmcnt(0) -; GCN-NEXT: s_nop 0 ; GCN-NEXT: global_load_dwordx2 v[8:9], v[0:1], s[2:3] ; GCN-NEXT: s_nop 0 ; GCN-NEXT: s_waitcnt vmcnt(0) -; GCN-NEXT: s_nop 0 ; GCN-NEXT: global_load_dwordx4 v[0:3], v[8:9], off ; GCN-NEXT: global_load_dwordx4 v[4:7], v[8:9], off offset:16 ; GCN-NEXT: v_mov_b32_e32 v9, s5 ; GCN-NEXT: v_mov_b32_e32 v8, s4 -; GCN-NEXT: s_nop 0 ; GCN-NEXT: s_waitcnt vmcnt(1) -; GCN-NEXT: s_nop 0 ; GCN-NEXT: global_store_dwordx4 v[8:9], v[0:3], off ; GCN-NEXT: s_waitcnt vmcnt(1) ; GCN-NEXT: global_store_dwordx4 v[8:9], v[4:7], off offset:16 @@ -230,15 +214,11 @@ ; GCN: ; %bb.0: ; %entry ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GCN-NEXT: v_mov_b32_e32 v5, v2 -; GCN-NEXT: s_nop 0 -; GCN-NEXT: s_nop 0 ; GCN-NEXT: global_load_short_d16_hi v5, v[0:1], off ; GCN-NEXT: s_nop 0 -; GCN-NEXT: s_nop 0 ; GCN-NEXT: global_load_short_d16_hi v2, v[0:1], off offset:64 ; GCN-NEXT: s_nop 0 ; GCN-NEXT: s_waitcnt vmcnt(1) -; GCN-NEXT: s_nop 0 ; GCN-NEXT: global_store_dword v[3:4], v5, off ; GCN-NEXT: s_waitcnt vmcnt(1) ; GCN-NEXT: global_store_dword v[3:4], v2, off offset:128 @@ -263,15 +243,11 @@ ; GCN: ; %bb.0: ; %entry ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; GCN-NEXT: v_mov_b32_e32 v5, v2 -; GCN-NEXT: s_nop 0 -; GCN-NEXT: s_nop 0 ; GCN-NEXT: global_load_short_d16 v5, v[0:1], off ; GCN-NEXT: s_nop 0 -; GCN-NEXT: s_nop 0 ; GCN-NEXT: global_load_short_d16 v2, v[0:1], off offset:64 ; GCN-NEXT: s_nop 0 ; GCN-NEXT: s_waitcnt vmcnt(1) -; GCN-NEXT: s_nop 0 ; GCN-NEXT: global_store_dword v[3:4], v5, off ; GCN-NEXT: s_waitcnt vmcnt(1) ; GCN-NEXT: global_store_dword v[3:4], v2, off offset:128