Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6918,7 +6918,7 @@ void BoUpSLP::tryToVectorizeGatheredLoads(
return L1.second > L2.second;
};

auto IsMaskedGatherSupported = [&](ArrayRef<LoadInst *> Loads) {
auto IsMaskedGatherSupported = [&, TTI = TTI](ArrayRef<LoadInst *> Loads) {
ArrayRef<Value *> Values(reinterpret_cast<Value *const *>(Loads.begin()),
Loads.size());
Align Alignment = computeCommonAlignment<LoadInst>(Values);
Expand Down Expand Up @@ -7085,9 +7085,10 @@ void BoUpSLP::tryToVectorizeGatheredLoads(
}
SmallVector<std::pair<LoadInst *, int>> LocalLoadsDists(LoadsDists);
SmallVector<LoadInst *> OriginalLoads(LocalLoadsDists.size());
transform(
LoadsDists, OriginalLoads.begin(),
[](const std::pair<LoadInst *, int> &L) { return L.first; });
transform(LoadsDists, OriginalLoads.begin(),
[](const std::pair<LoadInst *, int> &L) -> LoadInst * {
return L.first;
});
stable_sort(LocalLoadsDists, LoadSorter);
SmallVector<LoadInst *> Loads;
unsigned MaxConsecutiveDistance = 0;
Expand Down Expand Up @@ -7314,7 +7315,8 @@ void BoUpSLP::tryToVectorizeGatheredLoads(
if (!Ref.empty() && !NonVectorized.empty() &&
std::accumulate(
Ref.begin(), Ref.end(), 0u,
[](unsigned S, ArrayRef<std::pair<LoadInst *, int>> LoadsDists) {
[](unsigned S,
ArrayRef<std::pair<LoadInst *, int>> LoadsDists) -> unsigned {
return S + LoadsDists.size();
}) != NonVectorized.size() &&
IsMaskedGatherSupported(NonVectorized)) {
Expand Down Expand Up @@ -16970,8 +16972,9 @@ void BoUpSLP::optimizeGatherSequence() {
// and its mask indeces are the same as in the first one or undefs. E.g.
// shuffle %0, poison, <0, 0, 0, undef> is less defined than shuffle %0,
// poison, <0, 0, 0, 0>.
auto &&IsIdenticalOrLessDefined = [this](Instruction *I1, Instruction *I2,
SmallVectorImpl<int> &NewMask) {
auto &&IsIdenticalOrLessDefined = [TTI = TTI](Instruction *I1,
Instruction *I2,
SmallVectorImpl<int> &NewMask) {
if (I1->getType() != I2->getType())
return false;
auto *SI1 = dyn_cast<ShuffleVectorInst>(I1);
Expand Down Expand Up @@ -17765,7 +17768,7 @@ bool BoUpSLP::collectValuesToDemote(
BitWidth = std::max(BitWidth, BitWidth1);
return BitWidth > 0 && OrigBitWidth >= (BitWidth * 2);
};
auto FinalAnalysis = [&]() {
auto FinalAnalysis = [&, TTI = TTI]() {
if (!IsProfitableToDemote)
return false;
bool Res = all_of(
Expand Down
Loading