Skip to content

Commit c185092

Browse files
committed
fixup! [SLP] More OOP to simplify vectorizeStores() (NFC)
1 parent ef65d73 commit c185092

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20864,7 +20864,8 @@ class RelatedStoreInsts {
2086420864
}
2086520865

2086620866
void reset(unsigned NewBaseInstr) {
20867-
assert(NewBaseInstr < AllStores.size());
20867+
assert(NewBaseInstr < AllStores.size() &&
20868+
"Instruction index out of bounds");
2086820869
BaseInstrIdx = NewBaseInstr;
2086920870
Instrs.clear();
2087020871
insertOrLookup(NewBaseInstr, 0);
@@ -20894,9 +20895,8 @@ class RelatedStoreInsts {
2089420895
// again. Their distance will be "rebased" to use NewBaseInstIdx as
2089520896
// reference.
2089620897
for (auto [Dist, InstIdx] : PrevSet) {
20897-
if (InstIdx >= MinSafeIdx) {
20898+
if (InstIdx >= MinSafeIdx)
2089820899
insertOrLookup(InstIdx, Dist - DistFromCurBase);
20899-
}
2090020900
}
2090120901
}
2090220902

@@ -21270,6 +21270,7 @@ bool SLPVectorizerPass::vectorizeStores(
2127021270

2127121271
// If there is already a store in the group with the same PtrDiff, try to
2127221272
// vectorize the existing instructions before adding the current store.
21273+
// Otherwise, insert this store and keep collecting.
2127321274
if (std::optional<unsigned> PrevInst =
2127421275
RelatedStores->insertOrLookup(Idx, *Diff)) {
2127521276
TryToVectorize(RelatedStores->getStores());

0 commit comments

Comments
 (0)