[llvm] [Transform][LoadStoreVectorizer] allow redundant in Chain (PR #163019)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 12 21:25:36 PST 2025
================
@@ -626,26 +626,38 @@ std::vector<Chain> Vectorizer::splitChainByContiguity(Chain &C) {
std::vector<Chain> Ret;
Ret.push_back({C.front()});
+ unsigned ElemBytes = DL.getTypeStoreSize(getChainElemTy(C));
+ APInt PrevReadEnd = C[0].OffsetFromLeader +
+ DL.getTypeSizeInBits(getLoadStoreType(&*C[0].Inst)) / 8;
for (auto It = std::next(C.begin()), End = C.end(); It != End; ++It) {
// `prev` accesses offsets [PrevDistFromBase, PrevReadEnd).
auto &CurChain = Ret.back();
- const ChainElem &Prev = CurChain.back();
- unsigned SzBits = DL.getTypeSizeInBits(getLoadStoreType(&*Prev.Inst));
+ unsigned SzBits = DL.getTypeSizeInBits(getLoadStoreType(&*It->Inst));
assert(SzBits % 8 == 0 && "Non-byte sizes should have been filtered out by "
"collectEquivalenceClass");
- APInt PrevReadEnd = Prev.OffsetFromLeader + SzBits / 8;
// Add this instruction to the end of the current chain, or start a new one.
- bool AreContiguous = It->OffsetFromLeader == PrevReadEnd;
- LLVM_DEBUG(dbgs() << "LSV: Instructions are "
- << (AreContiguous ? "" : "not ") << "contiguous: "
- << *Prev.Inst << " (ends at offset " << PrevReadEnd
- << ") -> " << *It->Inst << " (starts at offset "
+ uint64_t SzBytes = SzBits / 8;
----------------
arsenm wrote:
Not sure why this was and is mixing getTypeStoreSize with getTypeSizeInBits and manually computing bytes? Just consistently use getTypeStoreSize?
https://github.com/llvm/llvm-project/pull/163019
More information about the llvm-commits
mailing list