@@ -477,6 +477,18 @@ class VSETVLIInfo {
477477 return AVLImm;
478478 }
479479
480+ void setAVL (VSETVLIInfo Info) {
481+ assert (Info.isValid ());
482+ if (Info.isUnknown ())
483+ setUnknown ();
484+ else if (Info.hasAVLReg ())
485+ setAVLReg (Info.getAVLReg ());
486+ else {
487+ assert (Info.hasAVLImm ());
488+ setAVLImm (Info.getAVLImm ());
489+ }
490+ }
491+
480492 unsigned getSEW () const { return SEW; }
481493 RISCVII::VLMUL getVLMUL () const { return VLMul; }
482494
@@ -1054,10 +1066,7 @@ void RISCVInsertVSETVLI::transferBefore(VSETVLIInfo &Info,
10541066 // TODO: We can probably relax this for immediates.
10551067 if (Demanded.VLZeroness && !Demanded.VLAny && PrevInfo.isValid () &&
10561068 PrevInfo.hasEquallyZeroAVL (Info, *MRI) && Info.hasSameVLMAX (PrevInfo)) {
1057- if (PrevInfo.hasAVLImm ())
1058- Info.setAVLImm (PrevInfo.getAVLImm ());
1059- else
1060- Info.setAVLReg (PrevInfo.getAVLReg ());
1069+ Info.setAVL (PrevInfo);
10611070 return ;
10621071 }
10631072
@@ -1074,10 +1083,7 @@ void RISCVInsertVSETVLI::transferBefore(VSETVLIInfo &Info,
10741083 VSETVLIInfo DefInfo = getInfoForVSETVLI (*DefMI);
10751084 if (DefInfo.hasSameVLMAX (Info) &&
10761085 (DefInfo.hasAVLImm () || DefInfo.getAVLReg () == RISCV::X0)) {
1077- if (DefInfo.hasAVLImm ())
1078- Info.setAVLImm (DefInfo.getAVLImm ());
1079- else
1080- Info.setAVLReg (DefInfo.getAVLReg ());
1086+ Info.setAVL (DefInfo);
10811087 return ;
10821088 }
10831089}
0 commit comments