[llvm] [RISCV] Handle recurrences in RISCVVLOptimizer (PR #151285)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 11 11:17:04 PDT 2025


================
@@ -30,6 +40,27 @@ using namespace llvm;
 
 namespace {
 
+/// Wrapper around MachineOperand that defaults to immediate 0.
+struct DemandedVL {
+  MachineOperand VL;
+  DemandedVL() : VL(MachineOperand::CreateImm(0)) {}
+  DemandedVL(MachineOperand VL) : VL(VL) {}
+  static DemandedVL vlmax() {
+    return DemandedVL(MachineOperand::CreateImm(RISCV::VLMaxSentinel));
+  }
+  bool operator!=(const DemandedVL &Other) const {
+    return !VL.isIdenticalTo(Other.VL);
+  }
+};
+
+static DemandedVL max(const DemandedVL &LHS, const DemandedVL &RHS) {
----------------
topperc wrote:

Move this into the DemandedVL class so that it has to be called as `DemandedVL::max`?

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


More information about the llvm-commits mailing list