[llvm] [CodeGen] Fix stale LiveIntervals regmask tables after MachineBasicBl… (PR #209610)
Nathan Corbyn via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 4 02:51:05 PDT 2026
================
@@ -294,6 +294,48 @@ void LiveIntervals::computeRegMasks() {
}
}
+void LiveIntervals::reassignRegMaskSlots(MachineBasicBlock &Orig,
+ MachineBasicBlock &SplitBB) {
+ assert(&Orig != &SplitBB && "expected distinct blocks");
+ std::pair<unsigned, unsigned> &OrigRMB = RegMaskBlocks[Orig.getNumber()];
+ std::pair<unsigned, unsigned> &SplitRMB = RegMaskBlocks[SplitBB.getNumber()];
+
+ // splitAt moved the tail of Orig into SplitBB. RegMaskSlots is sorted, so the
+ // slots now belonging to SplitBB are those in Orig's slice at/after SplitBB's
+ // start index.
+ ArrayRef<SlotIndex> OrigSlots =
+ getRegMaskSlots().slice(OrigRMB.first, OrigRMB.second);
+ unsigned KeptCount = llvm::lower_bound(OrigSlots, getMBBStartIdx(&SplitBB)) -
+ OrigSlots.begin();
+ if (KeptCount == OrigRMB.second)
+ return; // No regmask slots moved into SplitBB.
+
+ SplitRMB.first = OrigRMB.first + KeptCount;
+ SplitRMB.second = OrigRMB.second - KeptCount;
+ OrigRMB.second = KeptCount;
+}
+
+void LiveIntervals::insertMBBInMapsImpl(
+ MachineBasicBlock *MBB, [[maybe_unused]] bool AssumeRegMaskEmpty) {
+#ifdef EXPENSIVE_CHECKS
+ // Outside of splitAt(), the block is recorded as having no regmask slots, so
+ // it must not contain any.
----------------
cofibrant wrote:
This can be dropped
https://github.com/llvm/llvm-project/pull/209610
More information about the llvm-commits
mailing list