Skip to content
/ rustc Public
forked from rust-lang/rust

Commit f37c576

Browse files
committed
add codegen test for rust-lang#113757
1 parent f3c89f1 commit f37c576

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// in Rust 1.73, -O and opt-level=3 optimizes differently
2+
//@ compile-flags: -C opt-level=3
3+
//@ min-llvm-version: 17
4+
#![crate_type = "lib"]
5+
6+
use std::cmp::max;
7+
8+
#[no_mangle]
9+
// CHECK-LABEL: @foo
10+
// CHECK-NOT: slice_start_index_len_fail
11+
// CHECK-NOT: unreachable
12+
pub fn foo(v: &mut Vec<u8>, size: usize)-> Option<&mut [u8]> {
13+
if v.len() > max(1, size) {
14+
let start = v.len() - size;
15+
Some(&mut v[start..])
16+
} else {
17+
None
18+
}
19+
}

0 commit comments

Comments
 (0)