@@ -3116,12 +3116,13 @@ LoopVectorizationCostModel::getDivRemSpeculationCost(Instruction *I,
31163116 // that we will create. This cost is likely to be zero. The phi node
31173117 // cost, if any, should be scaled by the block probability because it
31183118 // 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);
31213121
31223122 // 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);
31253126
31263127 // The cost of insertelement and extractelement instructions needed for
31273128 // scalarization.
@@ -4289,7 +4290,7 @@ static bool willGenerateVectors(VPlan &Plan, ElementCount VF,
42894290 return NumLegalParts <= VF.getKnownMinValue ();
42904291 }
42914292 // Two or more elements that share a register - are vectorized.
4292- return NumLegalParts < VF.getKnownMinValue ();
4293+ return NumLegalParts < VF.getFixedValue ();
42934294 };
42944295
42954296 // If no def nor is a store, e.g., branches, continue - no value to check.
@@ -4574,8 +4575,8 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
45744575 assert (!isa<SCEVCouldNotCompute>(TC) &&
45754576 " Trip count SCEV must be computable" );
45764577 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 ;
45794580 if (SE.isKnownPredicate (CmpInst::ICMP_ULT, RemainingIterations,
45804581 SE.getConstant (TCType, MaxTripCount))) {
45814582 MaxTripCount =
@@ -4586,7 +4587,7 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
45864587 }
45874588 if (SE.isKnownPredicate (
45884589 CmpInst::ICMP_UGT,
4589- SE.getConstant (TCType, NextVF.Width .getKnownMinValue ()),
4590+ SE.getConstant (TCType, NextVF.Width .getFixedValue ()),
45904591 RemainingIterations))
45914592 continue ;
45924593 }
@@ -5257,14 +5258,14 @@ LoopVectorizationCostModel::getMemInstScalarizationCost(Instruction *I,
52575258
52585259 // Get the cost of the scalar memory instruction and address computation.
52595260 InstructionCost Cost =
5260- VF.getKnownMinValue () * TTI.getAddressComputationCost (PtrTy, SE, PtrSCEV);
5261+ VF.getFixedValue () * TTI.getAddressComputationCost (PtrTy, SE, PtrSCEV);
52615262
52625263 // Don't pass *I here, since it is scalar but will actually be part of a
52635264 // vectorized loop where the user of it is a vectorized instruction.
52645265 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);
52685269
52695270 // Get the overhead of the extractelement and insertelement instructions
52705271 // we might create due to scalarization.
@@ -5280,7 +5281,7 @@ LoopVectorizationCostModel::getMemInstScalarizationCost(Instruction *I,
52805281 auto *VecI1Ty =
52815282 VectorType::get (IntegerType::getInt1Ty (ValTy->getContext ()), VF);
52825283 Cost += TTI.getScalarizationOverhead (
5283- VecI1Ty, APInt::getAllOnes (VF.getKnownMinValue ()),
5284+ VecI1Ty, APInt::getAllOnes (VF.getFixedValue ()),
52845285 /* Insert=*/ false , /* Extract=*/ true , CostKind);
52855286 Cost += TTI.getCFInstrCost (Instruction::Br, CostKind);
52865287
@@ -5341,6 +5342,10 @@ LoopVectorizationCostModel::getUniformMemOpCost(Instruction *I,
53415342 StoreInst *SI = cast<StoreInst>(I);
53425343
53435344 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.
53445349 return TTI.getAddressComputationCost (ValTy) +
53455350 TTI.getMemoryOpCost (Instruction::Store, ValTy, Alignment, AS,
53465351 CostKind) +
@@ -5623,7 +5628,7 @@ LoopVectorizationCostModel::getScalarizationOverhead(Instruction *I,
56235628
56245629 for (Type *VectorTy : getContainedTypes (RetTy)) {
56255630 Cost += TTI.getScalarizationOverhead (
5626- cast<VectorType>(VectorTy), APInt::getAllOnes (VF.getKnownMinValue ()),
5631+ cast<VectorType>(VectorTy), APInt::getAllOnes (VF.getFixedValue ()),
56275632 /* Insert=*/ true ,
56285633 /* Extract=*/ false , CostKind);
56295634 }
0 commit comments