File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -21198,7 +21198,11 @@ bool SLPVectorizerPass::vectorizeStores(
2119821198 }
2119921199 }
2120021200
21201+ // MaxRegVF represents the number of instructions (scalar, or vector in
21202+ // case of revec) that can be vectorized to naturally fit in a vector
21203+ // register.
2120121204 unsigned MaxRegVF = MaxVF;
21205+
2120221206 MaxVF = std::min<unsigned>(MaxVF, bit_floor(Operands.size()));
2120321207 if (MaxVF < MinVF) {
2120421208 LLVM_DEBUG(dbgs() << "SLP: Vectorization infeasible as MaxVF (" << MaxVF
@@ -21207,13 +21211,11 @@ bool SLPVectorizerPass::vectorizeStores(
2120721211 continue;
2120821212 }
2120921213
21210- unsigned Sz = 1 + Log2_32(MaxVF) - Log2_32(MinVF);
21211- SmallVector<unsigned> CandidateVFs(Sz + (NonPowerOf2VF > 0 ? 1 : 0));
21212- unsigned Size = MinVF;
21213- for (unsigned &VF : reverse(CandidateVFs)) {
21214- VF = Size > MaxVF ? NonPowerOf2VF : Size;
21215- Size *= 2;
21216- }
21214+ SmallVector<unsigned> CandidateVFs;
21215+ for (unsigned VF = std::max(MaxVF, NonPowerOf2VF); VF >= MinVF;
21216+ VF = divideCeil(VF, 2))
21217+ CandidateVFs.push_back(VF);
21218+
2121721219 unsigned End = Operands.size();
2121821220 unsigned Repeat = 0;
2121921221 constexpr unsigned MaxAttempts = 4;
You can’t perform that action at this time.
0 commit comments