Skip to content

Commit

Permalink
Unrolled build for rust-lang#134852
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#134852 - alex:patch-1, r=durin42

Added a codegen test for optimization with const arrays

Closes rust-lang#107208
  • Loading branch information
rust-timer authored Dec 29, 2024
2 parents b76036c + d6c73eb commit d3561a1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/codegen/const-array.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//@ compile-flags: -O

#![crate_type = "lib"]

const LUT: [u8; 2] = [1, 1];

// CHECK-LABEL: @decode
#[no_mangle]
pub fn decode(i: u8) -> u8 {
// CHECK: start:
// CHECK-NEXT: icmp
// CHECK-NEXT: select
// CHECK-NEXT: ret
if i < 2 { LUT[i as usize] } else { 2 }
}

0 comments on commit d3561a1

Please sign in to comment.