File tree Expand file tree Collapse file tree 1 file changed +12
-13
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 1 file changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -23833,21 +23833,20 @@ class HorizontalReduction {
2383323833 stable_sort(PossibleRedValsVect, [](const auto &P1, const auto &P2) {
2383423834 return P1.size() > P2.size();
2383523835 });
23836- int NewIdx = -1 ;
23836+ bool First = true ;
2383723837 for (ArrayRef<Value *> Data : PossibleRedValsVect) {
23838- if (NewIdx < 0 ||
23839- (!isGoodForReduction(Data) &&
23840- (!isa<LoadInst>(Data.front()) ||
23841- !isa<LoadInst>(ReducedVals[NewIdx].front()) ||
23842- getUnderlyingObject(
23843- cast<LoadInst>(Data.front())->getPointerOperand()) !=
23844- getUnderlyingObject(
23845- cast<LoadInst>(ReducedVals[NewIdx].front())
23846- ->getPointerOperand())))) {
23847- NewIdx = ReducedVals.size();
23838+ if (First) {
23839+ First = false;
2384823840 ReducedVals.emplace_back();
23849- }
23850- ReducedVals[NewIdx].append(Data.rbegin(), Data.rend());
23841+ } else if (!isGoodForReduction(Data)) {
23842+ auto *LI = dyn_cast<LoadInst>(Data.front());
23843+ auto *LastLI = dyn_cast<LoadInst>(ReducedVals.back().front());
23844+ if (!LI || !LastLI ||
23845+ getUnderlyingObject(LI->getPointerOperand()) !=
23846+ getUnderlyingObject(LastLI->getPointerOperand()))
23847+ ReducedVals.emplace_back();
23848+ }
23849+ ReducedVals.back().append(Data.rbegin(), Data.rend());
2385123850 }
2385223851 }
2385323852 // Sort the reduced values by number of same/alternate opcode and/or pointer
You can’t perform that action at this time.
0 commit comments