2023-04-23 11:15:22 -05:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2024-04-20 06:19:34 -05:00
|
|
|
//@ test-mir-pass: DataflowConstProp
|
2024-07-27 01:36:17 -05:00
|
|
|
//@ compile-flags: -Zmir-enable-passes=+InstSimplify-after-simplifycfg
|
2023-04-23 11:15:22 -05:00
|
|
|
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
|
|
|
|
|
|
|
// EMIT_MIR slice_len.main.DataflowConstProp.diff
|
2024-01-08 22:20:53 -06:00
|
|
|
|
2024-01-12 01:22:33 -06:00
|
|
|
// CHECK-LABEL: fn main(
|
2023-04-23 11:15:22 -05:00
|
|
|
fn main() {
|
2024-01-12 01:22:33 -06:00
|
|
|
// CHECK: debug local => [[local:_.*]];
|
|
|
|
// CHECK: debug constant => [[constant:_.*]];
|
2024-01-08 22:20:53 -06:00
|
|
|
|
2024-01-12 01:22:33 -06:00
|
|
|
// CHECK-NOT: {{_.*}} = Len(
|
|
|
|
// CHECK-NOT: {{_.*}} = Lt(
|
|
|
|
// CHECK-NOT: assert(move _
|
|
|
|
// CHECK: {{_.*}} = const 3_usize;
|
|
|
|
// CHECK: {{_.*}} = const true;
|
|
|
|
// CHECK: assert(const true,
|
2024-01-08 22:20:53 -06:00
|
|
|
|
2024-08-18 17:51:53 -05:00
|
|
|
// CHECK: [[local]] = copy (*{{_.*}})[1 of 2];
|
2023-09-07 10:59:05 -05:00
|
|
|
let local = (&[1u32, 2, 3] as &[u32])[1];
|
|
|
|
|
2024-01-12 01:22:33 -06:00
|
|
|
// CHECK-NOT: {{_.*}} = Len(
|
|
|
|
// CHECK-NOT: {{_.*}} = Lt(
|
|
|
|
// CHECK-NOT: assert(move _
|
2023-09-07 10:59:05 -05:00
|
|
|
const SLICE: &[u32] = &[1, 2, 3];
|
2024-01-12 01:22:33 -06:00
|
|
|
// CHECK: {{_.*}} = const 3_usize;
|
|
|
|
// CHECK: {{_.*}} = const true;
|
|
|
|
// CHECK: assert(const true,
|
2024-01-08 22:20:53 -06:00
|
|
|
|
2024-08-18 17:51:53 -05:00
|
|
|
// CHECK-NOT: [[constant]] = {{copy|move}} (*{{_.*}})[_
|
|
|
|
// CHECK: [[constant]] = copy (*{{_.*}})[1 of 2];
|
2023-09-07 10:59:05 -05:00
|
|
|
let constant = SLICE[1];
|
2023-04-23 11:15:22 -05:00
|
|
|
}
|