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(
21198
21198
}
21199
21199
}
21200
21200
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.
21201
21204
unsigned MaxRegVF = MaxVF;
21205
+
21202
21206
MaxVF = std::min<unsigned>(MaxVF, bit_floor(Operands.size()));
21203
21207
if (MaxVF < MinVF) {
21204
21208
LLVM_DEBUG(dbgs() << "SLP: Vectorization infeasible as MaxVF (" << MaxVF
@@ -21207,13 +21211,11 @@ bool SLPVectorizerPass::vectorizeStores(
21207
21211
continue;
21208
21212
}
21209
21213
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
+
21217
21219
unsigned End = Operands.size();
21218
21220
unsigned Repeat = 0;
21219
21221
constexpr unsigned MaxAttempts = 4;
You can’t perform that action at this time.
0 commit comments