@@ -315,3 +315,53 @@ entry:
315
315
store i8 1 , i8* %a.gep.5
316
316
ret i8* %res
317
317
}
318
+
319
+ declare i8* @__memcpy_chk (i8* writeonly , i8* readonly , i64 , i64 )
320
+
321
+ define i8* @test_memcpy_chk_const_size (i8* noalias %a , i8* noalias %b , i64 %n ) {
322
+ ; CHECK-LABEL: Function: test_memcpy_chk_const_size
323
+ ; CHECK: Just Mod: Ptr: i8* %a <-> %res = tail call i8* @__memcpy_chk(i8* %a, i8* %b, i64 4, i64 %n)
324
+ ; CHECK-NEXT: Just Mod: Ptr: i8* %res <-> %res = tail call i8* @__memcpy_chk(i8* %a, i8* %b, i64 4, i64 %n)
325
+ ; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> %res = tail call i8* @__memcpy_chk(i8* %a, i8* %b, i64 4, i64 %n)
326
+ ; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.5 <-> %res = tail call i8* @__memcpy_chk(i8* %a, i8* %b, i64 4, i64 %n)
327
+ ; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call i8* @__memcpy_chk(i8* %a, i8* %b, i64 4, i64 %n)
328
+ ; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.5 <-> %res = tail call i8* @__memcpy_chk(i8* %a, i8* %b, i64 4, i64 %n)
329
+ ;
330
+ entry:
331
+ load i8 , i8* %a
332
+ %res = tail call i8* @__memcpy_chk (i8* %a , i8* %b , i64 4 , i64 %n )
333
+ load i8 , i8* %res
334
+ %a.gep.1 = getelementptr i8 , i8* %a , i32 1
335
+ store i8 0 , i8* %a.gep.1
336
+ %a.gep.5 = getelementptr i8 , i8* %a , i32 5
337
+ store i8 1 , i8* %a.gep.5
338
+ %b.gep.1 = getelementptr i8 , i8* %b , i32 1
339
+ store i8 0 , i8* %b.gep.1
340
+ %b.gep.5 = getelementptr i8 , i8* %b , i32 5
341
+ store i8 1 , i8* %b.gep.5
342
+ ret i8* %res
343
+ }
344
+
345
+ define i8* @test_memcpy_chk_variable_size (i8* noalias %a , i8* 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 i8* @__memcpy_chk(i8* %a, i8* %b, i64 %n.1, i64 %n.2)
348
+ ; CHECK-NEXT: Just Mod: Ptr: i8* %res <-> %res = tail call i8* @__memcpy_chk(i8* %a, i8* %b, i64 %n.1, i64 %n.2)
349
+ ; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> %res = tail call i8* @__memcpy_chk(i8* %a, i8* %b, i64 %n.1, i64 %n.2)
350
+ ; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.5 <-> %res = tail call i8* @__memcpy_chk(i8* %a, i8* %b, i64 %n.1, i64 %n.2)
351
+ ; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call i8* @__memcpy_chk(i8* %a, i8* %b, i64 %n.1, i64 %n.2)
352
+ ; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.5 <-> %res = tail call i8* @__memcpy_chk(i8* %a, i8* %b, i64 %n.1, i64 %n.2)
353
+ ;
354
+ entry:
355
+ load i8 , i8* %a
356
+ %res = tail call i8* @__memcpy_chk (i8* %a , i8* %b , i64 %n.1 , i64 %n.2 )
357
+ load i8 , i8* %res
358
+ %a.gep.1 = getelementptr i8 , i8* %a , i32 1
359
+ store i8 0 , i8* %a.gep.1
360
+ %a.gep.5 = getelementptr i8 , i8* %a , i32 5
361
+ store i8 1 , i8* %a.gep.5
362
+ %b.gep.1 = getelementptr i8 , i8* %b , i32 1
363
+ store i8 0 , i8* %b.gep.1
364
+ %b.gep.5 = getelementptr i8 , i8* %b , i32 5
365
+ store i8 1 , i8* %b.gep.5
366
+ ret i8* %res
367
+ }
0 commit comments