llvm-project
367 строк · 17.2 Кб
1; RUN: opt -mtriple=x86_64-pc-linux-gnu -aa-pipeline=basic-aa -passes=inferattrs,aa-eval -print-all-alias-modref-info -disable-output 2>&1 %s | FileCheck %s
2
3; CHECK-LABEL: Function: test_memcmp_const_size
4; CHECK: Just Ref: Ptr: i8* %a <-> %res = tail call i32 @memcmp(ptr %a, ptr %b, i64 4)
5; CHECK-NEXT: Just Ref: Ptr: i8* %b <-> %res = tail call i32 @memcmp(ptr %a, ptr %b, i64 4)
6; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.1 <-> %res = tail call i32 @memcmp(ptr %a, ptr %b, i64 4)
7; CHECK-NEXT: NoModRef: Ptr: i8* %a.gep.5 <-> %res = tail call i32 @memcmp(ptr %a, ptr %b, i64 4)
8; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call i32 @memcmp(ptr %a, ptr %b, i64 4)
9; CHECK-NEXT: NoModRef: Ptr: i8* %b.gep.5 <-> %res = tail call i32 @memcmp(ptr %a, ptr %b, i64 4)
10define i32 @test_memcmp_const_size(ptr noalias %a, ptr noalias %b) {
11entry:
12load i8, ptr %a
13load i8, ptr %b
14%res = tail call i32 @memcmp(ptr %a, ptr %b, i64 4)
15%a.gep.1 = getelementptr i8, ptr %a, i32 1
16store i8 0, ptr %a.gep.1
17%a.gep.5 = getelementptr i8, ptr %a, i32 5
18store i8 1, ptr %a.gep.5
19%b.gep.1 = getelementptr i8, ptr %b, i32 1
20store i8 2, ptr %b.gep.1
21%b.gep.5 = getelementptr i8, ptr %b, i32 5
22store i8 3, ptr %b.gep.5
23ret i32 %res
24}
25
26; CHECK-LABEL: Function: test_memcmp_variable_size
27; CHECK: Just Ref: Ptr: i8* %a <-> %res = tail call i32 @memcmp(ptr %a, ptr %b, i64 %n)
28; CHECK-NEXT: Just Ref: Ptr: i8* %b <-> %res = tail call i32 @memcmp(ptr %a, ptr %b, i64 %n)
29; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.1 <-> %res = tail call i32 @memcmp(ptr %a, ptr %b, i64 %n)
30; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.5 <-> %res = tail call i32 @memcmp(ptr %a, ptr %b, i64 %n)
31; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call i32 @memcmp(ptr %a, ptr %b, i64 %n)
32; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.5 <-> %res = tail call i32 @memcmp(ptr %a, ptr %b, i64 %n)
33define i32 @test_memcmp_variable_size(ptr noalias %a, ptr noalias %b, i64 %n) {
34entry:
35load i8, ptr %a
36load i8, ptr %b
37%res = tail call i32 @memcmp(ptr %a, ptr %b, i64 %n)
38%a.gep.1 = getelementptr i8, ptr %a, i32 1
39store i8 0, ptr %a.gep.1
40%a.gep.5 = getelementptr i8, ptr %a, i32 5
41store i8 1, ptr %a.gep.5
42%b.gep.1 = getelementptr i8, ptr %b, i32 1
43store i8 2, ptr %b.gep.1
44%b.gep.5 = getelementptr i8, ptr %b, i32 5
45store i8 3, ptr %b.gep.5
46ret i32 %res
47}
48
49declare i32 @memcmp(ptr, ptr, i64)
50declare i32 @bcmp(ptr, ptr, i64)
51
52; CHECK-LABEL: Function: test_bcmp_const_size
53; CHECK: Just Ref: Ptr: i8* %a <-> %res = tail call i32 @bcmp(ptr %a, ptr %b, i64 4)
54; CHECK-NEXT: Just Ref: Ptr: i8* %b <-> %res = tail call i32 @bcmp(ptr %a, ptr %b, i64 4)
55; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.1 <-> %res = tail call i32 @bcmp(ptr %a, ptr %b, i64 4)
56; CHECK-NEXT: NoModRef: Ptr: i8* %a.gep.5 <-> %res = tail call i32 @bcmp(ptr %a, ptr %b, i64 4)
57; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call i32 @bcmp(ptr %a, ptr %b, i64 4)
58; CHECK-NEXT: NoModRef: Ptr: i8* %b.gep.5 <-> %res = tail call i32 @bcmp(ptr %a, ptr %b, i64 4)
59define i32 @test_bcmp_const_size(ptr noalias %a, ptr noalias %b) {
60entry:
61load i8, ptr %a
62load i8, ptr %b
63%res = tail call i32 @bcmp(ptr %a, ptr %b, i64 4)
64%a.gep.1 = getelementptr i8, ptr %a, i32 1
65store i8 0, ptr %a.gep.1
66%a.gep.5 = getelementptr i8, ptr %a, i32 5
67store i8 1, ptr %a.gep.5
68%b.gep.1 = getelementptr i8, ptr %b, i32 1
69store i8 2, ptr %b.gep.1
70%b.gep.5 = getelementptr i8, ptr %b, i32 5
71store i8 3, ptr %b.gep.5
72ret i32 %res
73}
74
75; CHECK-LABEL: Function: test_bcmp_variable_size
76; CHECK: Just Ref: Ptr: i8* %a <-> %res = tail call i32 @bcmp(ptr %a, ptr %b, i64 %n)
77; CHECK-NEXT: Just Ref: Ptr: i8* %b <-> %res = tail call i32 @bcmp(ptr %a, ptr %b, i64 %n)
78; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.1 <-> %res = tail call i32 @bcmp(ptr %a, ptr %b, i64 %n)
79; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.5 <-> %res = tail call i32 @bcmp(ptr %a, ptr %b, i64 %n)
80; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call i32 @bcmp(ptr %a, ptr %b, i64 %n)
81; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.5 <-> %res = tail call i32 @bcmp(ptr %a, ptr %b, i64 %n)
82define i32 @test_bcmp_variable_size(ptr noalias %a, ptr noalias %b, i64 %n) {
83entry:
84load i8, ptr %a
85load i8, ptr %b
86%res = tail call i32 @bcmp(ptr %a, ptr %b, i64 %n)
87%a.gep.1 = getelementptr i8, ptr %a, i32 1
88store i8 0, ptr %a.gep.1
89%a.gep.5 = getelementptr i8, ptr %a, i32 5
90store i8 1, ptr %a.gep.5
91%b.gep.1 = getelementptr i8, ptr %b, i32 1
92store i8 2, ptr %b.gep.1
93%b.gep.5 = getelementptr i8, ptr %b, i32 5
94store i8 3, ptr %b.gep.5
95ret i32 %res
96}
97
98declare ptr @memchr(ptr, i32, i64)
99
100; CHECK-LABEL: Function: test_memchr_const_size
101; CHECK: Just Ref: Ptr: i8* %res <-> %res = call ptr @memchr(ptr %a, i32 42, i64 4)
102; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.1 <-> %res = call ptr @memchr(ptr %a, i32 42, i64 4)
103; CHECK-NEXT: NoModRef: Ptr: i8* %a.gep.5 <-> %res = call ptr @memchr(ptr %a, i32 42, i64 4)
104define ptr @test_memchr_const_size(ptr noalias %a) {
105entry:
106%res = call ptr @memchr(ptr %a, i32 42, i64 4)
107load i8, ptr %res
108%a.gep.1 = getelementptr i8, ptr %a, i32 1
109store i8 0, ptr %a.gep.1
110%a.gep.5 = getelementptr i8, ptr %a, i32 5
111store i8 1, ptr %a.gep.5
112ret ptr %res
113}
114
115declare ptr @memccpy(ptr, ptr, i32, i64)
116
117; CHECK-LABEL: Function: test_memccpy_const_size
118; CHECK: Just Mod: Ptr: i8* %a <-> %res = call ptr @memccpy(ptr %a, ptr %b, i32 42, i64 4)
119; CHECK-NEXT: Just Ref: Ptr: i8* %b <-> %res = call ptr @memccpy(ptr %a, ptr %b, i32 42, i64 4)
120; CHECK-NEXT: Just Mod: Ptr: i8* %res <-> %res = call ptr @memccpy(ptr %a, ptr %b, i32 42, i64 4)
121; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> %res = call ptr @memccpy(ptr %a, ptr %b, i32 42, i64 4)
122; CHECK-NEXT: NoModRef: Ptr: i8* %a.gep.5 <-> %res = call ptr @memccpy(ptr %a, ptr %b, i32 42, i64 4)
123; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = call ptr @memccpy(ptr %a, ptr %b, i32 42, i64 4)
124; CHECK-NEXT: NoModRef: Ptr: i8* %b.gep.5 <-> %res = call ptr @memccpy(ptr %a, ptr %b, i32 42, i64 4)
125
126define ptr @test_memccpy_const_size(ptr noalias %a, ptr noalias %b) {
127entry:
128load i8, ptr %a
129load i8, ptr %b
130%res = call ptr @memccpy(ptr %a, ptr %b, i32 42, i64 4)
131load i8, ptr %res
132%a.gep.1 = getelementptr i8, ptr %a, i32 1
133store i8 0, ptr %a.gep.1
134%a.gep.5 = getelementptr i8, ptr %a, i32 5
135store i8 1, ptr %a.gep.5
136%b.gep.1 = getelementptr i8, ptr %b, i32 1
137store i8 2, ptr %b.gep.1
138%b.gep.5 = getelementptr i8, ptr %b, i32 5
139store i8 3, ptr %b.gep.5
140ret ptr %res
141}
142
143declare ptr @strcat(ptr, ptr)
144
145define ptr @test_strcat_read_write_after(ptr noalias %a, ptr noalias %b) {
146; CHECK-LABEL: Function: test_strcat_read_write_after
147; CHECK: NoModRef: Ptr: i8* %a <-> %res = tail call ptr @strcat(ptr %a.gep.1, ptr %b.gep.1)
148; CHECK-NEXT: NoModRef: Ptr: i8* %b <-> %res = tail call ptr @strcat(ptr %a.gep.1, ptr %b.gep.1)
149; CHECK-NEXT: Both ModRef: Ptr: i8* %a.gep.1 <-> %res = tail call ptr @strcat(ptr %a.gep.1, ptr %b.gep.1)
150; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call ptr @strcat(ptr %a.gep.1, ptr %b.gep.1)
151; CHECK-NEXT: Both ModRef: Ptr: i8* %res <-> %res = tail call ptr @strcat(ptr %a.gep.1, ptr %b.gep.1)
152; CHECK-NEXT: Both ModRef: Ptr: i8* %a.gep.5 <-> %res = tail call ptr @strcat(ptr %a.gep.1, ptr %b.gep.1)
153; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.5 <-> %res = tail call ptr @strcat(ptr %a.gep.1, ptr %b.gep.1)
154;
155entry:
156store i8 0, ptr %a
157store i8 2, ptr %b
158%a.gep.1 = getelementptr i8, ptr %a, i32 1
159load i8, ptr %a.gep.1
160%b.gep.1 = getelementptr i8, ptr %b, i32 1
161load i8, ptr %b.gep.1
162%res = tail call ptr @strcat(ptr %a.gep.1, ptr %b.gep.1)
163load i8, ptr %res
164%a.gep.5 = getelementptr i8, ptr %a, i32 5
165store i8 1, ptr %a.gep.5
166%b.gep.5 = getelementptr i8, ptr %b, i32 5
167store i8 3, ptr %b.gep.5
168ret ptr %res
169}
170
171declare ptr @strncat(ptr, ptr, i64)
172
173define ptr @test_strncat_read_write_after(ptr noalias %a, ptr noalias %b, i64 %n) {
174; CHECK-LABEL: Function: test_strncat_read_write_after
175; CHECK: NoModRef: Ptr: i8* %a <-> %res = tail call ptr @strncat(ptr %a.gep.1, ptr %b.gep.1, i64 %n)
176; CHECK-NEXT: NoModRef: Ptr: i8* %b <-> %res = tail call ptr @strncat(ptr %a.gep.1, ptr %b.gep.1, i64 %n)
177; CHECK-NEXT: Both ModRef: Ptr: i8* %a.gep.1 <-> %res = tail call ptr @strncat(ptr %a.gep.1, ptr %b.gep.1, i64 %n)
178; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call ptr @strncat(ptr %a.gep.1, ptr %b.gep.1, i64 %n)
179; CHECK-NEXT: Both ModRef: Ptr: i8* %res <-> %res = tail call ptr @strncat(ptr %a.gep.1, ptr %b.gep.1, i64 %n)
180; CHECK-NEXT: Both ModRef: Ptr: i8* %a.gep.5 <-> %res = tail call ptr @strncat(ptr %a.gep.1, ptr %b.gep.1, i64 %n)
181; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.5 <-> %res = tail call ptr @strncat(ptr %a.gep.1, ptr %b.gep.1, i64 %n)
182;
183entry:
184store i8 0, ptr %a
185store i8 2, ptr %b
186%a.gep.1 = getelementptr i8, ptr %a, i32 1
187load i8, ptr %a.gep.1
188%b.gep.1 = getelementptr i8, ptr %b, i32 1
189load i8, ptr %b.gep.1
190%res = tail call ptr @strncat(ptr %a.gep.1, ptr %b.gep.1, i64 %n)
191load i8, ptr %res
192%a.gep.5 = getelementptr i8, ptr %a, i32 5
193store i8 1, ptr %a.gep.5
194%b.gep.5 = getelementptr i8, ptr %b, i32 5
195store i8 3, ptr %b.gep.5
196ret ptr %res
197}
198
199declare ptr @strcpy(ptr, ptr)
200
201define ptr @test_strcpy_read_write_after(ptr noalias %a, ptr noalias %b) {
202; CHECK-LABEL: Function: test_strcpy_read_write_after
203; CHECK: NoModRef: Ptr: i8* %a <-> %res = tail call ptr @strcpy(ptr %a.gep.1, ptr %b.gep.1)
204; CHECK-NEXT: NoModRef: Ptr: i8* %b <-> %res = tail call ptr @strcpy(ptr %a.gep.1, ptr %b.gep.1)
205; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> %res = tail call ptr @strcpy(ptr %a.gep.1, ptr %b.gep.1)
206; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call ptr @strcpy(ptr %a.gep.1, ptr %b.gep.1)
207; CHECK-NEXT: Just Mod: Ptr: i8* %res <-> %res = tail call ptr @strcpy(ptr %a.gep.1, ptr %b.gep.1)
208; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.5 <-> %res = tail call ptr @strcpy(ptr %a.gep.1, ptr %b.gep.1)
209; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.5 <-> %res = tail call ptr @strcpy(ptr %a.gep.1, ptr %b.gep.1)
210;
211entry:
212store i8 0, ptr %a
213store i8 2, ptr %b
214%a.gep.1 = getelementptr i8, ptr %a, i32 1
215load i8, ptr %a.gep.1
216%b.gep.1 = getelementptr i8, ptr %b, i32 1
217load i8, ptr %b.gep.1
218%res = tail call ptr @strcpy(ptr %a.gep.1, ptr %b.gep.1)
219load i8, ptr %res
220%a.gep.5 = getelementptr i8, ptr %a, i32 5
221store i8 1, ptr %a.gep.5
222%b.gep.5 = getelementptr i8, ptr %b, i32 5
223store i8 3, ptr %b.gep.5
224ret ptr %res
225}
226
227declare ptr @strncpy(ptr, ptr, i64)
228
229define ptr @test_strncpy_const_size(ptr noalias %a, ptr noalias %b) {
230; CHECK-LABEL: Function: test_strncpy_const_size
231; CHECK: Just Mod: Ptr: i8* %a <-> %res = tail call ptr @strncpy(ptr %a, ptr %b, i64 4)
232; CHECK-NEXT: Just Ref: Ptr: i8* %b <-> %res = tail call ptr @strncpy(ptr %a, ptr %b, i64 4)
233; CHECK-NEXT: Just Mod: Ptr: i8* %res <-> %res = tail call ptr @strncpy(ptr %a, ptr %b, i64 4)
234; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> %res = tail call ptr @strncpy(ptr %a, ptr %b, i64 4)
235; CHECK-NEXT: NoModRef: Ptr: i8* %a.gep.5 <-> %res = tail call ptr @strncpy(ptr %a, ptr %b, i64 4)
236; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call ptr @strncpy(ptr %a, ptr %b, i64 4)
237; CHECK-NEXT: NoModRef: Ptr: i8* %b.gep.5 <-> %res = tail call ptr @strncpy(ptr %a, ptr %b, i64 4)
238;
239entry:
240load i8, ptr %a
241load i8, ptr %b
242%res = tail call ptr @strncpy(ptr %a, ptr %b, i64 4)
243load i8, ptr %res
244%a.gep.1 = getelementptr i8, ptr %a, i32 1
245store i8 0, ptr %a.gep.1
246%a.gep.5 = getelementptr i8, ptr %a, i32 5
247store i8 1, ptr %a.gep.5
248%b.gep.1 = getelementptr i8, ptr %b, i32 1
249store i8 2, ptr %b.gep.1
250%b.gep.5 = getelementptr i8, ptr %b, i32 5
251store i8 3, ptr %b.gep.5
252ret ptr %res
253}
254
255define ptr @test_strncpy_variable_size(ptr noalias %a, ptr noalias %b, i64 %n) {
256; CHECK-LABEL: Function: test_strncpy_variable_size
257; CHECK: Just Mod: Ptr: i8* %a <-> %res = tail call ptr @strncpy(ptr %a, ptr %b, i64 %n)
258; CHECK-NEXT: Just Ref: Ptr: i8* %b <-> %res = tail call ptr @strncpy(ptr %a, ptr %b, i64 %n)
259; CHECK-NEXT: Just Mod: Ptr: i8* %res <-> %res = tail call ptr @strncpy(ptr %a, ptr %b, i64 %n)
260; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> %res = tail call ptr @strncpy(ptr %a, ptr %b, i64 %n)
261; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.5 <-> %res = tail call ptr @strncpy(ptr %a, ptr %b, i64 %n)
262; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call ptr @strncpy(ptr %a, ptr %b, i64 %n)
263; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.5 <-> %res = tail call ptr @strncpy(ptr %a, ptr %b, i64 %n)
264;
265entry:
266load i8, ptr %a
267load i8, ptr %b
268%res = tail call ptr @strncpy(ptr %a, ptr %b, i64 %n)
269load i8, ptr %res
270%a.gep.1 = getelementptr i8, ptr %a, i32 1
271store i8 0, ptr %a.gep.1
272%a.gep.5 = getelementptr i8, ptr %a, i32 5
273store i8 1, ptr %a.gep.5
274%b.gep.1 = getelementptr i8, ptr %b, i32 1
275store i8 2, ptr %b.gep.1
276%b.gep.5 = getelementptr i8, ptr %b, i32 5
277store i8 3, ptr %b.gep.5
278ret ptr %res
279}
280
281declare ptr @__memset_chk(ptr writeonly, i32, i64, i64)
282
283; CHECK-LABEL: Function: test_memset_chk_const_size
284define ptr @test_memset_chk_const_size(ptr noalias %a, i64 %n) {
285; CHECK: Just Mod: Ptr: i8* %a <-> %res = tail call ptr @__memset_chk(ptr %a, i32 0, i64 4, i64 %n)
286; CHECK-NEXT: Just Mod: Ptr: i8* %res <-> %res = tail call ptr @__memset_chk(ptr %a, i32 0, i64 4, i64 %n)
287; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> %res = tail call ptr @__memset_chk(ptr %a, i32 0, i64 4, i64 %n)
288; CHECK-NEXT: NoModRef: Ptr: i8* %a.gep.5 <-> %res = tail call ptr @__memset_chk(ptr %a, i32 0, i64 4, i64 %n)
289;
290entry:
291load i8, ptr %a
292%res = tail call ptr @__memset_chk(ptr %a, i32 0, i64 4, i64 %n)
293load i8, ptr %res
294%a.gep.1 = getelementptr i8, ptr %a, i32 1
295store i8 0, ptr %a.gep.1
296%a.gep.5 = getelementptr i8, ptr %a, i32 5
297store i8 1, ptr %a.gep.5
298ret ptr %res
299}
300
301define ptr @test_memset_chk_variable_size(ptr noalias %a, i64 %n.1, i64 %n.2) {
302; CHECK-LABEL: Function: test_memset_chk_variable_size
303; CHECK: Just Mod: Ptr: i8* %a <-> %res = tail call ptr @__memset_chk(ptr %a, i32 0, i64 %n.1, i64 %n.2)
304; CHECK-NEXT: Just Mod: Ptr: i8* %res <-> %res = tail call ptr @__memset_chk(ptr %a, i32 0, i64 %n.1, i64 %n.2)
305; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> %res = tail call ptr @__memset_chk(ptr %a, i32 0, i64 %n.1, i64 %n.2)
306; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.5 <-> %res = tail call ptr @__memset_chk(ptr %a, i32 0, i64 %n.1, i64 %n.2)
307;
308entry:
309load i8, ptr %a
310%res = tail call ptr @__memset_chk(ptr %a, i32 0, i64 %n.1, i64 %n.2)
311load i8, ptr %res
312%a.gep.1 = getelementptr i8, ptr %a, i32 1
313store i8 0, ptr %a.gep.1
314%a.gep.5 = getelementptr i8, ptr %a, i32 5
315store i8 1, ptr %a.gep.5
316ret ptr %res
317}
318
319declare ptr @__memcpy_chk(ptr writeonly, ptr readonly, i64, i64)
320
321define ptr @test_memcpy_chk_const_size(ptr noalias %a, ptr noalias %b, i64 %n) {
322; CHECK-LABEL: Function: test_memcpy_chk_const_size
323; CHECK: Just Mod: Ptr: i8* %a <-> %res = tail call ptr @__memcpy_chk(ptr %a, ptr %b, i64 4, i64 %n)
324; CHECK-NEXT: Just Mod: Ptr: i8* %res <-> %res = tail call ptr @__memcpy_chk(ptr %a, ptr %b, i64 4, i64 %n)
325; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> %res = tail call ptr @__memcpy_chk(ptr %a, ptr %b, i64 4, i64 %n)
326; CHECK-NEXT: NoModRef: Ptr: i8* %a.gep.5 <-> %res = tail call ptr @__memcpy_chk(ptr %a, ptr %b, i64 4, i64 %n)
327; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call ptr @__memcpy_chk(ptr %a, ptr %b, i64 4, i64 %n)
328; CHECK-NEXT: NoModRef: Ptr: i8* %b.gep.5 <-> %res = tail call ptr @__memcpy_chk(ptr %a, ptr %b, i64 4, i64 %n)
329;
330entry:
331load i8, ptr %a
332%res = tail call ptr @__memcpy_chk(ptr %a, ptr %b, i64 4, i64 %n)
333load i8, ptr %res
334%a.gep.1 = getelementptr i8, ptr %a, i32 1
335store i8 0, ptr %a.gep.1
336%a.gep.5 = getelementptr i8, ptr %a, i32 5
337store i8 1, ptr %a.gep.5
338%b.gep.1 = getelementptr i8, ptr %b, i32 1
339store i8 0, ptr %b.gep.1
340%b.gep.5 = getelementptr i8, ptr %b, i32 5
341store i8 1, ptr %b.gep.5
342ret ptr %res
343}
344
345define ptr @test_memcpy_chk_variable_size(ptr noalias %a, ptr noalias %b, i64 %n.1, i64 %n.2) {
346; CHECK-LABEL: Function: test_memcpy_chk_variable_size
347; CHECK: Just Mod: Ptr: i8* %a <-> %res = tail call ptr @__memcpy_chk(ptr %a, ptr %b, i64 %n.1, i64 %n.2)
348; CHECK-NEXT: Just Mod: Ptr: i8* %res <-> %res = tail call ptr @__memcpy_chk(ptr %a, ptr %b, i64 %n.1, i64 %n.2)
349; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> %res = tail call ptr @__memcpy_chk(ptr %a, ptr %b, i64 %n.1, i64 %n.2)
350; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.5 <-> %res = tail call ptr @__memcpy_chk(ptr %a, ptr %b, i64 %n.1, i64 %n.2)
351; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call ptr @__memcpy_chk(ptr %a, ptr %b, i64 %n.1, i64 %n.2)
352; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.5 <-> %res = tail call ptr @__memcpy_chk(ptr %a, ptr %b, i64 %n.1, i64 %n.2)
353;
354entry:
355load i8, ptr %a
356%res = tail call ptr @__memcpy_chk(ptr %a, ptr %b, i64 %n.1, i64 %n.2)
357load i8, ptr %res
358%a.gep.1 = getelementptr i8, ptr %a, i32 1
359store i8 0, ptr %a.gep.1
360%a.gep.5 = getelementptr i8, ptr %a, i32 5
361store i8 1, ptr %a.gep.5
362%b.gep.1 = getelementptr i8, ptr %b, i32 1
363store i8 0, ptr %b.gep.1
364%b.gep.5 = getelementptr i8, ptr %b, i32 5
365store i8 1, ptr %b.gep.5
366ret ptr %res
367}
368