[llvm] [RISCV][NFC] Simplify the creation of Scheduler (PR #142553)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 3 00:32:31 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-risc-v
Author: Pengcheng Wang (wangpc-pp)
<details>
<summary>Changes</summary>
If `createMachineScheduler`/`createPostMachineScheduler` return a
`nullptr`, then we will call `createSchedLive`/`createSchedPostRA`
anyway.
We can always create the Scheduler first and simplify the following
conditions.
---
Full diff: https://github.com/llvm/llvm-project/pull/142553.diff
1 Files Affected:
- (modified) llvm/lib/Target/RISCV/RISCVTargetMachine.cpp (+4-7)
``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
index 3e12f2afcdd9d..8a47453cedcd3 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
@@ -298,9 +298,8 @@ bool RISCVTargetMachine::isNoopAddrSpaceCast(unsigned SrcAS,
ScheduleDAGInstrs *
RISCVTargetMachine::createMachineScheduler(MachineSchedContext *C) const {
- ScheduleDAGMILive *DAG = nullptr;
+ ScheduleDAGMILive *DAG = createSchedLive(C);
if (EnableMISchedLoadStoreClustering) {
- DAG = createSchedLive(C);
DAG->addMutation(createLoadClusterDAGMutation(
DAG->TII, DAG->TRI, /*ReorderWhileClustering=*/true));
DAG->addMutation(createStoreClusterDAGMutation(
@@ -308,18 +307,16 @@ RISCVTargetMachine::createMachineScheduler(MachineSchedContext *C) const {
}
const RISCVSubtarget &ST = C->MF->getSubtarget<RISCVSubtarget>();
- if (!DisableVectorMaskMutation && ST.hasVInstructions()) {
- DAG = DAG ? DAG : createSchedLive(C);
+ if (!DisableVectorMaskMutation && ST.hasVInstructions())
DAG->addMutation(createRISCVVectorMaskDAGMutation(DAG->TRI));
- }
+
return DAG;
}
ScheduleDAGInstrs *
RISCVTargetMachine::createPostMachineScheduler(MachineSchedContext *C) const {
- ScheduleDAGMI *DAG = nullptr;
+ ScheduleDAGMI *DAG = createSchedPostRA(C);
if (EnablePostMISchedLoadStoreClustering) {
- DAG = createSchedPostRA(C);
DAG->addMutation(createLoadClusterDAGMutation(
DAG->TII, DAG->TRI, /*ReorderWhileClustering=*/true));
DAG->addMutation(createStoreClusterDAGMutation(
``````````
</details>
https://github.com/llvm/llvm-project/pull/142553
More information about the llvm-commits
mailing list