[llvm] b3d2d50 - [SLP][NFC]Reorder code for better structural complexity, NFC
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 9 12:41:57 PDT 2024
Author: Alexey Bataev
Date: 2024-09-09T12:33:18-07:00
New Revision: b3d2d5039b9b8aa10a86c593387f200b15c02aef
URL: https://github.com/llvm/llvm-project/commit/b3d2d5039b9b8aa10a86c593387f200b15c02aef
DIFF: https://github.com/llvm/llvm-project/commit/b3d2d5039b9b8aa10a86c593387f200b15c02aef.diff
LOG: [SLP][NFC]Reorder code for better structural complexity, NFC
Added:
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index c87d1055c8bc5d..c89a50fc7bd429 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -8464,6 +8464,9 @@ void BoUpSLP::transformNodes() {
for (unsigned VF = VL.size() / 2; VF >= MinVF; VF /= 2) {
for (unsigned Cnt = StartIdx; Cnt + VF <= End; Cnt += VF) {
ArrayRef<Value *> Slice = VL.slice(Cnt, VF);
+ // If any instruction is vectorized already - do not try again.
+ if (getTreeEntry(Slice.front()) || getTreeEntry(Slice.back()))
+ continue;
InstructionsState S = getSameOpcode(Slice, *TLI);
if (!S.getOpcode() || S.isAltShuffle() ||
(S.getOpcode() != Instruction::Load &&
@@ -8472,20 +8475,18 @@ void BoUpSLP::transformNodes() {
UserIgnoreList);
})))
continue;
- if (!getTreeEntry(Slice.front()) && !getTreeEntry(Slice.back())) {
- unsigned PrevSize = VectorizableTree.size();
- buildTree_rec(Slice, 0, EdgeInfo(&E, UINT_MAX));
- if (PrevSize + 1 == VectorizableTree.size() &&
- VectorizableTree[PrevSize]->isGather()) {
- VectorizableTree.pop_back();
- continue;
- }
- E.CombinedEntriesWithIndices.emplace_back(PrevSize, Cnt);
- if (StartIdx == Cnt)
- StartIdx = Cnt + VF;
- if (End == Cnt + VF)
- End = Cnt;
+ unsigned PrevSize = VectorizableTree.size();
+ buildTree_rec(Slice, 0, EdgeInfo(&E, UINT_MAX));
+ if (PrevSize + 1 == VectorizableTree.size() &&
+ VectorizableTree[PrevSize]->isGather()) {
+ VectorizableTree.pop_back();
+ continue;
}
+ E.CombinedEntriesWithIndices.emplace_back(PrevSize, Cnt);
+ if (StartIdx == Cnt)
+ StartIdx = Cnt + VF;
+ if (End == Cnt + VF)
+ End = Cnt;
}
}
}
More information about the llvm-commits
mailing list