[llvm] [RISCV][VLOPT] Support segmented store instructions (PR #155467)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 4 03:26:40 PDT 2025
================
@@ -1396,6 +1502,22 @@ RISCVVLOptimizer::checkUsers(const MachineInstr &MI) const {
continue;
}
+ if (isTupleInsertInstr(UserMI, *MRI)) {
+ LLVM_DEBUG(dbgs().indent(4) << "Peeking through uses of INSERT_SUBREG\n");
+ for (MachineOperand &UseOp :
+ MRI->use_operands(UserMI.getOperand(0).getReg())) {
+ const MachineInstr &CandidateMI = *UseOp.getParent();
+ // We should not propagate the VL if the user is not a segmented store
+ // or another INSERT_SUBREG, since VL just works differently
+ // between segmented operations (per-field) v.s. other RVV ops (on the
+ // whole register group).
+ if (isTupleInsertInstr(CandidateMI, *MRI) ||
+ isSegmentedStoreInstr(CandidateMI))
+ Worklist.insert(&UseOp);
----------------
lukel97 wrote:
I think https://github.com/llvm/llvm-project/pull/151285 should make this less confusing. Currently checkUsers does two things, it checks to see if the EEW/EMUL are compatible, and it also tries to compute the maximum VL of its users.
#151285 splits it out so checkUsers only does the EEW/EMUL check and leaves the maximum VL computation to the transfer function.
https://github.com/llvm/llvm-project/pull/155467
More information about the llvm-commits
mailing list