[llvm] [MISched] Add a hook to override PostRA scheduling policy (PR #115455)

Pengcheng Wang via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 10 23:45:07 PST 2024


================
@@ -3897,6 +3897,12 @@ void PostGenericScheduler::initialize(ScheduleDAGMI *Dag) {
 void PostGenericScheduler::initPolicy(MachineBasicBlock::iterator Begin,
                                       MachineBasicBlock::iterator End,
                                       unsigned NumRegionInstrs) {
+  const MachineFunction &MF = *Begin->getMF();
+
+  // Allow the subtarget to override default policy.
+  MF.getSubtarget().overridePostRASchedPolicy(RegionPolicy, NumRegionInstrs);
+
+  // After subtarget overrides, apply command line options.
   if (PostRADirection == MISchedPostRASched::TopDown) {
     RegionPolicy.OnlyTopDown = true;
     RegionPolicy.OnlyBottomUp = false;
----------------
wangpc-pp wrote:

Thanks! I didn't notice this mistake.
Done. I added a `getNumOccurrences()` check now, what do you think about current code?

https://github.com/llvm/llvm-project/pull/115455


More information about the llvm-commits mailing list