rust/tests/codegen/vec_pop_push_noop.rs
Scott McMurray 6f2a78345e Update a bunch of library types for MCP807
This greatly reduces the number of places that actually use the `rustc_layout_scalar_valid_range_*` attributes down to just 3:
```
library/core\src\ptr\non_null.rs
68:#[rustc_layout_scalar_valid_range_start(1)]

library/core\src\num\niche_types.rs
19:        #[rustc_layout_scalar_valid_range_start($low)]
20:        #[rustc_layout_scalar_valid_range_end($high)]
```

Everything else -- PAL Nanoseconds, alloc's `Cap`, niched FDs, etc -- all just wrap those `niche_types` types.
2025-01-09 23:47:11 -08:00

28 lines
583 B
Rust

//@ revisions: llvm-pre-19 llvm-19
//@ [llvm-19] min-llvm-version: 19
//@ [llvm-pre-19] max-llvm-major-version: 18
//@ compile-flags: -O
#![crate_type = "lib"]
#[no_mangle]
// CHECK-LABEL: @noop(
pub fn noop(v: &mut Vec<u8>) {
// CHECK-NOT: grow_one
// CHECK-NOT: call
// CHECK: tail call void @llvm.assume
// CHECK-NOT: grow_one
// CHECK-NOT: call
// CHECK: {{ret|[}]}}
if let Some(x) = v.pop() {
v.push(x)
}
}
#[no_mangle]
// CHECK-LABEL: @push_byte(
pub fn push_byte(v: &mut Vec<u8>) {
// CHECK: call {{.*}}grow_one
v.push(3);
}