2015-10-01 11:55:52 +02:00
|
|
|
// compile-flags: -C no-prepopulate-passes
|
|
|
|
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
|
|
|
// Hack to get the correct size for the length part in slices
|
2019-09-13 19:25:05 +03:00
|
|
|
// CHECK: @helper([[USIZE:i[0-9]+]] %_1)
|
2015-10-01 11:55:52 +02:00
|
|
|
#[no_mangle]
|
2017-10-30 18:18:00 +01:00
|
|
|
pub fn helper(_: usize) {
|
2015-10-01 11:55:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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"
|
2017-10-09 19:56:41 +03:00
|
|
|
// CHECK: [[X0:%[0-9]+]] = getelementptr {{.*}} { [0 x i8]*, [[USIZE]] }* %x, i32 0, i32 0
|
2017-09-21 20:40:50 +03:00
|
|
|
// CHECK: store [0 x i8]* %s.0, [0 x i8]** [[X0]]
|
2017-10-06 10:25:35 +03:00
|
|
|
// CHECK: [[X1:%[0-9]+]] = getelementptr {{.*}} { [0 x i8]*, [[USIZE]] }* %x, i32 0, i32 1
|
2017-09-21 20:40:50 +03:00
|
|
|
// CHECK: store [[USIZE]] %s.1, [[USIZE]]* [[X1]]
|
2016-08-24 06:36:37 +03:00
|
|
|
|
2015-10-01 11:55:52 +02:00
|
|
|
let x = &*s;
|
2016-08-24 06:36:37 +03:00
|
|
|
&x; // keep variable in an alloca
|
2015-10-01 11:55:52 +02:00
|
|
|
}
|