]>
Commit | Line | Data |
---|---|---|
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] | |
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 | } |