[llvm] LSV: forbid load-cycles when vectorizing; fix bug (PR #104815)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 09:36:30 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.
----------------
arsenm wrote:
I'm surprised the result in this situation is a 0. In the test case, how is %gep.x.2 - %gep.x.1 0?
https://github.com/llvm/llvm-project/pull/104815
More information about the llvm-commits
mailing list