Skip to content

Commit b779e84

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

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
@@ -20506,7 +20506,8 @@ class RelatedStoreInsts {
2050620506
}
2050720507

2050820508
void reset(unsigned NewBaseInstr) {
20509-
assert(NewBaseInstr < AllStores.size());
20509+
assert(NewBaseInstr < AllStores.size() &&
20510+
"Instruction index out of bounds");
2051020511
BaseInstrIdx = NewBaseInstr;
2051120512
Instrs.clear();
2051220513
insertOrLookup(NewBaseInstr, 0);
@@ -20536,9 +20537,8 @@ class RelatedStoreInsts {
2053620537
// again. Their distance will be "rebased" to use NewBaseInstIdx as
2053720538
// reference.
2053820539
for (auto [Dist, InstIdx] : PrevSet) {
20539-
if (InstIdx >= MinSafeIdx) {
20540+
if (InstIdx >= MinSafeIdx)
2054020541
insertOrLookup(InstIdx, Dist - DistFromCurBase);
20541-
}
2054220542
}
2054320543
}
2054420544

@@ -20912,6 +20912,7 @@ bool SLPVectorizerPass::vectorizeStores(
2091220912

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

0 commit comments

Comments
 (0)