@@ -1251,8 +1251,8 @@ class LoopVectorizationCostModel {
1251
1251
return false ;
1252
1252
1253
1253
// Get the source and destination types of the truncate.
1254
- Type *SrcTy = ToVectorTy (cast<CastInst>(I)->getSrcTy (), VF);
1255
- Type *DestTy = ToVectorTy (cast<CastInst>(I)->getDestTy (), VF);
1254
+ Type *SrcTy = toVectorTy (cast<CastInst>(I)->getSrcTy (), VF);
1255
+ Type *DestTy = toVectorTy (cast<CastInst>(I)->getDestTy (), VF);
1256
1256
1257
1257
// If the truncate is free for the given types, return false. Replacing a
1258
1258
// free truncate with an induction variable would add an induction variable
@@ -3535,14 +3535,14 @@ LoopVectorizationCostModel::getDivRemSpeculationCost(Instruction *I,
3535
3535
}
3536
3536
InstructionCost SafeDivisorCost = 0 ;
3537
3537
3538
- auto *VecTy = ToVectorTy (I->getType (), VF);
3538
+ auto *VecTy = toVectorTy (I->getType (), VF);
3539
3539
3540
3540
// The cost of the select guard to ensure all lanes are well defined
3541
3541
// after we speculate above any internal control flow.
3542
- SafeDivisorCost += TTI. getCmpSelInstrCost (
3543
- Instruction::Select, VecTy,
3544
- ToVectorTy (Type::getInt1Ty (I->getContext ()), VF),
3545
- CmpInst::BAD_ICMP_PREDICATE, CostKind);
3542
+ SafeDivisorCost +=
3543
+ TTI. getCmpSelInstrCost ( Instruction::Select, VecTy,
3544
+ toVectorTy (Type::getInt1Ty (I->getContext ()), VF),
3545
+ CmpInst::BAD_ICMP_PREDICATE, CostKind);
3546
3546
3547
3547
// Certain instructions can be cheaper to vectorize if they have a constant
3548
3548
// second vector operand. One example of this are shifts on x86.
@@ -4662,7 +4662,7 @@ static bool willGenerateVectors(VPlan &Plan, ElementCount VF,
4662
4662
}
4663
4663
4664
4664
auto WillWiden = [&TTI, VF](Type *ScalarTy) {
4665
- Type *VectorTy = ToVectorTy (ScalarTy, VF);
4665
+ Type *VectorTy = toVectorTy (ScalarTy, VF);
4666
4666
unsigned NumLegalParts = TTI.getNumberOfParts (VectorTy);
4667
4667
if (!NumLegalParts)
4668
4668
return false ;
@@ -5653,7 +5653,7 @@ InstructionCost LoopVectorizationCostModel::computePredInstDiscount(
5653
5653
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput;
5654
5654
if (isScalarWithPredication (I, VF) && !I->getType ()->isVoidTy ()) {
5655
5655
ScalarCost += TTI.getScalarizationOverhead (
5656
- cast<VectorType>(ToVectorTy (I->getType (), VF)),
5656
+ cast<VectorType>(toVectorTy (I->getType (), VF)),
5657
5657
APInt::getAllOnes (VF.getFixedValue ()), /* Insert*/ true ,
5658
5658
/* Extract*/ false , CostKind);
5659
5659
ScalarCost +=
@@ -5672,7 +5672,7 @@ InstructionCost LoopVectorizationCostModel::computePredInstDiscount(
5672
5672
Worklist.push_back (J);
5673
5673
else if (needsExtract (J, VF)) {
5674
5674
ScalarCost += TTI.getScalarizationOverhead (
5675
- cast<VectorType>(ToVectorTy (J->getType (), VF)),
5675
+ cast<VectorType>(toVectorTy (J->getType (), VF)),
5676
5676
APInt::getAllOnes (VF.getFixedValue ()), /* Insert*/ false ,
5677
5677
/* Extract*/ true , CostKind);
5678
5678
}
@@ -5783,7 +5783,7 @@ LoopVectorizationCostModel::getMemInstScalarizationCost(Instruction *I,
5783
5783
5784
5784
unsigned AS = getLoadStoreAddressSpace (I);
5785
5785
Value *Ptr = getLoadStorePointerOperand (I);
5786
- Type *PtrTy = ToVectorTy (Ptr->getType (), VF);
5786
+ Type *PtrTy = toVectorTy (Ptr->getType (), VF);
5787
5787
// NOTE: PtrTy is a vector to signal `TTI::getAddressComputationCost`
5788
5788
// that it is being called from this specific place.
5789
5789
@@ -5834,7 +5834,7 @@ InstructionCost
5834
5834
LoopVectorizationCostModel::getConsecutiveMemOpCost (Instruction *I,
5835
5835
ElementCount VF) {
5836
5836
Type *ValTy = getLoadStoreType (I);
5837
- auto *VectorTy = cast<VectorType>(ToVectorTy (ValTy, VF));
5837
+ auto *VectorTy = cast<VectorType>(toVectorTy (ValTy, VF));
5838
5838
Value *Ptr = getLoadStorePointerOperand (I);
5839
5839
unsigned AS = getLoadStoreAddressSpace (I);
5840
5840
int ConsecutiveStride = Legal->isConsecutivePtr (ValTy, Ptr);
@@ -5866,7 +5866,7 @@ LoopVectorizationCostModel::getUniformMemOpCost(Instruction *I,
5866
5866
assert (Legal->isUniformMemOp (*I, VF));
5867
5867
5868
5868
Type *ValTy = getLoadStoreType (I);
5869
- auto *VectorTy = cast<VectorType>(ToVectorTy (ValTy, VF));
5869
+ auto *VectorTy = cast<VectorType>(toVectorTy (ValTy, VF));
5870
5870
const Align Alignment = getLoadStoreAlignment (I);
5871
5871
unsigned AS = getLoadStoreAddressSpace (I);
5872
5872
enum TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput;
@@ -5892,7 +5892,7 @@ InstructionCost
5892
5892
LoopVectorizationCostModel::getGatherScatterCost (Instruction *I,
5893
5893
ElementCount VF) {
5894
5894
Type *ValTy = getLoadStoreType (I);
5895
- auto *VectorTy = cast<VectorType>(ToVectorTy (ValTy, VF));
5895
+ auto *VectorTy = cast<VectorType>(toVectorTy (ValTy, VF));
5896
5896
const Align Alignment = getLoadStoreAlignment (I);
5897
5897
const Value *Ptr = getLoadStorePointerOperand (I);
5898
5898
@@ -5910,7 +5910,7 @@ LoopVectorizationCostModel::getInterleaveGroupCost(Instruction *I,
5910
5910
5911
5911
Instruction *InsertPos = Group->getInsertPos ();
5912
5912
Type *ValTy = getLoadStoreType (InsertPos);
5913
- auto *VectorTy = cast<VectorType>(ToVectorTy (ValTy, VF));
5913
+ auto *VectorTy = cast<VectorType>(toVectorTy (ValTy, VF));
5914
5914
unsigned AS = getLoadStoreAddressSpace (InsertPos);
5915
5915
enum TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput;
5916
5916
@@ -6155,7 +6155,7 @@ InstructionCost LoopVectorizationCostModel::getScalarizationOverhead(
6155
6155
return 0 ;
6156
6156
6157
6157
InstructionCost Cost = 0 ;
6158
- Type *RetTy = ToVectorTy (I->getType (), VF);
6158
+ Type *RetTy = toVectorTy (I->getType (), VF);
6159
6159
if (!RetTy->isVoidTy () &&
6160
6160
(!isa<LoadInst>(I) || !TTI.supportsEfficientVectorElementLoadStore ()))
6161
6161
Cost += TTI.getScalarizationOverhead (
@@ -6421,9 +6421,9 @@ void LoopVectorizationCostModel::setVectorizedCallDecision(ElementCount VF) {
6421
6421
6422
6422
bool MaskRequired = Legal->isMaskRequired (CI);
6423
6423
// Compute corresponding vector type for return value and arguments.
6424
- Type *RetTy = ToVectorTy (ScalarRetTy, VF);
6424
+ Type *RetTy = toVectorTy (ScalarRetTy, VF);
6425
6425
for (Type *ScalarTy : ScalarTys)
6426
- Tys.push_back (ToVectorTy (ScalarTy, VF));
6426
+ Tys.push_back (toVectorTy (ScalarTy, VF));
6427
6427
6428
6428
// An in-loop reduction using an fmuladd intrinsic is a special case;
6429
6429
// we don't want the normal cost for that intrinsic.
@@ -6613,7 +6613,7 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
6613
6613
HasSingleCopyAfterVectorization (I, VF));
6614
6614
VectorTy = RetTy;
6615
6615
} else
6616
- VectorTy = ToVectorTy (RetTy, VF);
6616
+ VectorTy = toVectorTy (RetTy, VF);
6617
6617
6618
6618
if (VF.isVector () && VectorTy->isVectorTy () &&
6619
6619
!TTI.getNumberOfParts (VectorTy))
@@ -6673,8 +6673,8 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
6673
6673
return Switch->getNumCases () *
6674
6674
TTI.getCmpSelInstrCost (
6675
6675
Instruction::ICmp,
6676
- ToVectorTy (Switch->getCondition ()->getType (), VF),
6677
- ToVectorTy (Type::getInt1Ty (I->getContext ()), VF),
6676
+ toVectorTy (Switch->getCondition ()->getType (), VF),
6677
+ toVectorTy (Type::getInt1Ty (I->getContext ()), VF),
6678
6678
CmpInst::ICMP_EQ, CostKind);
6679
6679
}
6680
6680
case Instruction::PHI: {
@@ -6719,8 +6719,8 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
6719
6719
}
6720
6720
return (Phi->getNumIncomingValues () - 1 ) *
6721
6721
TTI.getCmpSelInstrCost (
6722
- Instruction::Select, ToVectorTy (ResultTy, VF),
6723
- ToVectorTy (Type::getInt1Ty (Phi->getContext ()), VF),
6722
+ Instruction::Select, toVectorTy (ResultTy, VF),
6723
+ toVectorTy (Type::getInt1Ty (Phi->getContext ()), VF),
6724
6724
CmpInst::BAD_ICMP_PREDICATE, CostKind);
6725
6725
}
6726
6726
@@ -6729,8 +6729,8 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
6729
6729
if (VF.isVector () && foldTailWithEVL () &&
6730
6730
Legal->getReductionVars ().contains (Phi) && !isInLoopReduction (Phi)) {
6731
6731
IntrinsicCostAttributes ICA (
6732
- Intrinsic::vp_merge, ToVectorTy (Phi->getType (), VF),
6733
- {ToVectorTy (Type::getInt1Ty (Phi->getContext ()), VF)});
6732
+ Intrinsic::vp_merge, toVectorTy (Phi->getType (), VF),
6733
+ {toVectorTy (Type::getInt1Ty (Phi->getContext ()), VF)});
6734
6734
return TTI.getIntrinsicInstrCost (ICA, CostKind);
6735
6735
}
6736
6736
@@ -6870,7 +6870,7 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
6870
6870
ValTy = IntegerType::get (ValTy->getContext (), MinBWs[I]);
6871
6871
}
6872
6872
6873
- VectorTy = ToVectorTy (ValTy, VF);
6873
+ VectorTy = toVectorTy (ValTy, VF);
6874
6874
return TTI.getCmpSelInstrCost (I->getOpcode (), VectorTy, nullptr ,
6875
6875
cast<CmpInst>(I)->getPredicate (), CostKind,
6876
6876
{TTI::OK_AnyValue, TTI::OP_None},
@@ -6888,7 +6888,7 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
6888
6888
if (Decision == CM_Scalarize)
6889
6889
Width = ElementCount::getFixed (1 );
6890
6890
}
6891
- VectorTy = ToVectorTy (getLoadStoreType (I), Width);
6891
+ VectorTy = toVectorTy (getLoadStoreType (I), Width);
6892
6892
return getMemoryInstructionCost (I, VF);
6893
6893
}
6894
6894
case Instruction::BitCast:
@@ -6969,7 +6969,7 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
6969
6969
SrcScalarTy =
6970
6970
IntegerType::get (SrcScalarTy->getContext (), MinBWs[Op0AsInstruction]);
6971
6971
Type *SrcVecTy =
6972
- VectorTy->isVectorTy () ? ToVectorTy (SrcScalarTy, VF) : SrcScalarTy;
6972
+ VectorTy->isVectorTy () ? toVectorTy (SrcScalarTy, VF) : SrcScalarTy;
6973
6973
6974
6974
if (canTruncateToMinimalBitwidth (I, VF)) {
6975
6975
// If the result type is <= the source type, there will be no extend
@@ -7498,7 +7498,7 @@ LoopVectorizationPlanner::precomputeCosts(VPlan &Plan, ElementCount VF,
7498
7498
// Pre-compute the cost for I, if it has a reduction pattern cost.
7499
7499
for (Instruction *I : ChainOpsAndOperands) {
7500
7500
auto ReductionCost = CM.getReductionPatternCost (
7501
- I, VF, ToVectorTy (I->getType (), VF), TTI::TCK_RecipThroughput);
7501
+ I, VF, toVectorTy (I->getType (), VF), TTI::TCK_RecipThroughput);
7502
7502
if (!ReductionCost)
7503
7503
continue ;
7504
7504
0 commit comments