Skip to content

Commit 617398e

Browse files
authored
[SLP] Collect candidate VFs in vector in vectorizeStores (NFC). (#82793)
This is in preparation for #77790 and makes it easy to add other, non-power-of-2 VFs for processing. PR: #82793
1 parent ebaf26d commit 617398e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14026,10 +14026,17 @@ bool SLPVectorizerPass::vectorizeStores(ArrayRef<StoreInst *> Stores,
1402614026
continue;
1402714027
}
1402814028

14029+
unsigned Sz = 1 + Log2_32(MaxVF) - Log2_32(MinVF);
14030+
SmallVector<unsigned> CandidateVFs(Sz);
1402914031
// FIXME: Is division-by-2 the correct step? Should we assert that the
1403014032
// register size is a power-of-2?
14033+
unsigned Size = MaxVF;
14034+
for_each(CandidateVFs, [&](unsigned &VF) {
14035+
VF = Size;
14036+
Size /= 2;
14037+
});
1403114038
unsigned StartIdx = 0;
14032-
for (unsigned Size = MaxVF; Size >= MinVF; Size /= 2) {
14039+
for (unsigned Size : CandidateVFs) {
1403314040
for (unsigned Cnt = StartIdx, E = Operands.size(); Cnt + Size <= E;) {
1403414041
ArrayRef<Value *> Slice = ArrayRef(Operands).slice(Cnt, Size);
1403514042
assert(

0 commit comments

Comments
 (0)