@@ -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 )
@@ -229,9 +226,8 @@ GCNHazardRecognizer::getHazardType(SUnit *SU, int Stalls) {
229226 if (SIInstrInfo::isMAI (*MI) && checkMAIHazards (MI) > 0 )
230227 return HazardType;
231228
232- if ((SIInstrInfo::isVMEM (*MI) ||
233- SIInstrInfo::isFLAT (*MI) ||
234- SIInstrInfo::isDS (*MI)) && checkMAILdStHazards (MI) > 0 )
229+ if ((SIInstrInfo::isVMEM (*MI) || SIInstrInfo::isDS (*MI)) &&
230+ checkMAILdStHazards (MI) > 0 )
235231 return HazardType;
236232
237233 if (MI->isInlineAsm () && checkInlineAsmHazards (MI) > 0 )
@@ -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 ())
@@ -369,9 +365,7 @@ unsigned GCNHazardRecognizer::PreEmitNoopsCommon(MachineInstr *MI) {
369365 if (SIInstrInfo::isMAI (*MI))
370366 return std::max (WaitStates, checkMAIHazards (MI));
371367
372- if (SIInstrInfo::isVMEM (*MI) ||
373- SIInstrInfo::isFLAT (*MI) ||
374- SIInstrInfo::isDS (*MI))
368+ if (SIInstrInfo::isVMEM (*MI) || SIInstrInfo::isDS (*MI))
375369 return std::max (WaitStates, checkMAILdStHazards (MI));
376370
377371 if (ST.hasGFX950Insts () && isPermlane (*MI))
@@ -598,7 +592,7 @@ static bool breaksSMEMSoftClause(MachineInstr *MI) {
598592}
599593
600594static bool breaksVMEMSoftClause (MachineInstr *MI) {
601- return !SIInstrInfo::isVMEM (*MI) && ! SIInstrInfo::isFLAT (*MI) ;
595+ return !SIInstrInfo::isVMEM (*MI);
602596}
603597
604598int GCNHazardRecognizer::checkSoftClauseHazards (MachineInstr *MEM) {
@@ -1250,8 +1244,7 @@ bool GCNHazardRecognizer::fixVMEMtoScalarWriteHazards(MachineInstr *MI) {
12501244 const SIRegisterInfo *TRI = ST.getRegisterInfo ();
12511245
12521246 auto IsHazardFn = [TRI, MI](const MachineInstr &I) {
1253- if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isDS (I) &&
1254- !SIInstrInfo::isFLAT (I))
1247+ if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isDS (I))
12551248 return false ;
12561249
12571250 for (const MachineOperand &Def : MI->defs ()) {
@@ -1425,8 +1418,8 @@ static bool shouldRunLdsBranchVmemWARHazardFixup(const MachineFunction &MF,
14251418 for (auto &MBB : MF) {
14261419 for (auto &MI : MBB) {
14271420 HasLds |= SIInstrInfo::isDS (MI);
1428- HasVmem |=
1429- SIInstrInfo::isVMEM (MI) || SIInstrInfo::isSegmentSpecificFLAT (MI);
1421+ HasVmem |= ( SIInstrInfo::isVMEM (MI) && ! SIInstrInfo::isFLAT (MI)) ||
1422+ SIInstrInfo::isSegmentSpecificFLAT (MI);
14301423 if (HasLds && HasVmem)
14311424 return true ;
14321425 }
@@ -1450,7 +1443,8 @@ bool GCNHazardRecognizer::fixLdsBranchVmemWARHazard(MachineInstr *MI) {
14501443 auto IsHazardInst = [](const MachineInstr &MI) {
14511444 if (SIInstrInfo::isDS (MI))
14521445 return 1 ;
1453- if (SIInstrInfo::isVMEM (MI) || SIInstrInfo::isSegmentSpecificFLAT (MI))
1446+ if ((SIInstrInfo::isVMEM (MI) && !SIInstrInfo::isFLAT (MI)) ||
1447+ SIInstrInfo::isSegmentSpecificFLAT (MI))
14541448 return 2 ;
14551449 return 0 ;
14561450 };
@@ -1517,8 +1511,8 @@ bool GCNHazardRecognizer::fixLdsDirectVALUHazard(MachineInstr *MI) {
15171511 if (WaitStates >= NoHazardWaitStates)
15181512 return true ;
15191513 // Instructions which cause va_vdst==0 expire hazard
1520- return SIInstrInfo::isVMEM (I) || SIInstrInfo::isFLAT (I) ||
1521- SIInstrInfo::isDS (I) || SIInstrInfo:: isEXP (I);
1514+ return SIInstrInfo::isVMEM (I) || SIInstrInfo::isDS (I) ||
1515+ SIInstrInfo::isEXP (I);
15221516 };
15231517 auto GetWaitStatesFn = [](const MachineInstr &MI) {
15241518 return SIInstrInfo::isVALU (MI) ? 1 : 0 ;
@@ -1549,8 +1543,7 @@ bool GCNHazardRecognizer::fixLdsDirectVMEMHazard(MachineInstr *MI) {
15491543 const Register VDSTReg = VDST->getReg ();
15501544
15511545 auto IsHazardFn = [this , VDSTReg](const MachineInstr &I) {
1552- if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isFLAT (I) &&
1553- !SIInstrInfo::isDS (I))
1546+ if (!SIInstrInfo::isVMEM (I) && !SIInstrInfo::isDS (I))
15541547 return false ;
15551548 return I.readsRegister (VDSTReg, &TRI) || I.modifiesRegister (VDSTReg, &TRI);
15561549 };
@@ -1635,8 +1628,8 @@ bool GCNHazardRecognizer::fixVALUPartialForwardingHazard(MachineInstr *MI) {
16351628 return HazardExpired;
16361629
16371630 // Instructions which cause va_vdst==0 expire hazard
1638- if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isFLAT (I) ||
1639- SIInstrInfo::isDS (I) || SIInstrInfo:: isEXP (I) ||
1631+ if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isDS (I) ||
1632+ SIInstrInfo::isEXP (I) ||
16401633 (I.getOpcode () == AMDGPU::S_WAITCNT_DEPCTR &&
16411634 AMDGPU::DepCtr::decodeFieldVaVdst (I.getOperand (0 ).getImm ()) == 0 ))
16421635 return HazardExpired;
@@ -1772,8 +1765,8 @@ bool GCNHazardRecognizer::fixVALUTransUseHazard(MachineInstr *MI) {
17721765 return HazardExpired;
17731766
17741767 // Instructions which cause va_vdst==0 expire hazard
1775- if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isFLAT (I) ||
1776- SIInstrInfo::isDS (I) || SIInstrInfo:: isEXP (I) ||
1768+ if (SIInstrInfo::isVMEM (I) || SIInstrInfo::isDS (I) ||
1769+ SIInstrInfo::isEXP (I) ||
17771770 (I.getOpcode () == AMDGPU::S_WAITCNT_DEPCTR &&
17781771 I.getOperand (0 ).getImm () == 0x0fff ))
17791772 return HazardExpired;
@@ -2003,7 +1996,7 @@ int GCNHazardRecognizer::checkFPAtomicToDenormModeHazard(MachineInstr *MI) {
20031996 return 0 ;
20041997
20051998 auto IsHazardFn = [](const MachineInstr &I) {
2006- if (!SIInstrInfo::isVMEM (I) && ! SIInstrInfo::isFLAT (I) )
1999+ if (!SIInstrInfo::isVMEM (I))
20072000 return false ;
20082001 return SIInstrInfo::isFPAtomic (I);
20092002 };
@@ -2625,9 +2618,7 @@ int GCNHazardRecognizer::checkMAIVALUHazards(MachineInstr *MI) {
26252618
26262619 int WaitStatesNeeded = 0 ;
26272620
2628- bool IsMem = SIInstrInfo::isVMEM (*MI) ||
2629- SIInstrInfo::isFLAT (*MI) ||
2630- SIInstrInfo::isDS (*MI);
2621+ bool IsMem = SIInstrInfo::isVMEM (*MI) || SIInstrInfo::isDS (*MI);
26312622 bool IsMemOrExport = IsMem || SIInstrInfo::isEXP (*MI);
26322623 bool IsVALU = SIInstrInfo::isVALU (*MI);
26332624
0 commit comments