@@ -696,20 +696,20 @@ bool VectorCombine::foldBitcastShuf(Instruction &I) {
696
696
return false ;
697
697
698
698
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 ();
701
701
SmallVector<int , 16 > NewMask;
702
- if (SrcNumElts <= DestNumElts ) {
702
+ if (DestEltSize <= SrcEltSize ) {
703
703
// The bitcast is from wide to narrow/equal elements. The shuffle mask can
704
704
// 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 ;
707
707
narrowShuffleMaskElts (ScaleFactor, Mask, NewMask);
708
708
} else {
709
709
// The bitcast is from narrow elements to wide elements. The shuffle mask
710
710
// 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 ;
713
713
if (!widenShuffleMaskElts (ScaleFactor, Mask, NewMask))
714
714
return false ;
715
715
}
0 commit comments