[clang] [llvm] [BasicAA] Do not decompose past casts with different index width (PR #119365)
Björn Pettersson via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 8 08:07:10 PST 2025
bjope wrote:
I'm investigating various regressions we've seen downstream after this patch.
I reduced one test down to this IR (also see https://godbolt.org/z/E4caeWcYd):
```
target datalayout = "p:16:8-p1:32:8"
define void @gazonk() {
entry:
%alloca = alloca i8, align 1
br label %loop
loop:
%0 = load i8, ptr %alloca, align 1
%1 = getelementptr inbounds i8, ptr addrspace(1) null, i32 2
store i8 0, ptr addrspace(1) %1, align 1
br label %loop
}
```
We used to get `NoAlias: i8 addrspace(1)* %1, i8* %alloca` but now we get MayAlias for those pointers.
For our downstream target we kind of now that different address spaces never alias, but unfortunately I don't think BasicAA is aware of such things. Still a bit unsure if those pointers should result in MayAlias now. Maybe we were just lucky in the past that BasicAA returned NoAlias.
After this patch we take the early exit for "Fall back to base objects if pointers have different index widths.", while we used to derive NoAlias when checking "if an inbounds GEP would have to start from an out of bounds address for the two to alias, then we can assume noalias."
I guess we do not really want to check TargetTransformInfo::addrspacesMayAlias inside BasicAA, which would be a simple way to determine if accesses to different address spaces may alias or not. So a bit unsure what we can do.
https://github.com/llvm/llvm-project/pull/119365
More information about the llvm-commits
mailing list