@@ -395,17 +395,17 @@ costShuffleViaVRegSplitting(RISCVTTIImpl &TTI, MVT LegalVT,
395395 std::optional<unsigned > VLen, VectorType *Tp,
396396 ArrayRef<int > Mask, TTI::TargetCostKind CostKind) {
397397 assert (LegalVT.isFixedLengthVector ());
398- InstructionCost NumOfDests = InstructionCost::getInvalid ();
399- if (VLen && !Mask. empty ()) {
400- MVT ElemVT = LegalVT.getVectorElementType ();
401- unsigned ElemsPerVReg = *VLen / ElemVT.getFixedSizeInBits ();
402- LegalVT = TTI.getTypeLegalizationCost (
403- FixedVectorType::get (Tp->getElementType (), ElemsPerVReg))
404- .second ;
405- // Number of destination vectors after legalization:
406- NumOfDests = divideCeil (Mask. size (), LegalVT. getVectorNumElements ());
407- }
408- if (!NumOfDests. isValid () || NumOfDests <= 1 ||
398+ if (!VLen || Mask. empty ())
399+ return InstructionCost::getInvalid ();
400+ MVT ElemVT = LegalVT.getVectorElementType ();
401+ unsigned ElemsPerVReg = *VLen / ElemVT.getFixedSizeInBits ();
402+ LegalVT = TTI.getTypeLegalizationCost (
403+ FixedVectorType::get (Tp->getElementType (), ElemsPerVReg))
404+ .second ;
405+ // Number of destination vectors after legalization:
406+ InstructionCost NumOfDests =
407+ divideCeil (Mask. size (), LegalVT. getVectorNumElements ());
408+ if (NumOfDests <= 1 ||
409409 LegalVT.getVectorElementType ().getSizeInBits () !=
410410 Tp->getElementType ()->getPrimitiveSizeInBits () ||
411411 LegalVT.getVectorNumElements () >= Tp->getElementCount ().getFixedValue ())
0 commit comments