Skip to content

Commit 2c1de08

Browse files
Rollup merge of #78046 - bugadani:issue-73827, r=nikic
Add codegen test for issue #73827 Closes #73827
2 parents 981346f + 64c239c commit 2c1de08

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
}

0 commit comments

Comments
 (0)