[llvm] feabb30 - [MISched] Apply debug filters before starting a block (#222270)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 20:52:19 PDT 2026
Author: Pengcheng Wang
Date: 2026-09-10T11:52:15+08:00
New Revision: feabb30f0feef2361ac301618ff56566289919e7
URL: https://github.com/llvm/llvm-project/commit/feabb30f0feef2361ac301618ff56566289919e7
DIFF: https://github.com/llvm/llvm-project/commit/feabb30f0feef2361ac301618ff56566289919e7.diff
LOG: [MISched] Apply debug filters before starting a block (#222270)
Apply the `misched-only-func` and `misched-only-block` filters before
calling `startBlock`. This avoids entering a target scheduling strategy
for a filtered block without a matching `finishBlock`/`leaveMBB` call.
Add a SystemZ post-RA scheduler regression that checks a filtered block
does not contribute hazard-recognizer state.
Split from #221984 in response to review.
Added:
llvm/test/CodeGen/SystemZ/postra-sched-filter.mir
Modified:
llvm/lib/CodeGen/MachineScheduler.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index 960c75d8050b1..8d0130973b81b 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -815,9 +815,6 @@ void MachineSchedulerBase::scheduleRegions(ScheduleDAGInstrs &Scheduler,
// loop tree. Then we can optionally compute global RegPressure.
for (MachineFunction::iterator MBB = MF->begin(), MBBEnd = MF->end();
MBB != MBBEnd; ++MBB) {
-
- Scheduler.startBlock(&*MBB);
-
#ifndef NDEBUG
if (SchedOnlyFunc.getNumOccurrences() && SchedOnlyFunc != MF->getName())
continue;
@@ -826,6 +823,8 @@ void MachineSchedulerBase::scheduleRegions(ScheduleDAGInstrs &Scheduler,
continue;
#endif
+ Scheduler.startBlock(&*MBB);
+
// Break the block into scheduling regions [I, RegionEnd). RegionEnd
// points to the scheduling boundary at the bottom of the region. The DAG
// does not include RegionEnd, but the region does (i.e. the next
diff --git a/llvm/test/CodeGen/SystemZ/postra-sched-filter.mir b/llvm/test/CodeGen/SystemZ/postra-sched-filter.mir
new file mode 100644
index 0000000000000..01e0dadde5465
--- /dev/null
+++ b/llvm/test/CodeGen/SystemZ/postra-sched-filter.mir
@@ -0,0 +1,21 @@
+# REQUIRES: asserts
+# RUN: llc -mtriple=s390x-linux-gnu -mcpu=z13 -run-pass=postmisched \
+# RUN: -misched-only-block=1 -debug-only=machine-scheduler -o /dev/null %s \
+# RUN: 2>&1 | FileCheck %s
+
+# CHECK-NOT: ** Entering %bb.0
+# CHECK: ** Entering %bb.1:
+
+---
+name: test
+tracksRegLiveness: true
+body: |
+ bb.0:
+ successors: %bb.1(0x80000000)
+
+ J %bb.1
+
+ bb.1:
+ $r2l = LHI 0
+ Return implicit killed $r2l
+...
More information about the llvm-commits
mailing list