rust/tests/codegen-llvm/vec_pop_push_noop.rs
Augie Fackler e32b975e84 tests: relax expectations after llvm change 902ddda120a5
LLVM 22 is able to drop assumes that seem to not help further
optimizations, which actually seems to dramatically _help_ further
optimizations in some of our small test cases.
2025-09-19 13:56:19 -04:00

28 lines
570 B
Rust

//@ compile-flags: -Copt-level=3
//@ revisions: new old
//@ [old] ignore-llvm-version: 22 - 99
//@ [new] min-llvm-version: 22
#![crate_type = "lib"]
#[no_mangle]
// CHECK-LABEL: @noop(
pub fn noop(v: &mut Vec<u8>) {
// CHECK-NOT: grow_one
// CHECK-NOT: call
// old: 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);
}