File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -373,6 +373,12 @@ lookupActiveElementsAffectsResult(const MachineInstr &MI) {
373373 return Info->ActiveElementsAffectResult ;
374374}
375375
376+ static unsigned getSEWLMULRatio (const MachineInstr &MI) {
377+ RISCVII::VLMUL LMUL = RISCVII::getLMul (MI.getDesc ().TSFlags );
378+ unsigned Log2SEW = MI.getOperand (RISCVII::getSEWOpNum (MI.getDesc ())).getImm ();
379+ return RISCVVType::getSEWLMULRatio (1 << Log2SEW, LMUL);
380+ }
381+
376382// / If a PseudoVMV_V_V is the only user of its input, fold its passthru and VL
377383// / into it.
378384// /
@@ -399,6 +405,10 @@ bool RISCVVectorPeephole::foldVMV_V_V(MachineInstr &MI) {
399405 !RISCVII::hasVecPolicyOp (Src->getDesc ().TSFlags ))
400406 return false ;
401407
408+ // Src needs to have the same VLMAX as MI
409+ if (getSEWLMULRatio (MI) != getSEWLMULRatio (*Src))
410+ return false ;
411+
402412 // Src needs to have the same passthru as VMV_V_V
403413 if (Src->getOperand (1 ).getReg () != RISCV::NoRegister &&
404414 Src->getOperand (1 ).getReg () != Passthru.getReg ())
You can’t perform that action at this time.
0 commit comments