Skip to content

Commit f65ae19

Browse files
author
git apple-llvm automerger
committed
Merge commit '949103b45c2f' from llvm.org/main into next
2 parents c69623a + 949103b commit f65ae19

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22140,7 +22140,7 @@ class HorizontalReduction {
2214022140
// Try to regroup reduced values so that it gets more profitable to try to
2214122141
// reduce them. Values are grouped by their value ids, instructions - by
2214222142
// instruction op id and/or alternate op id, plus do extra analysis for
22143-
// loads (grouping them by the distabce between pointers) and cmp
22143+
// loads (grouping them by the distance between pointers) and cmp
2214422144
// instructions (grouping them by the predicate).
2214522145
SmallMapVector<
2214622146
size_t, SmallMapVector<size_t, SmallMapVector<Value *, unsigned, 2>, 2>,
@@ -22207,10 +22207,9 @@ class HorizontalReduction {
2220722207
for (auto &PossibleReducedVals : PossibleReducedValsVect) {
2220822208
auto PossibleRedVals = PossibleReducedVals.second.takeVector();
2220922209
SmallVector<SmallVector<Value *>> PossibleRedValsVect;
22210-
for (auto It = PossibleRedVals.begin(), E = PossibleRedVals.end();
22211-
It != E; ++It) {
22210+
for (auto &Slice : PossibleRedVals) {
2221222211
PossibleRedValsVect.emplace_back();
22213-
auto RedValsVect = It->second.takeVector();
22212+
auto RedValsVect = Slice.second.takeVector();
2221422213
stable_sort(RedValsVect, llvm::less_second());
2221522214
for (const std::pair<Value *, unsigned> &Data : RedValsVect)
2221622215
PossibleRedValsVect.back().append(Data.second, Data.first);
@@ -22370,8 +22369,8 @@ class HorizontalReduction {
2237022369
SmallVector<Value *> Candidates;
2237122370
Candidates.reserve(2 * OrigReducedVals.size());
2237222371
DenseMap<Value *, Value *> TrackedToOrig(2 * OrigReducedVals.size());
22373-
for (unsigned Cnt = 0, Sz = OrigReducedVals.size(); Cnt < Sz; ++Cnt) {
22374-
Value *RdxVal = TrackedVals.at(OrigReducedVals[Cnt]);
22372+
for (Value *ReducedVal : OrigReducedVals) {
22373+
Value *RdxVal = TrackedVals.at(ReducedVal);
2237522374
// Check if the reduction value was not overriden by the extractelement
2237622375
// instruction because of the vectorization and exclude it, if it is not
2237722376
// compatible with other values.
@@ -22382,7 +22381,7 @@ class HorizontalReduction {
2238222381
(S && !Inst))
2238322382
continue;
2238422383
Candidates.push_back(RdxVal);
22385-
TrackedToOrig.try_emplace(RdxVal, OrigReducedVals[Cnt]);
22384+
TrackedToOrig.try_emplace(RdxVal, ReducedVal);
2238622385
}
2238722386
bool ShuffledExtracts = false;
2238822387
// Try to handle shuffled extractelements.

0 commit comments

Comments
 (0)