diff options
author | Lucas Ramirez <11032120+lucas-rami@users.noreply.github.com> | 2025-02-27 11:27:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-27 11:27:07 +0100 |
commit | 15e295d30aa356a0ab1d83e477375cf3ef314947 (patch) | |
tree | dbd27d998e7f6cb148fb06d1724b9054892ac239 /llvm/lib/CodeGen/MachineScheduler.cpp | |
parent | c0b5451129bba52e33cd7957d58af897a58d14c6 (diff) | |
download | llvm-15e295d30aa356a0ab1d83e477375cf3ef314947.zip llvm-15e295d30aa356a0ab1d83e477375cf3ef314947.tar.gz llvm-15e295d30aa356a0ab1d83e477375cf3ef314947.tar.bz2 |
[MachineScheduler][AMDGPU] Allow scheduling of single-MI regions (#128739)
The MI scheduler skips regions containing a single MI during scheduling.
This can prevent targets that perform multi-stage scheduling and move
MIs between regions during some stages to reason correctly about the
entire IR, since some MIs will not be assigned to a region at the
beginning.
This makes the machine scheduler no longer skip single-MI regions. Only
a few unit tests are affected (mainly those which check for the
scheduler's debug output).
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineScheduler.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp index bd7eeca..d67e4ef 100644 --- a/llvm/lib/CodeGen/MachineScheduler.cpp +++ b/llvm/lib/CodeGen/MachineScheduler.cpp @@ -779,8 +779,11 @@ void MachineSchedulerBase::scheduleRegions(ScheduleDAGInstrs &Scheduler, // it. Perhaps it still needs to be bundled. Scheduler.enterRegion(&*MBB, I, RegionEnd, NumRegionInstrs); - // Skip empty scheduling regions (0 or 1 schedulable instructions). - if (I == RegionEnd || I == std::prev(RegionEnd)) { + // Skip empty scheduling regions but include single-MI regions; we want + // those to be scheduled so that backends which move MIs across regions + // during scheduling can reason about and schedule those regions + // correctly. + if (I == RegionEnd) { // Close the current region. Bundle the terminator if needed. // This invalidates 'RegionEnd' and 'I'. Scheduler.exitRegion(); |