Skip to content

Commit e3e274f

Browse files
committed
[AMDGPU] Fix missing S_WAIT_XCNT with multiple pending VMEMs
1 parent fb6364c commit e3e274f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ void WaitcntBrackets::applyXcnt(const AMDGPU::Waitcnt &Wait) {
13101310
!hasPendingEvent(STORE_CNT)) {
13111311
if (!hasMixedPendingEvents(X_CNT))
13121312
applyWaitcnt(X_CNT, std::min(Wait.XCnt, Wait.LoadCnt));
1313-
else
1313+
else if (Wait.LoadCnt == 0)
13141314
PendingEvents &= ~(1 << VMEM_GROUP);
13151315
return;
13161316
}

llvm/test/CodeGen/AMDGPU/wait-xcnt.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,6 @@ body: |
10691069
$sgpr0 = S_MOV_B32 $sgpr0
10701070
...
10711071

1072-
# FIXME: Missing S_WAIT_XCNT before overwriting vgpr0.
10731072
---
10741073
name: mixed_pending_events
10751074
tracksRegLiveness: true
@@ -1098,6 +1097,7 @@ body: |
10981097
; GCN-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr2, implicit $exec
10991098
; GCN-NEXT: S_WAIT_KMCNT 0
11001099
; GCN-NEXT: $sgpr2 = S_MOV_B32 $sgpr2
1100+
; GCN-NEXT: S_WAIT_XCNT 0
11011101
; GCN-NEXT: $vgpr0 = V_MOV_B32_e32 0, implicit $exec
11021102
bb.0:
11031103
liveins: $vgpr0_vgpr1, $sgpr0_sgpr1, $scc

0 commit comments

Comments
 (0)