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

Fabian Ritter via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 11 05:46:04 PST 2025


================
@@ -1147,27 +1103,29 @@ void WaitcntBrackets::print(raw_ostream &OS) const {
       // Print vgpr scores.
       unsigned LB = getScoreLB(T);
 
-      for (int J = 0; J <= VgprUB; J++) {
-        unsigned RegScore = getRegScore(J, T);
+      for (auto &[ID, Info] : VMem) {
+        unsigned RegScore = Info.Scores[T];
         if (RegScore <= LB)
           continue;
         unsigned RelScore = RegScore - LB - 1;
-        if (J < FIRST_LDS_VGPR) {
-          OS << RelScore << ":v" << J << " ";
-        } else {
-          OS << RelScore << ":ds ";
+        if (ID < REGUNITS_END) {
+          OS << RelScore << ":vRU" << ID << " ";
+        } else if (ID >= LDSDMA_BEGIN && ID < LDSDMA_END) {
----------------
ritter-x2a wrote:

This could be an assert, right?

```suggestion
        } else {
          assert(ID >= LDSDMA_BEGIN && ID < LDSDMA_END);
```

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


More information about the llvm-commits mailing list