diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:25:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:25:56 +0000 |
commit | 018c4950b9406055dec02ef0fb52f132e2bb1e2c (patch) | |
tree | a835ebdf2088ef88fa681f8fad45f09922c1ae9a /tests/mir-opt/inline | |
parent | Adding debian version 1.75.0+dfsg1-5. (diff) | |
download | rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.tar.xz rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.zip |
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/mir-opt/inline')
8 files changed, 137 insertions, 533 deletions
diff --git a/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-abort.diff b/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-abort.diff index 217c8b802..3ffe2ee0c 100644 --- a/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-abort.diff @@ -69,58 +69,58 @@ + } + + bb2: { ++ _4 = <() as F>::call() -> [return: bb1, unwind unreachable]; ++ } ++ ++ bb3: { + StorageDead(_7); + StorageDead(_6); + StorageDead(_5); -+ _3 = <() as F>::call() -> [return: bb3, unwind unreachable]; ++ _3 = <() as F>::call() -> [return: bb2, unwind unreachable]; + } + -+ bb3: { -+ _4 = <() as F>::call() -> [return: bb1, unwind unreachable]; ++ bb4: { ++ _7 = <() as E>::call() -> [return: bb3, unwind unreachable]; + } + -+ bb4: { ++ bb5: { + StorageDead(_10); + StorageDead(_9); + StorageDead(_8); -+ _6 = <() as E>::call() -> [return: bb5, unwind unreachable]; ++ _6 = <() as E>::call() -> [return: bb4, unwind unreachable]; + } + -+ bb5: { -+ _7 = <() as E>::call() -> [return: bb2, unwind unreachable]; ++ bb6: { ++ _10 = <() as D>::call() -> [return: bb5, unwind unreachable]; + } + -+ bb6: { ++ bb7: { + StorageDead(_13); + StorageDead(_12); + StorageDead(_11); -+ _9 = <() as D>::call() -> [return: bb7, unwind unreachable]; ++ _9 = <() as D>::call() -> [return: bb6, unwind unreachable]; + } + -+ bb7: { -+ _10 = <() as D>::call() -> [return: bb4, unwind unreachable]; ++ bb8: { ++ _13 = <() as C>::call() -> [return: bb7, unwind unreachable]; + } + -+ bb8: { ++ bb9: { + StorageDead(_16); + StorageDead(_15); + StorageDead(_14); -+ _12 = <() as C>::call() -> [return: bb9, unwind unreachable]; ++ _12 = <() as C>::call() -> [return: bb8, unwind unreachable]; + } + -+ bb9: { -+ _13 = <() as C>::call() -> [return: bb6, unwind unreachable]; ++ bb10: { ++ _16 = <() as B>::call() -> [return: bb9, unwind unreachable]; + } + -+ bb10: { ++ bb11: { + StorageDead(_19); + StorageDead(_18); + StorageDead(_17); -+ _15 = <() as B>::call() -> [return: bb11, unwind unreachable]; -+ } -+ -+ bb11: { -+ _16 = <() as B>::call() -> [return: bb8, unwind unreachable]; ++ _15 = <() as B>::call() -> [return: bb10, unwind unreachable]; + } + + bb12: { @@ -128,7 +128,7 @@ + } + + bb13: { -+ _19 = <() as A>::call() -> [return: bb10, unwind unreachable]; ++ _19 = <() as A>::call() -> [return: bb11, unwind unreachable]; } } diff --git a/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-unwind.diff index 0a4ce40c5..3f334779e 100644 --- a/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-unwind.diff @@ -69,58 +69,58 @@ + } + + bb2: { ++ _4 = <() as F>::call() -> [return: bb1, unwind continue]; ++ } ++ ++ bb3: { + StorageDead(_7); + StorageDead(_6); + StorageDead(_5); -+ _3 = <() as F>::call() -> [return: bb3, unwind continue]; ++ _3 = <() as F>::call() -> [return: bb2, unwind continue]; + } + -+ bb3: { -+ _4 = <() as F>::call() -> [return: bb1, unwind continue]; ++ bb4: { ++ _7 = <() as E>::call() -> [return: bb3, unwind continue]; + } + -+ bb4: { ++ bb5: { + StorageDead(_10); + StorageDead(_9); + StorageDead(_8); -+ _6 = <() as E>::call() -> [return: bb5, unwind continue]; ++ _6 = <() as E>::call() -> [return: bb4, unwind continue]; + } + -+ bb5: { -+ _7 = <() as E>::call() -> [return: bb2, unwind continue]; ++ bb6: { ++ _10 = <() as D>::call() -> [return: bb5, unwind continue]; + } + -+ bb6: { ++ bb7: { + StorageDead(_13); + StorageDead(_12); + StorageDead(_11); -+ _9 = <() as D>::call() -> [return: bb7, unwind continue]; ++ _9 = <() as D>::call() -> [return: bb6, unwind continue]; + } + -+ bb7: { -+ _10 = <() as D>::call() -> [return: bb4, unwind continue]; ++ bb8: { ++ _13 = <() as C>::call() -> [return: bb7, unwind continue]; + } + -+ bb8: { ++ bb9: { + StorageDead(_16); + StorageDead(_15); + StorageDead(_14); -+ _12 = <() as C>::call() -> [return: bb9, unwind continue]; ++ _12 = <() as C>::call() -> [return: bb8, unwind continue]; + } + -+ bb9: { -+ _13 = <() as C>::call() -> [return: bb6, unwind continue]; ++ bb10: { ++ _16 = <() as B>::call() -> [return: bb9, unwind continue]; + } + -+ bb10: { ++ bb11: { + StorageDead(_19); + StorageDead(_18); + StorageDead(_17); -+ _15 = <() as B>::call() -> [return: bb11, unwind continue]; -+ } -+ -+ bb11: { -+ _16 = <() as B>::call() -> [return: bb8, unwind continue]; ++ _15 = <() as B>::call() -> [return: bb10, unwind continue]; + } + + bb12: { @@ -128,7 +128,7 @@ + } + + bb13: { -+ _19 = <() as A>::call() -> [return: bb10, unwind continue]; ++ _19 = <() as A>::call() -> [return: bb11, unwind continue]; } } diff --git a/tests/mir-opt/inline/indirect_destination.rs b/tests/mir-opt/inline/indirect_destination.rs new file mode 100644 index 000000000..2842e2336 --- /dev/null +++ b/tests/mir-opt/inline/indirect_destination.rs @@ -0,0 +1,42 @@ +// Test for inlining with an indirect destination place. +// +// unit-test: Inline +// edition: 2021 +// needs-unwind +#![crate_type = "lib"] +#![feature(custom_mir, core_intrinsics)] +use core::intrinsics::mir::*; + +#[custom_mir(dialect = "runtime", phase = "initial")] +// CHECK-LABEL: fn f( +// CHECK: bb1: { +// CHECK-NEXT: StorageLive([[A:.*]]); +// CHECK-NEXT: [[A]] = &mut (*_1); +// CHECK-NEXT: StorageLive([[B:.*]]); +// CHECK-NEXT: [[B]] = const 42_u8; +// CHECK-NEXT: (*[[A]]) = move [[B]]; +// CHECK-NEXT: StorageDead([[B]]); +// CHECK-NEXT: StorageDead([[A]]); +// CHECK-NEXT: goto -> bb1; +// CHECK-NEXT: } +pub fn f(a: *mut u8) { + mir! { + { + Goto(bb1) + } + bb1 = { + Call(*a = g(), bb1, UnwindUnreachable()) + } + } +} + +#[custom_mir(dialect = "runtime", phase = "initial")] +#[inline(always)] +fn g() -> u8 { + mir! { + { + RET = 42; + Return() + } + } +} diff --git a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff index 40eeda539..68c612314 100644 --- a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff @@ -50,20 +50,20 @@ bb1: { - _3 = &mut _4; - _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new(move _3) -> [return: bb2, unwind unreachable]; -+ StorageDead(_7); -+ StorageDead(_6); -+ StorageDead(_5); -+ StorageDead(_2); -+ drop(_4) -> [return: bb2, unwind unreachable]; ++ StorageDead(_4); ++ _0 = const (); ++ StorageDead(_1); ++ return; } bb2: { - StorageDead(_3); - _1 = <{coroutine@$DIR/inline_coroutine.rs:19:5: 19:8} as Coroutine<bool>>::resume(move _2, const false) -> [return: bb3, unwind unreachable]; -+ StorageDead(_4); -+ _0 = const (); -+ StorageDead(_1); -+ return; ++ StorageDead(_7); ++ StorageDead(_6); ++ StorageDead(_5); ++ StorageDead(_2); ++ drop(_4) -> [return: bb1, unwind unreachable]; } bb3: { @@ -89,8 +89,9 @@ + + bb6: { + _1 = CoroutineState::<i32, bool>::Yielded(move _8); ++ StorageDead(_8); + discriminant((*_6)) = 3; -+ goto -> bb1; ++ goto -> bb2; + } + + bb7: { @@ -102,7 +103,7 @@ + StorageDead(_8); + _1 = CoroutineState::<i32, bool>::Complete(_5); + discriminant((*_6)) = 1; -+ goto -> bb1; ++ goto -> bb2; + } + + bb9: { diff --git a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff index fdb42bf3d..1bf14e8c3 100644 --- a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff @@ -34,18 +34,10 @@ StorageLive(_3); StorageLive(_4); - _4 = g() -> [return: bb1, unwind continue]; -- } -- -- bb1: { + _4 = {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8 (#0)}; - _3 = &mut _4; -- _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new(move _3) -> [return: bb2, unwind: bb5]; -- } -- -- bb2: { ++ _3 = &mut _4; + _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}> { pointer: move _3 }; - StorageDead(_3); -- _1 = <{coroutine@$DIR/inline_coroutine.rs:19:5: 19:8} as Coroutine<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb5]; ++ StorageDead(_3); + StorageLive(_5); + _5 = const false; + StorageLive(_6); @@ -55,40 +47,50 @@ + switchInt(move _7) -> [0: bb5, 1: bb9, 3: bb10, otherwise: bb11]; } + bb1: { +- _3 = &mut _4; +- _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new(move _3) -> [return: bb2, unwind: bb5]; ++ StorageDead(_4); ++ _0 = const (); ++ StorageDead(_1); ++ return; + } + +- bb2: { +- StorageDead(_3); +- _1 = <{coroutine@$DIR/inline_coroutine.rs:19:5: 19:8} as Coroutine<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb5]; ++ bb2 (cleanup): { ++ drop(_4) -> [return: bb3, unwind terminate(cleanup)]; + } + - bb3: { -+ bb1: { -+ StorageDead(_7); -+ StorageDead(_6); -+ StorageDead(_5); - StorageDead(_2); +- StorageDead(_2); - drop(_4) -> [return: bb4, unwind: bb6]; -+ drop(_4) -> [return: bb2, unwind: bb4]; ++ bb3 (cleanup): { ++ resume; } -- bb4: { -+ bb2: { - StorageDead(_4); - _0 = const (); - StorageDead(_1); - return; + bb4: { +- StorageDead(_4); +- _0 = const (); +- StorageDead(_1); +- return; ++ StorageDead(_7); ++ StorageDead(_6); ++ StorageDead(_5); ++ StorageDead(_2); ++ drop(_4) -> [return: bb1, unwind: bb3]; } - bb5 (cleanup): { - drop(_4) -> [return: bb6, unwind terminate(cleanup)]; -+ bb3 (cleanup): { -+ drop(_4) -> [return: bb4, unwind terminate(cleanup)]; - } - -- bb6 (cleanup): { -+ bb4 (cleanup): { - resume; -+ } -+ + bb5: { + StorageLive(_8); + switchInt(_5) -> [0: bb6, otherwise: bb7]; -+ } -+ + } + +- bb6 (cleanup): { +- resume; + bb6: { + _8 = const 13_i32; + goto -> bb8; @@ -101,12 +103,13 @@ + + bb8: { + _1 = CoroutineState::<i32, bool>::Yielded(move _8); ++ StorageDead(_8); + discriminant((*_6)) = 3; -+ goto -> bb1; ++ goto -> bb4; + } + + bb9: { -+ assert(const false, "coroutine resumed after completion") -> [success: bb9, unwind: bb3]; ++ assert(const false, "coroutine resumed after completion") -> [success: bb9, unwind: bb2]; + } + + bb10: { @@ -114,7 +117,7 @@ + StorageDead(_8); + _1 = CoroutineState::<i32, bool>::Complete(_5); + discriminant((*_6)) = 1; -+ goto -> bb1; ++ goto -> bb4; + } + + bb11: { diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff deleted file mode 100644 index b90e0505c..000000000 --- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff +++ /dev/null @@ -1,209 +0,0 @@ -- // MIR for `main` before Inline -+ // MIR for `main` after Inline - - fn main() -> () { - let mut _0: (); - let _1: std::boxed::Box<std::vec::Vec<u32>>; - let mut _2: std::vec::Vec<u32>; - scope 1 { - debug _x => _1; - } -+ scope 2 (inlined Vec::<u32>::new) { -+ let mut _3: alloc::raw_vec::RawVec<u32>; -+ } -+ scope 3 (inlined Box::<Vec<u32>>::new) { -+ debug x => _2; -+ let mut _4: usize; -+ let mut _5: usize; -+ let mut _6: *mut u8; -+ let mut _7: *const std::vec::Vec<u32>; -+ scope 4 { -+ scope 5 (inlined alloc::alloc::exchange_malloc) { -+ debug size => _4; -+ debug align => _5; -+ let _8: std::alloc::Layout; -+ let mut _9: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>; -+ let mut _10: isize; -+ let mut _12: !; -+ scope 6 { -+ debug layout => _8; -+ let _11: std::ptr::NonNull<[u8]>; -+ let mut _13: &std::alloc::Global; -+ scope 8 { -+ debug ptr => _11; -+ scope 18 (inlined NonNull::<[u8]>::as_mut_ptr) { -+ debug self => _11; -+ let mut _15: std::ptr::NonNull<u8>; -+ scope 19 (inlined NonNull::<[u8]>::as_non_null_ptr) { -+ debug self => _11; -+ let mut _16: *mut u8; -+ let mut _17: *mut [u8]; -+ scope 20 { -+ scope 21 (inlined NonNull::<[u8]>::as_ptr) { -+ debug self => _11; -+ let mut _18: *const [u8]; -+ } -+ scope 22 (inlined ptr::mut_ptr::<impl *mut [u8]>::as_mut_ptr) { -+ debug self => _17; -+ } -+ scope 23 (inlined NonNull::<u8>::new_unchecked) { -+ debug ptr => _16; -+ let mut _19: *const u8; -+ scope 24 { -+ scope 25 (inlined NonNull::<T>::new_unchecked::runtime::<u8>) { -+ debug ptr => _16; -+ scope 26 (inlined ptr::mut_ptr::<impl *mut u8>::is_null) { -+ debug self => _16; -+ let mut _20: *mut u8; -+ scope 27 { -+ scope 28 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { -+ debug ptr => _20; -+ scope 29 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { -+ debug self => _20; -+ scope 30 { -+ scope 31 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { -+ debug self => _20; -+ } -+ } -+ } -+ } -+ } -+ } -+ } -+ } -+ } -+ } -+ } -+ scope 32 (inlined NonNull::<u8>::as_ptr) { -+ debug self => _15; -+ let mut _21: *const u8; -+ } -+ } -+ } -+ scope 17 (inlined <std::alloc::Global as Allocator>::allocate) { -+ debug self => const _; -+ debug layout => _8; -+ } -+ } -+ scope 7 { -+ scope 9 (inlined Layout::from_size_align_unchecked) { -+ debug size => _4; -+ debug align => _5; -+ let mut _14: std::ptr::Alignment; -+ scope 10 { -+ scope 11 (inlined std::ptr::Alignment::new_unchecked) { -+ debug align => _5; -+ scope 12 { -+ scope 14 (inlined std::ptr::Alignment::new_unchecked::runtime) { -+ debug align => _5; -+ scope 15 (inlined core::num::<impl usize>::is_power_of_two) { -+ debug self => _5; -+ scope 16 (inlined core::num::<impl usize>::count_ones) { -+ debug self => _5; -+ } -+ } -+ } -+ } -+ scope 13 { -+ } -+ } -+ } -+ } -+ } -+ } -+ } -+ } - - bb0: { - StorageLive(_1); - StorageLive(_2); -- _2 = Vec::<u32>::new() -> [return: bb1, unwind unreachable]; -+ StorageLive(_3); -+ _3 = const _; -+ _2 = Vec::<u32> { buf: move _3, len: const 0_usize }; -+ StorageDead(_3); -+ StorageLive(_4); -+ StorageLive(_5); -+ StorageLive(_6); -+ StorageLive(_7); -+ _4 = SizeOf(std::vec::Vec<u32>); -+ _5 = AlignOf(std::vec::Vec<u32>); -+ StorageLive(_8); -+ StorageLive(_10); -+ StorageLive(_11); -+ StorageLive(_12); -+ StorageLive(_13); -+ StorageLive(_14); -+ _14 = _5 as std::ptr::Alignment (Transmute); -+ _8 = Layout { size: _4, align: move _14 }; -+ StorageDead(_14); -+ StorageLive(_9); -+ _13 = const _; -+ _9 = std::alloc::Global::alloc_impl(move _13, _8, const false) -> [return: bb5, unwind unreachable]; - } - - bb1: { -- _1 = Box::<Vec<u32>>::new(move _2) -> [return: bb2, unwind unreachable]; -+ StorageDead(_1); -+ return; - } - - bb2: { -+ _12 = handle_alloc_error(move _8) -> unwind unreachable; -+ } -+ -+ bb3: { -+ unreachable; -+ } -+ -+ bb4: { -+ _11 = ((_9 as Ok).0: std::ptr::NonNull<[u8]>); -+ StorageLive(_15); -+ StorageLive(_16); -+ StorageLive(_17); -+ StorageLive(_18); -+ _18 = (_11.0: *const [u8]); -+ _17 = move _18 as *mut [u8] (PtrToPtr); -+ StorageDead(_18); -+ _16 = _17 as *mut u8 (PtrToPtr); -+ StorageDead(_17); -+ StorageLive(_19); -+ StorageLive(_20); -+ _19 = _16 as *const u8 (PointerCoercion(MutToConstPointer)); -+ _15 = NonNull::<u8> { pointer: _19 }; -+ StorageDead(_20); -+ StorageDead(_19); -+ StorageDead(_16); -+ StorageLive(_21); -+ _21 = (_15.0: *const u8); -+ _6 = move _21 as *mut u8 (PtrToPtr); -+ StorageDead(_21); -+ StorageDead(_15); -+ StorageDead(_9); -+ StorageDead(_13); -+ StorageDead(_12); -+ StorageDead(_11); -+ StorageDead(_10); -+ StorageDead(_8); -+ _1 = ShallowInitBox(move _6, std::vec::Vec<u32>); -+ _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>); -+ (*_7) = move _2; -+ StorageDead(_7); -+ StorageDead(_6); -+ StorageDead(_5); -+ StorageDead(_4); - StorageDead(_2); - _0 = const (); -- drop(_1) -> [return: bb3, unwind unreachable]; -+ drop(_1) -> [return: bb1, unwind unreachable]; - } - -- bb3: { -- StorageDead(_1); -- return; -+ bb5: { -+ _10 = discriminant(_9); -+ switchInt(move _10) -> [0: bb4, 1: bb2, otherwise: bb3]; - } - } - diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff deleted file mode 100644 index f9c637caa..000000000 --- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff +++ /dev/null @@ -1,222 +0,0 @@ -- // MIR for `main` before Inline -+ // MIR for `main` after Inline - - fn main() -> () { - let mut _0: (); - let _1: std::boxed::Box<std::vec::Vec<u32>>; - let mut _2: std::vec::Vec<u32>; - scope 1 { - debug _x => _1; - } -+ scope 2 (inlined Vec::<u32>::new) { -+ let mut _3: alloc::raw_vec::RawVec<u32>; -+ } -+ scope 3 (inlined Box::<Vec<u32>>::new) { -+ debug x => _2; -+ let mut _4: usize; -+ let mut _5: usize; -+ let mut _6: *mut u8; -+ let mut _7: *const std::vec::Vec<u32>; -+ scope 4 { -+ scope 5 (inlined alloc::alloc::exchange_malloc) { -+ debug size => _4; -+ debug align => _5; -+ let _8: std::alloc::Layout; -+ let mut _9: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>; -+ let mut _10: isize; -+ let mut _12: !; -+ scope 6 { -+ debug layout => _8; -+ let _11: std::ptr::NonNull<[u8]>; -+ let mut _13: &std::alloc::Global; -+ scope 8 { -+ debug ptr => _11; -+ scope 18 (inlined NonNull::<[u8]>::as_mut_ptr) { -+ debug self => _11; -+ let mut _15: std::ptr::NonNull<u8>; -+ scope 19 (inlined NonNull::<[u8]>::as_non_null_ptr) { -+ debug self => _11; -+ let mut _16: *mut u8; -+ let mut _17: *mut [u8]; -+ scope 20 { -+ scope 21 (inlined NonNull::<[u8]>::as_ptr) { -+ debug self => _11; -+ let mut _18: *const [u8]; -+ } -+ scope 22 (inlined ptr::mut_ptr::<impl *mut [u8]>::as_mut_ptr) { -+ debug self => _17; -+ } -+ scope 23 (inlined NonNull::<u8>::new_unchecked) { -+ debug ptr => _16; -+ let mut _19: *const u8; -+ scope 24 { -+ scope 25 (inlined NonNull::<T>::new_unchecked::runtime::<u8>) { -+ debug ptr => _16; -+ scope 26 (inlined ptr::mut_ptr::<impl *mut u8>::is_null) { -+ debug self => _16; -+ let mut _20: *mut u8; -+ scope 27 { -+ scope 28 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { -+ debug ptr => _20; -+ scope 29 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { -+ debug self => _20; -+ scope 30 { -+ scope 31 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { -+ debug self => _20; -+ } -+ } -+ } -+ } -+ } -+ } -+ } -+ } -+ } -+ } -+ } -+ scope 32 (inlined NonNull::<u8>::as_ptr) { -+ debug self => _15; -+ let mut _21: *const u8; -+ } -+ } -+ } -+ scope 17 (inlined <std::alloc::Global as Allocator>::allocate) { -+ debug self => const _; -+ debug layout => _8; -+ } -+ } -+ scope 7 { -+ scope 9 (inlined Layout::from_size_align_unchecked) { -+ debug size => _4; -+ debug align => _5; -+ let mut _14: std::ptr::Alignment; -+ scope 10 { -+ scope 11 (inlined std::ptr::Alignment::new_unchecked) { -+ debug align => _5; -+ scope 12 { -+ scope 14 (inlined std::ptr::Alignment::new_unchecked::runtime) { -+ debug align => _5; -+ scope 15 (inlined core::num::<impl usize>::is_power_of_two) { -+ debug self => _5; -+ scope 16 (inlined core::num::<impl usize>::count_ones) { -+ debug self => _5; -+ } -+ } -+ } -+ } -+ scope 13 { -+ } -+ } -+ } -+ } -+ } -+ } -+ } -+ } - - bb0: { - StorageLive(_1); - StorageLive(_2); -- _2 = Vec::<u32>::new() -> [return: bb1, unwind continue]; -+ StorageLive(_3); -+ _3 = const _; -+ _2 = Vec::<u32> { buf: move _3, len: const 0_usize }; -+ StorageDead(_3); -+ StorageLive(_4); -+ StorageLive(_5); -+ StorageLive(_6); -+ StorageLive(_7); -+ _4 = SizeOf(std::vec::Vec<u32>); -+ _5 = AlignOf(std::vec::Vec<u32>); -+ StorageLive(_8); -+ StorageLive(_10); -+ StorageLive(_11); -+ StorageLive(_12); -+ StorageLive(_13); -+ StorageLive(_14); -+ _14 = _5 as std::ptr::Alignment (Transmute); -+ _8 = Layout { size: _4, align: move _14 }; -+ StorageDead(_14); -+ StorageLive(_9); -+ _13 = const _; -+ _9 = std::alloc::Global::alloc_impl(move _13, _8, const false) -> [return: bb7, unwind: bb3]; - } - - bb1: { -- _1 = Box::<Vec<u32>>::new(move _2) -> [return: bb2, unwind: bb4]; -+ StorageDead(_1); -+ return; - } - -- bb2: { -- StorageDead(_2); -- _0 = const (); -- drop(_1) -> [return: bb3, unwind: bb4]; -+ bb2 (cleanup): { -+ resume; - } - -- bb3: { -- StorageDead(_1); -- return; -+ bb3 (cleanup): { -+ drop(_2) -> [return: bb2, unwind terminate(cleanup)]; - } - -- bb4 (cleanup): { -- resume; -+ bb4: { -+ _12 = handle_alloc_error(move _8) -> bb3; -+ } -+ -+ bb5: { -+ unreachable; -+ } -+ -+ bb6: { -+ _11 = ((_9 as Ok).0: std::ptr::NonNull<[u8]>); -+ StorageLive(_15); -+ StorageLive(_16); -+ StorageLive(_17); -+ StorageLive(_18); -+ _18 = (_11.0: *const [u8]); -+ _17 = move _18 as *mut [u8] (PtrToPtr); -+ StorageDead(_18); -+ _16 = _17 as *mut u8 (PtrToPtr); -+ StorageDead(_17); -+ StorageLive(_19); -+ StorageLive(_20); -+ _19 = _16 as *const u8 (PointerCoercion(MutToConstPointer)); -+ _15 = NonNull::<u8> { pointer: _19 }; -+ StorageDead(_20); -+ StorageDead(_19); -+ StorageDead(_16); -+ StorageLive(_21); -+ _21 = (_15.0: *const u8); -+ _6 = move _21 as *mut u8 (PtrToPtr); -+ StorageDead(_21); -+ StorageDead(_15); -+ StorageDead(_9); -+ StorageDead(_13); -+ StorageDead(_12); -+ StorageDead(_11); -+ StorageDead(_10); -+ StorageDead(_8); -+ _1 = ShallowInitBox(move _6, std::vec::Vec<u32>); -+ _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>); -+ (*_7) = move _2; -+ StorageDead(_7); -+ StorageDead(_6); -+ StorageDead(_5); -+ StorageDead(_4); -+ StorageDead(_2); -+ _0 = const (); -+ drop(_1) -> [return: bb1, unwind: bb2]; -+ } -+ -+ bb7: { -+ _10 = discriminant(_9); -+ switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; - } - } - diff --git a/tests/mir-opt/inline/inline_into_box_place.rs b/tests/mir-opt/inline/inline_into_box_place.rs deleted file mode 100644 index 65f8e2916..000000000 --- a/tests/mir-opt/inline/inline_into_box_place.rs +++ /dev/null @@ -1,11 +0,0 @@ -// ignore-endian-big -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// ignore-debug MIR alignment checks in std alter the diff, breaking the test -// compile-flags: -Zmir-opt-level=4 -Zinline-mir-hint-threshold=200 - -// EMIT_MIR inline_into_box_place.main.Inline.diff -fn main() { - // CHECK-LABEL: fn main( - // CHECK: (inlined Box::<Vec<u32>>::new) - let _x: Box<Vec<u32>> = Box::new(Vec::new()); -} |