rust/tests/mir-opt/simplify_aggregate_to_copy_miscompile.foo.GVN.diff

62 lines
1.5 KiB
Diff

- // MIR for `foo` before GVN
+ // MIR for `foo` after GVN
fn foo(_1: &mut Option<i32>) -> Option<i32> {
debug v => _1;
let mut _0: std::option::Option<i32>;
let mut _2: &std::option::Option<i32>;
let mut _3: &std::option::Option<i32>;
let mut _4: isize;
let mut _6: !;
let mut _7: std::option::Option<i32>;
let mut _8: i32;
let mut _9: !;
scope 1 {
debug col => _5;
let _5: i32;
}
bb0: {
StorageLive(_2);
StorageLive(_3);
_3 = &(*_1);
_2 = get::<Option<i32>>(move _3) -> [return: bb1, unwind unreachable];
}
bb1: {
StorageDead(_3);
_4 = discriminant((*_2));
switchInt(move _4) -> [1: bb2, otherwise: bb3];
}
bb2: {
- StorageLive(_5);
+ nop;
_5 = copy (((*_2) as Some).0: i32);
StorageLive(_7);
- _7 = Option::<i32>::None;
- (*_1) = move _7;
+ _7 = const Option::<i32>::None;
+ (*_1) = const Option::<i32>::None;
StorageDead(_7);
StorageLive(_8);
_8 = copy _5;
- _0 = Option::<i32>::Some(move _8);
+ _0 = Option::<i32>::Some(copy _5);
StorageDead(_8);
- StorageDead(_5);
+ nop;
StorageDead(_2);
return;
}
bb3: {
StorageLive(_9);
unreachable;
}
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 00 00 00 00 __ __ __ __ │ ....░░░░
}