[llvm] [LoadStoreVectorizer] Allow redundant stores (PR #169946)

Gang Chen via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 8 12:53:24 PST 2025


cmc-rep wrote:

> > We have downstream needs for this: major IR transform happens after the last call of DSE, which creates new case of DSE.
> > We either need to add another DSE pass somewhere, or we add DSE-like capability here.
> 
> ...
> 
> > The functionality of this PR is NOT a complete overlapping with DSE. It allows vectorization of partially overlapping vector-stores.
> 
> Perhaps the description of the PR should be updated to include the parts "why" we're doing this change, how it helps with the partially overlapped vector stores, and why we're doing it this way, here, and what other options were considered. Clearly there are more moving parts that are not obvious from the tactical changes in the patch. E.g. based on the description, I'd assume that we'll see increased number of stores generated by the pass, but the tests appear to show a reduction.
> 
> "Allow redundant stores" by itself sounds very much like a pessimization that "happens to work" by helping some other passes do their job better. While it may be useful/needed, such opportunistic tweaks may need to be confined to the specific use cases/targets. Implementing them using existing passes, if possible, may be preferred over changes to a generic pass or a bespoke pass.
> 
> On the other hand, if the improvement is more general, there may be a good argument that it should be part of the LSV. "allow redundant sores to improve vectorization of overlapping vector stores" along with the tests demonstrating that, may fit the bill.

Thanks for the suggestion. I will update the title and description with better explanations. I did add a test to show the vectorization of partially overlapping vector-stores. see AMDGPU/vectorize-redundant-stores.ll

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


More information about the llvm-commits mailing list