@@ -116,21 +116,20 @@ void GCNSchedStrategy::initialize(ScheduleDAGMI *DAG) {
116116 << " , SGPRExcessLimit = " << SGPRExcessLimit << " \n\n " );
117117}
118118
119- static bool canUsePressureDiffs (SUnit *SU) {
120- if (SU->isInstr ()) {
121- // Cannot use pressure diffs for subregister defs or with physregs, it's
122- // imprecise in both cases.
123- for (const auto &Op : SU->getInstr ()->operands ()) {
124- if (!Op.isReg () || Op.isImplicit ())
125- continue ;
126- if (Op.getReg ().isPhysical () ||
127- (Op.isDef () && Op.getSubReg () != AMDGPU::NoSubRegister))
128- return false ;
129- }
130- return true ;
131- }
119+ static bool canUsePressureDiffs (const SUnit &SU) {
120+ if (!SU.isInstr ())
121+ return false ;
132122
133- return false ;
123+ // Cannot use pressure diffs for subregister defs or with physregs, it's
124+ // imprecise in both cases.
125+ for (const auto &Op : SU.getInstr ()->operands ()) {
126+ if (!Op.isReg () || Op.isImplicit ())
127+ continue ;
128+ if (Op.getReg ().isPhysical () ||
129+ (Op.isDef () && Op.getSubReg () != AMDGPU::NoSubRegister))
130+ return false ;
131+ }
132+ return true ;
134133}
135134
136135static void getRegisterPressures (bool AtTop,
@@ -161,7 +160,7 @@ void GCNSchedStrategy::initCandidate(SchedCandidate &Cand, SUnit *SU,
161160 Pressure.clear ();
162161 MaxPressure.clear ();
163162
164- if (AtTop || !canUsePressureDiffs (SU)) {
163+ if (AtTop || !canUsePressureDiffs (* SU)) {
165164 getRegisterPressures (AtTop, RPTracker, SU, Pressure, MaxPressure);
166165 } else {
167166 // Reserve 4 slots.
@@ -185,15 +184,15 @@ void GCNSchedStrategy::initCandidate(SchedCandidate &Cand, SUnit *SU,
185184 CheckPressure[AMDGPU::RegisterPressureSets::SReg_32] ||
186185 Pressure[AMDGPU::RegisterPressureSets::VGPR_32] !=
187186 CheckPressure[AMDGPU::RegisterPressureSets::VGPR_32]) {
188- errs () << " Register Pressure is innaccurate when calculated through "
187+ errs () << " Register Pressure is inaccurate when calculated through "
189188 " PressureDiff\n " ;
190189 errs () << " SGPR got " << Pressure[AMDGPU::RegisterPressureSets::SReg_32]
191190 << " , expected "
192191 << CheckPressure[AMDGPU::RegisterPressureSets::SReg_32] << " \n " ;
193192 errs () << " VGPR got " << Pressure[AMDGPU::RegisterPressureSets::VGPR_32]
194193 << " , expected "
195194 << CheckPressure[AMDGPU::RegisterPressureSets::VGPR_32] << " \n " ;
196- report_fatal_error (" innaccurate register pressure calculation" );
195+ report_fatal_error (" inaccurate register pressure calculation" );
197196 }
198197#endif
199198 }
@@ -318,7 +317,7 @@ SUnit *GCNSchedStrategy::pickNodeBidirectional(bool &IsTopNode) {
318317 BotCand.Policy != BotPolicy) {
319318 BotCand.reset (CandPolicy ());
320319 pickNodeFromQueue (Bot, BotPolicy, DAG->getBotRPTracker (), BotCand,
321- /* IsBottomUp*/ true );
320+ /* IsBottomUp= */ true );
322321 assert (BotCand.Reason != NoCand && " failed to find the first candidate" );
323322 } else {
324323 LLVM_DEBUG (traceCandidate (BotCand));
@@ -327,7 +326,7 @@ SUnit *GCNSchedStrategy::pickNodeBidirectional(bool &IsTopNode) {
327326 SchedCandidate TCand;
328327 TCand.reset (CandPolicy ());
329328 pickNodeFromQueue (Bot, BotPolicy, DAG->getBotRPTracker (), TCand,
330- /* IsBottomUp*/ true );
329+ /* IsBottomUp= */ true );
331330 assert (TCand.SU == BotCand.SU &&
332331 " Last pick result should correspond to re-picking right now" );
333332 }
@@ -340,7 +339,7 @@ SUnit *GCNSchedStrategy::pickNodeBidirectional(bool &IsTopNode) {
340339 TopCand.Policy != TopPolicy) {
341340 TopCand.reset (CandPolicy ());
342341 pickNodeFromQueue (Top, TopPolicy, DAG->getTopRPTracker (), TopCand,
343- /* IsBottomUp*/ false );
342+ /* IsBottomUp= */ false );
344343 assert (TopCand.Reason != NoCand && " failed to find the first candidate" );
345344 } else {
346345 LLVM_DEBUG (traceCandidate (TopCand));
@@ -349,7 +348,7 @@ SUnit *GCNSchedStrategy::pickNodeBidirectional(bool &IsTopNode) {
349348 SchedCandidate TCand;
350349 TCand.reset (CandPolicy ());
351350 pickNodeFromQueue (Top, TopPolicy, DAG->getTopRPTracker (), TCand,
352- /* IsBottomUp*/ false );
351+ /* IsBottomUp= */ false );
353352 assert (TCand.SU == TopCand.SU &&
354353 " Last pick result should correspond to re-picking right now" );
355354 }
@@ -387,7 +386,7 @@ SUnit *GCNSchedStrategy::pickNode(bool &IsTopNode) {
387386 CandPolicy NoPolicy;
388387 TopCand.reset (NoPolicy);
389388 pickNodeFromQueue (Top, NoPolicy, DAG->getTopRPTracker (), TopCand,
390- /* IsBottomUp*/ false );
389+ /* IsBottomUp= */ false );
391390 assert (TopCand.Reason != NoCand && " failed to find a candidate" );
392391 SU = TopCand.SU ;
393392 }
@@ -398,7 +397,7 @@ SUnit *GCNSchedStrategy::pickNode(bool &IsTopNode) {
398397 CandPolicy NoPolicy;
399398 BotCand.reset (NoPolicy);
400399 pickNodeFromQueue (Bot, NoPolicy, DAG->getBotRPTracker (), BotCand,
401- /* IsBottomUp*/ true );
400+ /* IsBottomUp= */ true );
402401 assert (BotCand.Reason != NoCand && " failed to find a candidate" );
403402 SU = BotCand.SU ;
404403 }
0 commit comments