@@ -6918,13 +6918,13 @@ void BoUpSLP::tryToVectorizeGatheredLoads(
69186918 return L1.second > L2.second;
69196919 };
69206920
6921- auto IsMaskedGatherSupported = [&](ArrayRef<LoadInst *> Loads) {
6921+ auto IsMaskedGatherSupported = [&, TTI = TTI ](ArrayRef<LoadInst *> Loads) {
69226922 ArrayRef<Value *> Values(reinterpret_cast<Value *const *>(Loads.begin()),
69236923 Loads.size());
69246924 Align Alignment = computeCommonAlignment<LoadInst>(Values);
69256925 auto *Ty = getWidenedType(Loads.front()->getType(), Loads.size());
6926- return this-> TTI->isLegalMaskedGather(Ty, Alignment) &&
6927- !this-> TTI->forceScalarizeMaskedGather(Ty, Alignment);
6926+ return TTI->isLegalMaskedGather(Ty, Alignment) &&
6927+ !TTI->forceScalarizeMaskedGather(Ty, Alignment);
69286928 };
69296929
69306930 auto GetVectorizedRanges = [this](ArrayRef<LoadInst *> Loads,
@@ -16972,8 +16972,9 @@ void BoUpSLP::optimizeGatherSequence() {
1697216972 // and its mask indeces are the same as in the first one or undefs. E.g.
1697316973 // shuffle %0, poison, <0, 0, 0, undef> is less defined than shuffle %0,
1697416974 // poison, <0, 0, 0, 0>.
16975- auto &&IsIdenticalOrLessDefined = [this](Instruction *I1, Instruction *I2,
16976- SmallVectorImpl<int> &NewMask) {
16975+ auto &&IsIdenticalOrLessDefined = [TTI = TTI](Instruction *I1,
16976+ Instruction *I2,
16977+ SmallVectorImpl<int> &NewMask) {
1697716978 if (I1->getType() != I2->getType())
1697816979 return false;
1697916980 auto *SI1 = dyn_cast<ShuffleVectorInst>(I1);
@@ -17005,8 +17006,8 @@ void BoUpSLP::optimizeGatherSequence() {
1700517006 // Check if the last undefs actually change the final number of used vector
1700617007 // registers.
1700717008 return SM1.size() - LastUndefsCnt > 1 &&
17008- this-> TTI->getNumberOfParts(SI1->getType()) ==
17009- this-> TTI->getNumberOfParts(
17009+ TTI->getNumberOfParts(SI1->getType()) ==
17010+ TTI->getNumberOfParts(
1701017011 getWidenedType(SI1->getType()->getElementType(),
1701117012 SM1.size() - LastUndefsCnt));
1701217013 };
@@ -17767,7 +17768,7 @@ bool BoUpSLP::collectValuesToDemote(
1776717768 BitWidth = std::max(BitWidth, BitWidth1);
1776817769 return BitWidth > 0 && OrigBitWidth >= (BitWidth * 2);
1776917770 };
17770- auto FinalAnalysis = [&]() {
17771+ auto FinalAnalysis = [&, TTI = TTI ]() {
1777117772 if (!IsProfitableToDemote)
1777217773 return false;
1777317774 bool Res = all_of(
@@ -17786,8 +17787,8 @@ bool BoUpSLP::collectValuesToDemote(
1778617787 const unsigned VF = E.Scalars.size();
1778717788 Type *OrigScalarTy = E.Scalars.front()->getType();
1778817789 if (UniqueBases.size() <= 2 ||
17789- this-> TTI->getNumberOfParts(getWidenedType(OrigScalarTy, VF)) ==
17790- this-> TTI->getNumberOfParts(getWidenedType(
17790+ TTI->getNumberOfParts(getWidenedType(OrigScalarTy, VF)) ==
17791+ TTI->getNumberOfParts(getWidenedType(
1779117792 IntegerType::get(OrigScalarTy->getContext(), BitWidth), VF)))
1779217793 ToDemote.push_back(E.Idx);
1779317794 }
0 commit comments