• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // This test checks an optimization that is not guaranteed to work. This test case should not block
2 // a future LLVM update.
3 // compile-flags: -O
4 
5 #![crate_type = "lib"]
6 
7 #[repr(u8)]
8 pub enum Exception {
9     Low = 5,
10     High = 10,
11 }
12 
13 // CHECK-LABEL: @access
14 #[no_mangle]
access(array: &[usize; 12], exc: Exception) -> usize15 pub fn access(array: &[usize; 12], exc: Exception) -> usize {
16     // CHECK-NOT: panic_bounds_check
17     array[(exc as u8 - 4) as usize]
18 }
19