[llvm] [TableGen] Fix regunit superset calculation (PR #81850)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 15 04:32:51 PST 2024


================
@@ -2015,15 +2015,14 @@ void CodeGenRegBank::computeRegUnitSets() {
 
   // Iterate over all unit sets, including new ones added by this loop.
   unsigned NumRegUnitSubSets = RegUnitSets.size();
-  for (unsigned Idx = 0, EndIdx = RegUnitSets.size(); Idx != EndIdx; ++Idx) {
+  for (unsigned Idx = 0; Idx != RegUnitSets.size(); ++Idx) {
     // In theory, this is combinatorial. In practice, it needs to be bounded
     // by a small number of sets for regpressure to be efficient.
     // If the assert is hit, we need to implement pruning.
-    assert(Idx < (2 * NumRegUnitSubSets) && "runaway unit set inference");
+    assert(Idx < (8 * NumRegUnitSubSets) && "runaway unit set inference");
 
     // Compare new sets with all original classes.
-    for (unsigned SearchIdx = (Idx >= NumRegUnitSubSets) ? 0 : Idx + 1;
----------------
jayfoad wrote:

Previously the Idx >= NumRegUnitSubSets test was trivially false.

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


More information about the llvm-commits mailing list