• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
2
3; CHECK: Function: t1
4; CHECK: NoAlias: i32* %gep1, i32* %gep2
5define void @t1([8 x i32]* %p, i32 %addend, i32* %q) {
6  %knownnonzero = load i32, i32* %q, !range !0
7  %add = add nsw nuw i32 %addend, %knownnonzero
8  %gep1 = getelementptr [8 x i32], [8 x i32]* %p, i32 2, i32 %addend
9  %gep2 = getelementptr [8 x i32], [8 x i32]* %p, i32 2, i32 %add
10  ret void
11}
12
13; CHECK: Function: t2
14; CHECK: PartialAlias: i32* %gep1, i32* %gep2
15define void @t2([8 x i32]* %p, i32 %addend, i32* %q) {
16  %knownnonzero = load i32, i32* %q, !range !0
17  %add = add nsw nuw i32 %addend, %knownnonzero
18  %gep1 = getelementptr [8 x i32], [8 x i32]* %p, i32 1, i32 %addend
19  %gep2 = getelementptr [8 x i32], [8 x i32]* %p, i32 0, i32 %add
20  ret void
21}
22
23; CHECK: Function: t3
24; CHECK: MustAlias: i32* %gep1, i32* %gep2
25define void @t3([8 x i32]* %p, i32 %addend, i32* %q) {
26  %knownnonzero = load i32, i32* %q, !range !0
27  %add = add nsw nuw i32 %addend, %knownnonzero
28  %gep1 = getelementptr [8 x i32], [8 x i32]* %p, i32 0, i32 %add
29  %gep2 = getelementptr [8 x i32], [8 x i32]* %p, i32 0, i32 %add
30  ret void
31}
32
33; CHECK: Function: t4
34; CHECK: PartialAlias: i32* %gep1, i32* %gep2
35define void @t4([8 x i32]* %p, i32 %addend, i32* %q) {
36  %knownnonzero = load i32, i32* %q, !range !0
37  %add = add nsw nuw i32 %addend, %knownnonzero
38  %gep1 = getelementptr [8 x i32], [8 x i32]* %p, i32 1, i32 %addend
39  %gep2 = getelementptr [8 x i32], [8 x i32]* %p, i32 %add, i32 %add
40  ret void
41}
42
43; CHECK: Function: t5
44; CHECK: PartialAlias: i32* %gep2, i64* %bc
45define void @t5([8 x i32]* %p, i32 %addend, i32* %q) {
46  %knownnonzero = load i32, i32* %q, !range !0
47  %add = add nsw nuw i32 %addend, %knownnonzero
48  %gep1 = getelementptr [8 x i32], [8 x i32]* %p, i32 2, i32 %addend
49  %gep2 = getelementptr [8 x i32], [8 x i32]* %p, i32 2, i32 %add
50  %bc = bitcast i32* %gep1 to i64*
51  ret void
52}
53
54!0 = !{ i32 1, i32 5 }
55