Skip to content

Commit 64c239c

Browse files
committed
Add codegen test for issue #73827
1 parent 8850893 commit 64c239c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
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)