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) {
373
373
return Info->ActiveElementsAffectResult ;
374
374
}
375
375
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
+
376
382
// / If a PseudoVMV_V_V is the only user of its input, fold its passthru and VL
377
383
// / into it.
378
384
// /
@@ -399,6 +405,10 @@ bool RISCVVectorPeephole::foldVMV_V_V(MachineInstr &MI) {
399
405
!RISCVII::hasVecPolicyOp (Src->getDesc ().TSFlags ))
400
406
return false ;
401
407
408
+ // Src needs to have the same VLMAX as MI
409
+ if (getSEWLMULRatio (MI) != getSEWLMULRatio (*Src))
410
+ return false ;
411
+
402
412
// Src needs to have the same passthru as VMV_V_V
403
413
if (Src->getOperand (1 ).getReg () != RISCV::NoRegister &&
404
414
Src->getOperand (1 ).getReg () != Passthru.getReg ())
You can’t perform that action at this time.
0 commit comments