mirror of
https://github.com/rust-lang/rust.git
synced 2025-12-02 17:28:12 +00:00
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.
28 lines
570 B
Rust
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);
|
|
}
|