rust/tests/mir-opt/dataflow-const-prop/array_index.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
625 B
Rust
Raw Normal View History

2023-04-23 16:15:22 +00:00
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR array_index.main.DataflowConstProp.diff
// CHECK-LABEL: fn main() -> () {
2023-04-23 16:15:22 +00:00
fn main() {
// CHECK: let mut [[array_lit:_.*]]: [u32; 4];
// CHECK: debug x => [[x:_.*]];
2023-04-23 16:15:22 +00:00
let x: u32 = [0, 1, 2, 3][2];
// CHECK: bb{{[0-9]+}}: {
// CHECK: [[array_lit]] = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
// CHECK: [[index:_.*]] = const 2_usize;
// CHECK: bb{{[0-9]+}}: {
// CHECK-NOT: [[x]] = [[array_lit]][[[index]]];
// CHECK: [[x]] = [[array_lit]][2 of 3];
2023-04-23 16:15:22 +00:00
}