1 // compile-flags: -C no-prepopulate-passes
2 // ignore-tidy-linelength
6 // Hack to get the correct size for the length part in slices
7 // CHECK: @helper([[USIZE:i[0-9]+]] %arg0)
9 pub fn helper(_: usize) {
12 // CHECK-LABEL: @no_op_slice_adjustment
14 pub fn no_op_slice_adjustment(x: &[u8]) -> &[u8] {
15 // We used to generate an extra alloca and memcpy for the block's trailing expression value, so
16 // check that we copy directly to the return value slot
17 // CHECK: %0 = insertvalue { [0 x i8]*, [[USIZE]] } undef, [0 x i8]* %x.0, 0
18 // CHECK: %1 = insertvalue { [0 x i8]*, [[USIZE]] } %0, [[USIZE]] %x.1, 1
19 // CHECK: ret { [0 x i8]*, [[USIZE]] } %1
23 // CHECK-LABEL: @no_op_slice_adjustment2
25 pub fn no_op_slice_adjustment2(x: &[u8]) -> &[u8] {
26 // We used to generate an extra alloca and memcpy for the function's return value, so check
27 // that there's no memcpy (the slice is written to sret_slot element-wise)
28 // CHECK-NOT: call void @llvm.memcpy.
29 no_op_slice_adjustment(x)