[llvm-branch-commits] [llvm] [RISCV] Schedule RVV instructions with compatible type first (PR #95924)

Min-Yih Hsu via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Dec 26 10:26:59 PST 2025


================
@@ -13,19 +13,35 @@
 #ifndef LLVM_LIB_TARGET_RISCV_RISCVMACHINESCHEDULER_H
 #define LLVM_LIB_TARGET_RISCV_RISCVMACHINESCHEDULER_H
 
+#include "RISCVSubtarget.h"
+#include "RISCVVSETVLIInfoAnalysis.h"
 #include "llvm/CodeGen/MachineScheduler.h"
 
 namespace llvm {
 
 /// A GenericScheduler implementation for RISCV pre RA scheduling.
 class RISCVPreRAMachineSchedStrategy : public GenericScheduler {
+private:
+  RISCV::RISCVVSETVLIInfoAnalysis VIA;
+  RISCV::VSETVLIInfo TopVType;
+  RISCV::VSETVLIInfo BottomVType;
+
+  RISCV::VSETVLIInfo getVSETVLIInfo(const MachineInstr *MI) const;
+  bool tryVType(RISCV::VSETVLIInfo TryVType, RISCV::VSETVLIInfo CandVtype,
+                SchedCandidate &TryCand, SchedCandidate &Cand,
+                CandReason Reason) const;
+
 public:
   RISCVPreRAMachineSchedStrategy(const MachineSchedContext *C)
----------------
mshockwave wrote:

could we also add a ctor variable to toggle this vtype-based heuristics, in addition to the command line flag (i.e. `EnableVTypeSchedHeuristic`) ? Some subtarget might want to enable this feature by default

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


More information about the llvm-branch-commits mailing list