Skip to content

Commit

Permalink
add a codegen check for absence of memcpy in String::push
Browse files Browse the repository at this point in the history
  • Loading branch information
lincot committed Feb 2, 2025
1 parent d2204ce commit b7f3a92
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/codegen/string-push.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//! Check that `String::push` is optimized enough not to call `memcpy`.
//@ compile-flags: -O
#![crate_type = "lib"]

// CHECK-LABEL: @string_push_does_not_call_memcpy
#[no_mangle]
pub fn string_push_does_not_call_memcpy(s: &mut String, ch: char) {
// CHECK-NOT: call void @llvm.memcpy
s.push(ch);
}

0 comments on commit b7f3a92

Please sign in to comment.