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

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

27 lines
488 B
Rust
Raw Normal View History

//@ test-mir-pass: DataflowConstProp
// EMIT_MIR self_assign.main.DataflowConstProp.diff
2024-01-12 01:22:33 -06:00
// CHECK-LABEL: fn main(
fn main() {
// CHECK: debug a => [[a:_.*]];
// CHECK: debug b => [[b:_.*]];
let mut a = 0;
2024-01-12 01:22:33 -06:00
// CHECK: [[a]] = Add(move {{_.*}}, const 1_i32);
a = a + 1;
2024-01-12 01:22:33 -06:00
// CHECK: [[a]] = move {{_.*}};
a = a;
// CHECK: [[b]] = &[[a]];
let mut b = &a;
2024-01-12 01:22:33 -06:00
// CHECK: [[b]] = move {{_.*}};
b = b;
2024-01-12 01:22:33 -06:00
// CHECK: [[a]] = move {{_.*}};
a = *b;
}