1
1
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2
- ; RUN: opt < %s -S -passes=memcpyopt | FileCheck %s
2
+ ; RUN: opt < %s -S -passes=memcpyopt -verify-memoryssa | FileCheck %s
3
3
4
4
; Check that we don't introduce llvm.lifetime.end.
5
5
@@ -8,14 +8,15 @@ target triple = "x86_64-grtev4-linux-gnu"
8
8
9
9
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
10
10
declare void @llvm.lifetime.start.p0 (i64 immarg, ptr nocapture ) #0
11
+ declare void @llvm.memset.p0.i64 (ptr nocapture writeonly , i8 , i64 , i1 immarg)
11
12
12
13
define void @test () {
13
14
; CHECK-LABEL: define void @test() {
14
15
; CHECK-NEXT: entry:
15
16
; CHECK-NEXT: [[AGG_TMP3_SROA_35:%.*]] = alloca [20 x i8], align 4
16
17
; CHECK-NEXT: [[AGG_TMP_SROA_14:%.*]] = alloca [20 x i8], align 4
17
18
; CHECK-NEXT: [[AGG_TMP_SROA_14_128_SROA_IDX:%.*]] = getelementptr i8, ptr [[AGG_TMP_SROA_14]], i64 4
18
- ; CHECK-NEXT: call void @llvm.memcpy .p0.p0. i64(ptr [[AGG_TMP_SROA_14_128_SROA_IDX]], ptr null , i64 1, i1 false)
19
+ ; CHECK-NEXT: call void @llvm.memset .p0.i64(ptr [[AGG_TMP_SROA_14_128_SROA_IDX]], i8 0 , i64 1, i1 false)
19
20
; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 20, ptr [[AGG_TMP3_SROA_35]])
20
21
; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[AGG_TMP3_SROA_35]], ptr [[AGG_TMP_SROA_14]], i64 20, i1 false)
21
22
; CHECK-NEXT: [[AGG_TMP3_SROA_35_128_SROA_IDX:%.*]] = getelementptr i8, ptr [[AGG_TMP3_SROA_35]], i64 4
27
28
%agg.tmp3.sroa.35 = alloca [20 x i8 ], align 4
28
29
%agg.tmp.sroa.14 = alloca [20 x i8 ], align 4
29
30
%agg.tmp.sroa.14.128.sroa_idx = getelementptr i8 , ptr %agg.tmp.sroa.14 , i64 4
30
- call void @llvm.memcpy .p0.p0. i64 (ptr %agg.tmp.sroa.14.128.sroa_idx , ptr null , i64 1 , i1 false )
31
+ call void @llvm.memset .p0.i64 (ptr %agg.tmp.sroa.14.128.sroa_idx , i8 0 , i64 1 , i1 false )
31
32
call void @llvm.lifetime.start.p0 (i64 20 , ptr %agg.tmp3.sroa.35 )
32
33
call void @llvm.memcpy.p0.p0.i64 (ptr %agg.tmp3.sroa.35 , ptr %agg.tmp.sroa.14 , i64 20 , i1 false )
33
34
%agg.tmp3.sroa.35.128.sroa_idx = getelementptr i8 , ptr %agg.tmp3.sroa.35 , i64 4
@@ -41,7 +42,7 @@ declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias
41
42
42
43
; uselistorder directives
43
44
uselistorder i64 4 , { 2 , 0 , 1 }
44
- uselistorder ptr @llvm.memcpy.p0.p0.i64 , { 3 , 2 , 1 , 0 }
45
+ uselistorder ptr @llvm.memcpy.p0.p0.i64 , { 2 , 1 , 0 }
45
46
46
47
attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
47
48
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
0 commit comments