Skip to content

Commit 5b20595

Browse files
authored
[SLP] NFC. Reduce newTreeEntry usage. (#92994)
1 parent cb6a623 commit 5b20595

File tree

1 file changed

+15
-32
lines changed

1 file changed

+15
-32
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6861,23 +6861,16 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
68616861
case Instruction::ExtractElement: {
68626862
if (CurrentOrder.empty()) {
68636863
LLVM_DEBUG(dbgs() << "SLP: Reusing or shuffling extract sequence.\n");
6864-
newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx,
6865-
ReuseShuffleIndices);
6866-
// This is a special case, as it does not gather, but at the same time
6867-
// we are not extending buildTree_rec() towards the operands.
6868-
ValueList Op0;
6869-
Op0.assign(VL.size(), VL0->getOperand(0));
6870-
VectorizableTree.back()->setOperand(0, Op0);
6871-
return;
6864+
} else {
6865+
LLVM_DEBUG({
6866+
dbgs() << "SLP: Reusing or shuffling of reordered extract sequence "
6867+
"with order";
6868+
for (unsigned Idx : CurrentOrder)
6869+
dbgs() << " " << Idx;
6870+
dbgs() << "\n";
6871+
});
6872+
fixupOrderingIndices(CurrentOrder);
68726873
}
6873-
LLVM_DEBUG({
6874-
dbgs() << "SLP: Reusing or shuffling of reordered extract sequence "
6875-
"with order";
6876-
for (unsigned Idx : CurrentOrder)
6877-
dbgs() << " " << Idx;
6878-
dbgs() << "\n";
6879-
});
6880-
fixupOrderingIndices(CurrentOrder);
68816874
// Insert new order with initial value 0, if it does not exist,
68826875
// otherwise return the iterator to the existing one.
68836876
newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx,
@@ -6931,28 +6924,18 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
69316924
fixupOrderingIndices(CurrentOrder);
69326925
switch (State) {
69336926
case TreeEntry::Vectorize:
6934-
if (CurrentOrder.empty()) {
6935-
// Original loads are consecutive and does not require reordering.
6936-
TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx,
6937-
ReuseShuffleIndices);
6927+
TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx,
6928+
ReuseShuffleIndices, CurrentOrder);
6929+
if (CurrentOrder.empty())
69386930
LLVM_DEBUG(dbgs() << "SLP: added a vector of loads.\n");
6939-
} else {
6940-
// Need to reorder.
6941-
TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx,
6942-
ReuseShuffleIndices, CurrentOrder);
6931+
else
69436932
LLVM_DEBUG(dbgs() << "SLP: added a vector of jumbled loads.\n");
6944-
}
69456933
TE->setOperandsInOrder();
69466934
break;
69476935
case TreeEntry::StridedVectorize:
69486936
// Vectorizing non-consecutive loads with `llvm.masked.gather`.
6949-
if (CurrentOrder.empty()) {
6950-
TE = newTreeEntry(VL, TreeEntry::StridedVectorize, Bundle, S,
6951-
UserTreeIdx, ReuseShuffleIndices);
6952-
} else {
6953-
TE = newTreeEntry(VL, TreeEntry::StridedVectorize, Bundle, S,
6954-
UserTreeIdx, ReuseShuffleIndices, CurrentOrder);
6955-
}
6937+
TE = newTreeEntry(VL, TreeEntry::StridedVectorize, Bundle, S,
6938+
UserTreeIdx, ReuseShuffleIndices, CurrentOrder);
69566939
TE->setOperandsInOrder();
69576940
LLVM_DEBUG(dbgs() << "SLP: added a vector of strided loads.\n");
69586941
break;

0 commit comments

Comments
 (0)