[llvm] [LAA][LV]Allow recognition of strided pointers with constant stride (PR #171151)
Nashe Mncube via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 11 03:24:28 PST 2026
nasherm wrote:
> I am not sure if we need all that complexity.
>
> We already have support for versioning strides, it just looks like multiplications with constants are not supported yet.
>
> Would it be enough to just extend `getStrideFromPointer` to support that stride pattern?
>
> ```
> diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
> index 2fc724970747..8a2c6880bc68 100644
> --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
> +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
> @@ -2979,6 +2979,8 @@ static const SCEV *getStrideFromPointer(Value *Ptr, ScalarEvolution *SE, Loop *L
> if (isa<SCEVUnknown>(V))
> return V;
>
> + const SCEVUnknown *UK;
> + match(V, m_scev_Mul(m_SCEVConstant(), m_SCEV(V)));
> if (auto *C = dyn_cast<SCEVIntegralCastExpr>(V))
> if (isa<SCEVUnknown>(C->getOperand()))
> return V;
> ```?
> ```
@fhahn your suggestion does allow for the vectorization of the matrix transpose patterns as outlined in the description. Thank you! However, looking at the updated test cases I see that there are some patterns that are not being vectorized when possible with this one liner. For the sake of the closing this ticket, I'll investigate why these patterns fail to vectorize separately to contain the scope of the original ticket.
https://github.com/llvm/llvm-project/pull/171151
More information about the llvm-commits
mailing list