@@ -1368,7 +1368,7 @@ int GCNHazardRecognizer::checkMAILdStHazards(MachineInstr *MI) {
1368
1368
Register Reg = Op.getReg ();
1369
1369
1370
1370
const int AccVgprReadLdStWaitStates = 2 ;
1371
- const int VALUWriteAccVgprReadLdStDepVALUWaitStates = 1 ;
1371
+ const int VALUWriteAccVgprRdWrLdStDepVALUWaitStates = 1 ;
1372
1372
const int MaxWaitStates = 2 ;
1373
1373
1374
1374
int WaitStatesNeededForUse = AccVgprReadLdStWaitStates -
@@ -1378,8 +1378,9 @@ int GCNHazardRecognizer::checkMAILdStHazards(MachineInstr *MI) {
1378
1378
if (WaitStatesNeeded == MaxWaitStates)
1379
1379
return WaitStatesNeeded; // Early exit.
1380
1380
1381
- auto IsVALUAccVgprReadCheckFn = [Reg, this ] (MachineInstr *MI) {
1382
- if (MI->getOpcode () != AMDGPU::V_ACCVGPR_READ_B32)
1381
+ auto IsVALUAccVgprRdWrCheckFn = [Reg, this ](MachineInstr *MI) {
1382
+ if (MI->getOpcode () != AMDGPU::V_ACCVGPR_READ_B32 &&
1383
+ MI->getOpcode () != AMDGPU::V_ACCVGPR_WRITE_B32)
1383
1384
return false ;
1384
1385
auto IsVALUFn = [] (MachineInstr *MI) {
1385
1386
return SIInstrInfo::isVALU (*MI) && !SIInstrInfo::isMAI (*MI);
@@ -1388,8 +1389,8 @@ int GCNHazardRecognizer::checkMAILdStHazards(MachineInstr *MI) {
1388
1389
std::numeric_limits<int >::max ();
1389
1390
};
1390
1391
1391
- WaitStatesNeededForUse = VALUWriteAccVgprReadLdStDepVALUWaitStates -
1392
- getWaitStatesSince (IsVALUAccVgprReadCheckFn , MaxWaitStates);
1392
+ WaitStatesNeededForUse = VALUWriteAccVgprRdWrLdStDepVALUWaitStates -
1393
+ getWaitStatesSince (IsVALUAccVgprRdWrCheckFn , MaxWaitStates);
1393
1394
WaitStatesNeeded = std::max (WaitStatesNeeded, WaitStatesNeededForUse);
1394
1395
}
1395
1396
0 commit comments