Skip to content

Commit

Permalink
Add codegen test for issue rust-lang#73827
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Oct 17, 2020
1 parent 8850893 commit 64c239c
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 64c239c

Please sign in to comment.