Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/codegen-llvm/lib-optimizations/append-elements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
//! zero-capacity length flowing into the memcpy arguments.

// CHECK-LABEL: @vec_append_with_temp_alloc
// CHECK-SAME: ptr{{.*}}[[DST:%[a-z]+]]{{.*}}ptr{{.*}}[[SRC:%[a-z]+]]
// CHECK-SAME: (ptr {{[^%]+}}%[[DST:[a-z0-9._]+]], ptr {{[^%]+}}%[[SRC:[a-z0-9._]+]],
#[no_mangle]
pub fn vec_append_with_temp_alloc(dst: &mut Vec<u8>, src: &[u8]) {
// CHECK-NOT: call void @llvm.memcpy
// CHECK: call void @llvm.memcpy.{{.*}}[[DST]].i{{.*}}[[SRC]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To help anyone else who might, like me, have missed it: note that there's a .i on here; it wasn't actually looking for a memcpy to the &mut Vec.

Makes me think that perhaps the test wants the GEP+load in the checks too?

// CHECK: call void @llvm.memcpy.{{.*}}ptr {{.*}}, ptr {{.*}}%[[SRC]]
// CHECK-NOT: call void @llvm.memcpy
let temp = src.to_vec();
dst.extend(&temp);
// CHECK: ret
}

// CHECK-LABEL: @string_append_with_temp_alloc
// CHECK-SAME: ptr{{.*}}[[DST:%[a-z]+]]{{.*}}ptr{{.*}}[[SRC:%[a-z]+]]
// CHECK-SAME: (ptr {{[^%]+}}%[[DST:[a-z0-9._]+]], ptr {{[^%]+}}%[[SRC:[a-z0-9._]+]],
#[no_mangle]
pub fn string_append_with_temp_alloc(dst: &mut String, src: &str) {
// CHECK-NOT: call void @llvm.memcpy
// CHECK: call void @llvm.memcpy.{{.*}}[[DST]].i{{.*}}[[SRC]]
// CHECK: call void @llvm.memcpy.{{.*}}ptr {{.*}}, ptr {{.*}}%[[SRC]]
// CHECK-NOT: call void @llvm.memcpy
let temp = src.to_string();
dst.push_str(&temp);
Expand Down
Loading