2024-04-20 06:19:34 -05:00
|
|
|
//@ test-mir-pass: DataflowConstProp
|
2024-06-14 18:01:26 -05:00
|
|
|
//@ compile-flags: -Coverflow-checks=on -Zdump-mir-exclude-alloc-bytes
|
2023-09-17 04:35:06 -05:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2022-08-25 11:43:46 -05:00
|
|
|
|
|
|
|
// EMIT_MIR checked.main.DataflowConstProp.diff
|
|
|
|
#[allow(arithmetic_overflow)]
|
2024-01-07 23:16:55 -06:00
|
|
|
|
|
|
|
// CHECK-LABEL: fn main(
|
2022-08-25 11:43:46 -05:00
|
|
|
fn main() {
|
2024-01-07 23:16:55 -06:00
|
|
|
// CHECK: debug a => [[a:_.*]];
|
|
|
|
// CHECK: debug b => [[b:_.*]];
|
|
|
|
// CHECK: debug c => [[c:_.*]];
|
|
|
|
// CHECK: debug d => [[d:_.*]];
|
|
|
|
// CHECK: debug e => [[e:_.*]];
|
|
|
|
|
|
|
|
// CHECK: [[a]] = const 1_i32;
|
2022-08-25 11:43:46 -05:00
|
|
|
let a = 1;
|
2024-01-07 23:16:55 -06:00
|
|
|
|
|
|
|
// CHECK: [[b]] = const 2_i32;
|
2022-08-25 11:43:46 -05:00
|
|
|
let b = 2;
|
2024-01-07 23:16:55 -06:00
|
|
|
|
2024-01-20 10:09:14 -06:00
|
|
|
// CHECK: assert(!const false,
|
2024-01-07 23:16:55 -06:00
|
|
|
// CHECK: [[c]] = const 3_i32;
|
2022-08-25 11:43:46 -05:00
|
|
|
let c = a + b;
|
|
|
|
|
2024-03-10 08:05:11 -05:00
|
|
|
// CHECK: [[d]] = const core::num::<impl i32>::MAX;
|
2022-08-25 11:43:46 -05:00
|
|
|
let d = i32::MAX;
|
2024-01-07 23:16:55 -06:00
|
|
|
|
2024-01-20 10:09:14 -06:00
|
|
|
// CHECK: assert(!const true,
|
2024-01-07 23:16:55 -06:00
|
|
|
// CHECK: [[e]] = const i32::MIN;
|
2022-08-25 11:43:46 -05:00
|
|
|
let e = d + 1;
|
|
|
|
}
|