mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
add codegen test for #113757
This commit is contained in:
parent
f3c89f1751
commit
f37c576dbd
@ -0,0 +1,19 @@
|
||||
// in Rust 1.73, -O and opt-level=3 optimizes differently
|
||||
//@ compile-flags: -C opt-level=3
|
||||
//@ min-llvm-version: 17
|
||||
#![crate_type = "lib"]
|
||||
|
||||
use std::cmp::max;
|
||||
|
||||
#[no_mangle]
|
||||
// CHECK-LABEL: @foo
|
||||
// CHECK-NOT: slice_start_index_len_fail
|
||||
// CHECK-NOT: unreachable
|
||||
pub fn foo(v: &mut Vec<u8>, size: usize)-> Option<&mut [u8]> {
|
||||
if v.len() > max(1, size) {
|
||||
let start = v.len() - size;
|
||||
Some(&mut v[start..])
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user