Skip to content

Commit f701557

Browse files
committed
[SLP][NFC] Limit this PR to matchAssociativeReduction
1 parent b789116 commit f701557

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5540,7 +5540,8 @@ BoUpSLP::findReusedOrderedScalars(const BoUpSLP::TreeEntry &TE,
55405540
return std::max(Entries[I].front()->getVectorFactor(),
55415541
Entries[I].back()->getVectorFactor());
55425542
});
5543-
unsigned NumUndefs = count(CurrentOrder, NumScalars);
5543+
unsigned NumUndefs =
5544+
count_if(CurrentOrder, [&](unsigned Idx) { return Idx == NumScalars; });
55445545
if (ShuffledSubMasks.all() || (NumScalars > 2 && NumUndefs >= NumScalars / 2))
55455546
return std::nullopt;
55465547
return std::move(CurrentOrder);
@@ -8622,10 +8623,11 @@ void BoUpSLP::tryToVectorizeGatheredLoads(
86228623
State == LoadsState::CompressVectorize)
86238624
return false;
86248625
ConsecutiveNodesSize += VL.size();
8625-
size_t Start = std::distance(Slice.begin(), It);
8626-
size_t Sz = Slice.size() - Start;
8626+
unsigned Start = std::distance(Slice.begin(), It);
8627+
unsigned Sz = Slice.size() - Start;
86278628
return Sz < VL.size() ||
8628-
Slice.slice(Start, VL.size()) != VL;
8629+
Slice.slice(std::distance(Slice.begin(), It),
8630+
VL.size()) != VL;
86298631
}))
86308632
continue;
86318633
// Try to build long masked gather loads.
@@ -22205,9 +22207,9 @@ class HorizontalReduction {
2220522207
for (auto &PossibleReducedVals : PossibleReducedValsVect) {
2220622208
auto PossibleRedVals = PossibleReducedVals.second.takeVector();
2220722209
SmallVector<SmallVector<Value *>> PossibleRedValsVect;
22208-
for (auto &It : PossibleRedVals) {
22210+
for (auto &Slice : PossibleRedVals) {
2220922211
PossibleRedValsVect.emplace_back();
22210-
auto RedValsVect = It.second.takeVector();
22212+
auto RedValsVect = Slice.second.takeVector();
2221122213
stable_sort(RedValsVect, llvm::less_second());
2221222214
for (const std::pair<Value *, unsigned> &Data : RedValsVect)
2221322215
PossibleRedValsVect.back().append(Data.second, Data.first);

0 commit comments

Comments
 (0)