[llvm] [AMDGPU][Scheduler] Fix non-monotonic SlotIndex after schedule revert (PR #192039)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 14 09:15:56 PDT 2026
================
@@ -2210,6 +2213,18 @@ void GCNSchedStage::modifyRegionSchedule(unsigned RegionIdx,
if (NonDebugReordered)
DAG.LIS->handleMove(*MI, true);
} else {
+ // MI is already at the expected position. However, earlier splices in
+ // this loop may have changed neighboring slot indices, so this MI's
+ // slot index can become non-monotonic w.r.t. the physical MBB order.
+ // Only re-seat when monotonicity is actually violated to avoid
+ // unnecessary LiveInterval changes that could perturb scheduling.
+ if (!MI->isDebugInstr() && !MI->isBundled() &&
+ DAG.LIS->getSlotIndexes()->hasIndex(*MI)) {
----------------
michaelselehov wrote:
Dropped `hasIndex()` — all MIs in a scheduling region should have indices. Kept `isBundled()` because `LiveIntervals::handleMove` (`LiveIntervals.cpp:1565`) has `assert((!MI.isBundled() || MI.getOpcode() == TargetOpcode::BUNDLE))` — if bundled MIs ever reach this point in the future, this avoids a hard assert. Happy to drop it too if you'd rather not have the guard.
https://github.com/llvm/llvm-project/pull/192039
More information about the llvm-commits
mailing list