Skip to content

Commit a7147f1

Browse files
committed
[MISched] Fix off-by-one error with -misched-cutoff=<n> flag
This flag instructs the scheduler to stop scheduling after N instructions, but it currently schedules N+1 instructions, e.g. $ llc -misched-cutoff=10 -debug-only=machine-scheduler \ example.ll 2>&1 | grep "^Scheduling SU" | wc -l 11
1 parent 4cde945 commit a7147f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/CodeGen/MachineScheduler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ void ScheduleDAGMI::moveInstruction(
965965

966966
bool ScheduleDAGMI::checkSchedLimit() {
967967
#if LLVM_ENABLE_ABI_BREAKING_CHECKS && !defined(NDEBUG)
968-
if (NumInstrsScheduled == MISchedCutoff && MISchedCutoff != ~0U) {
968+
if ((NumInstrsScheduled + 1) == MISchedCutoff && MISchedCutoff != ~0U) {
969969
CurrentTop = CurrentBottom;
970970
return false;
971971
}

0 commit comments

Comments
 (0)