Skip to content

Commit 1e6f589

Browse files
author
Mikhail Gudim
committed
address review comments.
1 parent 2b61c67 commit 1e6f589

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6968,16 +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;
6980-
FixedVectorType *StridedLoadTy = getWidenedType(NewScalarTy, VecSz);
69816981

69826982
// Quick detour: at this point we can say what the type of strided load would
69836983
// be if all the checks pass. Check if this type is legal for the target.
@@ -6993,12 +6993,12 @@ bool BoUpSLP::analyzeConstantStrideCandidate(
69936993
NewScalarTy = Type::getIntNTy(
69946994
SE->getContext(),
69956995
DL->getTypeSizeInBits(ScalarTy).getFixedValue() * GroupSize);
6996-
StridedLoadTy = getWidenedType(NewScalarTy, VecSz);
69976996
}
69986997

69996998
if (!isStridedLoad(PointerOps, NewScalarTy, Alignment, Diff, VecSz))
70006999
return false;
70017000

7001+
int64_t StrideIntVal = StrideWithinGroup;
70027002
if (NeedsWidening) {
70037003
// Continue with checking the "shape" of `SortedOffsetsFromBase`.
70047004
// Check that the strides between groups are all the same.
@@ -7032,7 +7032,7 @@ bool BoUpSLP::analyzeConstantStrideCandidate(
70327032

70337033
Type *StrideTy = DL->getIndexType(Ptr0->getType());
70347034
SPtrInfo.StrideVal = ConstantInt::get(StrideTy, StrideIntVal);
7035-
SPtrInfo.Ty = StridedLoadTy;
7035+
SPtrInfo.Ty = getWidenedType(NewScalarTy, VecSz);
70367036
return true;
70377037
}
70387038

0 commit comments

Comments
 (0)