[llvm] [AMDGPU] Iterative scheduling must behave the same with/without debug (PR #178460)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 28 09:02:53 PST 2026
================
@@ -381,10 +381,14 @@ void GCNIterativeScheduler::scheduleRegion(Region &R, Range &&Schedule,
auto Top = R.Begin;
for (const auto &I : Schedule) {
auto MI = getMachineInstr(I);
- if (MI != &*Top) {
+
+ MachineBasicBlock::iterator MII = MI->getIterator();
+ if (MII != Top) {
+ bool NonDebugReordered =
+ !MI->isDebugInstr() && skipDebugInstructionsForward(Top, MII) != MII;
BB->remove(MI);
BB->insert(Top, MI);
- if (!MI->isDebugInstr())
+ if (NonDebugReordered)
----------------
LU-JOHN wrote:
> Why does this need to be explicitly checking for debug instructions? Just do skipDebugInstructionsForward and then check if the position changed?
`skipDebugInstructionsForward()!=MII` alone does not guarantee that LiveIntervals needs to be updated. We can have MI is a debug instruction and `skipDebugInstructionsForward()!=MII`, but moving MI will not change the order of non-debug instructions.
https://github.com/llvm/llvm-project/pull/178460
More information about the llvm-commits
mailing list