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

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

31 lines
662 B
Rust
Raw Normal View History

// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ 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() {
// CHECK: debug a => [[a:_.*]];
// CHECK: debug b => [[b:_.*]];
2022-10-06 18:11:06 -05:00
let mut a = 0;
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-12 01:22:33 -06:00
// CHECK: {{_.*}} = some_function() -> {{.*}}
2022-10-06 18:17:43 -05:00
some_function();
// This should currently not be propagated.
2024-01-12 01:22:33 -06:00
// CHECK-NOT: [[b]] = const
// 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;
}