@@ -183,10 +183,7 @@ GCNHazardRecognizer::getHazardType(SUnit *SU, int Stalls) {
183183 if (ST.hasNoDataDepHazard ())
184184 return NoHazard;
185185
186- // FIXME: Should flat be considered vmem?
187- if ((SIInstrInfo::isVMEM (*MI) ||
188- SIInstrInfo::isFLAT (*MI))
189- && checkVMEMHazards (MI) > 0 )
186+ if (SIInstrInfo::isVMEM (*MI) && checkVMEMHazards (MI) > 0 )
190187 return HazardType;
191188
192189 if (SIInstrInfo::isVALU (*MI) && checkVALUHazards (MI) > 0 )
@@ -202,8 +199,8 @@ GCNHazardRecognizer::getHazardType(SUnit *SU, int Stalls) {
202199 return HazardType;
203200
204201 if ((SIInstrInfo::isVALU (*MI) || SIInstrInfo::isVMEM (*MI) ||
205- SIInstrInfo::isFLAT (*MI) || SIInstrInfo::isDS (*MI) ||
206- SIInstrInfo::isEXP (*MI)) && checkMAIVALUHazards (MI) > 0 )
202+ SIInstrInfo::isDS (*MI) || SIInstrInfo::isEXP (*MI)) &&
203+ checkMAIVALUHazards (MI) > 0 )
207204 return HazardType;
208205
209206 if (isSGetReg (MI->getOpcode ()) && checkGetRegHazards (MI) > 0 )
@@ -230,7 +227,6 @@ GCNHazardRecognizer::getHazardType(SUnit *SU, int Stalls) {
230227 return HazardType;
231228
232229 if ((SIInstrInfo::isVMEM (*MI) ||
233- SIInstrInfo::isFLAT (*MI) ||
234230 SIInstrInfo::isDS (*MI)) && checkMAILdStHazards (MI) > 0 )
235231 return HazardType;
236232
@@ -324,7 +320,7 @@ unsigned GCNHazardRecognizer::PreEmitNoopsCommon(MachineInstr *MI) {
324320 if (ST.hasNoDataDepHazard ())
325321 return WaitStates;
326322
327- if (SIInstrInfo::isVMEM (*MI) || SIInstrInfo::isFLAT (*MI) )
323+ if (SIInstrInfo::isVMEM (*MI))
328324 WaitStates = std::max (WaitStates, checkVMEMHazards (MI));
329325
330326 if (SIInstrInfo::isVALU (*MI))
@@ -340,8 +336,8 @@ unsigned GCNHazardRecognizer::PreEmitNoopsCommon(MachineInstr *MI) {
340336 WaitStates = std::max (WaitStates, checkRWLaneHazards (MI));
341337
342338 if ((SIInstrInfo::isVALU (*MI) || SIInstrInfo::isVMEM (*MI) ||
343- SIInstrInfo::isFLAT (*MI) || SIInstrInfo::isDS (*MI) ||
344- SIInstrInfo::isEXP (*MI)) && checkMAIVALUHazards (MI) > 0 )
339+ SIInstrInfo::isDS (*MI) || SIInstrInfo::isEXP (*MI)) &&
340+ checkMAIVALUHazards (MI) > 0 )
345341 WaitStates = std::max (WaitStates, checkMAIVALUHazards (MI));
346342
347343 if (MI->isInlineAsm ())
@@ -370,7 +366,6 @@ unsigned GCNHazardRecognizer::PreEmitNoopsCommon(MachineInstr *MI) {
370366 return std::max (WaitStates, checkMAIHazards (MI));
371367
372368 if (SIInstrInfo::isVMEM (*MI) ||
373- SIInstrInfo::isFLAT (*MI) ||
374369 SIInstrInfo::isDS (*MI))
375370 return std::max (WaitStates, checkMAILdStHazards (MI));
376371
@@ -598,7 +593,7 @@ static bool breaksSMEMSoftClause(MachineInstr *MI) {
598593}
599594
600595static bool breaksVMEMSoftClause (MachineInstr *MI) {
601- return !SIInstrInfo::isVMEM (*MI) && ! SIInstrInfo::isFLAT (*MI) ;
596+ return !SIInstrInfo::isVMEM (*MI);
602597}
603598
604599int GCNHazardRecognizer::checkSoftClauseHazards (MachineInstr *MEM) {
@@ -1250,8 +1245,7 @@ bool GCNHazardRecognizer::fixVMEMtoScalarWriteHazards(MachineInstr *MI) {
12501245 const SIRegisterInfo *TRI = ST.getRegisterInfo ();
12511246
12521247 auto IsHazardFn = [TRI, MI](const MachineInstr &I) {
1253- if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isDS (I) &&
1254- !SIInstrInfo::isFLAT (I))
1248+ if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isDS (I))
12551249 return false ;
12561250
12571251 for (const MachineOperand &Def : MI->defs ()) {
@@ -1424,9 +1418,8 @@ static bool shouldRunLdsBranchVmemWARHazardFixup(const MachineFunction &MF,
14241418 bool HasVmem = false ;
14251419 for (auto &MBB : MF) {
14261420 for (auto &MI : MBB) {
1427- HasLds |= SIInstrInfo::isDS (MI);
1428- HasVmem |=
1429- SIInstrInfo::isVMEM (MI) || SIInstrInfo::isSegmentSpecificFLAT (MI);
1421+ HasLds |= SIInstrInfo::isDS (MI) || SIInstrInfo::isLDSDMA (MI);
1422+ HasVmem |= SIInstrInfo::isVMEM (MI) && !SIInstrInfo::isLDSDMA (MI);
14301423 if (HasLds && HasVmem)
14311424 return true ;
14321425 }
@@ -1448,9 +1441,9 @@ bool GCNHazardRecognizer::fixLdsBranchVmemWARHazard(MachineInstr *MI) {
14481441 assert (!ST.hasExtendedWaitCounts ());
14491442
14501443 auto IsHazardInst = [](const MachineInstr &MI) {
1451- if (SIInstrInfo::isDS (MI))
1444+ if (SIInstrInfo::isDS (MI) || SIInstrInfo::isLDSDMA (MI) )
14521445 return 1 ;
1453- if (SIInstrInfo::isVMEM (MI) || SIInstrInfo::isSegmentSpecificFLAT (MI))
1446+ if (SIInstrInfo::isVMEM (MI) && ! SIInstrInfo::isLDSDMA (MI))
14541447 return 2 ;
14551448 return 0 ;
14561449 };
@@ -1517,8 +1510,8 @@ bool GCNHazardRecognizer::fixLdsDirectVALUHazard(MachineInstr *MI) {
15171510 if (WaitStates >= NoHazardWaitStates)
15181511 return true ;
15191512 // Instructions which cause va_vdst==0 expire hazard
1520- return SIInstrInfo::isVMEM (I) || SIInstrInfo::isFLAT (I) ||
1521- SIInstrInfo::isDS (I) || SIInstrInfo:: isEXP (I);
1513+ return SIInstrInfo::isVMEM (I) || SIInstrInfo::isDS (I) ||
1514+ SIInstrInfo::isEXP (I);
15221515 };
15231516 auto GetWaitStatesFn = [](const MachineInstr &MI) {
15241517 return SIInstrInfo::isVALU (MI) ? 1 : 0 ;
@@ -1549,8 +1542,7 @@ bool GCNHazardRecognizer::fixLdsDirectVMEMHazard(MachineInstr *MI) {
15491542 const Register VDSTReg = VDST->getReg ();
15501543
15511544 auto IsHazardFn = [this , VDSTReg](const MachineInstr &I) {
1552- if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isFLAT (I) &&
1553- !SIInstrInfo::isDS (I))
1545+ if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isDS (I))
15541546 return false ;
15551547 return I.readsRegister (VDSTReg, &TRI) || I.modifiesRegister (VDSTReg, &TRI);
15561548 };
@@ -1635,8 +1627,8 @@ bool GCNHazardRecognizer::fixVALUPartialForwardingHazard(MachineInstr *MI) {
16351627 return HazardExpired;
16361628
16371629 // Instructions which cause va_vdst==0 expire hazard
1638- if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isFLAT (I) ||
1639- SIInstrInfo::isDS (I) || SIInstrInfo:: isEXP (I) ||
1630+ if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isDS (I) ||
1631+ SIInstrInfo::isEXP (I) ||
16401632 (I.getOpcode () == AMDGPU::S_WAITCNT_DEPCTR &&
16411633 AMDGPU::DepCtr::decodeFieldVaVdst (I.getOperand (0 ).getImm ()) == 0 ))
16421634 return HazardExpired;
@@ -1772,8 +1764,8 @@ bool GCNHazardRecognizer::fixVALUTransUseHazard(MachineInstr *MI) {
17721764 return HazardExpired;
17731765
17741766 // Instructions which cause va_vdst==0 expire hazard
1775- if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isFLAT (I) ||
1776- SIInstrInfo::isDS (I) || SIInstrInfo:: isEXP (I) ||
1767+ if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isDS (I) ||
1768+ SIInstrInfo::isEXP (I) ||
17771769 (I.getOpcode () == AMDGPU::S_WAITCNT_DEPCTR &&
17781770 I.getOperand (0 ).getImm () == 0x0fff ))
17791771 return HazardExpired;
@@ -2003,7 +1995,7 @@ int GCNHazardRecognizer::checkFPAtomicToDenormModeHazard(MachineInstr *MI) {
20031995 return 0 ;
20041996
20051997 auto IsHazardFn = [](const MachineInstr &I) {
2006- if (!SIInstrInfo::isVMEM (I) && ! SIInstrInfo::isFLAT (I) )
1998+ if (!SIInstrInfo::isVMEM (I))
20071999 return false ;
20082000 return SIInstrInfo::isFPAtomic (I);
20092001 };
@@ -2626,7 +2618,6 @@ int GCNHazardRecognizer::checkMAIVALUHazards(MachineInstr *MI) {
26262618 int WaitStatesNeeded = 0 ;
26272619
26282620 bool IsMem = SIInstrInfo::isVMEM (*MI) ||
2629- SIInstrInfo::isFLAT (*MI) ||
26302621 SIInstrInfo::isDS (*MI);
26312622 bool IsMemOrExport = IsMem || SIInstrInfo::isEXP (*MI);
26322623 bool IsVALU = SIInstrInfo::isVALU (*MI);
0 commit comments