[llvm] [CodeGen] Fix stale LiveIntervals regmask tables after MachineBasicBl… (PR #209610)

Nathan Corbyn via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 2 02:27:11 PDT 2026


================
@@ -281,11 +281,20 @@ class LiveIntervals {
     return Indexes->getMBBFromIndex(index);
   }
 
-  void insertMBBInMaps(MachineBasicBlock *MBB) {
-    Indexes->insertMBBInMaps(MBB);
-    assert(unsigned(MBB->getNumber()) == RegMaskBlocks.size() &&
-           "Blocks must be added in order.");
-    RegMaskBlocks.push_back(std::make_pair(RegMaskSlots.size(), 0));
+  /// Add \p MBB to the SlotIndexes and regmask maps. \p MBB is normally a
+  /// fresh, empty block and is recorded as having no regmask slots. A caller
+  /// that inserts a block already populated with regmask-bearing instructions
+  /// should call splitAt() instead (which also fixes up the regmask table), or
+  /// pass \p AssumeRegMaskEmpty = false and fix up the table itself.
+  void insertMBBInMaps(MachineBasicBlock *MBB, bool AssumeRegMaskEmpty = true);
----------------
cofibrant wrote:

I'll defer to Quinton, but I'd maintain `CalledBySplitAt` is a worse name than `AssumeRegMaskEmpty` even for the internal parameter 

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


More information about the llvm-commits mailing list