@@ -978,7 +978,10 @@ class LoopVectorizationCostModel {
978978 InterleavedAccessInfo &IAI)
979979 : ScalarEpilogueStatus(SEL), TheLoop(L), PSE(PSE), LI(LI), Legal(Legal),
980980 TTI (TTI), TLI(TLI), DB(DB), AC(AC), ORE(ORE), TheFunction(F),
981- Hints(Hints), InterleaveInfo(IAI), CostKind(TTI::TCK_RecipThroughput) {}
981+ Hints(Hints), InterleaveInfo(IAI), CostKind(TTI::TCK_RecipThroughput) {
982+ if (TTI.supportsScalableVectors () || ForceTargetSupportsScalableVectors)
983+ initializeVScaleForTuning ();
984+ }
982985
983986 // / \return An upper bound for the vectorization factors (both fixed and
984987 // / scalable). If the factors are 0, vectorization and interleaving should be
@@ -1560,6 +1563,8 @@ class LoopVectorizationCostModel {
15601563private:
15611564 unsigned NumPredStores = 0 ;
15621565
1566+ // / Used to store the value of vscale used for tuning the cost model. It is
1567+ // / initialized during object construction.
15631568 std::optional<unsigned > VScaleForTuning;
15641569
15651570 // / Initializes the value of vscale used for tuning the cost model. If
@@ -3861,11 +3866,6 @@ FixedScalableVFPair LoopVectorizationCostModel::computeFeasibleMaxVF(
38613866 if (!Legal->isSafeForAnyVectorWidth ())
38623867 this ->MaxSafeElements = MaxSafeElements;
38633868
3864- if (MaxSafeScalableVF != ElementCount::getScalable (0 )) {
3865- // Cache the value of vscale for tuning, since we'll need it.
3866- initializeVScaleForTuning ();
3867- }
3868-
38693869 LLVM_DEBUG (dbgs () << " LV: The max safe fixed VF is: " << MaxSafeFixedVF
38703870 << " .\n " );
38713871 LLVM_DEBUG (dbgs () << " LV: The max safe scalable VF is: " << MaxSafeScalableVF
0 commit comments