[llvm-branch-commits] [llvm] [LoopInterchange] Disable LoopCacheAnalysis-based heuristic by default (PR #193478)

Ryotaro Kasuga via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Apr 22 08:18:58 PDT 2026


kasuga-fj wrote:

> Could you be more concrete about the regressions?

Maybe "regression" is too strong. That said, it's true that it sometimes makes fairly questionable decisions. Here is an example I found (godbolt: https://godbolt.org/z/fhn49e7Ke):

```c
for( m=0; m<9; m++ ) for( i=0; i<4; i++ )
  for( k=0; k<9; k++ ) for( j=0; j<4; j++ )
    ribosumdis[m*4+i][k*4+j] = ribosum4[i][j];
```

As you can see in the godbolt link, the k-loop and the j-loop are interchanged, which I don't think is a very good decision. Probably the impact on performance is not huge as the loops are small, but for such a non-trivial case, I think it's better to keep the original order. If we try to improve the LoopCacheAnalysis, it looks like we need to fundamentally reconsider how it calculates costs, but I'm not sure if it's worth the effort.

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


More information about the llvm-branch-commits mailing list