@@ -696,20 +696,20 @@ bool VectorCombine::foldBitcastShuf(Instruction &I) {
696696 return false ;
697697
698698 auto *DestTy = cast<FixedVectorType>(I.getType ());
699- unsigned DestNumElts = DestTy->getNumElements ();
700- unsigned SrcNumElts = SrcTy->getNumElements ();
699+ unsigned DestEltSize = DestTy->getScalarSizeInBits ();
700+ unsigned SrcEltSize = SrcTy->getScalarSizeInBits ();
701701 SmallVector<int , 16 > NewMask;
702- if (SrcNumElts <= DestNumElts ) {
702+ if (DestEltSize <= SrcEltSize ) {
703703 // The bitcast is from wide to narrow/equal elements. The shuffle mask can
704704 // always be expanded to the equivalent form choosing narrower elements.
705- assert (DestNumElts % SrcNumElts == 0 && " Unexpected shuffle mask" );
706- unsigned ScaleFactor = DestNumElts / SrcNumElts ;
705+ assert (SrcEltSize % DestEltSize == 0 && " Unexpected shuffle mask" );
706+ unsigned ScaleFactor = SrcEltSize / DestEltSize ;
707707 narrowShuffleMaskElts (ScaleFactor, Mask, NewMask);
708708 } else {
709709 // The bitcast is from narrow elements to wide elements. The shuffle mask
710710 // must choose consecutive elements to allow casting first.
711- assert (SrcNumElts % DestNumElts == 0 && " Unexpected shuffle mask" );
712- unsigned ScaleFactor = SrcNumElts / DestNumElts ;
711+ assert (DestEltSize % SrcEltSize == 0 && " Unexpected shuffle mask" );
712+ unsigned ScaleFactor = DestEltSize / SrcEltSize ;
713713 if (!widenShuffleMaskElts (ScaleFactor, Mask, NewMask))
714714 return false ;
715715 }
0 commit comments