File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
llvm/test/Transforms/MemCpyOpt Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -907,6 +907,23 @@ define void @memcpy_immut_escape_after(ptr align 4 noalias %val) {
907
907
ret void
908
908
}
909
909
910
+ declare void @two_args (ptr , ptr )
911
+
912
+ ; Should not perform call slot optimization: The function accepts the
913
+ ; destination as an argument and may read/write it.
914
+ define void @test (ptr noalias writable dereferenceable (4 ) %p ) {
915
+ ; CHECK-LABEL: @test(
916
+ ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
917
+ ; CHECK-NEXT: [[RET:%.*]] = call ptr @two_args(ptr [[A]], ptr captures(ret: address, provenance) [[P:%.*]]) #[[ATTR2]]
918
+ ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[P]], ptr [[A]], i64 4, i1 false)
919
+ ; CHECK-NEXT: ret void
920
+ ;
921
+ %a = alloca i32
922
+ %ret = call ptr @two_args (ptr %a , ptr captures(ret: address, provenance) %p ) nounwind
923
+ call void @llvm.memcpy (ptr align 4 %p , ptr %a , i64 4 , i1 false )
924
+ ret void
925
+ }
926
+
910
927
!0 = !{!0 }
911
928
!1 = !{!1 , !0 }
912
929
!2 = !{!1 }
You can’t perform that action at this time.
0 commit comments