diff options
| author | Cullen Rhodes <cullen.rhodes@arm.com> | 2025-05-06 11:12:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-06 11:12:23 +0100 |
| commit | 8ea5eacea263ed5c2c4b0950a4d1d6ef863444bc (patch) | |
| tree | a692fe512470a5f04dbd5f641c8f7809f9ba2fbb /llvm/lib/CodeGen/MachineScheduler.cpp | |
| parent | 4cc152c823ec0298b3962b5a09de6f74f5c1b16a (diff) | |
[MISched] Fix off-by-one error in debug output with -misched-cutoff=<n> flag (#137988)
This flag instructs the scheduler to stop scheduling after N
instructions, but
in the debug output it appears as if it's scheduling N+1 instructions,
e.g.
$ llc -misched-cutoff=10 -debug-only=machine-scheduler
example.ll 2>&1 | grep "^Scheduling SU" | wc -l
11
as it calls pickNode before calling checkSchedLimit.
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/MachineScheduler.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp index 0c3ffb1bbaa6..31acfef45cfe 100644 --- a/llvm/lib/CodeGen/MachineScheduler.cpp +++ b/llvm/lib/CodeGen/MachineScheduler.cpp @@ -1003,13 +1003,14 @@ void ScheduleDAGMI::schedule() { bool IsTopNode = false; while (true) { + if (!checkSchedLimit()) + break; + LLVM_DEBUG(dbgs() << "** ScheduleDAGMI::schedule picking next node\n"); SUnit *SU = SchedImpl->pickNode(IsTopNode); if (!SU) break; assert(!SU->isScheduled && "Node already scheduled"); - if (!checkSchedLimit()) - break; MachineInstr *MI = SU->getInstr(); if (IsTopNode) { @@ -1637,13 +1638,14 @@ void ScheduleDAGMILive::schedule() { bool IsTopNode = false; while (true) { + if (!checkSchedLimit()) + break; + LLVM_DEBUG(dbgs() << "** ScheduleDAGMILive::schedule picking next node\n"); SUnit *SU = SchedImpl->pickNode(IsTopNode); if (!SU) break; assert(!SU->isScheduled && "Node already scheduled"); - if (!checkSchedLimit()) - break; scheduleMI(SU, IsTopNode); |
