[llvm] [LAA] Fix WAW dependency analysis with negative distances (PR #155266)

Igor Kirillov via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 11 05:34:49 PDT 2025


igogo-x86 wrote:

When I was looking at that code and in particular WAW, my guess was that LV won't swap this instructions and we are save. I.e it can transform memory accesses like this (after vectorization):

```
A[((i+0)+1)*4] = 10; // First store
A[((i+1)+1)*4] = 10; // First store next iteration
A[i+0] = 100; // Second store
A[i+1] = 100; // Second store next iteration
```

but never this:

```
A[i] = 100; // Second store
A[(i+1)*4] = 10; // First store
```

I guess other LAA users may behave incorrectly. Is there really a way to generate a buggy code that would result in incorrect transformation? @fhahn, can LV still generate incorrect vector code for write-accesses like this?

Anyways I run spec benchmarks and didn't see any regressions.

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


More information about the llvm-commits mailing list