Index: lib/Target/AMDGPU/SIMachineScheduler.cpp =================================================================== --- lib/Target/AMDGPU/SIMachineScheduler.cpp +++ lib/Target/AMDGPU/SIMachineScheduler.cpp @@ -1842,11 +1842,11 @@ for (SDep& PredDep : SU->Preds) { SUnit *Pred = PredDep.getSUnit(); + if (Pred->NodeNum >= DAGSize) + continue; if (SITII->isLowLatencyInstruction(*Pred->getInstr())) { IsLowLatencyUser = true; } - if (Pred->NodeNum >= DAGSize) - continue; unsigned PredPos = ScheduledSUnitsInv[Pred->NodeNum]; if (PredPos >= MinPos) MinPos = PredPos + 1; @@ -1877,7 +1877,8 @@ bool CopyForLowLat = false; for (SDep& SuccDep : SU->Succs) { SUnit *Succ = SuccDep.getSUnit(); - if (SITII->isLowLatencyInstruction(*Succ->getInstr())) { + if (Succ->NodeNum < DAGSize && + SITII->isLowLatencyInstruction(*Succ->getInstr())) { CopyForLowLat = true; } }