[llvm] [NFC][TableGen] Code cleanup in CodeGenRegister (PR #137994)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Fri May 2 05:09:41 PDT 2025


================
@@ -1915,23 +1897,22 @@ static void computeUberWeights(std::vector<UberRegSet> &UberSets,
     }
     if (Weight > MaxWeight)
       MaxWeight = Weight;
-    if (I->Weight != MaxWeight) {
-      LLVM_DEBUG(dbgs() << "UberSet " << I - UberSets.begin() << " Weight "
-                        << MaxWeight;
-                 for (auto &Unit
-                      : I->Regs) dbgs()
-                 << " " << Unit->getName();
-                 dbgs() << "\n");
+    if (S.Weight != MaxWeight) {
+      LLVM_DEBUG({
+        dbgs() << "UberSet " << &S - UberSets.begin() << " Weight "
+               << MaxWeight;
+        for (auto &Unit : S.Regs)
+          dbgs() << " " << Unit->getName();
+        dbgs() << '\n';
+      });
       // Update the set weight.
-      I->Weight = MaxWeight;
+      S.Weight = MaxWeight;
     }
 
     // Find singular determinants.
-    for (const auto R : I->Regs) {
-      if (R->getRegUnits().count() == 1 && R->getWeight(RegBank) == I->Weight) {
-        I->SingularDeterminants |= R->getRegUnits();
-      }
-    }
+    for (const auto R : S.Regs)
----------------
jurahul wrote:

I've moved the loop into an existing and a new helper to print and using explicit type there

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


More information about the llvm-commits mailing list