Skip to content

Commit 68aa6ac

Browse files
authored
[SLP] NFC. Remove redundant computation in getReorderingData. (#117295)
1 parent 55e9afa commit 68aa6ac

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5626,18 +5626,12 @@ BoUpSLP::getReorderingData(const TreeEntry &TE, bool TopToBottom) {
56265626
}
56275627
return false;
56285628
};
5629-
SmallDenseMap<unsigned, unsigned, 16> PhiToId;
5630-
SmallVector<unsigned> Phis(TE.Scalars.size());
5629+
OrdersType Phis(TE.Scalars.size());
56315630
std::iota(Phis.begin(), Phis.end(), 0);
5632-
OrdersType ResOrder(TE.Scalars.size());
5633-
for (unsigned Id = 0, Sz = TE.Scalars.size(); Id < Sz; ++Id)
5634-
PhiToId[Id] = Id;
56355631
stable_sort(Phis, PHICompare);
5636-
for (unsigned Id = 0, Sz = Phis.size(); Id < Sz; ++Id)
5637-
ResOrder[Id] = PhiToId[Phis[Id]];
5638-
if (isIdentityOrder(ResOrder))
5632+
if (isIdentityOrder(Phis))
56395633
return std::nullopt; // No need to reorder.
5640-
return std::move(ResOrder);
5634+
return std::move(Phis);
56415635
}
56425636
if (TE.isGather() && !TE.isAltShuffle() && allSameType(TE.Scalars)) {
56435637
// TODO: add analysis of other gather nodes with extractelement

0 commit comments

Comments
 (0)