@@ -3107,12 +3107,13 @@ LoopVectorizationCostModel::getDivRemSpeculationCost(Instruction *I,
3107
3107
// that we will create. This cost is likely to be zero. The phi node
3108
3108
// cost, if any, should be scaled by the block probability because it
3109
3109
// models a copy at the end of each predicated block.
3110
- ScalarizationCost += VF. getKnownMinValue () *
3111
- TTI.getCFInstrCost (Instruction::PHI, CostKind);
3110
+ ScalarizationCost +=
3111
+ VF. getFixedValue () * TTI.getCFInstrCost (Instruction::PHI, CostKind);
3112
3112
3113
3113
// The cost of the non-predicated instruction.
3114
- ScalarizationCost += VF.getKnownMinValue () *
3115
- TTI.getArithmeticInstrCost (I->getOpcode (), I->getType (), CostKind);
3114
+ ScalarizationCost +=
3115
+ VF.getFixedValue () *
3116
+ TTI.getArithmeticInstrCost (I->getOpcode (), I->getType (), CostKind);
3116
3117
3117
3118
// The cost of insertelement and extractelement instructions needed for
3118
3119
// scalarization.
@@ -4280,7 +4281,7 @@ static bool willGenerateVectors(VPlan &Plan, ElementCount VF,
4280
4281
return NumLegalParts <= VF.getKnownMinValue ();
4281
4282
}
4282
4283
// Two or more elements that share a register - are vectorized.
4283
- return NumLegalParts < VF.getKnownMinValue ();
4284
+ return NumLegalParts < VF.getFixedValue ();
4284
4285
};
4285
4286
4286
4287
// If no def nor is a store, e.g., branches, continue - no value to check.
@@ -4565,8 +4566,8 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
4565
4566
assert (!isa<SCEVCouldNotCompute>(TC) &&
4566
4567
" Trip count SCEV must be computable" );
4567
4568
RemainingIterations = SE.getURemExpr (
4568
- TC, SE.getConstant (TCType, MainLoopVF.getKnownMinValue () * IC));
4569
- MaxTripCount = MainLoopVF.getKnownMinValue () * IC - 1 ;
4569
+ TC, SE.getConstant (TCType, MainLoopVF.getFixedValue () * IC));
4570
+ MaxTripCount = MainLoopVF.getFixedValue () * IC - 1 ;
4570
4571
if (SE.isKnownPredicate (CmpInst::ICMP_ULT, RemainingIterations,
4571
4572
SE.getConstant (TCType, MaxTripCount))) {
4572
4573
MaxTripCount =
@@ -4577,7 +4578,7 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
4577
4578
}
4578
4579
if (SE.isKnownPredicate (
4579
4580
CmpInst::ICMP_UGT,
4580
- SE.getConstant (TCType, NextVF.Width .getKnownMinValue ()),
4581
+ SE.getConstant (TCType, NextVF.Width .getFixedValue ()),
4581
4582
RemainingIterations))
4582
4583
continue ;
4583
4584
}
@@ -5248,14 +5249,14 @@ LoopVectorizationCostModel::getMemInstScalarizationCost(Instruction *I,
5248
5249
5249
5250
// Get the cost of the scalar memory instruction and address computation.
5250
5251
InstructionCost Cost =
5251
- VF.getKnownMinValue () * TTI.getAddressComputationCost (PtrTy, SE, PtrSCEV);
5252
+ VF.getFixedValue () * TTI.getAddressComputationCost (PtrTy, SE, PtrSCEV);
5252
5253
5253
5254
// Don't pass *I here, since it is scalar but will actually be part of a
5254
5255
// vectorized loop where the user of it is a vectorized instruction.
5255
5256
const Align Alignment = getLoadStoreAlignment (I);
5256
- Cost += VF.getKnownMinValue () * TTI.getMemoryOpCost (I->getOpcode (),
5257
- ValTy->getScalarType (),
5258
- Alignment, AS, CostKind);
5257
+ Cost += VF.getFixedValue () * TTI.getMemoryOpCost (I->getOpcode (),
5258
+ ValTy->getScalarType (),
5259
+ Alignment, AS, CostKind);
5259
5260
5260
5261
// Get the overhead of the extractelement and insertelement instructions
5261
5262
// we might create due to scalarization.
@@ -5271,7 +5272,7 @@ LoopVectorizationCostModel::getMemInstScalarizationCost(Instruction *I,
5271
5272
auto *VecI1Ty =
5272
5273
VectorType::get (IntegerType::getInt1Ty (ValTy->getContext ()), VF);
5273
5274
Cost += TTI.getScalarizationOverhead (
5274
- VecI1Ty, APInt::getAllOnes (VF.getKnownMinValue ()),
5275
+ VecI1Ty, APInt::getAllOnes (VF.getFixedValue ()),
5275
5276
/* Insert=*/ false , /* Extract=*/ true , CostKind);
5276
5277
Cost += TTI.getCFInstrCost (Instruction::Br, CostKind);
5277
5278
@@ -5317,7 +5318,6 @@ InstructionCost
5317
5318
LoopVectorizationCostModel::getUniformMemOpCost (Instruction *I,
5318
5319
ElementCount VF) {
5319
5320
assert (Legal->isUniformMemOp (*I, VF));
5320
-
5321
5321
Type *ValTy = getLoadStoreType (I);
5322
5322
auto *VectorTy = cast<VectorType>(toVectorTy (ValTy, VF));
5323
5323
const Align Alignment = getLoadStoreAlignment (I);
@@ -5332,6 +5332,10 @@ LoopVectorizationCostModel::getUniformMemOpCost(Instruction *I,
5332
5332
StoreInst *SI = cast<StoreInst>(I);
5333
5333
5334
5334
bool IsLoopInvariantStoreValue = Legal->isInvariant (SI->getValueOperand ());
5335
+ // TODO: We have tests that request the cost of extracting element
5336
+ // VF.getKnownMinValue() - 1 from a scalable vector. This is actually
5337
+ // meaningless, given what we actually want is the last lane and is likely
5338
+ // to be more expensive.
5335
5339
return TTI.getAddressComputationCost (ValTy) +
5336
5340
TTI.getMemoryOpCost (Instruction::Store, ValTy, Alignment, AS,
5337
5341
CostKind) +
@@ -5614,7 +5618,7 @@ LoopVectorizationCostModel::getScalarizationOverhead(Instruction *I,
5614
5618
5615
5619
for (Type *VectorTy : getContainedTypes (RetTy)) {
5616
5620
Cost += TTI.getScalarizationOverhead (
5617
- cast<VectorType>(VectorTy), APInt::getAllOnes (VF.getKnownMinValue ()),
5621
+ cast<VectorType>(VectorTy), APInt::getAllOnes (VF.getFixedValue ()),
5618
5622
/* Insert=*/ true ,
5619
5623
/* Extract=*/ false , CostKind);
5620
5624
}
0 commit comments