[llvm] [DependenceAnalysis] Extending SIV to handle fusable loops (PR #128782)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 7 03:05:24 PDT 2025


https://github.com/kasuga-fj commented:

What happens in a case like the following?

```c
for (int i = 0; i <100; i++)
  for (int j = 0; j < 100; j++) {
    for (int k = 0; k < 10; k++)
      A[i][j][2*k] = 42;
    for (int k = 0; k < 10; k++)
      A[i][j][2*k + 1] = 43;
  }
```
Currently DA returns `[0 0]` between the first store and the second one. However, once we fused the k-loops, SIV test will disprove the dependency and it would become `none` (godbolt: https://godbolt.org/z/4GT49nzdo).

So, this may be an improvement in this case, but at the very least, the result has changed. That is, assuming that fused loops can affect the outer loops, though I'm not sure if that's actually problematic.

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


More information about the llvm-commits mailing list