[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");
----------------
jayfoad wrote:

Previously this assertion was trivially true because Idx could never exceed NumRegUnitSubSets.

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


More information about the llvm-commits mailing list