[llvm] [LoopVectorize][LAA] Hoist load in memory IV to allow vectorization (PR #168312)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 12:41:26 PST 2025


fhahn 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.
> 

Would it be possible to share a build-able reproducer? From looking at the code, I am surprised that we are not able to determine no-alias via TBAA metadata given that it looks like we are accessing 16 and 64 bit integers, which should be have different TBAA nodes.

https://github.com/llvm/llvm-project/pull/168312


More information about the llvm-commits mailing list