@@ -2035,7 +2035,7 @@ void InnerLoopVectorizer::widenIntOrFpInduction(PHINode *IV, TruncInst *Trunc) {
2035
2035
Value *InnerLoopVectorizer::getStepVector (Value *Val, int StartIdx, Value *Step,
2036
2036
Instruction::BinaryOps BinOp) {
2037
2037
// Create and check the types.
2038
- auto *ValVTy = cast<VectorType >(Val->getType ());
2038
+ auto *ValVTy = cast<FixedVectorType >(Val->getType ());
2039
2039
int VLen = ValVTy->getNumElements ();
2040
2040
2041
2041
Type *STy = Val->getType ()->getScalarType ();
@@ -2799,19 +2799,18 @@ Value *InnerLoopVectorizer::getOrCreateVectorTripCount(Loop *L) {
2799
2799
Value *InnerLoopVectorizer::createBitOrPointerCast (Value *V, VectorType *DstVTy,
2800
2800
const DataLayout &DL) {
2801
2801
// Verify that V is a vector type with same number of elements as DstVTy.
2802
- assert (isa<FixedVectorType>(DstVTy) &&
2803
- " Vector type is assumed to be fixed width." );
2804
- unsigned VF = DstVTy->getNumElements ();
2805
- VectorType *SrcVecTy = cast<VectorType>(V->getType ());
2802
+ auto *DstFVTy = cast<FixedVectorType>(DstVTy);
2803
+ unsigned VF = DstFVTy->getNumElements ();
2804
+ auto *SrcVecTy = cast<FixedVectorType>(V->getType ());
2806
2805
assert ((VF == SrcVecTy->getNumElements ()) && " Vector dimensions do not match" );
2807
2806
Type *SrcElemTy = SrcVecTy->getElementType ();
2808
- Type *DstElemTy = DstVTy ->getElementType ();
2807
+ Type *DstElemTy = DstFVTy ->getElementType ();
2809
2808
assert ((DL.getTypeSizeInBits (SrcElemTy) == DL.getTypeSizeInBits (DstElemTy)) &&
2810
2809
" Vector elements must have same size" );
2811
2810
2812
2811
// Do a direct cast if element types are castable.
2813
2812
if (CastInst::isBitOrNoopPointerCastable (SrcElemTy, DstElemTy, DL)) {
2814
- return Builder.CreateBitOrPointerCast (V, DstVTy );
2813
+ return Builder.CreateBitOrPointerCast (V, DstFVTy );
2815
2814
}
2816
2815
// V cannot be directly casted to desired vector type.
2817
2816
// May happen when V is a floating point vector but DstVTy is a vector of
@@ -2825,7 +2824,7 @@ Value *InnerLoopVectorizer::createBitOrPointerCast(Value *V, VectorType *DstVTy,
2825
2824
IntegerType::getIntNTy (V->getContext (), DL.getTypeSizeInBits (SrcElemTy));
2826
2825
auto *VecIntTy = FixedVectorType::get (IntTy, VF);
2827
2826
Value *CastVal = Builder.CreateBitOrPointerCast (V, VecIntTy);
2828
- return Builder.CreateBitOrPointerCast (CastVal, DstVTy );
2827
+ return Builder.CreateBitOrPointerCast (CastVal, DstFVTy );
2829
2828
}
2830
2829
2831
2830
void InnerLoopVectorizer::emitMinimumIterationCountCheck (Loop *L,
@@ -3526,7 +3525,8 @@ void InnerLoopVectorizer::truncateToMinimalBitwidths() {
3526
3525
Type *ScalarTruncatedTy =
3527
3526
IntegerType::get (OriginalTy->getContext (), KV.second );
3528
3527
auto *TruncatedTy = FixedVectorType::get (
3529
- ScalarTruncatedTy, cast<VectorType>(OriginalTy)->getNumElements ());
3528
+ ScalarTruncatedTy,
3529
+ cast<FixedVectorType>(OriginalTy)->getNumElements ());
3530
3530
if (TruncatedTy == OriginalTy)
3531
3531
continue ;
3532
3532
@@ -3576,13 +3576,13 @@ void InnerLoopVectorizer::truncateToMinimalBitwidths() {
3576
3576
break ;
3577
3577
}
3578
3578
} else if (auto *SI = dyn_cast<ShuffleVectorInst>(I)) {
3579
- auto Elements0 =
3580
- cast<VectorType>(SI-> getOperand ( 0 )-> getType ()) ->getNumElements ();
3579
+ auto Elements0 = cast<FixedVectorType>(SI-> getOperand ( 0 )-> getType ())
3580
+ ->getNumElements ();
3581
3581
auto *O0 = B.CreateZExtOrTrunc (
3582
3582
SI->getOperand (0 ),
3583
3583
FixedVectorType::get (ScalarTruncatedTy, Elements0));
3584
- auto Elements1 =
3585
- cast<VectorType>(SI-> getOperand ( 1 )-> getType ()) ->getNumElements ();
3584
+ auto Elements1 = cast<FixedVectorType>(SI-> getOperand ( 1 )-> getType ())
3585
+ ->getNumElements ();
3586
3586
auto *O1 = B.CreateZExtOrTrunc (
3587
3587
SI->getOperand (1 ),
3588
3588
FixedVectorType::get (ScalarTruncatedTy, Elements1));
@@ -3592,16 +3592,16 @@ void InnerLoopVectorizer::truncateToMinimalBitwidths() {
3592
3592
// Don't do anything with the operands, just extend the result.
3593
3593
continue ;
3594
3594
} else if (auto *IE = dyn_cast<InsertElementInst>(I)) {
3595
- auto Elements =
3596
- cast<VectorType>(IE-> getOperand ( 0 )-> getType ()) ->getNumElements ();
3595
+ auto Elements = cast<FixedVectorType>(IE-> getOperand ( 0 )-> getType ())
3596
+ ->getNumElements ();
3597
3597
auto *O0 = B.CreateZExtOrTrunc (
3598
3598
IE->getOperand (0 ),
3599
3599
FixedVectorType::get (ScalarTruncatedTy, Elements));
3600
3600
auto *O1 = B.CreateZExtOrTrunc (IE->getOperand (1 ), ScalarTruncatedTy);
3601
3601
NewI = B.CreateInsertElement (O0, O1, IE->getOperand (2 ));
3602
3602
} else if (auto *EE = dyn_cast<ExtractElementInst>(I)) {
3603
- auto Elements =
3604
- cast<VectorType>(EE-> getOperand ( 0 )-> getType ()) ->getNumElements ();
3603
+ auto Elements = cast<FixedVectorType>(EE-> getOperand ( 0 )-> getType ())
3604
+ ->getNumElements ();
3605
3605
auto *O0 = B.CreateZExtOrTrunc (
3606
3606
EE->getOperand (0 ),
3607
3607
FixedVectorType::get (ScalarTruncatedTy, Elements));
0 commit comments