[llvm] [Transform][LoadStoreVectorizer] allow redundant in Chain (PR #163019)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 14 12:22:08 PDT 2025


Artem-B wrote:

> Is there a reason this problem cannot be solved in VectorCombine itself? This feels like it might be a band-aid solution.
...
> It is an enhancement to LoadStoreVectorizer

I think both points have merit, but...
VectorCombine code explicitly says that they "convert to the vector form because the backend can invert this transform if it does not result in a performance win":
https://github.com/llvm/llvm-project/blob/975fba1b499422713e88cd6f374569f3bd38335e/llvm/lib/Transforms/Vectorize/VectorCombine.cpp#L328

It does sound like it's not a bug, but a feature. Whether vector load is profitable would generally require target-specific knowledge. E.g. on NVPTX, some vector loads may be nearly free, while others costly, if too many loaded elements are unused. LoadStoreVectorizer may be a reasonable place to handle some cases that we determine to be unprofitable. And we may still need to handle even more cases in the back-end.






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


More information about the llvm-commits mailing list