Skip to content

Commit

Permalink
add 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 Jul 10, 2024
1 parent 90154a2 commit 89fa55e
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 @@
//@ compile-flags: -O
#![crate_type = "lib"]

use std::hint::black_box;

// 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 89fa55e

Please sign in to comment.