Skip to content

Commit 48d5510

Browse files
committed
[LoadStoreVectorizer] review update
1 parent de54df4 commit 48d5510

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -637,12 +637,16 @@ std::vector<Chain> Vectorizer::splitChainByContiguity(Chain &C) {
637637
"collectEquivalenceClass");
638638

639639
// Add this instruction to the end of the current chain, or start a new one.
640+
uint64_t SzBytes = SzBits / 8;
641+
assert(SzBytes % ElemBytes == 0);
640642
APInt ReadEnd = It->OffsetFromLeader + SzBits / 8;
641-
// Alllow redundancy: partial or full overlaping counts as contiguous.
642-
int ExtraBytes =
643-
PrevReadEnd.sle(ReadEnd) ? (ReadEnd - PrevReadEnd).getSExtValue() : 0;
644-
bool AreContiguous = It->OffsetFromLeader.sle(PrevReadEnd) &&
645-
SzBits % ElemBytes == 0 && ExtraBytes % ElemBytes == 0;
643+
// Allow redundancy: partial or full overlap counts as contiguous.
644+
bool AreContiguous = false;
645+
if (It->OffsetFromLeader.sle(PrevReadEnd)) {
646+
uint64_t Overlap = (PrevReadEnd - It->OffsetFromLeader).getZExtValue();
647+
if (Overlap % ElemBytes == 0)
648+
AreContiguous = true;
649+
}
646650

647651
LLVM_DEBUG(dbgs() << "LSV: Instruction is "
648652
<< (AreContiguous ? "contiguous" : "chain-breaker")

0 commit comments

Comments
 (0)