diff --git a/tests/mir-opt/const_prop/union.main.GVN.diff b/tests/mir-opt/const_prop/union.main.GVN.diff new file mode 100644 index 000000000000..16a0432ab901 --- /dev/null +++ b/tests/mir-opt/const_prop/union.main.GVN.diff @@ -0,0 +1,42 @@ +- // MIR for `main` before GVN ++ // MIR for `main` after GVN + + fn main() -> () { + let mut _0: (); + let _1: main::Un; + let mut _2: u32; + let _3: (); + let mut _4: u32; + scope 1 { + debug un => _1; + scope 3 (inlined std::mem::drop::) { + } + } + scope 2 (inlined val) { + } + + bb0: { + StorageLive(_1); +- StorageLive(_2); ++ nop; + _2 = const 1_u32; +- _1 = Un { us: move _2 }; +- StorageDead(_2); ++ _1 = const Un {{ us: 1_u32 }}; ++ nop; + StorageLive(_3); + StorageLive(_4); +- _4 = copy (_1.0: u32); ++ _4 = const 1_u32; + StorageDead(_4); + StorageDead(_3); + _0 = const (); + StorageDead(_1); + return; + } ++ } ++ ++ ALLOC0 (size: 4, align: 4) { ++ 01 00 00 00 │ .... + } + diff --git a/tests/mir-opt/dest-prop/union.rs b/tests/mir-opt/const_prop/union.rs similarity index 52% rename from tests/mir-opt/dest-prop/union.rs rename to tests/mir-opt/const_prop/union.rs index 977ab9c57ad7..9f197a1a5833 100644 --- a/tests/mir-opt/dest-prop/union.rs +++ b/tests/mir-opt/const_prop/union.rs @@ -1,17 +1,17 @@ -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Tests that we can propagate into places that are projections into unions -//@ compile-flags: -Zunsound-mir-opts -C debuginfo=full +//@ test-mir-pass: GVN +//@ compile-flags: -Zinline-mir + fn val() -> u32 { 1 } -// EMIT_MIR union.main.DestinationPropagation.diff +// EMIT_MIR union.main.GVN.diff fn main() { // CHECK-LABEL: fn main( - // CHECK: debug un => const Un - // CHECK: debug _x => const 1_u32; + // CHECK: debug un => [[un:_.*]]; // CHECK: bb0: { - // CHECK-NEXT: return; + // CHECK: [[un]] = const Un {{{{ us: 1_u32 }}}}; union Un { us: u32, } diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff deleted file mode 100644 index 013f1ea4e497..000000000000 --- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff +++ /dev/null @@ -1,29 +0,0 @@ -- // MIR for `main` before DestinationPropagation -+ // MIR for `main` after DestinationPropagation - - fn main() -> () { - let mut _0: (); - let _1: main::Un; - let mut _2: u32; - scope 1 { - debug un => const Un {{ us: 1_u32 }}; - scope 3 (inlined std::mem::drop::) { - debug _x => const 1_u32; - } - } - scope 2 (inlined val) { - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - StorageDead(_2); - StorageDead(_1); - return; - } - } - - ALLOC0 (size: 4, align: 4) { - 01 00 00 00 │ .... - } - diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff deleted file mode 100644 index 013f1ea4e497..000000000000 --- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff +++ /dev/null @@ -1,29 +0,0 @@ -- // MIR for `main` before DestinationPropagation -+ // MIR for `main` after DestinationPropagation - - fn main() -> () { - let mut _0: (); - let _1: main::Un; - let mut _2: u32; - scope 1 { - debug un => const Un {{ us: 1_u32 }}; - scope 3 (inlined std::mem::drop::) { - debug _x => const 1_u32; - } - } - scope 2 (inlined val) { - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - StorageDead(_2); - StorageDead(_1); - return; - } - } - - ALLOC0 (size: 4, align: 4) { - 01 00 00 00 │ .... - } -