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

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 08:35:43 PST 2025


================
@@ -1230,46 +1233,59 @@ RISCVVLOptimizer::getMinimumVLForUser(MachineOperand &UserOp) {
   // Looking for an immediate or a register VL that isn't X0.
   assert((!VLOp.isReg() || VLOp.getReg() != RISCV::X0) &&
          "Did not expect X0 VL");
+
+  // If we know the demanded VL of UserMI, then we can reduce the VL it
+  // requires.
+  if (DemandedVLs.contains(&UserMI)) {
----------------
preames wrote:

I'm confused.  vcpop.m is not a supported instruction.  Thus, it's VL should never be reduced, and it shouldn't have an element in the map (not a candidate).  It can be a valid *user* of a supported instruction, but that seems fine?  We'd return the VL of the vcpop.m instruction?

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


More information about the llvm-commits mailing list