[llvm] [AMDGPU][SIInsertWaitCnts] Use RegUnits-based tracking (PR #162077)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 6 07:25:57 PDT 2025


================
@@ -616,32 +612,26 @@ class WaitcntBrackets {
     return getScoreUB(T) - getScoreLB(T);
   }
 
-  unsigned getRegScore(int GprNo, InstCounterType T) const {
-    if (GprNo < NUM_ALL_VGPRS)
-      return VgprScores[T][GprNo];
-
-    if (GprNo < NUM_ALL_ALLOCATABLE)
-      return SgprScores[getSgprScoresIdx(T)][GprNo - NUM_ALL_VGPRS];
+  unsigned getSGPRScore(MCRegUnit RU, InstCounterType T) const {
+    auto It = SGPRs.find(RU);
+    return (It != SGPRs.end()) ? It->second.Scores[getSgprScoresIdx(T)] : 0;
----------------
arsenm wrote:

```suggestion
    return It != SGPRs.end() ? It->second.Scores[getSgprScoresIdx(T)] : 0;
```

https://github.com/llvm/llvm-project/pull/162077


More information about the llvm-commits mailing list