[llvm] [RISCV][VLOPT] Compute demanded VLs up front. NFC (PR #124530)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 07:43:38 PST 2025


================
@@ -50,12 +51,15 @@ class RISCVVLOptimizer : public MachineFunctionPass {
   StringRef getPassName() const override { return PASS_NAME; }
 
 private:
-  std::optional<MachineOperand> getMinimumVLForUser(MachineOperand &UserOp);
-  /// Returns the largest common VL MachineOperand that may be used to optimize
-  /// MI. Returns std::nullopt if it failed to find a suitable VL.
-  std::optional<MachineOperand> checkUsers(MachineInstr &MI);
+  MachineOperand getMinimumVLForUser(MachineOperand &UserOp);
+  /// Computes the VL of \p MI that is actually used by its users.
----------------
lukel97 wrote:

This no longer computes the largest common VL, but instead the minimum demanded VL. 

E.g. if MI has a user with VL=2, it's still possible that this would return VL=1 if the user's demanded VL was only 1. Despite it's VL operand being higher. I think there's some other comments that need updated in the function now that you mention it.

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


More information about the llvm-commits mailing list