mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Apply review suggestions
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
This commit is contained in:
parent
75f1dfcc32
commit
78e11a4556
@ -1,5 +1,5 @@
|
||||
// min-llvm-version: 15.0
|
||||
// compile-flags: -C opt-level=3 -C target-cpu=native
|
||||
// compile-flags: -C opt-level=3
|
||||
|
||||
// The below two functions ensure that both `String::new()` and `"".to_string()`
|
||||
// produce the identical code.
|
||||
@ -7,21 +7,20 @@
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// CHECK-LABEL: @string_new = unnamed_addr alias void (ptr), ptr @empty_to_string
|
||||
// CHECK: define void @empty_to_string
|
||||
#[no_mangle]
|
||||
pub fn string_new() -> String {
|
||||
String::new()
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define void @empty_to_string
|
||||
#[no_mangle]
|
||||
pub fn empty_to_string() -> String {
|
||||
// CHECK-NOT: load i8
|
||||
// CHECK: store i64
|
||||
// CHECK: store i{{32|64}}
|
||||
// CHECK-NEXT: getelementptr
|
||||
// CHECK-NEXT: store ptr
|
||||
// CHECK-NEXT: getelementptr
|
||||
// CHECK-NOT: store i8
|
||||
// CHECK-NEXT: store i64
|
||||
// CHECK-NEXT: store i{{32|64}}
|
||||
// CHECK-NEXT: ret void
|
||||
"".to_string()
|
||||
}
|
||||
@ -32,12 +31,12 @@ pub fn empty_to_string() -> String {
|
||||
// CHECK-LABEL: @empty_vec
|
||||
#[no_mangle]
|
||||
pub fn empty_vec() -> Vec<u8> {
|
||||
// CHECK: store i64
|
||||
// CHECK: store i{{32|64}}
|
||||
// CHECK-NOT: load i8
|
||||
// CHECK-NEXT: getelementptr
|
||||
// CHECK-NEXT: store ptr
|
||||
// CHECK-NEXT: getelementptr
|
||||
// CHECK-NEXT: store i64
|
||||
// CHECK-NEXT: store i{{32|64}}
|
||||
// CHECK-NEXT: ret void
|
||||
vec![]
|
||||
}
|
||||
@ -45,12 +44,12 @@ pub fn empty_vec() -> Vec<u8> {
|
||||
// CHECK-LABEL: @empty_vec_clone
|
||||
#[no_mangle]
|
||||
pub fn empty_vec_clone() -> Vec<u8> {
|
||||
// CHECK: store i64
|
||||
// CHECK: store i{{32|64}}
|
||||
// CHECK-NOT: load i8
|
||||
// CHECK-NEXT: getelementptr
|
||||
// CHECK-NEXT: store ptr
|
||||
// CHECK-NEXT: getelementptr
|
||||
// CHECK-NEXT: store i64
|
||||
// CHECK-NEXT: store i{{32|64}}
|
||||
// CHECK-NEXT: ret void
|
||||
vec![].clone()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user