@@ -359,7 +359,8 @@ static unsigned getScalarSizeInBits(Type *Ty) {
359
359
// 3.
360
360
static unsigned getNumVectorRegs (Type *Ty) {
361
361
assert (Ty->isVectorTy () && " Expected vector type" );
362
- unsigned WideBits = getScalarSizeInBits (Ty) * Ty->getVectorNumElements ();
362
+ unsigned WideBits =
363
+ getScalarSizeInBits (Ty) * cast<VectorType>(Ty)->getNumElements ();
363
364
assert (WideBits > 0 && " Could not compute size of vector" );
364
365
return ((WideBits % 128U ) ? ((WideBits / 128U ) + 1 ) : (WideBits / 128U ));
365
366
}
@@ -459,7 +460,7 @@ int SystemZTTIImpl::getArithmeticInstrCost(
459
460
return DivInstrCost;
460
461
}
461
462
else if (ST->hasVector ()) {
462
- unsigned VF = Ty-> getVectorNumElements ();
463
+ unsigned VF = cast<VectorType>(Ty)-> getNumElements ();
463
464
unsigned NumVectors = getNumVectorRegs (Ty);
464
465
465
466
// These vector operations are custom handled, but are still supported
@@ -580,8 +581,9 @@ getVectorTruncCost(Type *SrcTy, Type *DstTy) {
580
581
assert (SrcTy->isVectorTy () && DstTy->isVectorTy ());
581
582
assert (SrcTy->getPrimitiveSizeInBits () > DstTy->getPrimitiveSizeInBits () &&
582
583
" Packing must reduce size of vector type." );
583
- assert (SrcTy->getVectorNumElements () == DstTy->getVectorNumElements () &&
584
- " Packing should not change number of elements." );
584
+ assert (cast<VectorType>(SrcTy)->getNumElements () ==
585
+ cast<VectorType>(DstTy)->getNumElements () &&
586
+ " Packing should not change number of elements." );
585
587
586
588
// TODO: Since fp32 is expanded, the extract cost should always be 0.
587
589
@@ -596,7 +598,7 @@ getVectorTruncCost(Type *SrcTy, Type *DstTy) {
596
598
597
599
unsigned Cost = 0 ;
598
600
unsigned Log2Diff = getElSizeLog2Diff (SrcTy, DstTy);
599
- unsigned VF = SrcTy-> getVectorNumElements ();
601
+ unsigned VF = cast<VectorType>( SrcTy)-> getNumElements ();
600
602
for (unsigned P = 0 ; P < Log2Diff; ++P) {
601
603
if (NumParts > 1 )
602
604
NumParts /= 2 ;
@@ -670,7 +672,7 @@ unsigned SystemZTTIImpl::
670
672
getBoolVecToIntConversionCost (unsigned Opcode, Type *Dst,
671
673
const Instruction *I) {
672
674
assert (Dst->isVectorTy ());
673
- unsigned VF = Dst-> getVectorNumElements ();
675
+ unsigned VF = cast<VectorType>( Dst)-> getNumElements ();
674
676
unsigned Cost = 0 ;
675
677
// If we know what the widths of the compared operands, get any cost of
676
678
// converting it to match Dst. Otherwise assume same widths.
@@ -719,7 +721,7 @@ int SystemZTTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
719
721
}
720
722
else if (ST->hasVector ()) {
721
723
assert (Dst->isVectorTy ());
722
- unsigned VF = Src-> getVectorNumElements ();
724
+ unsigned VF = cast<VectorType>( Src)-> getNumElements ();
723
725
unsigned NumDstVectors = getNumVectorRegs (Dst);
724
726
unsigned NumSrcVectors = getNumVectorRegs (Src);
725
727
@@ -846,7 +848,7 @@ int SystemZTTIImpl::getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
846
848
}
847
849
}
848
850
else if (ST->hasVector ()) {
849
- unsigned VF = ValTy-> getVectorNumElements ();
851
+ unsigned VF = cast<VectorType>( ValTy)-> getNumElements ();
850
852
851
853
// Called with a compare instruction.
852
854
if (Opcode == Instruction::ICmp || Opcode == Instruction::FCmp) {
@@ -1089,7 +1091,7 @@ int SystemZTTIImpl::getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy,
1089
1091
// Return the ceiling of dividing A by B.
1090
1092
auto ceil = [](unsigned A, unsigned B) { return (A + B - 1 ) / B; };
1091
1093
1092
- unsigned NumElts = VecTy-> getVectorNumElements ();
1094
+ unsigned NumElts = cast<VectorType>( VecTy)-> getNumElements ();
1093
1095
assert (Factor > 1 && NumElts % Factor == 0 && " Invalid interleave factor" );
1094
1096
unsigned VF = NumElts / Factor;
1095
1097
unsigned NumEltsPerVecReg = (128U / getScalarSizeInBits (VecTy));
0 commit comments