[llvm] [DA] Dependence analysis does not handle array accesses of different sizes (PR #116630)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 06:58:24 PST 2025


https://github.com/nikic commented:

Looking a bit more closely, I'm not sure that "different access sizes" is really the core issue here.

For example, consider this variant of your test case:
```
define i32 @bug16183_alias(ptr nocapture %A) {
entry:
  %arrayidx = getelementptr inbounds i8, ptr %A, i64 2
  store i32 2, ptr %arrayidx, align 1 
  %0 = load i32, ptr %A, align 1
  ret i32 %0
}
```
This has equal access sizes, but the two accesses still overlap, because the GEP is only by half the access width. It currently reports `da analyze - none!` and wouldn't be fixed by your patch.

Without looking at the implementation, I expect the issue here is that the code does not verify that the access sizes and the access stride are compatible.

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


More information about the llvm-commits mailing list