Skip to content

Commit

Permalink
Rollup merge of #78046 - bugadani:issue-73827, r=nikic
Browse files Browse the repository at this point in the history
Add codegen test for issue #73827

Closes #73827
  • Loading branch information
GuillaumeGomez authored Oct 20, 2020
2 parents 981346f + 64c239c commit 2c1de08
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/test/codegen/issue-73827-bounds-check-index-in-subexpr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This test checks that bounds checks are elided when
// index is part of a (x | y) < C style condition

// min-llvm-version: 11.0.0
// compile-flags: -O

#![crate_type = "lib"]

// CHECK-LABEL: @get
#[no_mangle]
pub fn get(array: &[u8; 8], x: usize, y: usize) -> u8 {
if x > 7 || y > 7 {
0
} else {
// CHECK-NOT: panic_bounds_check
array[y]
}
}

0 comments on commit 2c1de08

Please sign in to comment.