[llvm] [LoopVectorize][LAA] Hoist load in memory IV to allow vectorization (PR #168312)
Felipe Magno de Almeida via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 9 05:09:21 PST 2025
felipealmeida wrote:
Hello Florian, thanks for taking the time to review it.
> I'm curious what the original C/C++ source code looks like. Is there anything we are missing to enable hoisting/sinking earlier?
>
> After a first look, I am not sure LAA is the best place to add this hoisting detection, as it adds quite a bit of complexity and coupling spread out across LAA and LV. But I need to think about it a bit more to see what possible alternatives are.
I added the C++ code to the PR message. I don't think this hoisting can be made before LoopVectorize. I did look into that. However, it is not possible to prove that m_size pointer doesn't alias with the thePointer and theFirst. It is possible to hoist in the LoopVectorize because it can add a runtime check.
On the LAA, I didn't find a better place to put this code, because the problem is that LoopVectorize decides to vectorize based on hasLoadStoreDependenceInvolvingLoopInvariantAddress from LAA, which if we don't do a analysis taking the possible hoisting into consideration, then it will return true. And LoopVectorize can't distinguish between a loop invariant address that it can or cannot hoist because it doesn't do the analysis itself.
Kind regards,
https://github.com/llvm/llvm-project/pull/168312
More information about the llvm-commits
mailing list