]> git.proxmox.com Git - rustc.git/blame - src/test/codegen/issue-73827-bounds-check-index-in-subexpr.rs
New upstream version 1.49.0~beta.4+dfsg1
[rustc.git] / src / test / codegen / issue-73827-bounds-check-index-in-subexpr.rs
CommitLineData
29967ef6
XL
1// This test checks that bounds checks are elided when
2// index is part of a (x | y) < C style condition
3
4// min-llvm-version: 11.0.0
5// compile-flags: -O
6
7#![crate_type = "lib"]
8
9// CHECK-LABEL: @get
10#[no_mangle]
11pub fn get(array: &[u8; 8], x: usize, y: usize) -> u8 {
12 if x > 7 || y > 7 {
13 0
14 } else {
15 // CHECK-NOT: panic_bounds_check
16 array[y]
17 }
18}