@@ -22140,7 +22140,7 @@ class HorizontalReduction {
22140
22140
// Try to regroup reduced values so that it gets more profitable to try to
22141
22141
// reduce them. Values are grouped by their value ids, instructions - by
22142
22142
// 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
22144
22144
// instructions (grouping them by the predicate).
22145
22145
SmallMapVector<
22146
22146
size_t, SmallMapVector<size_t, SmallMapVector<Value *, unsigned, 2>, 2>,
@@ -22207,10 +22207,9 @@ class HorizontalReduction {
22207
22207
for (auto &PossibleReducedVals : PossibleReducedValsVect) {
22208
22208
auto PossibleRedVals = PossibleReducedVals.second.takeVector();
22209
22209
SmallVector<SmallVector<Value *>> PossibleRedValsVect;
22210
- for (auto It = PossibleRedVals.begin(), E = PossibleRedVals.end();
22211
- It != E; ++It) {
22210
+ for (auto &Slice : PossibleRedVals) {
22212
22211
PossibleRedValsVect.emplace_back();
22213
- auto RedValsVect = It-> second.takeVector();
22212
+ auto RedValsVect = Slice. second.takeVector();
22214
22213
stable_sort(RedValsVect, llvm::less_second());
22215
22214
for (const std::pair<Value *, unsigned> &Data : RedValsVect)
22216
22215
PossibleRedValsVect.back().append(Data.second, Data.first);
@@ -22370,8 +22369,8 @@ class HorizontalReduction {
22370
22369
SmallVector<Value *> Candidates;
22371
22370
Candidates.reserve(2 * OrigReducedVals.size());
22372
22371
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 );
22375
22374
// Check if the reduction value was not overriden by the extractelement
22376
22375
// instruction because of the vectorization and exclude it, if it is not
22377
22376
// compatible with other values.
@@ -22382,7 +22381,7 @@ class HorizontalReduction {
22382
22381
(S && !Inst))
22383
22382
continue;
22384
22383
Candidates.push_back(RdxVal);
22385
- TrackedToOrig.try_emplace(RdxVal, OrigReducedVals[Cnt] );
22384
+ TrackedToOrig.try_emplace(RdxVal, ReducedVal );
22386
22385
}
22387
22386
bool ShuffledExtracts = false;
22388
22387
// Try to handle shuffled extractelements.
0 commit comments