@@ -6861,23 +6861,16 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
6861
6861
case Instruction::ExtractElement: {
6862
6862
if (CurrentOrder.empty()) {
6863
6863
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);
6872
6873
}
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);
6881
6874
// Insert new order with initial value 0, if it does not exist,
6882
6875
// otherwise return the iterator to the existing one.
6883
6876
newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx,
@@ -6931,28 +6924,18 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
6931
6924
fixupOrderingIndices(CurrentOrder);
6932
6925
switch (State) {
6933
6926
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())
6938
6930
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
6943
6932
LLVM_DEBUG(dbgs() << "SLP: added a vector of jumbled loads.\n");
6944
- }
6945
6933
TE->setOperandsInOrder();
6946
6934
break;
6947
6935
case TreeEntry::StridedVectorize:
6948
6936
// 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);
6956
6939
TE->setOperandsInOrder();
6957
6940
LLVM_DEBUG(dbgs() << "SLP: added a vector of strided loads.\n");
6958
6941
break;
0 commit comments