Skip to content

Commit 27f0eb3

Browse files
committed
Address review comments
1 parent 97cb72b commit 27f0eb3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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 {
15601563
private:
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

Comments
 (0)