@@ -2237,8 +2237,7 @@ class BoUpSLP {
22372237 bool isStridedLoad(ArrayRef<Value *> VL, ArrayRef<Value *> PointerOps,
22382238 ArrayRef<unsigned> Order, const TargetTransformInfo &TTI,
22392239 const DataLayout &DL, ScalarEvolution &SE,
2240- const bool IsAnyPointerUsedOutGraph, const int64_t Diff,
2241- StridedPtrInfo &SPtrInfo) const;
2240+ const int64_t Diff, StridedPtrInfo &SPtrInfo) const;
22422241
22432242 /// Checks if the given array of loads can be represented as a vectorized,
22442243 /// scatter or just simple gather.
@@ -6822,10 +6821,22 @@ bool BoUpSLP::isStridedLoad(ArrayRef<Value *> VL, ArrayRef<Value *> PointerOps,
68226821 ArrayRef<unsigned> Order,
68236822 const TargetTransformInfo &TTI,
68246823 const DataLayout &DL, ScalarEvolution &SE,
6825- const bool IsAnyPointerUsedOutGraph,
68266824 const int64_t Diff,
68276825 StridedPtrInfo &SPtrInfo) const {
68286826 const size_t Sz = VL.size();
6827+ // Simple check if not a strided access - clear order.
6828+ bool IsPossibleStrided = Diff % (Sz - 1) == 0;
6829+ if (!IsPossibleStrided)
6830+ return false;
6831+
6832+ // Try to generate strided load node.
6833+ auto IsAnyPointerUsedOutGraph =
6834+ IsPossibleStrided && any_of(PointerOps, [&](Value *V) {
6835+ return isa<Instruction>(V) && any_of(V->users(), [&](User *U) {
6836+ return !isVectorized(U) && !MustGather.contains(U);
6837+ });
6838+ });
6839+
68296840 const uint64_t AbsoluteDiff = std::abs(Diff);
68306841 Type *ScalarTy = VL.front()->getType();
68316842 auto *VecTy = getWidenedType(ScalarTy, Sz);
@@ -6956,18 +6967,7 @@ BoUpSLP::LoadsState BoUpSLP::canVectorizeLoads(
69566967 cast<Instruction>(V), UserIgnoreList);
69576968 }))
69586969 return LoadsState::CompressVectorize;
6959- // Simple check if not a strided access - clear order.
6960- bool IsPossibleStrided = *Diff % (Sz - 1) == 0;
6961- // Try to generate strided load node.
6962- auto IsAnyPointerUsedOutGraph =
6963- IsPossibleStrided && any_of(PointerOps, [&](Value *V) {
6964- return isa<Instruction>(V) && any_of(V->users(), [&](User *U) {
6965- return !isVectorized(U) && !MustGather.contains(U);
6966- });
6967- });
6968- if (IsPossibleStrided &&
6969- isStridedLoad(VL, PointerOps, Order, *TTI, *DL, *SE,
6970- IsAnyPointerUsedOutGraph, *Diff, SPtrInfo))
6970+ if (isStridedLoad(VL, PointerOps, Order, *TTI, *DL, *SE, *Diff, SPtrInfo))
69716971 return LoadsState::StridedVectorize;
69726972 }
69736973 if (!TTI->isLegalMaskedGather(VecTy, CommonAlignment) ||
0 commit comments