@@ -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.
@@ -4289,7 +4290,7 @@ static bool willGenerateVectors(VPlan &Plan, ElementCount VF,
4289
4290
return NumLegalParts <= VF.getKnownMinValue ();
4290
4291
}
4291
4292
// Two or more elements that share a register - are vectorized.
4292
- return NumLegalParts < VF.getKnownMinValue ();
4293
+ return NumLegalParts < VF.getFixedValue ();
4293
4294
};
4294
4295
4295
4296
// If no def nor is a store, e.g., branches, continue - no value to check.
@@ -4574,8 +4575,8 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
4574
4575
assert (!isa<SCEVCouldNotCompute>(TC) &&
4575
4576
" Trip count SCEV must be computable" );
4576
4577
RemainingIterations = SE.getURemExpr (
4577
- TC, SE.getConstant (TCType, MainLoopVF.getKnownMinValue () * IC));
4578
- MaxTripCount = MainLoopVF.getKnownMinValue () * IC - 1 ;
4578
+ TC, SE.getConstant (TCType, MainLoopVF.getFixedValue () * IC));
4579
+ MaxTripCount = MainLoopVF.getFixedValue () * IC - 1 ;
4579
4580
if (SE.isKnownPredicate (CmpInst::ICMP_ULT, RemainingIterations,
4580
4581
SE.getConstant (TCType, MaxTripCount))) {
4581
4582
MaxTripCount =
@@ -4586,7 +4587,7 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
4586
4587
}
4587
4588
if (SE.isKnownPredicate (
4588
4589
CmpInst::ICMP_UGT,
4589
- SE.getConstant (TCType, NextVF.Width .getKnownMinValue ()),
4590
+ SE.getConstant (TCType, NextVF.Width .getFixedValue ()),
4590
4591
RemainingIterations))
4591
4592
continue ;
4592
4593
}
@@ -5257,14 +5258,14 @@ LoopVectorizationCostModel::getMemInstScalarizationCost(Instruction *I,
5257
5258
5258
5259
// Get the cost of the scalar memory instruction and address computation.
5259
5260
InstructionCost Cost =
5260
- VF.getKnownMinValue () * TTI.getAddressComputationCost (PtrTy, SE, PtrSCEV);
5261
+ VF.getFixedValue () * TTI.getAddressComputationCost (PtrTy, SE, PtrSCEV);
5261
5262
5262
5263
// Don't pass *I here, since it is scalar but will actually be part of a
5263
5264
// vectorized loop where the user of it is a vectorized instruction.
5264
5265
const Align Alignment = getLoadStoreAlignment (I);
5265
- Cost += VF.getKnownMinValue () * TTI.getMemoryOpCost (I->getOpcode (),
5266
- ValTy->getScalarType (),
5267
- Alignment, AS, CostKind);
5266
+ Cost += VF.getFixedValue () * TTI.getMemoryOpCost (I->getOpcode (),
5267
+ ValTy->getScalarType (),
5268
+ Alignment, AS, CostKind);
5268
5269
5269
5270
// Get the overhead of the extractelement and insertelement instructions
5270
5271
// we might create due to scalarization.
@@ -5280,7 +5281,7 @@ LoopVectorizationCostModel::getMemInstScalarizationCost(Instruction *I,
5280
5281
auto *VecI1Ty =
5281
5282
VectorType::get (IntegerType::getInt1Ty (ValTy->getContext ()), VF);
5282
5283
Cost += TTI.getScalarizationOverhead (
5283
- VecI1Ty, APInt::getAllOnes (VF.getKnownMinValue ()),
5284
+ VecI1Ty, APInt::getAllOnes (VF.getFixedValue ()),
5284
5285
/* Insert=*/ false , /* Extract=*/ true , CostKind);
5285
5286
Cost += TTI.getCFInstrCost (Instruction::Br, CostKind);
5286
5287
@@ -5341,6 +5342,10 @@ LoopVectorizationCostModel::getUniformMemOpCost(Instruction *I,
5341
5342
StoreInst *SI = cast<StoreInst>(I);
5342
5343
5343
5344
bool IsLoopInvariantStoreValue = Legal->isInvariant (SI->getValueOperand ());
5345
+ // TODO: We have existing tests that request the cost of extracting element
5346
+ // VF.getKnownMinValue() - 1 from a scalable vector. This does not represent
5347
+ // the actual generated code, which involves extracting the last element of
5348
+ // a scalable vector where the lane to extract is unknown at compile time.
5344
5349
return TTI.getAddressComputationCost (ValTy) +
5345
5350
TTI.getMemoryOpCost (Instruction::Store, ValTy, Alignment, AS,
5346
5351
CostKind) +
@@ -5623,7 +5628,7 @@ LoopVectorizationCostModel::getScalarizationOverhead(Instruction *I,
5623
5628
5624
5629
for (Type *VectorTy : getContainedTypes (RetTy)) {
5625
5630
Cost += TTI.getScalarizationOverhead (
5626
- cast<VectorType>(VectorTy), APInt::getAllOnes (VF.getKnownMinValue ()),
5631
+ cast<VectorType>(VectorTy), APInt::getAllOnes (VF.getFixedValue ()),
5627
5632
/* Insert=*/ true ,
5628
5633
/* Extract=*/ false , CostKind);
5629
5634
}
0 commit comments