llvm/test/Analysis/BasicAA/sequential-gep.ll
James Molloy 9d4c13124a [BasicAA] Bugfix for r251016
If the loaded type sizes don't match the element type of the sequential type, all bets are off and the addresses may, indeed, overlap.

Surprisingly, this just got caught in one test, on one builder, out of the 30+ builders testing this change. Congratulations go to http://lab.llvm.org:8011/builders/clang-aarch64-lnt/builds/5205.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251112 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-23 14:17:03 +00:00

55 lines
1.9 KiB
LLVM

; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
; CHECK: Function: t1
; CHECK: NoAlias: i32* %gep1, i32* %gep2
define void @t1([8 x i32]* %p, i32 %addend, i32* %q) {
%knownnonzero = load i32, i32* %q, !range !0
%add = add nsw nuw i32 %addend, %knownnonzero
%gep1 = getelementptr [8 x i32], [8 x i32]* %p, i32 2, i32 %addend
%gep2 = getelementptr [8 x i32], [8 x i32]* %p, i32 2, i32 %add
ret void
}
; CHECK: Function: t2
; CHECK: PartialAlias: i32* %gep1, i32* %gep2
define void @t2([8 x i32]* %p, i32 %addend, i32* %q) {
%knownnonzero = load i32, i32* %q, !range !0
%add = add nsw nuw i32 %addend, %knownnonzero
%gep1 = getelementptr [8 x i32], [8 x i32]* %p, i32 1, i32 %addend
%gep2 = getelementptr [8 x i32], [8 x i32]* %p, i32 0, i32 %add
ret void
}
; CHECK: Function: t3
; CHECK: MustAlias: i32* %gep1, i32* %gep2
define void @t3([8 x i32]* %p, i32 %addend, i32* %q) {
%knownnonzero = load i32, i32* %q, !range !0
%add = add nsw nuw i32 %addend, %knownnonzero
%gep1 = getelementptr [8 x i32], [8 x i32]* %p, i32 0, i32 %add
%gep2 = getelementptr [8 x i32], [8 x i32]* %p, i32 0, i32 %add
ret void
}
; CHECK: Function: t4
; CHECK: PartialAlias: i32* %gep1, i32* %gep2
define void @t4([8 x i32]* %p, i32 %addend, i32* %q) {
%knownnonzero = load i32, i32* %q, !range !0
%add = add nsw nuw i32 %addend, %knownnonzero
%gep1 = getelementptr [8 x i32], [8 x i32]* %p, i32 1, i32 %addend
%gep2 = getelementptr [8 x i32], [8 x i32]* %p, i32 %add, i32 %add
ret void
}
; CHECK: Function: t5
; CHECK: PartialAlias: i32* %gep2, i64* %bc
define void @t5([8 x i32]* %p, i32 %addend, i32* %q) {
%knownnonzero = load i32, i32* %q, !range !0
%add = add nsw nuw i32 %addend, %knownnonzero
%gep1 = getelementptr [8 x i32], [8 x i32]* %p, i32 2, i32 %addend
%gep2 = getelementptr [8 x i32], [8 x i32]* %p, i32 2, i32 %add
%bc = bitcast i32* %gep1 to i64*
ret void
}
!0 = !{ i32 1, i32 5 }