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