1 ; RUN: opt -basicaa -print-alias-sets -S -o - < %s 2>&1 | FileCheck %s
3 @s = global i8 1, align 1
4 @d = global i8 2, align 1
7 ; CHECK: Alias sets for function 'test_known_size':
8 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
9 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %d, LocationSize::precise(1))
10 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Ref Pointers: (i8* %s, LocationSize::precise(1))
11 define void @test_known_size(i8* noalias %s, i8* noalias %d) {
13 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %d, i8* %s, i64 1, i1 false)
17 ; CHECK: Alias sets for function 'test_unknown_size':
18 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
19 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %d, unknown)
20 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Ref Pointers: (i8* %s, unknown)
21 define void @test_unknown_size(i8* noalias %s, i8* noalias %d, i64 %len) {
23 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %d, i8* %s, i64 %len, i1 false)
28 ; CHECK: Alias sets for function 'test1':
29 ; CHECK: Alias Set Tracker: 3 alias sets for 4 pointer values.
30 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %a, LocationSize::precise(1))
31 ; CHECK-NOT: 1 Unknown instructions
32 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 2] may alias, Mod/Ref Pointers: (i8* %d, LocationSize::precise(1)), (i8* %s, LocationSize::precise(1))
33 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %b, LocationSize::precise(1))
34 define void @test1(i8* %s, i8* %d) {
36 %a = alloca i8, align 1
37 %b = alloca i8, align 1
38 store i8 1, i8* %a, align 1
39 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %d, i8* %s, i64 1, i1 false)
40 store i8 1, i8* %b, align 1
44 ; CHECK: Alias sets for function 'test1_atomic':
45 ; CHECK: Alias Set Tracker: 3 alias sets for 4 pointer values.
46 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %a, LocationSize::precise(1))
47 ; CHECK-NOT: 1 Unknown instructions
48 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 2] may alias, Mod/Ref Pointers: (i8* %d, LocationSize::precise(1)), (i8* %s, LocationSize::precise(1))
49 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %b, LocationSize::precise(1))
50 define void @test1_atomic(i8* %s, i8* %d) {
52 %a = alloca i8, align 1
53 %b = alloca i8, align 1
54 store atomic i8 1, i8* %a unordered, align 1
55 call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %d, i8* align 1 %s, i64 1, i32 1)
56 store atomic i8 1, i8* %b unordered, align 1
60 ; CHECK: Alias sets for function 'test2':
61 ; CHECK: Alias Set Tracker: 3 alias sets for 4 pointer values.
62 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %a, LocationSize::precise(1))
63 ; CHECK-NOT: 1 Unknown instructions
64 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 2] may alias, Mod/Ref Pointers: (i8* %d, LocationSize::precise(1)), (i8* %s, LocationSize::precise(1))
65 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %b, LocationSize::precise(1))
66 define void @test2(i8* %s, i8* %d) {
68 %a = alloca i8, align 1
69 %b = alloca i8, align 1
70 store i8 1, i8* %a, align 1
71 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %d, i8* %s, i64 1, i1 true)
72 store i8 1, i8* %b, align 1
76 ; CHECK: Alias sets for function 'test3':
77 ; CHECK: Alias Set Tracker: 3 alias sets for 4 pointer values.
78 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %a, LocationSize::precise(1))
79 ; CHECK-NOT: 1 Unknown instructions
80 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 2] may alias, Mod/Ref Pointers: (i8* %d, LocationSize::precise(1)), (i8* %s, LocationSize::precise(1))
81 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %b, LocationSize::precise(1))
82 define void @test3(i8* %s, i8* %d) {
84 %a = alloca i8, align 1
85 %b = alloca i8, align 1
86 store i8 1, i8* %a, align 1
87 call void @llvm.memmove.p0i8.p0i8.i64(i8* %d, i8* %s, i64 1, i1 false)
88 store i8 1, i8* %b, align 1
92 ; CHECK: Alias sets for function 'test3_atomic':
93 ; CHECK: Alias Set Tracker: 3 alias sets for 4 pointer values.
94 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %a, LocationSize::precise(1))
95 ; CHECK-NOT: 1 Unknown instructions
96 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 2] may alias, Mod/Ref Pointers: (i8* %d, LocationSize::precise(1)), (i8* %s, LocationSize::precise(1))
97 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %b, LocationSize::precise(1))
98 define void @test3_atomic(i8* %s, i8* %d) {
100 %a = alloca i8, align 1
101 %b = alloca i8, align 1
102 store atomic i8 1, i8* %a unordered, align 1
103 call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %d, i8* align 1 %s, i64 1, i32 1)
104 store atomic i8 1, i8* %b unordered, align 1
108 ; CHECK: Alias sets for function 'test4':
109 ; CHECK: Alias Set Tracker: 3 alias sets for 4 pointer values.
110 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %a, LocationSize::precise(1))
111 ; CHECK-NOT: 1 Unknown instructions
112 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 2] may alias, Mod/Ref Pointers: (i8* %d, LocationSize::precise(1)), (i8* %s, LocationSize::precise(1))
113 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %b, LocationSize::precise(1))
114 define void @test4(i8* %s, i8* %d) {
116 %a = alloca i8, align 1
117 %b = alloca i8, align 1
118 store i8 1, i8* %a, align 1
119 call void @llvm.memmove.p0i8.p0i8.i64(i8* %d, i8* %s, i64 1, i1 true)
120 store i8 1, i8* %b, align 1
124 ; CHECK: Alias sets for function 'test5':
125 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
126 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref Pointers: (i8* %a, LocationSize::precise(1))
127 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %b, LocationSize::precise(1))
128 define void @test5() {
130 %a = alloca i8, align 1
131 %b = alloca i8, align 1
132 store i8 1, i8* %a, align 1
133 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %b, i8* %a, i64 1, i1 false)
134 store i8 1, i8* %b, align 1
138 ; CHECK: Alias sets for function 'test5_atomic':
139 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
140 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref Pointers: (i8* %a, LocationSize::precise(1))
141 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %b, LocationSize::precise(1))
142 define void @test5_atomic() {
144 %a = alloca i8, align 1
145 %b = alloca i8, align 1
146 store atomic i8 1, i8* %a unordered, align 1
147 call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %b, i8* align 1 %a, i64 1, i32 1)
148 store atomic i8 1, i8* %b unordered, align 1
152 ; CHECK: Alias sets for function 'test6':
153 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
154 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref Pointers: (i8* %a, LocationSize::precise(1))
155 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %b, LocationSize::precise(1))
156 define void @test6() {
158 %a = alloca i8, align 1
159 %b = alloca i8, align 1
160 store i8 1, i8* %a, align 1
161 call void @llvm.memmove.p0i8.p0i8.i64(i8* %b, i8* %a, i64 1, i1 false)
162 store i8 1, i8* %b, align 1
166 ; CHECK: Alias sets for function 'test6_atomic':
167 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
168 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref Pointers: (i8* %a, LocationSize::precise(1))
169 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %b, LocationSize::precise(1))
170 define void @test6_atomic() {
172 %a = alloca i8, align 1
173 %b = alloca i8, align 1
174 store atomic i8 1, i8* %a unordered, align 1
175 call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %b, i8* align 1 %a, i64 1, i32 1)
176 store atomic i8 1, i8* %b unordered, align 1
180 ; CHECK: Alias sets for function 'test7':
181 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
182 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref Pointers: (i8* %a, LocationSize::precise(1))
183 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref Pointers: (i8* %b, LocationSize::precise(1))
184 define void @test7() {
186 %a = alloca i8, align 1
187 %b = alloca i8, align 1
188 store i8 1, i8* %a, align 1
189 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %b, i8* %a, i64 1, i1 false)
190 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* %b, i64 1, i1 false)
191 store i8 1, i8* %b, align 1
195 ; CHECK: Alias sets for function 'test7_atomic':
196 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
197 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref Pointers: (i8* %a, LocationSize::precise(1))
198 ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref Pointers: (i8* %b, LocationSize::precise(1))
199 define void @test7_atomic() {
201 %a = alloca i8, align 1
202 %b = alloca i8, align 1
203 store atomic i8 1, i8* %a unordered, align 1
204 call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %b, i8* align 1 %a, i64 1, i32 1)
205 call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %a, i8* align 1 %b, i64 1, i32 1)
206 store atomic i8 1, i8* %b unordered, align 1
210 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1)
211 declare void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32)
212 declare void @llvm.memmove.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1)
213 declare void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32)