[llvm] [LAA] Use diff checks for read-modify-write pointers (PR #226816)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 27 11:36:33 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Dávid Bolvanský (davidbolvansky)
<details>
<summary>Changes</summary>
Consider this loop:
```c
void update(int *dst, const int *src) {
for (int i = 0; i != 256; ++i)
dst[i + 128] += src[i];
}
```
Runtime pointer checking currently falls back to a full-range overlap check because `dst` is both read and written.
Deduplicate runtime-check pointers while forming checking groups, then allow a difference check when one pointer is read-modify-write and the other is read-only. Keep the existing fallback for other read/write combinations and when the difference check would not be invariant in the parent loop.
This is sound because the extra dependence is read/read. The difference check still covers the only potentially conflicting write/read pair.
---
Full diff: https://github.com/llvm/llvm-project/pull/226816.diff
13 Files Affected:
- (modified) llvm/lib/Analysis/LoopAccessAnalysis.cpp (+26-6)
- (modified) llvm/test/Transforms/LoopVectorize/dead_instructions.ll (+17-22)
- (modified) llvm/test/Transforms/LoopVectorize/if-conversion-nest.ll (+16-20)
- (modified) llvm/test/Transforms/LoopVectorize/if-conversion.ll (+14-23)
- (modified) llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll (+62-62)
- (modified) llvm/test/Transforms/LoopVectorize/induction.ll (+260-295)
- (modified) llvm/test/Transforms/LoopVectorize/opaque-ptr.ll (+36-46)
- (modified) llvm/test/Transforms/LoopVectorize/runtime-check.ll (+20-27)
- (modified) llvm/test/Transforms/LoopVectorize/runtime-checks-difference.ll (+60)
- (modified) llvm/test/Transforms/LoopVectorize/runtime-checks-hoist.ll (+59-64)
- (modified) llvm/test/Transforms/LoopVectorize/select-cmp-multiuse.ll (+94-112)
- (modified) llvm/test/Transforms/LoopVectorize/unroll-novec-memcheck-metadata.ll (+1)
- (modified) llvm/test/Transforms/LoopVectorize/widen-intrinsic.ll (+14-14)
``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````
</details>
https://github.com/llvm/llvm-project/pull/226816
More information about the llvm-commits
mailing list