@@ -412,7 +412,7 @@ static void buildCopyFromRegs(MachineIRBuilder &B, ArrayRef<Register> OrigRegs,
412412 // size, e.g. PartLLT == v2s64 and LLTy is v3s32, then first coerce it to
413413 // have the same elt type, i.e. v4s32.
414414 // TODO: Extend this coersion to element multiples other than just 2.
415- if (PartLLT.getSizeInBits () > LLTy.getSizeInBits () &&
415+ if (TypeSize::isKnownGT ( PartLLT.getSizeInBits (), LLTy.getSizeInBits () ) &&
416416 PartLLT.getScalarSizeInBits () == LLTy.getScalarSizeInBits () * 2 &&
417417 Regs.size () == 1 ) {
418418 LLT NewTy = PartLLT.changeElementType (LLTy.getElementType ())
@@ -529,7 +529,7 @@ static void buildCopyToRegs(MachineIRBuilder &B, ArrayRef<Register> DstRegs,
529529 // We could just insert a regular copy, but this is unreachable at the moment.
530530 assert (SrcTy != PartTy && " identical part types shouldn't reach here" );
531531
532- const unsigned PartSize = PartTy.getSizeInBits ();
532+ const TypeSize PartSize = PartTy.getSizeInBits ();
533533
534534 if (PartTy.isVector () == SrcTy.isVector () &&
535535 PartTy.getScalarSizeInBits () > SrcTy.getScalarSizeInBits ()) {
@@ -539,7 +539,7 @@ static void buildCopyToRegs(MachineIRBuilder &B, ArrayRef<Register> DstRegs,
539539 }
540540
541541 if (SrcTy.isVector () && !PartTy.isVector () &&
542- PartSize > SrcTy.getElementType ().getSizeInBits ()) {
542+ TypeSize::isKnownGT ( PartSize, SrcTy.getElementType ().getSizeInBits () )) {
543543 // Vector was scalarized, and the elements extended.
544544 auto UnmergeToEltTy = B.buildUnmerge (SrcTy.getElementType (), SrcReg);
545545 for (int i = 0 , e = DstRegs.size (); i != e; ++i)
@@ -548,9 +548,10 @@ static void buildCopyToRegs(MachineIRBuilder &B, ArrayRef<Register> DstRegs,
548548 }
549549
550550 if (SrcTy.isVector () && PartTy.isVector () &&
551- PartTy.getScalarSizeInBits () == SrcTy.getScalarSizeInBits () &&
552- SrcTy.getNumElements () < PartTy.getNumElements ()) {
553- // A coercion like: v2f32 -> v4f32.
551+ PartTy.getSizeInBits () == SrcTy.getSizeInBits () &&
552+ ElementCount::isKnownLT (SrcTy.getElementCount (),
553+ PartTy.getElementCount ())) {
554+ // A coercion like: v2f32 -> v4f32 or nxv2f32 -> nxv4f32
554555 Register DstReg = DstRegs.front ();
555556 B.buildPadVectorWithUndefElements (DstReg, SrcReg);
556557 return ;
0 commit comments