[llvm] [LAA] Fix WAW dependency analysis with negative distances (PR #155266)
Ryotaro Kasuga via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 12 12:48:27 PDT 2025
https://github.com/kasuga-fj commented:
(Came from https://discourse.llvm.org/t/rfc-de-type-ification-of-llvm-ir-why/88257/30)
I think LAA is correct because it relies on execution order, as already pointed out (see also [the comment in LoopAccessAnalysis.h](https://github.com/llvm/llvm-project/blob/ef7de8d1447c822dec72d685d85053216936b895/llvm/include/llvm/Analysis/LoopAccessAnalysis.h#L65-L67)).
As for the DependenceAnalysis (DA) reporting `[<>]`, I think this is simply because the analysis is rather poor. A dependence direction represents the ordering of the induction variable when two accesses can refer to the same memory location. In this case, it describes the relationship between `i0` and `i1` when `(i0 + 1) * 4 = i1`. Assuming `i0` and `i1` are positive, the equation holds only if `i0 < i1`, so if DA's analysis capability were sufficient, it should be able to report `[<]`, I believe.
https://github.com/llvm/llvm-project/pull/155266
More information about the llvm-commits
mailing list