
BasicAA currently tries to support addrspacecasts that change the index width by performing the decomposition in the maximum of all index widths and then trying to fix this up with in-place sign extends to get correct overflow behavior if the actual index width is smaller. However, even in the case where we don't mix different index widths and just have an index width that is smaller than the maximum, the behavior is incorrect (see test), because we only perform the index width adjustment during decomposition and not any of the later logic -- and we don't do anything at all for variable offsets. I'm sure that the case where we actually mix different index widths is even more broken than that. Fix this by not allowing decomposition through index width changes. If the pointers have different index widths, fall back to a base object comparison, ignoring the offsets.
13 lines
462 B
LLVM
13 lines
462 B
LLVM
; RUN: opt -S -passes=aa-eval -print-all-alias-modref-info -disable-output < %s 2>&1 | FileCheck %s
|
|
|
|
target datalayout = "p1:32:32"
|
|
|
|
; CHECK: PartialAlias: i32 addrspace(1)* %gep1, i32 addrspace(1)* %gep2
|
|
define void @test(ptr addrspace(1) %p) {
|
|
%gep1 = getelementptr i8, ptr addrspace(1) %p, i32 u0x7fffffff
|
|
%gep2 = getelementptr i8, ptr addrspace(1) %p, i32 u0x80000001
|
|
store i32 0, ptr addrspace(1) %gep1
|
|
load i32, ptr addrspace(1) %gep2
|
|
ret void
|
|
}
|