1 ; RUN: opt -mtriple=i386-pc-linux-gnu -inferattrs -basic-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 %s | FileCheck %s
3 ; CHECK-LABEL: Function: test_memcmp_const_size
4 ; CHECK: Just Ref: Ptr: i8* %a <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 4)
5 ; CHECK-NEXT: Just Ref: Ptr: i8* %b <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 4)
6 ; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.1 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 4)
7 ; CHECK-NEXT: NoModRef: Ptr: i8* %a.gep.5 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 4)
8 ; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 4)
9 ; CHECK-NEXT: NoModRef: Ptr: i8* %b.gep.5 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 4)
10 define i32 @test_memcmp_const_size(i8* noalias %a, i8* noalias %b) {
12 %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 4)
13 %a.gep.1 = getelementptr i8, i8* %a, i32 1
14 store i8 0, i8* %a.gep.1
15 %a.gep.5 = getelementptr i8, i8* %a, i32 5
16 store i8 1, i8* %a.gep.5
17 %b.gep.1 = getelementptr i8, i8* %b, i32 1
18 store i8 2, i8* %b.gep.1
19 %b.gep.5 = getelementptr i8, i8* %b, i32 5
20 store i8 3, i8* %b.gep.5
24 ; CHECK-LABEL: Function: test_memcmp_variable_size
25 ; CHECK: Just Ref: Ptr: i8* %a <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 %n)
26 ; CHECK-NEXT: Just Ref: Ptr: i8* %b <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 %n)
27 ; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.1 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 %n)
28 ; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.5 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 %n)
29 ; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 %n)
30 ; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.5 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 %n)
31 define i32 @test_memcmp_variable_size(i8* noalias %a, i8* noalias %b, i64 %n) {
33 %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 %n)
34 %a.gep.1 = getelementptr i8, i8* %a, i32 1
35 store i8 0, i8* %a.gep.1
36 %a.gep.5 = getelementptr i8, i8* %a, i32 5
37 store i8 1, i8* %a.gep.5
38 %b.gep.1 = getelementptr i8, i8* %b, i32 1
39 store i8 2, i8* %b.gep.1
40 %b.gep.5 = getelementptr i8, i8* %b, i32 5
41 store i8 3, i8* %b.gep.5
45 declare i32 @memcmp(i8*, i8*, i64)
46 declare i32 @bcmp(i8*, i8*, i64)
48 ; CHECK-LABEL: Function: test_bcmp_const_size
49 ; CHECK: Just Ref: Ptr: i8* %a <-> %res = tail call i32 @bcmp(i8* %a, i8* %b, i64 4)
50 ; CHECK-NEXT: Just Ref: Ptr: i8* %b <-> %res = tail call i32 @bcmp(i8* %a, i8* %b, i64 4)
51 ; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.1 <-> %res = tail call i32 @bcmp(i8* %a, i8* %b, i64 4)
52 ; CHECK-NEXT: NoModRef: Ptr: i8* %a.gep.5 <-> %res = tail call i32 @bcmp(i8* %a, i8* %b, i64 4)
53 ; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call i32 @bcmp(i8* %a, i8* %b, i64 4)
54 ; CHECK-NEXT: NoModRef: Ptr: i8* %b.gep.5 <-> %res = tail call i32 @bcmp(i8* %a, i8* %b, i64 4)
55 define i32 @test_bcmp_const_size(i8* noalias %a, i8* noalias %b) {
57 %res = tail call i32 @bcmp(i8* %a, i8* %b, i64 4)
58 %a.gep.1 = getelementptr i8, i8* %a, i32 1
59 store i8 0, i8* %a.gep.1
60 %a.gep.5 = getelementptr i8, i8* %a, i32 5
61 store i8 1, i8* %a.gep.5
62 %b.gep.1 = getelementptr i8, i8* %b, i32 1
63 store i8 2, i8* %b.gep.1
64 %b.gep.5 = getelementptr i8, i8* %b, i32 5
65 store i8 3, i8* %b.gep.5
69 ; CHECK-LABEL: Function: test_bcmp_variable_size
70 ; CHECK: Just Ref: Ptr: i8* %a <-> %res = tail call i32 @bcmp(i8* %a, i8* %b, i64 %n)
71 ; CHECK-NEXT: Just Ref: Ptr: i8* %b <-> %res = tail call i32 @bcmp(i8* %a, i8* %b, i64 %n)
72 ; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.1 <-> %res = tail call i32 @bcmp(i8* %a, i8* %b, i64 %n)
73 ; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.5 <-> %res = tail call i32 @bcmp(i8* %a, i8* %b, i64 %n)
74 ; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call i32 @bcmp(i8* %a, i8* %b, i64 %n)
75 ; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.5 <-> %res = tail call i32 @bcmp(i8* %a, i8* %b, i64 %n)
76 define i32 @test_bcmp_variable_size(i8* noalias %a, i8* noalias %b, i64 %n) {
78 %res = tail call i32 @bcmp(i8* %a, i8* %b, i64 %n)
79 %a.gep.1 = getelementptr i8, i8* %a, i32 1
80 store i8 0, i8* %a.gep.1
81 %a.gep.5 = getelementptr i8, i8* %a, i32 5
82 store i8 1, i8* %a.gep.5
83 %b.gep.1 = getelementptr i8, i8* %b, i32 1
84 store i8 2, i8* %b.gep.1
85 %b.gep.5 = getelementptr i8, i8* %b, i32 5
86 store i8 3, i8* %b.gep.5
90 declare i8* @memchr(i8*, i32, i64)
92 ; CHECK-LABEL: Function: test_memchr_const_size
93 ; CHECK: Just Ref: Ptr: i8* %res <-> %res = call i8* @memchr(i8* %a, i32 42, i64 4)
94 ; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.1 <-> %res = call i8* @memchr(i8* %a, i32 42, i64 4)
95 ; CHECK-NEXT: NoModRef: Ptr: i8* %a.gep.5 <-> %res = call i8* @memchr(i8* %a, i32 42, i64 4)
96 define i8* @test_memchr_const_size(i8* noalias %a) {
98 %res = call i8* @memchr(i8* %a, i32 42, i64 4)
99 %a.gep.1 = getelementptr i8, i8* %a, i32 1
100 store i8 0, i8* %a.gep.1
101 %a.gep.5 = getelementptr i8, i8* %a, i32 5
102 store i8 1, i8* %a.gep.5
106 declare i8* @memccpy(i8*, i8*, i32, i64)
108 ; CHECK-LABEL: Function: test_memccpy_const_size
109 ; CHECK: Just Mod: Ptr: i8* %a <-> %res = call i8* @memccpy(i8* %a, i8* %b, i32 42, i64 4)
110 ; CHECK-NEXT: Just Ref: Ptr: i8* %b <-> %res = call i8* @memccpy(i8* %a, i8* %b, i32 42, i64 4)
111 ; CHECK-NEXT: Just Mod: Ptr: i8* %res <-> %res = call i8* @memccpy(i8* %a, i8* %b, i32 42, i64 4)
112 ; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> %res = call i8* @memccpy(i8* %a, i8* %b, i32 42, i64 4)
113 ; CHECK-NEXT: NoModRef: Ptr: i8* %a.gep.5 <-> %res = call i8* @memccpy(i8* %a, i8* %b, i32 42, i64 4)
114 ; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = call i8* @memccpy(i8* %a, i8* %b, i32 42, i64 4)
115 ; CHECK-NEXT: NoModRef: Ptr: i8* %b.gep.5 <-> %res = call i8* @memccpy(i8* %a, i8* %b, i32 42, i64 4)
117 define i8* @test_memccpy_const_size(i8* noalias %a, i8* noalias %b) {
119 %res = call i8* @memccpy(i8* %a, i8* %b, i32 42, i64 4)
120 %a.gep.1 = getelementptr i8, i8* %a, i32 1
121 store i8 0, i8* %a.gep.1
122 %a.gep.5 = getelementptr i8, i8* %a, i32 5
123 store i8 1, i8* %a.gep.5
124 %b.gep.1 = getelementptr i8, i8* %b, i32 1
125 store i8 2, i8* %b.gep.1
126 %b.gep.5 = getelementptr i8, i8* %b, i32 5
127 store i8 3, i8* %b.gep.5