[llvm] [RISCV][VLOPT] Allow users that are passthrus if tail elements aren't demanded (PR #124066)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 29 06:45:22 PST 2025
================
@@ -1188,6 +1188,25 @@ RISCVVLOptimizer::getMinimumVLForUser(MachineOperand &UserOp) {
return std::nullopt;
}
+ unsigned VLOpNum = RISCVII::getVLOpNum(Desc);
+ const MachineOperand &VLOp = UserMI.getOperand(VLOpNum);
+ // 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 the user is a passthru it will read the elements past VL, so
+ // abort if any of the elements past VL are demanded.
+ if (UserOp.isTied()) {
+ assert(UserOp.getOperandNo() == UserMI.getNumExplicitDefs() &&
+ RISCVII::isFirstDefTiedToFirstUse(UserMI.getDesc()));
+ auto DemandedVL = DemandedVLs[&UserMI];
+ if (!DemandedVL || !RISCV::isVLKnownLE(*DemandedVL, VLOp)) {
----------------
lukel97 wrote:
Yeah, it should be read as "we couldn't compute the demanded VL for UserMI", so assume it's VLMAX.
https://github.com/llvm/llvm-project/pull/124066
More information about the llvm-commits
mailing list