Index: lib/Target/AMDGPU/GCNSchedStrategy.cpp =================================================================== --- lib/Target/AMDGPU/GCNSchedStrategy.cpp +++ lib/Target/AMDGPU/GCNSchedStrategy.cpp @@ -422,9 +422,10 @@ unsigned SGPRs = 0; unsigned VGPRs = 0; - auto &MI = *begin()->getParent()->getFirstNonDebugInstr(); + auto I = begin(); + I = skipDebugInstructionsForward(I, I->getParent()->end()); const SIRegisterInfo *SRI = static_cast(TRI); - SlotIndex SI = LIS->getInstructionIndex(MI).getBaseIndex(); + SlotIndex SI = LIS->getInstructionIndex(*I).getBaseIndex(); assert (SI.isValid()); DEBUG(dbgs() << "Region live-ins:");