Skip to content

Commit e6442a2

Browse files
author
Mikhail Gudim
committed
addressed review comments
1 parent 1e6f589 commit e6442a2

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6985,11 +6985,10 @@ bool BoUpSLP::analyzeConstantStrideCandidate(
69856985
if (NeedsWidening) {
69866986
if (Sz % GroupSize != 0)
69876987
return false;
6988-
VecSz = Sz / GroupSize;
69896988

69906989
if (StrideWithinGroup != 1)
69916990
return false;
6992-
unsigned VecSz = Sz / GroupSize;
6991+
VecSz = Sz / GroupSize;
69936992
NewScalarTy = Type::getIntNTy(
69946993
SE->getContext(),
69956994
DL->getTypeSizeInBits(ScalarTy).getFixedValue() * GroupSize);
@@ -7013,19 +7012,14 @@ bool BoUpSLP::analyzeConstantStrideCandidate(
70137012
return false;
70147013
}
70157014

7016-
auto CheckGroup = [&](const unsigned StartIdx, const unsigned GroupSize0,
7017-
const int64_t StrideWithinGroup) -> bool {
7018-
unsigned GroupEndIdx = StartIdx + 1;
7019-
for (; GroupEndIdx != Sz; ++GroupEndIdx) {
7020-
if (SortedOffsetsFromBase[GroupEndIdx] -
7021-
SortedOffsetsFromBase[GroupEndIdx - 1] !=
7022-
StrideWithinGroup)
7023-
break;
7024-
}
7025-
return GroupEndIdx - StartIdx == GroupSize0;
7015+
auto CheckGroup = [=](const unsigned StartIdx) -> bool {
7016+
auto Indices = seq<unsigned>(StartIdx + 1, Sz);
7017+
auto FoundIt = llvm::find_if(Indices, IsEndOfGroupIndex);
7018+
unsigned GroupEndIdx = FoundIt != Indices.end() ? *FoundIt : Sz;
7019+
return GroupEndIdx - StartIdx == GroupSize;
70267020
};
70277021
for (unsigned I = 0; I < Sz; I += GroupSize) {
7028-
if (!CheckGroup(I, GroupSize, StrideWithinGroup))
7022+
if (!CheckGroup(I))
70297023
return false;
70307024
}
70317025
}

0 commit comments

Comments
 (0)