[llvm] LSV: forbid load-cycles when vectorizing; fix bug (PR #104815)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 10:17:08 PDT 2024
================
@@ -1499,6 +1499,12 @@ std::optional<APInt> Vectorizer::getConstantOffset(Value *PtrA, Value *PtrB,
// Try to compute B - A.
const SCEV *DistScev = SE.getMinusSCEV(SE.getSCEV(PtrB), SE.getSCEV(PtrA));
+ if (DistScev->isZero()) {
+ // A load in the chain is dependent on another load in the chain, and
+ // attempting to vectorize this chain would create a cycle.
----------------
artagnon wrote:
Difference between the _same_ two SCEVUnknowns is zero, and I've seen several instances of this in the tree. Not different SCEVUnknowns. In the case of different SCEVUnknowns, the difference wouldn't have a constant value anyway. No, I don't think we should bail on two unknowns.
https://github.com/llvm/llvm-project/pull/104815
More information about the llvm-commits
mailing list