Skip to content

Commit b3d2d50

Browse files
committed
[SLP][NFC]Reorder code for better structural complexity, NFC
1 parent e62bf7c commit b3d2d50

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8464,6 +8464,9 @@ void BoUpSLP::transformNodes() {
84648464
for (unsigned VF = VL.size() / 2; VF >= MinVF; VF /= 2) {
84658465
for (unsigned Cnt = StartIdx; Cnt + VF <= End; Cnt += VF) {
84668466
ArrayRef<Value *> Slice = VL.slice(Cnt, VF);
8467+
// If any instruction is vectorized already - do not try again.
8468+
if (getTreeEntry(Slice.front()) || getTreeEntry(Slice.back()))
8469+
continue;
84678470
InstructionsState S = getSameOpcode(Slice, *TLI);
84688471
if (!S.getOpcode() || S.isAltShuffle() ||
84698472
(S.getOpcode() != Instruction::Load &&
@@ -8472,20 +8475,18 @@ void BoUpSLP::transformNodes() {
84728475
UserIgnoreList);
84738476
})))
84748477
continue;
8475-
if (!getTreeEntry(Slice.front()) && !getTreeEntry(Slice.back())) {
8476-
unsigned PrevSize = VectorizableTree.size();
8477-
buildTree_rec(Slice, 0, EdgeInfo(&E, UINT_MAX));
8478-
if (PrevSize + 1 == VectorizableTree.size() &&
8479-
VectorizableTree[PrevSize]->isGather()) {
8480-
VectorizableTree.pop_back();
8481-
continue;
8482-
}
8483-
E.CombinedEntriesWithIndices.emplace_back(PrevSize, Cnt);
8484-
if (StartIdx == Cnt)
8485-
StartIdx = Cnt + VF;
8486-
if (End == Cnt + VF)
8487-
End = Cnt;
8478+
unsigned PrevSize = VectorizableTree.size();
8479+
buildTree_rec(Slice, 0, EdgeInfo(&E, UINT_MAX));
8480+
if (PrevSize + 1 == VectorizableTree.size() &&
8481+
VectorizableTree[PrevSize]->isGather()) {
8482+
VectorizableTree.pop_back();
8483+
continue;
84888484
}
8485+
E.CombinedEntriesWithIndices.emplace_back(PrevSize, Cnt);
8486+
if (StartIdx == Cnt)
8487+
StartIdx = Cnt + VF;
8488+
if (End == Cnt + VF)
8489+
End = Cnt;
84898490
}
84908491
}
84918492
}

0 commit comments

Comments
 (0)