diff options
author | Pengcheng Wang <wangpengcheng.pp@bytedance.com> | 2024-11-08 11:45:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-08 11:45:36 +0800 |
commit | ee1608dd8e6d06d5aa6e62d7bbb6d60bae7bb5a5 (patch) | |
tree | 32a143ea170a2f0a939f44b18b76d7fd56301dea /llvm/lib/CodeGen/MachineScheduler.cpp | |
parent | 8440ced89f232f71ad28a91cd88965548b3095b0 (diff) | |
download | llvm-ee1608dd8e6d06d5aa6e62d7bbb6d60bae7bb5a5.zip llvm-ee1608dd8e6d06d5aa6e62d7bbb6d60bae7bb5a5.tar.gz llvm-ee1608dd8e6d06d5aa6e62d7bbb6d60bae7bb5a5.tar.bz2 |
[CodeGen][MISched] Set DumpDirection after initPolicy (#115112)
Previously we set the dump direction according to command line
options, but we may override the scheduling direction in `initPolicy`
and this results in mismatch between dump and actual policy.
Here we simply set the dump direction after initializing the policy.
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineScheduler.cpp | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp index 9b2862d..757f492 100644 --- a/llvm/lib/CodeGen/MachineScheduler.cpp +++ b/llvm/lib/CodeGen/MachineScheduler.cpp @@ -460,14 +460,6 @@ bool MachineScheduler::runOnMachineFunction(MachineFunction &mf) { // Instantiate the selected scheduler for this target, function, and // optimization level. std::unique_ptr<ScheduleDAGInstrs> Scheduler(createMachineScheduler()); - ScheduleDAGMI::DumpDirection D; - if (ForceTopDown) - D = ScheduleDAGMI::DumpDirection::TopDown; - else if (ForceBottomUp) - D = ScheduleDAGMI::DumpDirection::BottomUp; - else - D = ScheduleDAGMI::DumpDirection::Bidirectional; - Scheduler->setDumpDirection(D); scheduleRegions(*Scheduler, false); LLVM_DEBUG(LIS->dump()); @@ -501,14 +493,6 @@ bool PostMachineScheduler::runOnMachineFunction(MachineFunction &mf) { // Instantiate the selected scheduler for this target, function, and // optimization level. std::unique_ptr<ScheduleDAGInstrs> Scheduler(createPostMachineScheduler()); - ScheduleDAGMI::DumpDirection D; - if (PostRADirection == MISchedPostRASched::TopDown) - D = ScheduleDAGMI::DumpDirection::TopDown; - else if (PostRADirection == MISchedPostRASched::BottomUp) - D = ScheduleDAGMI::DumpDirection::BottomUp; - else - D = ScheduleDAGMI::DumpDirection::Bidirectional; - Scheduler->setDumpDirection(D); scheduleRegions(*Scheduler, true); if (VerifyScheduling) @@ -796,6 +780,16 @@ void ScheduleDAGMI::enterRegion(MachineBasicBlock *bb, ScheduleDAGInstrs::enterRegion(bb, begin, end, regioninstrs); SchedImpl->initPolicy(begin, end, regioninstrs); + + // Set dump direction after initializing sched policy. + ScheduleDAGMI::DumpDirection D; + if (SchedImpl->getPolicy().OnlyTopDown) + D = ScheduleDAGMI::DumpDirection::TopDown; + else if (SchedImpl->getPolicy().OnlyBottomUp) + D = ScheduleDAGMI::DumpDirection::BottomUp; + else + D = ScheduleDAGMI::DumpDirection::Bidirectional; + setDumpDirection(D); } /// This is normally called from the main scheduler loop but may also be invoked |