2023-06-08 02:18:34 -05:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2024-04-20 06:19:34 -05:00
|
|
|
//@ test-mir-pass: DataflowConstProp
|
2022-10-06 18:11:06 -05:00
|
|
|
|
|
|
|
#[inline(never)]
|
|
|
|
fn escape<T>(x: &T) {}
|
|
|
|
|
2022-10-06 18:17:43 -05:00
|
|
|
#[inline(never)]
|
|
|
|
fn some_function() {}
|
|
|
|
|
2022-10-06 18:11:06 -05:00
|
|
|
// EMIT_MIR ref_without_sb.main.DataflowConstProp.diff
|
2024-01-12 01:22:33 -06:00
|
|
|
// CHECK-LABEL: fn main(
|
2022-10-06 18:11:06 -05:00
|
|
|
fn main() {
|
2024-01-08 22:19:59 -06:00
|
|
|
// CHECK: debug a => [[a:_.*]];
|
|
|
|
// CHECK: debug b => [[b:_.*]];
|
|
|
|
|
2022-10-06 18:11:06 -05:00
|
|
|
let mut a = 0;
|
2024-01-08 22:19:59 -06:00
|
|
|
|
2024-01-12 01:22:33 -06:00
|
|
|
// CHECK: {{_.*}} = escape::<i32>(move {{_.*}}) -> {{.*}}
|
2022-10-06 18:11:06 -05:00
|
|
|
escape(&a);
|
|
|
|
a = 1;
|
2024-01-08 22:19:59 -06:00
|
|
|
|
2024-01-12 01:22:33 -06:00
|
|
|
// CHECK: {{_.*}} = some_function() -> {{.*}}
|
2022-10-06 18:17:43 -05:00
|
|
|
some_function();
|
2022-11-09 11:03:30 -06:00
|
|
|
// This should currently not be propagated.
|
2024-01-08 22:19:59 -06:00
|
|
|
|
2024-01-12 01:22:33 -06:00
|
|
|
// CHECK-NOT: [[b]] = const
|
2024-01-08 22:19:59 -06:00
|
|
|
// CHECK: [[b]] = [[a]];
|
2024-01-12 01:22:33 -06:00
|
|
|
// CHECK-NOT: [[b]] = const
|
2022-10-06 18:11:06 -05:00
|
|
|
let b = a;
|
|
|
|
}
|