[llvm] [LAA] Be more precise on different store sizes (PR #122318)

Igor Kirillov via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 22 04:30:40 PDT 2025


igogo-x86 wrote:

I think the cleanest solution is to have the dependency query return both the sink and source data sizes. To simplify, we have three dependence cases (assuming that distance is a constant):

1. **Theoretical overlap check (`areStridedAccessesIndependent`)**  
   Here, the iteration accesses overlap in roughly the same region, so we need **both** sizes to tell whether the two accesses interfere.  
   For example, consider two 8-byte regions accessed at `x` and `y` respectively:  
   ```text
   [o o x x y o o o] 2 and 1 byte acccesses
   [o o x y y o o o] 1 and 2 byte access
   ```
   They do not overlap and are safe to vectorise, but we can't determine it unless we know both sizes.

2. **Forward dependence**  
   I am not sure how `couldPreventStoreLoadForward` should behave with different data sizes, but I feel like it should be _sink_ size? I don't know much about it :(

3. **Backward dependence**  
   We only need the _source_ size to properly check when it runs into the sink buffer.

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


More information about the llvm-commits mailing list