@@ -302,12 +302,8 @@ class WaitcntBrackets {
302302 }
303303
304304 unsigned getSgprScoresIdx (InstCounterType T) const {
305- if (T == SmemAccessCounter)
306- return 0 ;
307- if (T == X_CNT)
308- return 1 ;
309-
310- llvm_unreachable (" Invalid SMEM counter" );
305+ assert (isSmemCounter (T) && " Invalid SMEM counter" );
306+ return T == X_CNT ? 1 : 0 ;
311307 }
312308
313309 unsigned getScoreLB (InstCounterType T) const {
@@ -325,10 +321,8 @@ class WaitcntBrackets {
325321 }
326322
327323 unsigned getRegScore (int GprNo, InstCounterType T) const {
328- if (GprNo < NUM_ALL_VGPRS) {
324+ if (GprNo < NUM_ALL_VGPRS)
329325 return VgprScores[T][GprNo];
330- }
331- assert (isSmemCounter (T));
332326 return SgprScores[getSgprScoresIdx (T)][GprNo - NUM_ALL_VGPRS];
333327 }
334328
@@ -866,7 +860,6 @@ void WaitcntBrackets::setScoreByInterval(RegInterval Interval,
866860 VgprUB = std::max (VgprUB, RegNo);
867861 VgprScores[CntTy][RegNo] = Score;
868862 } else {
869- assert (isSmemCounter (CntTy));
870863 SgprUB = std::max (SgprUB, RegNo - NUM_ALL_VGPRS);
871864 SgprScores[getSgprScoresIdx (CntTy)][RegNo - NUM_ALL_VGPRS] = Score;
872865 }
@@ -1006,12 +999,8 @@ void WaitcntBrackets::updateByEvent(const SIInstrInfo *TII,
1006999 }
10071000 }
10081001 } else if (T == X_CNT) {
1009- for (const MachineOperand &Op : Inst.all_uses ()) {
1010- RegInterval Interval = getRegInterval (&Inst, MRI, TRI, Op);
1011- for (int RegNo = Interval.first ; RegNo < Interval.second ; ++RegNo) {
1012- setRegScore (RegNo, T, CurrScore);
1013- }
1014- }
1002+ for (const MachineOperand &Op : Inst.all_uses ())
1003+ setScoreByOperand (&Inst, TRI, MRI, Op, T, CurrScore);
10151004 } else /* LGKM_CNT || EXP_CNT || VS_CNT || NUM_INST_CNTS */ {
10161005 // Match the score to the destination registers.
10171006 //
0 commit comments