summary refs log tree commit diff
path: root/tests/codegen-llvm/string-push.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codegen-llvm/string-push.rs')
-rw-r--r--tests/codegen-llvm/string-push.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/codegen-llvm/string-push.rs b/tests/codegen-llvm/string-push.rs
new file mode 100644
index 00000000000..cf5f6bb1aa3
--- /dev/null
+++ b/tests/codegen-llvm/string-push.rs
@@ -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);
+}