1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/test/Analysis/BasicAA/sequential-gep.ll
James Molloy 6472ad3426 [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.

llvm-svn: 251112
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 }