diff options
Diffstat (limited to 'tests')
45 files changed, 74 insertions, 501 deletions
diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination-initial.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination-initial.diff index ff18df1efcf..d584de6861c 100644 --- a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination-initial.diff +++ b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination-initial.diff @@ -19,10 +19,6 @@ - _3 = copy _2; - _2 = copy _1; - _1 = copy _5; -+ nop; -+ nop; -+ nop; -+ nop; _4 = cond() -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/dead-store-elimination/ref.dead_first.DeadStoreElimination-initial.diff b/tests/mir-opt/dead-store-elimination/ref.dead_first.DeadStoreElimination-initial.diff index d823241bc62..2a793e24990 100644 --- a/tests/mir-opt/dead-store-elimination/ref.dead_first.DeadStoreElimination-initial.diff +++ b/tests/mir-opt/dead-store-elimination/ref.dead_first.DeadStoreElimination-initial.diff @@ -15,7 +15,6 @@ StorageLive(_2); - _2 = &((*_1).2: i32); + // DBG: _2 = &((*_1).2: i32); -+ nop; StorageLive(_3); StorageLive(_4); _4 = &((*_1).0: i32); diff --git a/tests/mir-opt/dead-store-elimination/ref.tuple.DeadStoreElimination-initial.diff b/tests/mir-opt/dead-store-elimination/ref.tuple.DeadStoreElimination-initial.diff index 0547a42cab2..af28c1b9aa8 100644 --- a/tests/mir-opt/dead-store-elimination/ref.tuple.DeadStoreElimination-initial.diff +++ b/tests/mir-opt/dead-store-elimination/ref.tuple.DeadStoreElimination-initial.diff @@ -12,14 +12,13 @@ } bb0: { - StorageLive(_2); +- StorageLive(_2); _3 = deref_copy (_1.1: &Foo); - _2 = &((*_3).2: i32); + // DBG: _2 = &((*_3).2: i32); -+ nop; _4 = deref_copy (_1.1: &Foo); _0 = copy ((*_4).0: i32); - StorageDead(_2); +- StorageDead(_2); return; } } diff --git a/tests/mir-opt/debuginfo/simplifycfg.drop_debuginfo.SimplifyCfg-final.diff b/tests/mir-opt/debuginfo/simplifycfg.drop_debuginfo.SimplifyCfg-final.diff index 7a1ac92f6dd..d4a73351ee4 100644 --- a/tests/mir-opt/debuginfo/simplifycfg.drop_debuginfo.SimplifyCfg-final.diff +++ b/tests/mir-opt/debuginfo/simplifycfg.drop_debuginfo.SimplifyCfg-final.diff @@ -14,13 +14,11 @@ - - bb1: { - // DBG: _3 = &((*_1).0: i32); -- nop; - goto -> bb2; - } - - bb2: { // DBG: _4 = &((*_1).1: i64); -- nop; _0 = copy ((*_1).2: i32); return; } diff --git a/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_1.SimplifyCfg-final.diff b/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_1.SimplifyCfg-final.diff index fa4d3aebf83..1c12358ad89 100644 --- a/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_1.SimplifyCfg-final.diff +++ b/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_1.SimplifyCfg-final.diff @@ -17,16 +17,13 @@ - bb1: { (*_2) = const true; // DBG: _3 = &((*_1).0: i32); -- nop; - goto -> bb2; - } - - bb2: { // DBG: _4 = &((*_1).1: i64); -- nop; _0 = copy ((*_1).2: i32); // DBG: _5 = &((*_1).2: i32); -- nop; return; } } diff --git a/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_2.SimplifyCfg-final.diff b/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_2.SimplifyCfg-final.diff index b01c91f196b..de8e5612c87 100644 --- a/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_2.SimplifyCfg-final.diff +++ b/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_2.SimplifyCfg-final.diff @@ -16,16 +16,13 @@ - - bb1: { // DBG: _2 = &((*_1).0: i32); -- nop; - goto -> bb2; - } - - bb2: { // DBG: _3 = &((*_1).1: i64); -- nop; _0 = copy ((*_1).2: i32); // DBG: _4 = &((*_1).2: i32); -- nop; return; } } diff --git a/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_3.SimplifyCfg-final.diff b/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_3.SimplifyCfg-final.diff index caa90d79a1c..11372a262a7 100644 --- a/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_3.SimplifyCfg-final.diff +++ b/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_3.SimplifyCfg-final.diff @@ -17,13 +17,11 @@ bb1: { - // DBG: _3 = &((*_1).0: i32); -- nop; - goto -> bb3; - } - - bb2: { // DBG: _4 = &((*_1).1: i64); -- nop; _0 = copy ((*_1).2: i32); return; } @@ -32,7 +30,6 @@ + bb2: { + // DBG: _3 = &((*_1).0: i32); // DBG: _5 = &((*_1).2: i32); -- nop; _0 = copy ((*_1).0: i32); return; } diff --git a/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_identical_succs.SimplifyCfg-final.diff b/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_identical_succs.SimplifyCfg-final.diff index d8c36990a5f..0c6a75237d8 100644 --- a/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_identical_succs.SimplifyCfg-final.diff +++ b/tests/mir-opt/debuginfo/simplifycfg.preserve_debuginfo_identical_succs.SimplifyCfg-final.diff @@ -16,16 +16,13 @@ - - bb1: { // DBG: _3 = &((*_1).0: i32); -- nop; - goto -> bb2; - } - - bb2: { // DBG: _4 = &((*_1).1: i64); -- nop; _0 = copy ((*_1).2: i32); // DBG: _5 = &((*_1).2: i32); -- nop; return; } } diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff index f7729c7c5fa..7fa22524f00 100644 --- a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff @@ -64,9 +64,7 @@ + StorageLive(_8); + StorageLive(_9); + StorageLive(_11); -+ // DBG: _11 = &((*_6).0: alloc::raw_vec::RawVec<A>); + StorageLive(_12); -+ // DBG: _12 = &(((*_6).0: alloc::raw_vec::RawVec<A>).0: alloc::raw_vec::RawVecInner); + StorageLive(_13); + _13 = copy (((((*_6).0: alloc::raw_vec::RawVec<A>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>); + _9 = copy _13 as *mut A (Transmute); @@ -92,7 +90,6 @@ _5 = copy _2; - _0 = drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind unreachable]; + StorageLive(_17); -+ StorageLive(_18); + _17 = discriminant((*_5)); + switchInt(move _17) -> [0: bb5, otherwise: bb6]; } @@ -118,7 +115,6 @@ + } + + bb5: { -+ StorageDead(_18); + StorageDead(_17); StorageDead(_5); return; diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff index 18324276425..34f89da19f5 100644 --- a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff @@ -27,13 +27,11 @@ _5 = copy _2; - _0 = drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind continue]; + StorageLive(_6); -+ StorageLive(_7); + _6 = discriminant((*_5)); + switchInt(move _6) -> [0: bb2, otherwise: bb3]; } bb2: { -+ StorageDead(_7); + StorageDead(_6); StorageDead(_5); return; diff --git a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff index 649b5a65202..bb81cb4e260 100644 --- a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff +++ b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff @@ -129,11 +129,8 @@ _10 = deref_copy (_1.1: &mut std::task::Context<'_>); _9 = &mut (*_10); - _7 = <{async fn body of ActionPermit<'_, T>::perform()} as Future>::poll(move _8, move _9) -> [return: bb3, unwind unreachable]; -+ StorageLive(_11); -+ StorageLive(_15); + StorageLive(_16); + StorageLive(_25); -+ StorageLive(_27); + StorageLive(_30); + StorageLive(_31); + StorageLive(_32); @@ -166,11 +163,8 @@ + StorageDead(_32); + StorageDead(_31); + StorageDead(_30); -+ StorageDead(_27); + StorageDead(_25); + StorageDead(_16); -+ StorageDead(_15); -+ StorageDead(_11); StorageDead(_9); StorageDead(_8); StorageDead(_7); @@ -223,17 +217,13 @@ + _22 = &mut (*_23); + StorageDead(_24); + StorageLive(_44); -+ StorageLive(_45); + StorageLive(_49); + StorageLive(_41); + StorageLive(_42); + StorageLive(_43); -+ // DBG: _45 = &_19; + StorageLive(_46); -+ // DBG: _46 = &(_19.0: &mut std::future::Ready<()>); + _44 = copy (_19.0: &mut std::future::Ready<()>); + StorageDead(_46); -+ // DBG: _43 = &((*_44).0: std::option::Option<()>); + StorageLive(_47); + _47 = Option::<()>::None; + _42 = copy ((*_44).0: std::option::Option<()>); @@ -315,7 +305,6 @@ + _18 = Poll::<()>::Ready(move _41); + StorageDead(_41); + StorageDead(_49); -+ StorageDead(_45); + StorageDead(_44); + StorageDead(_22); + StorageDead(_19); diff --git a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff index 32021b20ef4..520c54824e1 100644 --- a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff @@ -131,11 +131,8 @@ _10 = deref_copy (_1.1: &mut std::task::Context<'_>); _9 = &mut (*_10); - _7 = <{async fn body of ActionPermit<'_, T>::perform()} as Future>::poll(move _8, move _9) -> [return: bb3, unwind: bb5]; -+ StorageLive(_11); -+ StorageLive(_15); + StorageLive(_16); + StorageLive(_25); -+ StorageLive(_27); + StorageLive(_30); + StorageLive(_31); + StorageLive(_32); @@ -180,11 +177,8 @@ + StorageDead(_32); + StorageDead(_31); + StorageDead(_30); -+ StorageDead(_27); + StorageDead(_25); + StorageDead(_16); -+ StorageDead(_15); -+ StorageDead(_11); StorageDead(_9); StorageDead(_8); StorageDead(_7); @@ -240,17 +234,13 @@ + _22 = &mut (*_23); + StorageDead(_24); + StorageLive(_46); -+ StorageLive(_47); + StorageLive(_51); + StorageLive(_43); + StorageLive(_44); + StorageLive(_45); -+ // DBG: _47 = &_19; + StorageLive(_48); -+ // DBG: _48 = &(_19.0: &mut std::future::Ready<()>); + _46 = copy (_19.0: &mut std::future::Ready<()>); + StorageDead(_48); -+ // DBG: _45 = &((*_46).0: std::option::Option<()>); + StorageLive(_49); + _49 = Option::<()>::None; + _44 = copy ((*_46).0: std::option::Option<()>); @@ -356,7 +346,6 @@ + _18 = Poll::<()>::Ready(move _43); + StorageDead(_43); + StorageDead(_51); -+ StorageDead(_47); + StorageDead(_46); + StorageDead(_22); + StorageDead(_19); diff --git a/tests/mir-opt/issue_101973.inner.GVN.panic-abort.diff b/tests/mir-opt/issue_101973.inner.GVN.panic-abort.diff index ac88fe67bb8..3ea7387a48d 100644 --- a/tests/mir-opt/issue_101973.inner.GVN.panic-abort.diff +++ b/tests/mir-opt/issue_101973.inner.GVN.panic-abort.diff @@ -30,7 +30,6 @@ StorageLive(_4); StorageLive(_5); _5 = copy _1; - nop; - StorageLive(_14); - _14 = BitAnd(copy _5, const 255_u32); - _4 = BitOr(const 0_u32, move _14); diff --git a/tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff b/tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff index 96c3cae2d33..832db856b2c 100644 --- a/tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff +++ b/tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff @@ -30,7 +30,6 @@ StorageLive(_4); StorageLive(_5); _5 = copy _1; - nop; - StorageLive(_14); - _14 = BitAnd(copy _5, const 255_u32); - _4 = BitOr(const 0_u32, move _14); diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff index a294c1b4588..614d9ad440d 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff @@ -33,15 +33,9 @@ } bb2: { - StorageLive(_5); // DBG: _5 = &(*_2)[0 of 3]; - StorageLive(_6); // DBG: _6 = &(*_2)[1 of 3]; - StorageLive(_7); // DBG: _7 = &(*_2)[2 of 3]; - StorageDead(_7); - StorageDead(_6); - StorageDead(_5); StorageDead(_4); return; } diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff index 691271cf94e..57a88cf8984 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff @@ -33,15 +33,9 @@ } bb2: { - StorageLive(_5); // DBG: _5 = &(*_2)[0 of 3]; - StorageLive(_6); // DBG: _6 = &(*_2)[1 of 3]; - StorageLive(_7); // DBG: _7 = &(*_2)[2 of 3]; - StorageDead(_7); - StorageDead(_6); - StorageDead(_5); StorageDead(_4); return; } diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.32bit.panic-abort.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.32bit.panic-abort.mir index d4248f5d87f..b5c23822162 100644 --- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.32bit.panic-abort.mir +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.32bit.panic-abort.mir @@ -6,7 +6,6 @@ fn num_to_digit(_1: char) -> u32 { let mut _4: std::option::Option<u32>; scope 1 (inlined char::methods::<impl char>::is_digit) { let _2: std::option::Option<u32>; - let mut _7: &std::option::Option<u32>; scope 2 (inlined Option::<u32>::is_some) { let mut _3: isize; scope 3 { @@ -21,17 +20,14 @@ fn num_to_digit(_1: char) -> u32 { } bb0: { - StorageLive(_7); StorageLive(_2); _2 = char::methods::<impl char>::to_digit(copy _1, const 8_u32) -> [return: bb1, unwind unreachable]; } bb1: { - // DBG: _7 = &_2; StorageLive(_3); _3 = discriminant(_2); StorageDead(_2); - StorageDead(_7); switchInt(move _3) -> [1: bb2, otherwise: bb7]; } diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.32bit.panic-unwind.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.32bit.panic-unwind.mir index a834932df5a..f22b8835735 100644 --- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.32bit.panic-unwind.mir +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.32bit.panic-unwind.mir @@ -6,7 +6,6 @@ fn num_to_digit(_1: char) -> u32 { let mut _4: std::option::Option<u32>; scope 1 (inlined char::methods::<impl char>::is_digit) { let _2: std::option::Option<u32>; - let mut _7: &std::option::Option<u32>; scope 2 (inlined Option::<u32>::is_some) { let mut _3: isize; scope 3 { @@ -21,17 +20,14 @@ fn num_to_digit(_1: char) -> u32 { } bb0: { - StorageLive(_7); StorageLive(_2); _2 = char::methods::<impl char>::to_digit(copy _1, const 8_u32) -> [return: bb1, unwind continue]; } bb1: { - // DBG: _7 = &_2; StorageLive(_3); _3 = discriminant(_2); StorageDead(_2); - StorageDead(_7); switchInt(move _3) -> [1: bb2, otherwise: bb7]; } diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-abort.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-abort.mir index d4248f5d87f..b5c23822162 100644 --- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-abort.mir +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-abort.mir @@ -6,7 +6,6 @@ fn num_to_digit(_1: char) -> u32 { let mut _4: std::option::Option<u32>; scope 1 (inlined char::methods::<impl char>::is_digit) { let _2: std::option::Option<u32>; - let mut _7: &std::option::Option<u32>; scope 2 (inlined Option::<u32>::is_some) { let mut _3: isize; scope 3 { @@ -21,17 +20,14 @@ fn num_to_digit(_1: char) -> u32 { } bb0: { - StorageLive(_7); StorageLive(_2); _2 = char::methods::<impl char>::to_digit(copy _1, const 8_u32) -> [return: bb1, unwind unreachable]; } bb1: { - // DBG: _7 = &_2; StorageLive(_3); _3 = discriminant(_2); StorageDead(_2); - StorageDead(_7); switchInt(move _3) -> [1: bb2, otherwise: bb7]; } diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-unwind.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-unwind.mir index a834932df5a..f22b8835735 100644 --- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-unwind.mir +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-unwind.mir @@ -6,7 +6,6 @@ fn num_to_digit(_1: char) -> u32 { let mut _4: std::option::Option<u32>; scope 1 (inlined char::methods::<impl char>::is_digit) { let _2: std::option::Option<u32>; - let mut _7: &std::option::Option<u32>; scope 2 (inlined Option::<u32>::is_some) { let mut _3: isize; scope 3 { @@ -21,17 +20,14 @@ fn num_to_digit(_1: char) -> u32 { } bb0: { - StorageLive(_7); StorageLive(_2); _2 = char::methods::<impl char>::to_digit(copy _1, const 8_u32) -> [return: bb1, unwind continue]; } bb1: { - // DBG: _7 = &_2; StorageLive(_3); _3 = discriminant(_2); StorageDead(_2); - StorageDead(_7); switchInt(move _3) -> [1: bb2, otherwise: bb7]; } diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-abort.mir index 23dbc066dd5..83478e60b5d 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-abort.mir @@ -5,9 +5,7 @@ fn step_forward(_1: u16, _2: usize) -> u16 { debug n => _2; let mut _0: u16; scope 1 (inlined <u16 as Step>::forward) { - let _8: std::option::Option<u16>; - let mut _10: u16; - let mut _11: &std::option::Option<u16>; + let mut _8: u16; scope 2 { } scope 3 (inlined <u16 as Step>::forward_checked) { @@ -15,9 +13,8 @@ fn step_forward(_1: u16, _2: usize) -> u16 { scope 6 (inlined core::num::<impl u16>::checked_add) { let mut _5: (u16, bool); let mut _6: bool; - let mut _7: u16; scope 7 (inlined std::intrinsics::unlikely) { - let _9: (); + let _7: (); } } } @@ -38,8 +35,6 @@ fn step_forward(_1: u16, _2: usize) -> u16 { bb0: { StorageLive(_4); - StorageLive(_11); - StorageLive(_8); StorageLive(_3); _3 = Gt(copy _2, const 65535_usize); switchInt(move _3) -> [0: bb1, otherwise: bb5]; @@ -58,55 +53,34 @@ fn step_forward(_1: u16, _2: usize) -> u16 { bb2: { StorageDead(_5); StorageDead(_6); - StorageLive(_7); - _7 = AddUnchecked(copy _1, copy _4); - _8 = Option::<u16>::Some(move _7); - StorageDead(_7); - // DBG: _11 = &_8; - StorageDead(_8); - StorageDead(_11); goto -> bb7; } bb3: { - _9 = std::intrinsics::cold_path() -> [return: bb4, unwind unreachable]; + _7 = std::intrinsics::cold_path() -> [return: bb4, unwind unreachable]; } bb4: { StorageDead(_5); StorageDead(_6); - _8 = const Option::<u16>::None; - // DBG: _11 = &_8; goto -> bb6; } bb5: { StorageDead(_3); - _8 = const Option::<u16>::None; - // DBG: _11 = &_8; goto -> bb6; } bb6: { - StorageDead(_8); - StorageDead(_11); assert(!const true, "attempt to compute `{} + {}`, which would overflow", const core::num::<impl u16>::MAX, const 1_u16) -> [success: bb7, unwind unreachable]; } bb7: { - StorageLive(_10); - _10 = copy _2 as u16 (IntToInt); - _0 = Add(copy _1, copy _10); - StorageDead(_10); + StorageLive(_8); + _8 = copy _2 as u16 (IntToInt); + _0 = Add(copy _1, copy _8); + StorageDead(_8); StorageDead(_4); return; } } - -ALLOC0 (size: 4, align: 2) { - 00 00 __ __ │ ..░░ -} - -ALLOC1 (size: 4, align: 2) { - 00 00 __ __ │ ..░░ -} diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-unwind.mir index ac15f070597..ac7a6e04451 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-unwind.mir @@ -5,9 +5,7 @@ fn step_forward(_1: u16, _2: usize) -> u16 { debug n => _2; let mut _0: u16; scope 1 (inlined <u16 as Step>::forward) { - let _8: std::option::Option<u16>; - let mut _10: u16; - let mut _11: &std::option::Option<u16>; + let mut _8: u16; scope 2 { } scope 3 (inlined <u16 as Step>::forward_checked) { @@ -15,9 +13,8 @@ fn step_forward(_1: u16, _2: usize) -> u16 { scope 6 (inlined core::num::<impl u16>::checked_add) { let mut _5: (u16, bool); let mut _6: bool; - let mut _7: u16; scope 7 (inlined std::intrinsics::unlikely) { - let _9: (); + let _7: (); } } } @@ -38,8 +35,6 @@ fn step_forward(_1: u16, _2: usize) -> u16 { bb0: { StorageLive(_4); - StorageLive(_11); - StorageLive(_8); StorageLive(_3); _3 = Gt(copy _2, const 65535_usize); switchInt(move _3) -> [0: bb1, otherwise: bb5]; @@ -58,55 +53,34 @@ fn step_forward(_1: u16, _2: usize) -> u16 { bb2: { StorageDead(_5); StorageDead(_6); - StorageLive(_7); - _7 = AddUnchecked(copy _1, copy _4); - _8 = Option::<u16>::Some(move _7); - StorageDead(_7); - // DBG: _11 = &_8; - StorageDead(_8); - StorageDead(_11); goto -> bb7; } bb3: { - _9 = std::intrinsics::cold_path() -> [return: bb4, unwind unreachable]; + _7 = std::intrinsics::cold_path() -> [return: bb4, unwind unreachable]; } bb4: { StorageDead(_5); StorageDead(_6); - _8 = const Option::<u16>::None; - // DBG: _11 = &_8; goto -> bb6; } bb5: { StorageDead(_3); - _8 = const Option::<u16>::None; - // DBG: _11 = &_8; goto -> bb6; } bb6: { - StorageDead(_8); - StorageDead(_11); assert(!const true, "attempt to compute `{} + {}`, which would overflow", const core::num::<impl u16>::MAX, const 1_u16) -> [success: bb7, unwind continue]; } bb7: { - StorageLive(_10); - _10 = copy _2 as u16 (IntToInt); - _0 = Add(copy _1, copy _10); - StorageDead(_10); + StorageLive(_8); + _8 = copy _2 as u16 (IntToInt); + _0 = Add(copy _1, copy _8); + StorageDead(_8); StorageDead(_4); return; } } - -ALLOC0 (size: 4, align: 2) { - 00 00 __ __ │ ..░░ -} - -ALLOC1 (size: 4, align: 2) { - 00 00 __ __ │ ..░░ -} diff --git a/tests/mir-opt/pre-codegen/clone_as_copy.clone_as_copy.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/clone_as_copy.clone_as_copy.PreCodegen.after.mir index 66239a0ef66..1e6e2ee1b8b 100644 --- a/tests/mir-opt/pre-codegen/clone_as_copy.clone_as_copy.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/clone_as_copy.clone_as_copy.PreCodegen.after.mir @@ -12,10 +12,8 @@ fn clone_as_copy(_1: &NestCopy) -> NestCopy { } bb0: { - StorageLive(_2); // DBG: _2 = &((*_1).1: AllCopy); _0 = copy (*_1); - StorageDead(_2); return; } } diff --git a/tests/mir-opt/pre-codegen/clone_as_copy.enum_clone_as_copy.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/clone_as_copy.enum_clone_as_copy.PreCodegen.after.mir index aa03cec070a..76bb49bc9c1 100644 --- a/tests/mir-opt/pre-codegen/clone_as_copy.enum_clone_as_copy.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/clone_as_copy.enum_clone_as_copy.PreCodegen.after.mir @@ -5,58 +5,28 @@ fn enum_clone_as_copy(_1: &Enum1) -> Enum1 { let mut _0: Enum1; scope 1 (inlined <Enum1 as Clone>::clone) { debug self => _1; - let mut _2: isize; - let _3: &AllCopy; - let _4: &NestCopy; + let _2: &AllCopy; + let _3: &NestCopy; scope 2 { - debug __self_0 => _3; + debug __self_0 => _2; scope 6 (inlined <AllCopy as Clone>::clone) { - debug self => _3; + debug self => _2; } } scope 3 { - debug __self_0 => _4; + debug __self_0 => _3; scope 4 (inlined <NestCopy as Clone>::clone) { - debug self => _4; - let _5: &AllCopy; + debug self => _3; + let _4: &AllCopy; scope 5 (inlined <AllCopy as Clone>::clone) { - debug self => _5; + debug self => _4; } } } } bb0: { - StorageLive(_2); - StorageLive(_3); - StorageLive(_4); - _2 = discriminant((*_1)); - switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4]; - } - - bb1: { - // DBG: _3 = &(((*_1) as A).0: AllCopy); _0 = copy (*_1); - goto -> bb3; - } - - bb2: { - // DBG: _4 = &(((*_1) as B).0: NestCopy); - StorageLive(_5); - // DBG: _5 = &((((*_1) as B).0: NestCopy).1: AllCopy); - StorageDead(_5); - _0 = copy (*_1); - goto -> bb3; - } - - bb3: { - StorageDead(_4); - StorageDead(_3); - StorageDead(_2); return; } - - bb4: { - unreachable; - } } diff --git a/tests/mir-opt/pre-codegen/clone_as_copy.rs b/tests/mir-opt/pre-codegen/clone_as_copy.rs index f5ff1854d38..00f24754d59 100644 --- a/tests/mir-opt/pre-codegen/clone_as_copy.rs +++ b/tests/mir-opt/pre-codegen/clone_as_copy.rs @@ -25,19 +25,19 @@ enum Enum1 { // EMIT_MIR clone_as_copy.clone_as_copy.PreCodegen.after.mir fn clone_as_copy(v: &NestCopy) -> NestCopy { // CHECK-LABEL: fn clone_as_copy( - // CHECK-NOT: = AllCopy { {{.*}} }; - // CHECK-NOT: = NestCopy { {{.*}} }; - // CHECK: _0 = copy (*_1); - // CHECK: return; + // CHECK: let [[DEAD_VAR:_.*]]: &AllCopy; + // CHECK: bb0: { + // CHECK-NEXT: DBG: [[DEAD_VAR]] = &((*_1).1: AllCopy) + // CHECK-NEXT: _0 = copy (*_1); + // CHECK-NEXT: return; v.clone() } -// FIXME: We can merge into exactly one assignment statement. // EMIT_MIR clone_as_copy.enum_clone_as_copy.PreCodegen.after.mir fn enum_clone_as_copy(v: &Enum1) -> Enum1 { // CHECK-LABEL: fn enum_clone_as_copy( - // CHECK-NOT: = Enum1:: - // CHECK: _0 = copy (*_1); - // CHECK: _0 = copy (*_1); + // CHECK: bb0: { + // CHECK-NEXT: _0 = copy (*_1); + // CHECK-NEXT: return; v.clone() } diff --git a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-abort.mir b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-abort.mir index 0dd2125dbe0..ba6ce0ee528 100644 --- a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-abort.mir @@ -8,10 +8,9 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { let _2: std::ptr::NonNull<[T]>; let mut _3: *mut [T]; let mut _4: *const [T]; - let _12: (); - let mut _13: &std::alloc::Layout; + let _11: (); scope 3 { - let _8: std::alloc::Layout; + let _8: std::ptr::alignment::AlignmentEnum; scope 4 { scope 12 (inlined Layout::size) { } @@ -27,19 +26,15 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } scope 18 (inlined <std::alloc::Global as Allocator>::deallocate) { let mut _9: *mut u8; - let mut _14: &std::alloc::Layout; scope 19 (inlined Layout::size) { } scope 20 (inlined NonNull::<u8>::as_ptr) { } scope 21 (inlined std::alloc::dealloc) { - let mut _11: usize; - let mut _15: &std::alloc::Layout; - let mut _16: &std::alloc::Layout; + let mut _10: usize; scope 22 (inlined Layout::size) { } scope 23 (inlined Layout::align) { - let mut _10: std::ptr::alignment::AlignmentEnum; scope 24 (inlined std::ptr::Alignment::as_usize) { } } @@ -68,7 +63,6 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } bb0: { - StorageLive(_8); StorageLive(_2); _2 = copy (((*_1).0: std::ptr::Unique<[T]>).0: std::ptr::NonNull<[T]>); StorageLive(_4); @@ -80,45 +74,31 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb1: { _6 = AlignOf(T); + StorageLive(_7); _7 = copy _6 as std::ptr::Alignment (Transmute); - _8 = Layout { size: copy _5, align: copy _7 }; + _8 = move (_7.0: std::ptr::alignment::AlignmentEnum); + StorageDead(_7); StorageDead(_6); StorageDead(_4); - StorageLive(_13); - // DBG: _13 = &_8; - StorageDead(_13); switchInt(copy _5) -> [0: bb4, otherwise: bb2]; } bb2: { - StorageLive(_14); - // DBG: _14 = &_8; - StorageDead(_14); StorageLive(_9); _9 = copy _3 as *mut u8 (PtrToPtr); - StorageLive(_15); - // DBG: _15 = &_8; - StorageDead(_15); - StorageLive(_11); - StorageLive(_16); - // DBG: _16 = &_8; StorageLive(_10); - _10 = copy (_7.0: std::ptr::alignment::AlignmentEnum); - _11 = discriminant(_10); - StorageDead(_10); - StorageDead(_16); - _12 = alloc::alloc::__rust_dealloc(move _9, move _5, move _11) -> [return: bb3, unwind unreachable]; + _10 = discriminant(_8); + _11 = alloc::alloc::__rust_dealloc(move _9, move _5, move _10) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_11); + StorageDead(_10); StorageDead(_9); goto -> bb4; } bb4: { StorageDead(_2); - StorageDead(_8); return; } } diff --git a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-unwind.mir b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-unwind.mir index 0dd2125dbe0..ba6ce0ee528 100644 --- a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.32bit.panic-unwind.mir @@ -8,10 +8,9 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { let _2: std::ptr::NonNull<[T]>; let mut _3: *mut [T]; let mut _4: *const [T]; - let _12: (); - let mut _13: &std::alloc::Layout; + let _11: (); scope 3 { - let _8: std::alloc::Layout; + let _8: std::ptr::alignment::AlignmentEnum; scope 4 { scope 12 (inlined Layout::size) { } @@ -27,19 +26,15 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } scope 18 (inlined <std::alloc::Global as Allocator>::deallocate) { let mut _9: *mut u8; - let mut _14: &std::alloc::Layout; scope 19 (inlined Layout::size) { } scope 20 (inlined NonNull::<u8>::as_ptr) { } scope 21 (inlined std::alloc::dealloc) { - let mut _11: usize; - let mut _15: &std::alloc::Layout; - let mut _16: &std::alloc::Layout; + let mut _10: usize; scope 22 (inlined Layout::size) { } scope 23 (inlined Layout::align) { - let mut _10: std::ptr::alignment::AlignmentEnum; scope 24 (inlined std::ptr::Alignment::as_usize) { } } @@ -68,7 +63,6 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } bb0: { - StorageLive(_8); StorageLive(_2); _2 = copy (((*_1).0: std::ptr::Unique<[T]>).0: std::ptr::NonNull<[T]>); StorageLive(_4); @@ -80,45 +74,31 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb1: { _6 = AlignOf(T); + StorageLive(_7); _7 = copy _6 as std::ptr::Alignment (Transmute); - _8 = Layout { size: copy _5, align: copy _7 }; + _8 = move (_7.0: std::ptr::alignment::AlignmentEnum); + StorageDead(_7); StorageDead(_6); StorageDead(_4); - StorageLive(_13); - // DBG: _13 = &_8; - StorageDead(_13); switchInt(copy _5) -> [0: bb4, otherwise: bb2]; } bb2: { - StorageLive(_14); - // DBG: _14 = &_8; - StorageDead(_14); StorageLive(_9); _9 = copy _3 as *mut u8 (PtrToPtr); - StorageLive(_15); - // DBG: _15 = &_8; - StorageDead(_15); - StorageLive(_11); - StorageLive(_16); - // DBG: _16 = &_8; StorageLive(_10); - _10 = copy (_7.0: std::ptr::alignment::AlignmentEnum); - _11 = discriminant(_10); - StorageDead(_10); - StorageDead(_16); - _12 = alloc::alloc::__rust_dealloc(move _9, move _5, move _11) -> [return: bb3, unwind unreachable]; + _10 = discriminant(_8); + _11 = alloc::alloc::__rust_dealloc(move _9, move _5, move _10) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_11); + StorageDead(_10); StorageDead(_9); goto -> bb4; } bb4: { StorageDead(_2); - StorageDead(_8); return; } } diff --git a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-abort.mir b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-abort.mir index 0dd2125dbe0..ba6ce0ee528 100644 --- a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-abort.mir @@ -8,10 +8,9 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { let _2: std::ptr::NonNull<[T]>; let mut _3: *mut [T]; let mut _4: *const [T]; - let _12: (); - let mut _13: &std::alloc::Layout; + let _11: (); scope 3 { - let _8: std::alloc::Layout; + let _8: std::ptr::alignment::AlignmentEnum; scope 4 { scope 12 (inlined Layout::size) { } @@ -27,19 +26,15 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } scope 18 (inlined <std::alloc::Global as Allocator>::deallocate) { let mut _9: *mut u8; - let mut _14: &std::alloc::Layout; scope 19 (inlined Layout::size) { } scope 20 (inlined NonNull::<u8>::as_ptr) { } scope 21 (inlined std::alloc::dealloc) { - let mut _11: usize; - let mut _15: &std::alloc::Layout; - let mut _16: &std::alloc::Layout; + let mut _10: usize; scope 22 (inlined Layout::size) { } scope 23 (inlined Layout::align) { - let mut _10: std::ptr::alignment::AlignmentEnum; scope 24 (inlined std::ptr::Alignment::as_usize) { } } @@ -68,7 +63,6 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } bb0: { - StorageLive(_8); StorageLive(_2); _2 = copy (((*_1).0: std::ptr::Unique<[T]>).0: std::ptr::NonNull<[T]>); StorageLive(_4); @@ -80,45 +74,31 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb1: { _6 = AlignOf(T); + StorageLive(_7); _7 = copy _6 as std::ptr::Alignment (Transmute); - _8 = Layout { size: copy _5, align: copy _7 }; + _8 = move (_7.0: std::ptr::alignment::AlignmentEnum); + StorageDead(_7); StorageDead(_6); StorageDead(_4); - StorageLive(_13); - // DBG: _13 = &_8; - StorageDead(_13); switchInt(copy _5) -> [0: bb4, otherwise: bb2]; } bb2: { - StorageLive(_14); - // DBG: _14 = &_8; - StorageDead(_14); StorageLive(_9); _9 = copy _3 as *mut u8 (PtrToPtr); - StorageLive(_15); - // DBG: _15 = &_8; - StorageDead(_15); - StorageLive(_11); - StorageLive(_16); - // DBG: _16 = &_8; StorageLive(_10); - _10 = copy (_7.0: std::ptr::alignment::AlignmentEnum); - _11 = discriminant(_10); - StorageDead(_10); - StorageDead(_16); - _12 = alloc::alloc::__rust_dealloc(move _9, move _5, move _11) -> [return: bb3, unwind unreachable]; + _10 = discriminant(_8); + _11 = alloc::alloc::__rust_dealloc(move _9, move _5, move _10) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_11); + StorageDead(_10); StorageDead(_9); goto -> bb4; } bb4: { StorageDead(_2); - StorageDead(_8); return; } } diff --git a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-unwind.mir b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-unwind.mir index 0dd2125dbe0..ba6ce0ee528 100644 --- a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.PreCodegen.after.64bit.panic-unwind.mir @@ -8,10 +8,9 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { let _2: std::ptr::NonNull<[T]>; let mut _3: *mut [T]; let mut _4: *const [T]; - let _12: (); - let mut _13: &std::alloc::Layout; + let _11: (); scope 3 { - let _8: std::alloc::Layout; + let _8: std::ptr::alignment::AlignmentEnum; scope 4 { scope 12 (inlined Layout::size) { } @@ -27,19 +26,15 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } scope 18 (inlined <std::alloc::Global as Allocator>::deallocate) { let mut _9: *mut u8; - let mut _14: &std::alloc::Layout; scope 19 (inlined Layout::size) { } scope 20 (inlined NonNull::<u8>::as_ptr) { } scope 21 (inlined std::alloc::dealloc) { - let mut _11: usize; - let mut _15: &std::alloc::Layout; - let mut _16: &std::alloc::Layout; + let mut _10: usize; scope 22 (inlined Layout::size) { } scope 23 (inlined Layout::align) { - let mut _10: std::ptr::alignment::AlignmentEnum; scope 24 (inlined std::ptr::Alignment::as_usize) { } } @@ -68,7 +63,6 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } bb0: { - StorageLive(_8); StorageLive(_2); _2 = copy (((*_1).0: std::ptr::Unique<[T]>).0: std::ptr::NonNull<[T]>); StorageLive(_4); @@ -80,45 +74,31 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb1: { _6 = AlignOf(T); + StorageLive(_7); _7 = copy _6 as std::ptr::Alignment (Transmute); - _8 = Layout { size: copy _5, align: copy _7 }; + _8 = move (_7.0: std::ptr::alignment::AlignmentEnum); + StorageDead(_7); StorageDead(_6); StorageDead(_4); - StorageLive(_13); - // DBG: _13 = &_8; - StorageDead(_13); switchInt(copy _5) -> [0: bb4, otherwise: bb2]; } bb2: { - StorageLive(_14); - // DBG: _14 = &_8; - StorageDead(_14); StorageLive(_9); _9 = copy _3 as *mut u8 (PtrToPtr); - StorageLive(_15); - // DBG: _15 = &_8; - StorageDead(_15); - StorageLive(_11); - StorageLive(_16); - // DBG: _16 = &_8; StorageLive(_10); - _10 = copy (_7.0: std::ptr::alignment::AlignmentEnum); - _11 = discriminant(_10); - StorageDead(_10); - StorageDead(_16); - _12 = alloc::alloc::__rust_dealloc(move _9, move _5, move _11) -> [return: bb3, unwind unreachable]; + _10 = discriminant(_8); + _11 = alloc::alloc::__rust_dealloc(move _9, move _5, move _10) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_11); + StorageDead(_10); StorageDead(_9); goto -> bb4; } bb4: { StorageDead(_2); - StorageDead(_8); return; } } diff --git a/tests/mir-opt/pre-codegen/drop_boxed_slice.rs b/tests/mir-opt/pre-codegen/drop_boxed_slice.rs index c291366a694..9ceba9444b8 100644 --- a/tests/mir-opt/pre-codegen/drop_boxed_slice.rs +++ b/tests/mir-opt/pre-codegen/drop_boxed_slice.rs @@ -11,7 +11,7 @@ pub unsafe fn generic_in_place<T: Copy>(ptr: *mut Box<[T]>) { // CHECK: [[SIZE:_.+]] = std::intrinsics::size_of_val::<[T]> // CHECK: [[ALIGN:_.+]] = AlignOf(T); // CHECK: [[B:_.+]] = copy [[ALIGN]] as std::ptr::Alignment (Transmute); - // CHECK: [[C:_.+]] = copy ([[B]].0: std::ptr::alignment::AlignmentEnum); + // CHECK: [[C:_.+]] = move ([[B]].0: std::ptr::alignment::AlignmentEnum); // CHECK: [[D:_.+]] = discriminant([[C]]); // CHECK: = alloc::alloc::__rust_dealloc({{.+}}, move [[SIZE]], move [[D]]) -> std::ptr::drop_in_place(ptr) diff --git a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir index b1af3141ee6..beb7b936ccf 100644 --- a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir @@ -60,9 +60,7 @@ fn int_range(_1: usize, _2: usize) -> () { StorageLive(_9); // DBG: _12 = &_3; StorageLive(_6); - StorageLive(_13); // DBG: _13 = &(_3.0: usize); - StorageLive(_14); // DBG: _14 = &(_3.1: usize); StorageLive(_4); _4 = copy (_3.0: usize); @@ -75,16 +73,12 @@ fn int_range(_1: usize, _2: usize) -> () { } bb2: { - StorageDead(_14); - StorageDead(_13); StorageDead(_6); StorageDead(_9); return; } bb3: { - StorageDead(_14); - StorageDead(_13); _7 = copy (_3.0: usize); StorageLive(_8); _8 = AddUnchecked(copy _7, const 1_usize); diff --git a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir index 03cdc221c30..f453741dc6c 100644 --- a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir @@ -171,12 +171,9 @@ fn vec_move(_1: Vec<impl Sized>) -> () { bb0: { StorageLive(_22); - StorageLive(_29); StorageLive(_6); StorageLive(_7); - StorageLive(_33); StorageLive(_11); - StorageLive(_35); StorageLive(_20); StorageLive(_5); StorageLive(_4); @@ -184,30 +181,18 @@ fn vec_move(_1: Vec<impl Sized>) -> () { StorageLive(_2); _2 = ManuallyDrop::<Vec<impl Sized>> { value: copy _1 }; StorageLive(_3); - StorageLive(_30); // DBG: _30 = &_2; // DBG: _29 = &(_2.0: std::vec::Vec<impl Sized>); - StorageDead(_30); - StorageLive(_39); // DBG: _39 = &((_2.0: std::vec::Vec<impl Sized>).0: alloc::raw_vec::RawVec<impl Sized>); - StorageLive(_40); // DBG: _40 = &(((_2.0: std::vec::Vec<impl Sized>).0: alloc::raw_vec::RawVec<impl Sized>).0: alloc::raw_vec::RawVecInner); - StorageDead(_40); - StorageDead(_39); _3 = &raw const ((((_2.0: std::vec::Vec<impl Sized>).0: alloc::raw_vec::RawVec<impl Sized>).0: alloc::raw_vec::RawVecInner).2: std::alloc::Global); StorageDead(_3); - StorageLive(_31); - StorageLive(_32); // DBG: _32 = &_2; - StorageDead(_32); // DBG: _31 = &((_2.0: std::vec::Vec<impl Sized>).0: alloc::raw_vec::RawVec<impl Sized>); - StorageLive(_41); // DBG: _41 = &(((_2.0: std::vec::Vec<impl Sized>).0: alloc::raw_vec::RawVec<impl Sized>).0: alloc::raw_vec::RawVecInner); _4 = copy (((((_2.0: std::vec::Vec<impl Sized>).0: alloc::raw_vec::RawVec<impl Sized>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>); _5 = copy _4 as *const impl Sized (Transmute); _6 = NonNull::<impl Sized> { pointer: copy _5 }; - StorageDead(_41); - StorageDead(_31); _7 = copy _4 as *mut impl Sized (Transmute); switchInt(const <impl Sized as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; } @@ -215,10 +200,8 @@ fn vec_move(_1: Vec<impl Sized>) -> () { bb1: { StorageLive(_10); StorageLive(_8); - StorageLive(_36); // DBG: _36 = &_2; // DBG: _35 = &(_2.0: std::vec::Vec<impl Sized>); - StorageDead(_36); _8 = copy ((_2.0: std::vec::Vec<impl Sized>).1: usize); StorageLive(_9); _9 = Le(copy _8, const <impl Sized as std::mem::SizedTypeProperties>::MAX_SLICE_LEN); @@ -233,10 +216,8 @@ fn vec_move(_1: Vec<impl Sized>) -> () { bb2: { StorageLive(_12); - StorageLive(_34); // DBG: _34 = &_2; // DBG: _33 = &(_2.0: std::vec::Vec<impl Sized>); - StorageDead(_34); _12 = copy ((_2.0: std::vec::Vec<impl Sized>).1: usize); StorageLive(_13); _13 = Le(copy _12, const <impl Sized as std::mem::SizedTypeProperties>::MAX_SLICE_LEN); @@ -264,12 +245,8 @@ fn vec_move(_1: Vec<impl Sized>) -> () { } bb4: { - StorageLive(_37); - StorageLive(_38); // DBG: _38 = &_2; - StorageDead(_38); // DBG: _37 = &((_2.0: std::vec::Vec<impl Sized>).0: alloc::raw_vec::RawVec<impl Sized>); - StorageLive(_42); // DBG: _42 = &(((_2.0: std::vec::Vec<impl Sized>).0: alloc::raw_vec::RawVec<impl Sized>).0: alloc::raw_vec::RawVecInner); StorageLive(_19); _19 = SizeOf(impl Sized); @@ -291,20 +268,15 @@ fn vec_move(_1: Vec<impl Sized>) -> () { bb7: { StorageDead(_19); - StorageDead(_42); - StorageDead(_37); _22 = std::vec::IntoIter::<impl Sized> { buf: copy _6, phantom: const ZeroSized: PhantomData<impl Sized>, cap: move _20, alloc: const ManuallyDrop::<std::alloc::Global> {{ value: std::alloc::Global }}, ptr: copy _6, end: copy _11 }; StorageDead(_2); StorageDead(_17); StorageDead(_4); StorageDead(_5); StorageDead(_20); - StorageDead(_35); StorageDead(_11); - StorageDead(_33); StorageDead(_7); StorageDead(_6); - StorageDead(_29); StorageLive(_23); _23 = move _22; goto -> bb8; diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir index 9d4bacef954..86c729b3e95 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir @@ -70,9 +70,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 // DBG: _15 = &((*_3).2: usize); // DBG: _16 = &((*_3).3: usize); StorageLive(_6); - StorageLive(_17); // DBG: _17 = &_13; - StorageLive(_18); // DBG: _18 = &_15; _4 = copy ((*_3).0: usize); _5 = copy ((*_3).2: usize); @@ -81,18 +79,12 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 } bb1: { - StorageDead(_18); - StorageDead(_17); goto -> bb4; } bb2: { - StorageDead(_18); - StorageDead(_17); StorageLive(_9); - StorageLive(_19); // DBG: _19 = &_16; - StorageLive(_20); // DBG: _20 = &_14; StorageLive(_7); _7 = copy ((*_3).3: usize); @@ -105,34 +97,24 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 } bb3: { - StorageDead(_20); - StorageDead(_19); goto -> bb4; } bb4: { StorageLive(_10); - StorageLive(_21); // DBG: _21 = &_15; - StorageLive(_22); // DBG: _22 = &_13; _10 = Le(copy _5, copy _4); switchInt(move _10) -> [0: bb5, otherwise: bb6]; } bb5: { - StorageDead(_22); - StorageDead(_21); _0 = const false; goto -> bb7; } bb6: { - StorageDead(_22); - StorageDead(_21); - StorageLive(_23); // DBG: _23 = &_14; - StorageLive(_24); // DBG: _24 = &_16; StorageLive(_11); _11 = copy ((*_3).1: usize); @@ -141,8 +123,6 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 _0 = Le(move _11, move _12); StorageDead(_12); StorageDead(_11); - StorageDead(_24); - StorageDead(_23); goto -> bb7; } @@ -152,8 +132,6 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 } bb8: { - StorageDead(_20); - StorageDead(_19); _0 = const true; goto -> bb9; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir index 1b2e7b7163c..104987b0fdd 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir @@ -51,9 +51,6 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let mut _16: bool; let mut _20: usize; let _22: &T; - let mut _34: &std::ptr::NonNull<T>; - let mut _35: &std::ptr::NonNull<T>; - let mut _36: &std::ptr::NonNull<T>; scope 29 { let _12: *const T; scope 30 { @@ -189,11 +186,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb5: { StorageLive(_16); - StorageLive(_34); - // DBG: _34 = &_11; - StorageLive(_35); _13 = copy _12 as std::ptr::NonNull<T> (Transmute); - // DBG: _35 = &_13; StorageLive(_14); _14 = copy _11 as *mut T (Transmute); StorageLive(_15); @@ -205,8 +198,6 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb6: { - StorageDead(_35); - StorageDead(_34); StorageDead(_16); StorageLive(_18); StorageLive(_17); @@ -219,8 +210,6 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb7: { - StorageDead(_35); - StorageDead(_34); StorageDead(_16); StorageDead(_22); StorageDead(_13); @@ -266,13 +255,10 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb13: { - StorageLive(_36); - // DBG: _36 = &_11; StorageLive(_21); _21 = copy _11 as *const T (Transmute); _22 = &(*_21); StorageDead(_21); - StorageDead(_36); _23 = Option::<&T>::Some(copy _22); StorageDead(_22); StorageDead(_13); diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir index c18dd01a189..4d0e3548e7d 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -23,9 +23,6 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { let mut _15: bool; let mut _19: usize; let _21: &T; - let mut _27: &std::ptr::NonNull<T>; - let mut _28: &std::ptr::NonNull<T>; - let mut _29: &std::ptr::NonNull<T>; scope 17 { let _11: *const T; scope 18 { @@ -151,11 +148,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb5: { StorageLive(_15); - StorageLive(_27); - // DBG: _27 = &_10; - StorageLive(_28); _12 = copy _11 as std::ptr::NonNull<T> (Transmute); - // DBG: _28 = &_12; StorageLive(_13); _13 = copy _10 as *mut T (Transmute); StorageLive(_14); @@ -167,8 +160,6 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb6: { - StorageDead(_28); - StorageDead(_27); StorageDead(_15); StorageLive(_17); StorageLive(_16); @@ -181,8 +172,6 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb7: { - StorageDead(_28); - StorageDead(_27); StorageDead(_15); StorageDead(_21); StorageDead(_12); @@ -224,13 +213,10 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb13: { - StorageLive(_29); - // DBG: _29 = &_10; StorageLive(_20); _20 = copy _10 as *const T (Transmute); _21 = &(*_20); StorageDead(_20); - StorageDead(_29); _22 = Option::<&T>::Some(copy _21); StorageDead(_21); StorageDead(_12); diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir index 6334c611430..2b5d8c27d71 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -23,9 +23,6 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { let mut _15: bool; let mut _19: usize; let _21: &T; - let mut _27: &std::ptr::NonNull<T>; - let mut _28: &std::ptr::NonNull<T>; - let mut _29: &std::ptr::NonNull<T>; scope 17 { let _11: *const T; scope 18 { @@ -151,11 +148,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb5: { StorageLive(_15); - StorageLive(_27); - // DBG: _27 = &_10; - StorageLive(_28); _12 = copy _11 as std::ptr::NonNull<T> (Transmute); - // DBG: _28 = &_12; StorageLive(_13); _13 = copy _10 as *mut T (Transmute); StorageLive(_14); @@ -167,8 +160,6 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb6: { - StorageDead(_28); - StorageDead(_27); StorageDead(_15); StorageLive(_17); StorageLive(_16); @@ -181,8 +172,6 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb7: { - StorageDead(_28); - StorageDead(_27); StorageDead(_15); StorageDead(_21); StorageDead(_12); @@ -224,13 +213,10 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb13: { - StorageLive(_29); - // DBG: _29 = &_10; StorageLive(_20); _20 = copy _10 as *const T (Transmute); _21 = &(*_20); StorageDead(_20); - StorageDead(_29); _22 = Option::<&T>::Some(copy _21); StorageDead(_21); StorageDead(_12); diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir index 24c6618d31c..3009be3f9dc 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir @@ -23,8 +23,6 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let mut _18: bool; let mut _19: *const T; let _32: &T; - let mut _38: &std::ptr::NonNull<T>; - let mut _39: &std::ptr::NonNull<T>; scope 20 { let _14: std::ptr::NonNull<T>; let _20: usize; @@ -48,7 +46,6 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } scope 28 (inlined std::slice::Iter::<'_, T>::next_back_unchecked) { let _26: std::ptr::NonNull<T>; - let mut _40: &std::ptr::NonNull<T>; scope 29 (inlined std::slice::Iter::<'_, T>::pre_dec_end) { let mut _21: *mut *const T; let mut _22: *mut std::ptr::NonNull<T>; @@ -190,10 +187,6 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { _13 = copy ((_12.0: std::slice::Iter<'_, T>).1: *const T); _14 = copy _13 as std::ptr::NonNull<T> (Transmute); StorageDead(_13); - StorageLive(_38); - // DBG: _38 = &((_12.0: std::slice::Iter<'_, T>).0: std::ptr::NonNull<T>); - StorageLive(_39); - // DBG: _39 = &_14; StorageLive(_16); StorageLive(_15); _15 = copy ((_12.0: std::slice::Iter<'_, T>).0: std::ptr::NonNull<T>); @@ -204,8 +197,6 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { _18 = Eq(copy _16, copy _17); StorageDead(_17); StorageDead(_16); - StorageDead(_39); - StorageDead(_38); goto -> bb7; } @@ -222,7 +213,6 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb8: { StorageLive(_26); - StorageLive(_40); StorageLive(_28); StorageLive(_22); StorageLive(_23); @@ -275,12 +265,10 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageDead(_23); StorageDead(_22); StorageDead(_28); - // DBG: _40 = &_26; StorageLive(_31); _31 = copy _26 as *const T (Transmute); _32 = &(*_31); StorageDead(_31); - StorageDead(_40); StorageDead(_26); _33 = Option::<&T>::Some(copy _32); StorageDead(_18); diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir index e5c7bcca44b..e40bff5ea35 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir @@ -23,8 +23,6 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let mut _18: bool; let mut _19: *const T; let _32: &T; - let mut _38: &std::ptr::NonNull<T>; - let mut _39: &std::ptr::NonNull<T>; scope 20 { let _14: std::ptr::NonNull<T>; let _20: usize; @@ -48,7 +46,6 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } scope 28 (inlined std::slice::Iter::<'_, T>::next_back_unchecked) { let _26: std::ptr::NonNull<T>; - let mut _40: &std::ptr::NonNull<T>; scope 29 (inlined std::slice::Iter::<'_, T>::pre_dec_end) { let mut _21: *mut *const T; let mut _22: *mut std::ptr::NonNull<T>; @@ -190,10 +187,6 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { _13 = copy ((_12.0: std::slice::Iter<'_, T>).1: *const T); _14 = copy _13 as std::ptr::NonNull<T> (Transmute); StorageDead(_13); - StorageLive(_38); - // DBG: _38 = &((_12.0: std::slice::Iter<'_, T>).0: std::ptr::NonNull<T>); - StorageLive(_39); - // DBG: _39 = &_14; StorageLive(_16); StorageLive(_15); _15 = copy ((_12.0: std::slice::Iter<'_, T>).0: std::ptr::NonNull<T>); @@ -204,8 +197,6 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { _18 = Eq(copy _16, copy _17); StorageDead(_17); StorageDead(_16); - StorageDead(_39); - StorageDead(_38); goto -> bb7; } @@ -222,7 +213,6 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb8: { StorageLive(_26); - StorageLive(_40); StorageLive(_28); StorageLive(_22); StorageLive(_23); @@ -275,12 +265,10 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageDead(_23); StorageDead(_22); StorageDead(_28); - // DBG: _40 = &_26; StorageLive(_31); _31 = copy _26 as *const T (Transmute); _32 = &(*_31); StorageDead(_31); - StorageDead(_40); StorageDead(_26); _33 = Option::<&T>::Some(copy _32); StorageDead(_18); diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir index 18a3d8e7c4a..9b510380b10 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir @@ -6,8 +6,6 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { scope 1 (inlined <std::slice::Iter<'_, T> as ExactSizeIterator>::is_empty) { let mut _2: *const T; let mut _7: *const T; - let mut _9: &std::ptr::NonNull<T>; - let mut _10: &std::ptr::NonNull<T>; scope 2 { let _3: std::ptr::NonNull<T>; let _8: usize; @@ -43,10 +41,6 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { _2 = copy ((*_1).1: *const T); _3 = copy _2 as std::ptr::NonNull<T> (Transmute); StorageDead(_2); - StorageLive(_9); - // DBG: _9 = &((*_1).0: std::ptr::NonNull<T>); - StorageLive(_10); - // DBG: _10 = &_3; StorageLive(_5); StorageLive(_4); _4 = copy ((*_1).0: std::ptr::NonNull<T>); @@ -57,8 +51,6 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { _0 = Eq(copy _5, copy _6); StorageDead(_6); StorageDead(_5); - StorageDead(_10); - StorageDead(_9); goto -> bb3; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir index 18a3d8e7c4a..9b510380b10 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir @@ -6,8 +6,6 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { scope 1 (inlined <std::slice::Iter<'_, T> as ExactSizeIterator>::is_empty) { let mut _2: *const T; let mut _7: *const T; - let mut _9: &std::ptr::NonNull<T>; - let mut _10: &std::ptr::NonNull<T>; scope 2 { let _3: std::ptr::NonNull<T>; let _8: usize; @@ -43,10 +41,6 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { _2 = copy ((*_1).1: *const T); _3 = copy _2 as std::ptr::NonNull<T> (Transmute); StorageDead(_2); - StorageLive(_9); - // DBG: _9 = &((*_1).0: std::ptr::NonNull<T>); - StorageLive(_10); - // DBG: _10 = &_3; StorageLive(_5); StorageLive(_4); _4 = copy ((*_1).0: std::ptr::NonNull<T>); @@ -57,8 +51,6 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { _0 = Eq(copy _5, copy _6); StorageDead(_6); StorageDead(_5); - StorageDead(_10); - StorageDead(_9); goto -> bb3; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir index 590d4ac2c83..62b738c36bf 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir @@ -8,8 +8,6 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut let mut _7: bool; let mut _8: *mut T; let mut _21: &mut T; - let mut _22: &std::ptr::NonNull<T>; - let mut _23: &std::ptr::NonNull<T>; scope 2 { let _3: std::ptr::NonNull<T>; let _9: usize; @@ -33,7 +31,6 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut } scope 10 (inlined std::slice::IterMut::<'_, T>::next_back_unchecked) { let mut _15: std::ptr::NonNull<T>; - let mut _24: &mut std::ptr::NonNull<T>; scope 11 (inlined std::slice::IterMut::<'_, T>::pre_dec_end) { let mut _10: *mut *mut T; let mut _11: *mut std::ptr::NonNull<T>; @@ -88,10 +85,6 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut bb1: { _2 = copy ((*_1).1: *mut T); _3 = copy _2 as std::ptr::NonNull<T> (Transmute); - StorageLive(_22); - // DBG: _22 = &((*_1).0: std::ptr::NonNull<T>); - StorageLive(_23); - // DBG: _23 = &_3; StorageLive(_5); StorageLive(_4); _4 = copy ((*_1).0: std::ptr::NonNull<T>); @@ -102,8 +95,6 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut _7 = Eq(copy _5, copy _6); StorageDead(_6); StorageDead(_5); - StorageDead(_23); - StorageDead(_22); goto -> bb3; } @@ -120,7 +111,6 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut bb4: { StorageLive(_15); - StorageLive(_24); StorageLive(_17); StorageLive(_11); StorageLive(_12); @@ -173,12 +163,10 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut StorageDead(_12); StorageDead(_11); StorageDead(_17); - // DBG: _24 = &_15; StorageLive(_20); _20 = copy _15 as *mut T (Transmute); _21 = &mut (*_20); StorageDead(_20); - StorageDead(_24); StorageDead(_15); _0 = Option::<&mut T>::Some(copy _21); goto -> bb11; diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir index 590d4ac2c83..62b738c36bf 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir @@ -8,8 +8,6 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut let mut _7: bool; let mut _8: *mut T; let mut _21: &mut T; - let mut _22: &std::ptr::NonNull<T>; - let mut _23: &std::ptr::NonNull<T>; scope 2 { let _3: std::ptr::NonNull<T>; let _9: usize; @@ -33,7 +31,6 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut } scope 10 (inlined std::slice::IterMut::<'_, T>::next_back_unchecked) { let mut _15: std::ptr::NonNull<T>; - let mut _24: &mut std::ptr::NonNull<T>; scope 11 (inlined std::slice::IterMut::<'_, T>::pre_dec_end) { let mut _10: *mut *mut T; let mut _11: *mut std::ptr::NonNull<T>; @@ -88,10 +85,6 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut bb1: { _2 = copy ((*_1).1: *mut T); _3 = copy _2 as std::ptr::NonNull<T> (Transmute); - StorageLive(_22); - // DBG: _22 = &((*_1).0: std::ptr::NonNull<T>); - StorageLive(_23); - // DBG: _23 = &_3; StorageLive(_5); StorageLive(_4); _4 = copy ((*_1).0: std::ptr::NonNull<T>); @@ -102,8 +95,6 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut _7 = Eq(copy _5, copy _6); StorageDead(_6); StorageDead(_5); - StorageDead(_23); - StorageDead(_22); goto -> bb3; } @@ -120,7 +111,6 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut bb4: { StorageLive(_15); - StorageLive(_24); StorageLive(_17); StorageLive(_11); StorageLive(_12); @@ -173,12 +163,10 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut StorageDead(_12); StorageDead(_11); StorageDead(_17); - // DBG: _24 = &_15; StorageLive(_20); _20 = copy _15 as *mut T (Transmute); _21 = &mut (*_20); StorageDead(_20); - StorageDead(_24); StorageDead(_15); _0 = Option::<&mut T>::Some(copy _21); goto -> bb11; diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir index e9ed932cbaf..cc0fce26149 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir @@ -10,9 +10,6 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { let mut _10: std::ptr::NonNull<T>; let mut _12: usize; let _14: &T; - let mut _15: &std::ptr::NonNull<T>; - let mut _16: &std::ptr::NonNull<T>; - let mut _17: &std::ptr::NonNull<T>; scope 2 { let _3: *const T; scope 3 { @@ -70,11 +67,7 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { bb1: { StorageLive(_7); - StorageLive(_15); - // DBG: _15 = &_2; - StorageLive(_16); _4 = copy _3 as std::ptr::NonNull<T> (Transmute); - // DBG: _16 = &_4; StorageLive(_5); _5 = copy _2 as *mut T (Transmute); StorageLive(_6); @@ -86,8 +79,6 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { } bb2: { - StorageDead(_16); - StorageDead(_15); StorageDead(_7); StorageLive(_10); StorageLive(_9); @@ -103,8 +94,6 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { } bb3: { - StorageDead(_16); - StorageDead(_15); _0 = const {transmute(0x0000000000000000): Option<&T>}; StorageDead(_7); goto -> bb8; @@ -127,13 +116,10 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { } bb7: { - StorageLive(_17); - // DBG: _17 = &_2; StorageLive(_13); _13 = copy _2 as *const T (Transmute); _14 = &(*_13); StorageDead(_13); - StorageDead(_17); _0 = Option::<&T>::Some(copy _14); goto -> bb8; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir index e9ed932cbaf..cc0fce26149 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir @@ -10,9 +10,6 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { let mut _10: std::ptr::NonNull<T>; let mut _12: usize; let _14: &T; - let mut _15: &std::ptr::NonNull<T>; - let mut _16: &std::ptr::NonNull<T>; - let mut _17: &std::ptr::NonNull<T>; scope 2 { let _3: *const T; scope 3 { @@ -70,11 +67,7 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { bb1: { StorageLive(_7); - StorageLive(_15); - // DBG: _15 = &_2; - StorageLive(_16); _4 = copy _3 as std::ptr::NonNull<T> (Transmute); - // DBG: _16 = &_4; StorageLive(_5); _5 = copy _2 as *mut T (Transmute); StorageLive(_6); @@ -86,8 +79,6 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { } bb2: { - StorageDead(_16); - StorageDead(_15); StorageDead(_7); StorageLive(_10); StorageLive(_9); @@ -103,8 +94,6 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { } bb3: { - StorageDead(_16); - StorageDead(_15); _0 = const {transmute(0x0000000000000000): Option<&T>}; StorageDead(_7); goto -> bb8; @@ -127,13 +116,10 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { } bb7: { - StorageLive(_17); - // DBG: _17 = &_2; StorageLive(_13); _13 = copy _2 as *const T (Transmute); _14 = &(*_13); StorageDead(_13); - StorageDead(_17); _0 = Option::<&T>::Some(copy _14); goto -> bb8; } diff --git a/tests/ui/extern/extern-types-field-offset.rs b/tests/ui/extern/extern-types-field-offset.rs index 7a5f36da209..470ae07a0b5 100644 --- a/tests/ui/extern/extern-types-field-offset.rs +++ b/tests/ui/extern/extern-types-field-offset.rs @@ -23,12 +23,17 @@ fn main() { let x: &Newtype = unsafe { &*(&buf as *const _ as *const Newtype) }; // Projecting to the newtype works, because it is always at offset 0. let field = &x.0; + // Avoid being eliminated by DSE. + std::hint::black_box(field); let x: &S = unsafe { &*(&buf as *const _ as *const S) }; // Accessing sized fields is perfectly fine, even at non-zero offsets. let field = &x.i; + std::hint::black_box(field); let field = &x.j; + std::hint::black_box(field); // This needs to compute the field offset, but we don't know the type's alignment, // so this panics. let field = &x.a; + std::hint::black_box(field); } |
