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
667 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
2024-08-18 17:51:53 -05:00
// CHECK: [[b]] = copy [[a]];
2024-01-12 01:22:33 -06:00
// CHECK-NOT: [[b]] = const
2022-10-06 18:11:06 -05:00
let b = a;
}