@@ -379,6 +379,45 @@ define i32 @load_after_memset_0_offset(ptr %a) {
379
379
ret i32 %v
380
380
}
381
381
382
+ define i32 @load_after_memset_1_offset (ptr %a ) {
383
+ ; CHECK-LABEL: @load_after_memset_1_offset(
384
+ ; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) [[A:%.*]], i8 1, i64 16, i1 false)
385
+ ; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, ptr [[A]], i64 4
386
+ ; CHECK-NEXT: [[V:%.*]] = load i32, ptr [[GEP]], align 4
387
+ ; CHECK-NEXT: ret i32 [[V]]
388
+ ;
389
+ call void @llvm.memset.p0.i64 (ptr %a , i8 1 , i64 16 , i1 false )
390
+ %gep = getelementptr i8 , ptr %a , i64 4
391
+ %v = load i32 , ptr %gep
392
+ ret i32 %v
393
+ }
394
+
395
+ define i1 @neg_load_after_memset_0_offset_i1 (ptr %a ) {
396
+ ; CHECK-LABEL: @neg_load_after_memset_0_offset_i1(
397
+ ; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) [[A:%.*]], i8 15, i64 16, i1 false)
398
+ ; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, ptr [[A]], i64 12
399
+ ; CHECK-NEXT: [[V:%.*]] = load i1, ptr [[GEP]], align 1
400
+ ; CHECK-NEXT: ret i1 [[V]]
401
+ ;
402
+ call void @llvm.memset.p0.i64 (ptr %a , i8 15 , i64 16 , i1 false )
403
+ %gep = getelementptr i1 , ptr %a , i64 12
404
+ %v = load i1 , ptr %gep
405
+ ret i1 %v
406
+ }
407
+
408
+ define i8 @neg_load_after_memset_0_neg_offset (ptr %a ) {
409
+ ; CHECK-LABEL: @neg_load_after_memset_0_neg_offset(
410
+ ; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, ptr [[A:%.*]], i64 2
411
+ ; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) [[GEP]], i8 15, i64 16, i1 false)
412
+ ; CHECK-NEXT: [[V:%.*]] = load i8, ptr [[A]], align 1
413
+ ; CHECK-NEXT: ret i8 [[V]]
414
+ ;
415
+ %gep = getelementptr i8 , ptr %a , i64 2
416
+ call void @llvm.memset.p0.i64 (ptr %gep , i8 15 , i64 16 , i1 false )
417
+ %v = load i8 , ptr %a
418
+ ret i8 %v
419
+ }
420
+
382
421
define i32 @load_after_memset_0_offset_too_large (ptr %a ) {
383
422
; CHECK-LABEL: @load_after_memset_0_offset_too_large(
384
423
; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) [[A:%.*]], i8 0, i64 16, i1 false)
0 commit comments