@@ -6968,15 +6968,16 @@ bool BoUpSLP::analyzeConstantStrideCandidate(
69686968 SortedOffsetsFromBase[1] - SortedOffsetsFromBase[0];
69696969 // Determine size of the first group. Later we will check that all other
69706970 // groups have the same size.
6971- auto isEndOfGroupIndex = [=, &SortedOffsetsFromBase](unsigned Idx) {
6971+ auto IsEndOfGroupIndex = [=, &SortedOffsetsFromBase](unsigned Idx) {
69726972 return SortedOffsetsFromBase[Idx] - SortedOffsetsFromBase[Idx - 1] !=
69736973 StrideWithinGroup;
69746974 };
6975- unsigned GroupSize = *llvm::find_if(seq<unsigned>(1, Sz), isEndOfGroupIndex);
6975+ auto Indices = seq<unsigned>(1, Sz);
6976+ auto FoundIt = llvm::find_if(Indices, IsEndOfGroupIndex);
6977+ unsigned GroupSize = FoundIt != Indices.end() ? *FoundIt : Sz;
69766978
69776979 unsigned VecSz = Sz;
69786980 Type *NewScalarTy = ScalarTy;
6979- int64_t StrideIntVal = StrideWithinGroup;
69806981 FixedVectorType *StridedLoadTy = getWidenedType(NewScalarTy, VecSz);
69816982
69826983 // Quick detour: at this point we can say what the type of strided load would
@@ -6999,6 +7000,7 @@ bool BoUpSLP::analyzeConstantStrideCandidate(
69997000 if (!isStridedLoad(PointerOps, NewScalarTy, Alignment, Diff, VecSz))
70007001 return false;
70017002
7003+ int64_t StrideIntVal = StrideWithinGroup;
70027004 if (NeedsWidening) {
70037005 // Continue with checking the "shape" of `SortedOffsetsFromBase`.
70047006 // Check that the strides between groups are all the same.
0 commit comments