add codegen test
This commit is contained in:
parent
5b12d906bb
commit
7782401c52
@ -1,9 +1,11 @@
|
|||||||
//@ compile-flags: -O
|
//@ compile-flags: -O
|
||||||
|
//@ compile-flags: -Zmerge-functions=disabled
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
// Test to check that types with "complex" destructors, but trivial `Default` impls
|
// Test to check that types with "complex" destructors, but trivial `Default` impls
|
||||||
// are constructed directly into the allocation in `Box::default` and `Arc::default`.
|
// are constructed directly into the allocation in `Box::default` and `Arc::default`.
|
||||||
|
|
||||||
|
use std::rc::Rc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
// CHECK-LABEL: @box_default_inplace
|
// CHECK-LABEL: @box_default_inplace
|
||||||
@ -16,6 +18,16 @@ pub fn box_default_inplace() -> Box<(String, String)> {
|
|||||||
Box::default()
|
Box::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CHECK-LABEL: @rc_default_inplace
|
||||||
|
#[no_mangle]
|
||||||
|
pub fn rc_default_inplace() -> Rc<(String, String)> {
|
||||||
|
// CHECK-NOT: alloca
|
||||||
|
// CHECK: [[RC:%.*]] = {{.*}}call {{.*}}__rust_alloc(
|
||||||
|
// CHECK-NOT: call void @llvm.memcpy
|
||||||
|
// CHECK: ret ptr [[RC]]
|
||||||
|
Rc::default()
|
||||||
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: @arc_default_inplace
|
// CHECK-LABEL: @arc_default_inplace
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn arc_default_inplace() -> Arc<(String, String)> {
|
pub fn arc_default_inplace() -> Arc<(String, String)> {
|
||||||
|
Loading…
Reference in New Issue
Block a user