[llvm] [DA] Add initial support for monotonicity check (PR #162280)
Ehsan Amiri via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 21 06:59:18 PDT 2025
amehsan wrote:
> @amehsan JFYI: [This commit message](https://github.com/llvm/llvm-project/commit/a353e258ba495be58263d6cc6e382e6dde298361) really helped me understand the nusw-based inference in LAA.
Thanks. I am wondering about cases like this:
```
void foo2 (char * restrict A, uint64_t n, uint64_t mask) {
for (uint64_t j = 0; j < n ; j ++) {
uint16_t k = j; // or uint32_t k = j;
A[k ] = A[k+1] + 4;
}
}
```
Where your offset spans a much smaller interval (So we cannot rely on UB from object size). Somehow this is taken care of in vectorization. I believe that happens before we reach this part of LAA code and so here, we don't need to worry about it.
For this case, we check and if n is larger than a threshold (which depends on the size of `k`) we don't execute vectorized code. If we complicate the operation on `j` the loop will not be vectorized anymore.
https://github.com/llvm/llvm-project/pull/162280
More information about the llvm-commits
mailing list