about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-10-01 20:06:35 +0000
committerbors <bors@rust-lang.org>2015-10-01 20:06:35 +0000
commit168a23ebe1729386138fa71643382fdd64fac205 (patch)
tree0b755f0d869731afaaf2c0a8af486027ad376ef8 /src/test/codegen
parentd9d9ca1a025a944c552c027129cec984ffeeb41c (diff)
parentbda083fa706c1a5a26a5c197960197086a84b4b9 (diff)
downloadrust-168a23ebe1729386138fa71643382fdd64fac205.tar.gz
rust-168a23ebe1729386138fa71643382fdd64fac205.zip
Auto merge of #28787 - dotdash:no_more___fat_ptr, r=eddyb
A DST value and a fat pointer to it have the same representation, all we
have to do is to adjust the type of the datum holding the pointer.
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/refs.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/codegen/refs.rs b/src/test/codegen/refs.rs
new file mode 100644
index 00000000000..08eec0045f7
--- /dev/null
+++ b/src/test/codegen/refs.rs
@@ -0,0 +1,30 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -C no-prepopulate-passes
+
+#![crate_type = "lib"]
+
+// Hack to get the correct size for the length part in slices
+// CHECK: @helper([[USIZE:i[0-9]+]])
+#[no_mangle]
+fn helper(_: usize) {
+}
+
+// CHECK-LABEL: @ref_dst
+#[no_mangle]
+pub fn ref_dst(s: &[u8]) {
+    // We used to generate an extra alloca and memcpy to ref the dst, so check that we copy
+    // directly to the alloca for "x"
+// CHECK: [[SRC:%[0-9]+]] = bitcast { i8*, [[USIZE]] }* %s to i8*
+// CHECK: [[DST:%[0-9]+]] = bitcast { i8*, [[USIZE]] }* %x to i8*
+// CHECK: call void @llvm.memcpy.{{.*}}(i8* [[DST]], i8* [[SRC]],
+    let x = &*s;
+}