@@ -3116,12 +3116,13 @@ LoopVectorizationCostModel::getDivRemSpeculationCost(Instruction *I,
3116
3116
// that we will create. This cost is likely to be zero. The phi node
3117
3117
// cost, if any, should be scaled by the block probability because it
3118
3118
// models a copy at the end of each predicated block.
3119
- ScalarizationCost += VF. getKnownMinValue () *
3120
- TTI.getCFInstrCost (Instruction::PHI, CostKind);
3119
+ ScalarizationCost +=
3120
+ VF. getFixedValue () * TTI.getCFInstrCost (Instruction::PHI, CostKind);
3121
3121
3122
3122
// The cost of the non-predicated instruction.
3123
- ScalarizationCost += VF.getKnownMinValue () *
3124
- TTI.getArithmeticInstrCost (I->getOpcode (), I->getType (), CostKind);
3123
+ ScalarizationCost +=
3124
+ VF.getFixedValue () *
3125
+ TTI.getArithmeticInstrCost (I->getOpcode (), I->getType (), CostKind);
3125
3126
3126
3127
// The cost of insertelement and extractelement instructions needed for
3127
3128
// scalarization.
@@ -4290,7 +4291,7 @@ static bool willGenerateVectors(VPlan &Plan, ElementCount VF,
4290
4291
return NumLegalParts <= VF.getKnownMinValue ();
4291
4292
}
4292
4293
// Two or more elements that share a register - are vectorized.
4293
- return NumLegalParts < VF.getKnownMinValue ();
4294
+ return NumLegalParts < VF.getFixedValue ();
4294
4295
};
4295
4296
4296
4297
// If no def nor is a store, e.g., branches, continue - no value to check.
@@ -4575,8 +4576,8 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
4575
4576
assert (!isa<SCEVCouldNotCompute>(TC) &&
4576
4577
" Trip count SCEV must be computable" );
4577
4578
RemainingIterations = SE.getURemExpr (
4578
- TC, SE.getConstant (TCType, MainLoopVF.getKnownMinValue () * IC));
4579
- MaxTripCount = MainLoopVF.getKnownMinValue () * IC - 1 ;
4579
+ TC, SE.getConstant (TCType, MainLoopVF.getFixedValue () * IC));
4580
+ MaxTripCount = MainLoopVF.getFixedValue () * IC - 1 ;
4580
4581
if (SE.isKnownPredicate (CmpInst::ICMP_ULT, RemainingIterations,
4581
4582
SE.getConstant (TCType, MaxTripCount))) {
4582
4583
MaxTripCount =
@@ -4587,7 +4588,7 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
4587
4588
}
4588
4589
if (SE.isKnownPredicate (
4589
4590
CmpInst::ICMP_UGT,
4590
- SE.getConstant (TCType, NextVF.Width .getKnownMinValue ()),
4591
+ SE.getConstant (TCType, NextVF.Width .getFixedValue ()),
4591
4592
RemainingIterations))
4592
4593
continue ;
4593
4594
}
@@ -5258,14 +5259,14 @@ LoopVectorizationCostModel::getMemInstScalarizationCost(Instruction *I,
5258
5259
5259
5260
// Get the cost of the scalar memory instruction and address computation.
5260
5261
InstructionCost Cost =
5261
- VF.getKnownMinValue () * TTI.getAddressComputationCost (PtrTy, SE, PtrSCEV);
5262
+ VF.getFixedValue () * TTI.getAddressComputationCost (PtrTy, SE, PtrSCEV);
5262
5263
5263
5264
// Don't pass *I here, since it is scalar but will actually be part of a
5264
5265
// vectorized loop where the user of it is a vectorized instruction.
5265
5266
const Align Alignment = getLoadStoreAlignment (I);
5266
- Cost += VF.getKnownMinValue () * TTI.getMemoryOpCost (I->getOpcode (),
5267
- ValTy->getScalarType (),
5268
- Alignment, AS, CostKind);
5267
+ Cost += VF.getFixedValue () * TTI.getMemoryOpCost (I->getOpcode (),
5268
+ ValTy->getScalarType (),
5269
+ Alignment, AS, CostKind);
5269
5270
5270
5271
// Get the overhead of the extractelement and insertelement instructions
5271
5272
// we might create due to scalarization.
@@ -5281,7 +5282,7 @@ LoopVectorizationCostModel::getMemInstScalarizationCost(Instruction *I,
5281
5282
auto *VecI1Ty =
5282
5283
VectorType::get (IntegerType::getInt1Ty (ValTy->getContext ()), VF);
5283
5284
Cost += TTI.getScalarizationOverhead (
5284
- VecI1Ty, APInt::getAllOnes (VF.getKnownMinValue ()),
5285
+ VecI1Ty, APInt::getAllOnes (VF.getFixedValue ()),
5285
5286
/* Insert=*/ false , /* Extract=*/ true , CostKind);
5286
5287
Cost += TTI.getCFInstrCost (Instruction::Br, CostKind);
5287
5288
@@ -5327,7 +5328,6 @@ InstructionCost
5327
5328
LoopVectorizationCostModel::getUniformMemOpCost (Instruction *I,
5328
5329
ElementCount VF) {
5329
5330
assert (Legal->isUniformMemOp (*I, VF));
5330
-
5331
5331
Type *ValTy = getLoadStoreType (I);
5332
5332
auto *VectorTy = cast<VectorType>(toVectorTy (ValTy, VF));
5333
5333
const Align Alignment = getLoadStoreAlignment (I);
@@ -5342,6 +5342,10 @@ LoopVectorizationCostModel::getUniformMemOpCost(Instruction *I,
5342
5342
StoreInst *SI = cast<StoreInst>(I);
5343
5343
5344
5344
bool IsLoopInvariantStoreValue = Legal->isInvariant (SI->getValueOperand ());
5345
+ // TODO: We have tests that request the cost of extracting element
5346
+ // VF.getKnownMinValue() - 1 from a scalable vector. This is actually
5347
+ // meaningless, given what we actually want is the last lane and is likely
5348
+ // to be more expensive.
5345
5349
return TTI.getAddressComputationCost (ValTy) +
5346
5350
TTI.getMemoryOpCost (Instruction::Store, ValTy, Alignment, AS,
5347
5351
CostKind) +
@@ -5624,7 +5628,7 @@ LoopVectorizationCostModel::getScalarizationOverhead(Instruction *I,
5624
5628
5625
5629
for (Type *VectorTy : getContainedTypes (RetTy)) {
5626
5630
Cost += TTI.getScalarizationOverhead (
5627
- cast<VectorType>(VectorTy), APInt::getAllOnes (VF.getKnownMinValue ()),
5631
+ cast<VectorType>(VectorTy), APInt::getAllOnes (VF.getFixedValue ()),
5628
5632
/* Insert=*/ true ,
5629
5633
/* Extract=*/ false , CostKind);
5630
5634
}
0 commit comments