]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/issue-73827-bounds-check-index-in-subexpr.rs
Rollup merge of #82296 - spastorino:pubrules, r=nikomatsakis
[rust.git] / src / test / codegen / issue-73827-bounds-check-index-in-subexpr.rs
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]
11 pub 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 }