Skip to content

Commit 400bd8b

Browse files
[RISCV] Do not check UsePostRAScheduler in enablePostRAScheduler
On RISC-V, there are a few ways to control whether the PostMachineScheduler is enabled. If `-enable-post-misched` is passed or passed with a value of true, then the PostMachineScheduler is enabled. If it is passed with a value of false then the PostMachineScheduler is disabled. If the option is not passed at all, then `TargetSubtargetInfo::enablePostRAMachineScheduler` decides whether the pass should be enabled or not. `RISCVSubtarget::enablePostRAMachineScheduler` currently checks if the active scheduler model sets `PostRAScheduler`. If it is set to true by the scheduler model, then the pass is enabled. If it is not set to true by the scheduler model, then the value of `UsePostRAScheduler` subtarget feature is used. I argue that the RISC-V backend should not use `PostRAScheduler` field of the scheduler model to control whether the PostMachineScheduler is enabled for the following reasons: 1. No other targets use this value to control whether PostMachineScheduler is enabled. They only use it to check whether the legacy PostRASchedulerList scheduelr is enabled. 2. We can add the `UsePostRAScheduler` feature to the processor definition in RISCVProcessors.td to tie a processor to whether the pass should be enabled by default. This makes the feature and the sched model field redundant. 3. Since these options are redundant, we should prefer the feature, since we can set `+` and `-` on the feature, but the value of the scheduler cannot be controled on the command line. 4. Keeping both options allows us to set the feature and the scheduler model value to conflicting values. Although the scheduler model value will win out, it feels awkward to allow it. There are no upstream subtargets that use the scheduler model `PostRAScheduler` field. If this patch lands, all downstream subtargets should replace `PostRAScheduler` with the `UsePostRAScheduler` feature in RISCVProcessors.td to acheive the desired functionality.
1 parent 0bc710f commit 400bd8b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

llvm/lib/Target/RISCV/RISCVSubtarget.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ class RISCVSubtarget : public RISCVGenSubtargetInfo {
121121
}
122122
bool enableMachineScheduler() const override { return true; }
123123

124-
bool enablePostRAScheduler() const override {
125-
return getSchedModel().PostRAScheduler || UsePostRAScheduler;
126-
}
124+
bool enablePostRAScheduler() const override { return UsePostRAScheduler; }
127125

128126
Align getPrefFunctionAlignment() const {
129127
return Align(TuneInfo->PrefFunctionAlignment);

0 commit comments

Comments
 (0)