From 611c3cb56109593824f3570720d8404b591724cc Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Wed, 7 Feb 2024 10:30:39 -0500 Subject: [PATCH] Bless/fix tests --- tests/assembly/is_aligned.rs | 4 +- ...n.DataflowConstProp.32bit.panic-abort.diff | 60 ++--- ....DataflowConstProp.32bit.panic-unwind.diff | 68 +++-- ...n.DataflowConstProp.64bit.panic-abort.diff | 60 ++--- ....DataflowConstProp.64bit.panic-unwind.diff | 68 +++-- ...oxed_slice.main.GVN.32bit.panic-abort.diff | 63 +++-- ...xed_slice.main.GVN.32bit.panic-unwind.diff | 71 +++-- ...oxed_slice.main.GVN.64bit.panic-abort.diff | 63 +++-- ...xed_slice.main.GVN.64bit.panic-unwind.diff | 71 +++-- tests/mir-opt/inline/unwrap_unchecked.rs | 2 +- ...d.unwrap_unchecked.Inline.panic-abort.diff | 39 +-- ....unwrap_unchecked.Inline.panic-unwind.diff | 51 ++-- ...unchecked.PreCodegen.after.panic-abort.mir | 34 +-- ...nchecked.PreCodegen.after.panic-unwind.mir | 34 +-- ...witch_targets.ub_if_b.PreCodegen.after.mir | 22 +- ..._replace.PreCodegen.after.panic-abort.mir} | 0 ..._replace.PreCodegen.after.panic-unwind.mir | 16 ++ ...m_replace.mem_replace.PreCodegen.after.mir | 66 ----- ...m_replace.PreCodegen.after.panic-abort.mir | 33 +++ ..._replace.PreCodegen.after.panic-unwind.mir | 33 +++ tests/mir-opt/pre-codegen/mem_replace.rs | 3 +- ...ated_loop.PreCodegen.after.panic-abort.mir | 240 +++++++++-------- ...ted_loop.PreCodegen.after.panic-unwind.mir | 240 +++++++++-------- ...ward_loop.PreCodegen.after.panic-abort.mir | 216 ++++++++-------- ...ard_loop.PreCodegen.after.panic-unwind.mir | 216 ++++++++-------- ...erse_loop.PreCodegen.after.panic-abort.mir | 244 +++++++++--------- ...rse_loop.PreCodegen.after.panic-unwind.mir | 244 +++++++++--------- tests/ui/hygiene/panic-location.run.stderr | 2 +- 28 files changed, 1113 insertions(+), 1150 deletions(-) rename tests/mir-opt/pre-codegen/{mem_replace.manual_replace.PreCodegen.after.mir => mem_replace.manual_replace.PreCodegen.after.panic-abort.mir} (100%) create mode 100644 tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.panic-unwind.mir delete mode 100644 tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir create mode 100644 tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir diff --git a/tests/assembly/is_aligned.rs b/tests/assembly/is_aligned.rs index d152d200adfd7..c4a7823ce1ad4 100644 --- a/tests/assembly/is_aligned.rs +++ b/tests/assembly/is_aligned.rs @@ -2,8 +2,8 @@ // only-x86_64 // ignore-sgx // revisions: opt-speed opt-size -// [opt-speed] compile-flags: -Copt-level=1 -// [opt-size] compile-flags: -Copt-level=s +// [opt-speed] compile-flags: -Copt-level=2 -Cdebug-assertions=no +// [opt-size] compile-flags: -Copt-level=s -Cdebug-assertions=no #![crate_type="rlib"] #![feature(core_intrinsics)] diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff index ffbd97bb5452f..94cfb4e63fc22 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff @@ -24,29 +24,11 @@ debug ptr => _6; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; scope 12 { - scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; - scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; - scope 15 { - scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; - scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; - scope 18 { - scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; - } - } - } - } - } - } - } } } } @@ -66,6 +48,7 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); + StorageLive(_9); StorageLive(_4); StorageLive(_5); StorageLive(_6); @@ -73,30 +56,41 @@ _7 = const 1_usize; _6 = const {0x1 as *mut [bool; 0]}; StorageDead(_7); - StorageLive(_8); - StorageLive(_9); StorageLive(_10); - _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); - StorageDead(_9); + StorageLive(_11); + StorageLive(_8); + _8 = cfg!(debug_assertions); + switchInt(move _8) -> [0: bb3, otherwise: bb2]; + } + + bb1: { + StorageDead(_1); + return; + } + + bb2: { + _10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr); + _9 = NonNull::::new_unchecked::precondition_check(move _10) -> [return: bb3, unwind unreachable]; + } + + bb3: { StorageDead(_8); + _11 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); + _5 = NonNull::<[bool; 0]> { pointer: _11 }; + StorageDead(_11); + StorageDead(_10); StorageDead(_6); _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; StorageDead(_5); _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); StorageDead(_4); _2 = Box::<[bool]>(_3, const std::alloc::Global); + StorageDead(_9); StorageDead(_3); _1 = A { foo: move _2 }; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind unreachable]; } - - bb1: { - StorageDead(_1); - return; - } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff index 7b6dcf1972b2e..ee85287882be9 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff @@ -24,29 +24,11 @@ debug ptr => _6; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; scope 12 { - scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; - scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; - scope 15 { - scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; - scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; - scope 18 { - scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; - } - } - } - } - } - } - } } } } @@ -66,6 +48,7 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); + StorageLive(_9); StorageLive(_4); StorageLive(_5); StorageLive(_6); @@ -73,34 +56,45 @@ _7 = const 1_usize; _6 = const {0x1 as *mut [bool; 0]}; StorageDead(_7); - StorageLive(_8); - StorageLive(_9); StorageLive(_10); - _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); - StorageDead(_9); + StorageLive(_11); + StorageLive(_8); + _8 = cfg!(debug_assertions); + switchInt(move _8) -> [0: bb4, otherwise: bb3]; + } + + bb1: { + StorageDead(_1); + return; + } + + bb2 (cleanup): { + resume; + } + + bb3: { + _10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr); + _9 = NonNull::::new_unchecked::precondition_check(move _10) -> [return: bb4, unwind unreachable]; + } + + bb4: { StorageDead(_8); + _11 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); + _5 = NonNull::<[bool; 0]> { pointer: _11 }; + StorageDead(_11); + StorageDead(_10); StorageDead(_6); _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; StorageDead(_5); _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); StorageDead(_4); _2 = Box::<[bool]>(_3, const std::alloc::Global); + StorageDead(_9); StorageDead(_3); _1 = A { foo: move _2 }; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind: bb2]; } - - bb1: { - StorageDead(_1); - return; - } - - bb2 (cleanup): { - resume; - } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff index ffbd97bb5452f..94cfb4e63fc22 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff @@ -24,29 +24,11 @@ debug ptr => _6; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; scope 12 { - scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; - scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; - scope 15 { - scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; - scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; - scope 18 { - scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; - } - } - } - } - } - } - } } } } @@ -66,6 +48,7 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); + StorageLive(_9); StorageLive(_4); StorageLive(_5); StorageLive(_6); @@ -73,30 +56,41 @@ _7 = const 1_usize; _6 = const {0x1 as *mut [bool; 0]}; StorageDead(_7); - StorageLive(_8); - StorageLive(_9); StorageLive(_10); - _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); - StorageDead(_9); + StorageLive(_11); + StorageLive(_8); + _8 = cfg!(debug_assertions); + switchInt(move _8) -> [0: bb3, otherwise: bb2]; + } + + bb1: { + StorageDead(_1); + return; + } + + bb2: { + _10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr); + _9 = NonNull::::new_unchecked::precondition_check(move _10) -> [return: bb3, unwind unreachable]; + } + + bb3: { StorageDead(_8); + _11 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); + _5 = NonNull::<[bool; 0]> { pointer: _11 }; + StorageDead(_11); + StorageDead(_10); StorageDead(_6); _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; StorageDead(_5); _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); StorageDead(_4); _2 = Box::<[bool]>(_3, const std::alloc::Global); + StorageDead(_9); StorageDead(_3); _1 = A { foo: move _2 }; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind unreachable]; } - - bb1: { - StorageDead(_1); - return; - } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff index 7b6dcf1972b2e..ee85287882be9 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff @@ -24,29 +24,11 @@ debug ptr => _6; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; scope 12 { - scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; - scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; - scope 15 { - scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; - scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; - scope 18 { - scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; - } - } - } - } - } - } - } } } } @@ -66,6 +48,7 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); + StorageLive(_9); StorageLive(_4); StorageLive(_5); StorageLive(_6); @@ -73,34 +56,45 @@ _7 = const 1_usize; _6 = const {0x1 as *mut [bool; 0]}; StorageDead(_7); - StorageLive(_8); - StorageLive(_9); StorageLive(_10); - _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); - StorageDead(_9); + StorageLive(_11); + StorageLive(_8); + _8 = cfg!(debug_assertions); + switchInt(move _8) -> [0: bb4, otherwise: bb3]; + } + + bb1: { + StorageDead(_1); + return; + } + + bb2 (cleanup): { + resume; + } + + bb3: { + _10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr); + _9 = NonNull::::new_unchecked::precondition_check(move _10) -> [return: bb4, unwind unreachable]; + } + + bb4: { StorageDead(_8); + _11 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); + _5 = NonNull::<[bool; 0]> { pointer: _11 }; + StorageDead(_11); + StorageDead(_10); StorageDead(_6); _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; StorageDead(_5); _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); StorageDead(_4); _2 = Box::<[bool]>(_3, const std::alloc::Global); + StorageDead(_9); StorageDead(_3); _1 = A { foo: move _2 }; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind: bb2]; } - - bb1: { - StorageDead(_1); - return; - } - - bb2 (cleanup): { - resume; - } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff index df68ce496fd8c..4df38d6e61b7e 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff @@ -24,29 +24,11 @@ debug ptr => _6; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; scope 12 { - scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; - scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; - scope 15 { - scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; - scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; - scope 18 { - scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; - } - } - } - } - } - } - } } } } @@ -66,6 +48,7 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); + StorageLive(_9); StorageLive(_4); StorageLive(_5); StorageLive(_6); @@ -75,31 +58,43 @@ + _7 = const 1_usize; + _6 = const {0x1 as *mut [bool; 0]}; StorageDead(_7); - StorageLive(_8); - StorageLive(_9); StorageLive(_10); -- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); -+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); - StorageDead(_9); + StorageLive(_11); + StorageLive(_8); + _8 = cfg!(debug_assertions); + switchInt(move _8) -> [0: bb3, otherwise: bb2]; + } + + bb1: { + StorageDead(_1); + return; + } + + bb2: { +- _10 = _6 as *mut () (PtrToPtr); ++ _10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr); + _9 = NonNull::::new_unchecked::precondition_check(move _10) -> [return: bb3, unwind unreachable]; + } + + bb3: { StorageDead(_8); +- _11 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); ++ _11 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); + _5 = NonNull::<[bool; 0]> { pointer: _11 }; + StorageDead(_11); + StorageDead(_10); StorageDead(_6); _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; StorageDead(_5); _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); StorageDead(_4); _2 = Box::<[bool]>(_3, const std::alloc::Global); + StorageDead(_9); StorageDead(_3); _1 = A { foo: move _2 }; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind unreachable]; } - - bb1: { - StorageDead(_1); - return; - } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff index e16ea22091ee2..6aac30bcd17fb 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff @@ -24,29 +24,11 @@ debug ptr => _6; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; scope 12 { - scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; - scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; - scope 15 { - scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; - scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; - scope 18 { - scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; - } - } - } - } - } - } - } } } } @@ -66,6 +48,7 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); + StorageLive(_9); StorageLive(_4); StorageLive(_5); StorageLive(_6); @@ -75,35 +58,47 @@ + _7 = const 1_usize; + _6 = const {0x1 as *mut [bool; 0]}; StorageDead(_7); - StorageLive(_8); - StorageLive(_9); StorageLive(_10); -- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); -+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); - StorageDead(_9); + StorageLive(_11); + StorageLive(_8); + _8 = cfg!(debug_assertions); + switchInt(move _8) -> [0: bb4, otherwise: bb3]; + } + + bb1: { + StorageDead(_1); + return; + } + + bb2 (cleanup): { + resume; + } + + bb3: { +- _10 = _6 as *mut () (PtrToPtr); ++ _10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr); + _9 = NonNull::::new_unchecked::precondition_check(move _10) -> [return: bb4, unwind unreachable]; + } + + bb4: { StorageDead(_8); +- _11 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); ++ _11 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); + _5 = NonNull::<[bool; 0]> { pointer: _11 }; + StorageDead(_11); + StorageDead(_10); StorageDead(_6); _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; StorageDead(_5); _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); StorageDead(_4); _2 = Box::<[bool]>(_3, const std::alloc::Global); + StorageDead(_9); StorageDead(_3); _1 = A { foo: move _2 }; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind: bb2]; } - - bb1: { - StorageDead(_1); - return; - } - - bb2 (cleanup): { - resume; - } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff index df68ce496fd8c..4df38d6e61b7e 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff @@ -24,29 +24,11 @@ debug ptr => _6; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; scope 12 { - scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; - scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; - scope 15 { - scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; - scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; - scope 18 { - scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; - } - } - } - } - } - } - } } } } @@ -66,6 +48,7 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); + StorageLive(_9); StorageLive(_4); StorageLive(_5); StorageLive(_6); @@ -75,31 +58,43 @@ + _7 = const 1_usize; + _6 = const {0x1 as *mut [bool; 0]}; StorageDead(_7); - StorageLive(_8); - StorageLive(_9); StorageLive(_10); -- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); -+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); - StorageDead(_9); + StorageLive(_11); + StorageLive(_8); + _8 = cfg!(debug_assertions); + switchInt(move _8) -> [0: bb3, otherwise: bb2]; + } + + bb1: { + StorageDead(_1); + return; + } + + bb2: { +- _10 = _6 as *mut () (PtrToPtr); ++ _10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr); + _9 = NonNull::::new_unchecked::precondition_check(move _10) -> [return: bb3, unwind unreachable]; + } + + bb3: { StorageDead(_8); +- _11 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); ++ _11 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); + _5 = NonNull::<[bool; 0]> { pointer: _11 }; + StorageDead(_11); + StorageDead(_10); StorageDead(_6); _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; StorageDead(_5); _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); StorageDead(_4); _2 = Box::<[bool]>(_3, const std::alloc::Global); + StorageDead(_9); StorageDead(_3); _1 = A { foo: move _2 }; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind unreachable]; } - - bb1: { - StorageDead(_1); - return; - } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff index e16ea22091ee2..6aac30bcd17fb 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff @@ -24,29 +24,11 @@ debug ptr => _6; scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) { debug ptr => _6; - let mut _8: *const [bool; 0]; - let mut _9: *mut [bool; 0]; + let mut _8: bool; + let _9: (); + let mut _10: *mut (); + let mut _11: *const [bool; 0]; scope 12 { - scope 13 (inlined NonNull::::new_unchecked::runtime::<[bool; 0]>) { - debug ptr => _9; - scope 14 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _9; - let mut _10: *mut u8; - scope 15 { - scope 16 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _10; - scope 17 (inlined std::ptr::mut_ptr::::addr) { - debug self => _10; - scope 18 { - scope 19 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _10; - } - } - } - } - } - } - } } } } @@ -66,6 +48,7 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); + StorageLive(_9); StorageLive(_4); StorageLive(_5); StorageLive(_6); @@ -75,35 +58,47 @@ + _7 = const 1_usize; + _6 = const {0x1 as *mut [bool; 0]}; StorageDead(_7); - StorageLive(_8); - StorageLive(_9); StorageLive(_10); -- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); -+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); - _5 = NonNull::<[bool; 0]> { pointer: _8 }; - StorageDead(_10); - StorageDead(_9); + StorageLive(_11); + StorageLive(_8); + _8 = cfg!(debug_assertions); + switchInt(move _8) -> [0: bb4, otherwise: bb3]; + } + + bb1: { + StorageDead(_1); + return; + } + + bb2 (cleanup): { + resume; + } + + bb3: { +- _10 = _6 as *mut () (PtrToPtr); ++ _10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr); + _9 = NonNull::::new_unchecked::precondition_check(move _10) -> [return: bb4, unwind unreachable]; + } + + bb4: { StorageDead(_8); +- _11 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer)); ++ _11 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer)); + _5 = NonNull::<[bool; 0]> { pointer: _11 }; + StorageDead(_11); + StorageDead(_10); StorageDead(_6); _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; StorageDead(_5); _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); StorageDead(_4); _2 = Box::<[bool]>(_3, const std::alloc::Global); + StorageDead(_9); StorageDead(_3); _1 = A { foo: move _2 }; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind: bb2]; } - - bb1: { - StorageDead(_1); - return; - } - - bb2 (cleanup): { - resume; - } } diff --git a/tests/mir-opt/inline/unwrap_unchecked.rs b/tests/mir-opt/inline/unwrap_unchecked.rs index be133706e5c22..1adf2224d976a 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.rs +++ b/tests/mir-opt/inline/unwrap_unchecked.rs @@ -2,7 +2,7 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // ignore-debug: the debug assertions prevent the inlining we are testing for -// compile-flags: -Zmir-opt-level=2 -Zinline-mir +// compile-flags: -Zmir-opt-level=2 -Zinline-mir -Cdebug-assertions=no // EMIT_MIR unwrap_unchecked.unwrap_unchecked.Inline.diff // EMIT_MIR unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff index 2a36ad9230e4b..9358a64b4fabe 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff @@ -7,41 +7,44 @@ let mut _2: std::option::Option; + scope 1 (inlined #[track_caller] Option::::unwrap_unchecked) { + debug self => _2; -+ let mut _3: &std::option::Option; -+ let mut _4: isize; -+ let mut _5: bool; ++ let mut _3: isize; + scope 2 { + debug val => _0; + } + scope 3 { -+ scope 5 (inlined unreachable_unchecked) { -+ scope 6 { -+ scope 7 (inlined unreachable_unchecked::runtime) { -+ } ++ scope 4 (inlined unreachable_unchecked) { ++ let mut _4: bool; ++ let _5: (); ++ scope 5 { + } + } + } -+ scope 4 (inlined Option::::is_some) { -+ debug self => _3; -+ } + } bb0: { StorageLive(_2); _2 = move _1; - _0 = Option::::unwrap_unchecked(move _2) -> [return: bb1, unwind unreachable]; -- } -- -- bb1: { + StorageLive(_3); -+ StorageLive(_4); + StorageLive(_5); -+ _4 = discriminant(_2); -+ _5 = Eq(_4, const 1_isize); -+ assume(move _5); ++ _3 = discriminant(_2); ++ switchInt(move _3) -> [0: bb1, 1: bb3, otherwise: bb2]; + } + + bb1: { ++ StorageLive(_4); ++ _4 = cfg!(debug_assertions); ++ assume(_4); ++ _5 = unreachable_unchecked::precondition_check() -> [return: bb2, unwind unreachable]; ++ } ++ ++ bb2: { ++ unreachable; ++ } ++ ++ bb3: { + _0 = move ((_2 as Some).0: T); + StorageDead(_5); -+ StorageDead(_4); + StorageDead(_3); StorageDead(_2); return; diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff index 14c8c671d3fe2..ac33c126155ca 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff @@ -7,48 +7,51 @@ let mut _2: std::option::Option; + scope 1 (inlined #[track_caller] Option::::unwrap_unchecked) { + debug self => _2; -+ let mut _3: &std::option::Option; -+ let mut _4: isize; -+ let mut _5: bool; ++ let mut _3: isize; + scope 2 { + debug val => _0; + } + scope 3 { -+ scope 5 (inlined unreachable_unchecked) { -+ scope 6 { -+ scope 7 (inlined unreachable_unchecked::runtime) { -+ } ++ scope 4 (inlined unreachable_unchecked) { ++ let mut _4: bool; ++ let _5: (); ++ scope 5 { + } + } + } -+ scope 4 (inlined Option::::is_some) { -+ debug self => _3; -+ } + } bb0: { StorageLive(_2); _2 = move _1; - _0 = Option::::unwrap_unchecked(move _2) -> [return: bb1, unwind: bb2]; -- } -- -- bb1: { + StorageLive(_3); -+ StorageLive(_4); + StorageLive(_5); -+ _4 = discriminant(_2); -+ _5 = Eq(_4, const 1_isize); -+ assume(move _5); ++ _3 = discriminant(_2); ++ switchInt(move _3) -> [0: bb1, 1: bb3, otherwise: bb2]; + } + + bb1: { +- StorageDead(_2); +- return; ++ StorageLive(_4); ++ _4 = cfg!(debug_assertions); ++ assume(_4); ++ _5 = unreachable_unchecked::precondition_check() -> [return: bb2, unwind unreachable]; + } + +- bb2 (cleanup): { +- resume; ++ bb2: { ++ unreachable; ++ } ++ ++ bb3: { + _0 = move ((_2 as Some).0: T); + StorageDead(_5); -+ StorageDead(_4); + StorageDead(_3); - StorageDead(_2); - return; -- } -- -- bb2 (cleanup): { -- resume; ++ StorageDead(_2); ++ return; } } diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir index d6a608476df9c..8ec65935c6612 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir @@ -6,35 +6,39 @@ fn unwrap_unchecked(_1: Option) -> T { scope 1 (inlined #[track_caller] Option::::unwrap_unchecked) { debug self => _1; let mut _2: isize; - let mut _3: bool; - let mut _4: &std::option::Option; scope 2 { debug val => _0; } scope 3 { - scope 5 (inlined unreachable_unchecked) { - scope 6 { - scope 7 (inlined unreachable_unchecked::runtime) { - } + scope 4 (inlined unreachable_unchecked) { + let mut _3: bool; + let _4: (); + scope 5 { } } } - scope 4 (inlined Option::::is_some) { - debug self => _4; - } } bb0: { - StorageLive(_4); StorageLive(_2); - StorageLive(_3); _2 = discriminant(_1); - _3 = Eq(_2, const 1_isize); - assume(move _3); + switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb3]; + } + + bb1: { + StorageLive(_3); + _3 = cfg!(debug_assertions); + assume(_3); + _4 = unreachable_unchecked::precondition_check() -> [return: bb3, unwind unreachable]; + } + + bb2: { _0 = ((_1 as Some).0: T); - StorageDead(_3); StorageDead(_2); - StorageDead(_4); return; } + + bb3: { + unreachable; + } } diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir index d6a608476df9c..8ec65935c6612 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir @@ -6,35 +6,39 @@ fn unwrap_unchecked(_1: Option) -> T { scope 1 (inlined #[track_caller] Option::::unwrap_unchecked) { debug self => _1; let mut _2: isize; - let mut _3: bool; - let mut _4: &std::option::Option; scope 2 { debug val => _0; } scope 3 { - scope 5 (inlined unreachable_unchecked) { - scope 6 { - scope 7 (inlined unreachable_unchecked::runtime) { - } + scope 4 (inlined unreachable_unchecked) { + let mut _3: bool; + let _4: (); + scope 5 { } } } - scope 4 (inlined Option::::is_some) { - debug self => _4; - } } bb0: { - StorageLive(_4); StorageLive(_2); - StorageLive(_3); _2 = discriminant(_1); - _3 = Eq(_2, const 1_isize); - assume(move _3); + switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb3]; + } + + bb1: { + StorageLive(_3); + _3 = cfg!(debug_assertions); + assume(_3); + _4 = unreachable_unchecked::precondition_check() -> [return: bb3, unwind unreachable]; + } + + bb2: { _0 = ((_1 as Some).0: T); - StorageDead(_3); StorageDead(_2); - StorageDead(_4); return; } + + bb3: { + unreachable; + } } diff --git a/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir index 0114309dbb58e..7c038b0ee88e7 100644 --- a/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir @@ -4,19 +4,31 @@ fn ub_if_b(_1: Thing) -> Thing { debug t => _1; let mut _0: Thing; let mut _2: isize; - let mut _3: bool; scope 1 (inlined unreachable_unchecked) { + let mut _3: bool; + let _4: (); scope 2 { - scope 3 (inlined unreachable_unchecked::runtime) { - } } } bb0: { _2 = discriminant(_1); - _3 = Eq(_2, const 0_isize); - assume(move _3); + switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb3]; + } + + bb1: { _0 = move _1; return; } + + bb2: { + StorageLive(_3); + _3 = cfg!(debug_assertions); + assume(_3); + _4 = unreachable_unchecked::precondition_check() -> [return: bb3, unwind unreachable]; + } + + bb3: { + unreachable; + } } diff --git a/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.panic-abort.mir similarity index 100% rename from tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir rename to tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.panic-abort.mir diff --git a/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.panic-unwind.mir new file mode 100644 index 0000000000000..3ca24e152a4e0 --- /dev/null +++ b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.panic-unwind.mir @@ -0,0 +1,16 @@ +// MIR for `manual_replace` after PreCodegen + +fn manual_replace(_1: &mut u32, _2: u32) -> u32 { + debug r => _1; + debug v => _2; + let mut _0: u32; + scope 1 { + debug temp => _0; + } + + bb0: { + _0 = (*_1); + (*_1) = _2; + return; + } +} diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir deleted file mode 100644 index f0cb4ca31fecc..0000000000000 --- a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir +++ /dev/null @@ -1,66 +0,0 @@ -// MIR for `mem_replace` after PreCodegen - -fn mem_replace(_1: &mut u32, _2: u32) -> u32 { - debug r => _1; - debug v => _2; - let mut _0: u32; - scope 1 (inlined std::mem::replace::) { - debug dest => _1; - debug src => _2; - scope 2 { - scope 3 { - debug result => _0; - scope 16 (inlined std::ptr::write::) { - debug dst => _1; - debug src => _2; - scope 17 { - } - } - } - scope 4 (inlined std::ptr::read::) { - debug src => _1; - let mut _3: *const u32; - scope 5 { - scope 6 (inlined std::ptr::read::runtime::) { - debug src => _3; - scope 7 (inlined intrinsics::is_aligned_and_not_null::) { - debug ptr => _3; - scope 8 (inlined std::ptr::const_ptr::::is_null) { - debug self => _3; - let mut _4: *const u8; - scope 9 { - scope 10 (inlined std::ptr::const_ptr::::is_null::runtime_impl) { - debug ptr => _4; - scope 11 (inlined std::ptr::const_ptr::::addr) { - debug self => _4; - scope 12 { - scope 13 (inlined std::ptr::const_ptr::::cast::<()>) { - debug self => _4; - } - } - } - } - } - } - scope 14 (inlined std::ptr::const_ptr::::is_aligned) { - debug self => _3; - scope 15 (inlined align_of::) { - } - } - } - } - } - } - } - } - - bb0: { - StorageLive(_3); - StorageLive(_4); - _0 = (*_1); - StorageDead(_4); - StorageDead(_3); - (*_1) = _2; - return; - } -} diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir new file mode 100644 index 0000000000000..26919dd98dd27 --- /dev/null +++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir @@ -0,0 +1,33 @@ +// MIR for `mem_replace` after PreCodegen + +fn mem_replace(_1: &mut u32, _2: u32) -> u32 { + debug r => _1; + debug v => _2; + let mut _0: u32; + scope 1 (inlined std::mem::replace::) { + debug dest => _1; + debug src => _2; + scope 2 { + scope 3 { + debug result => _0; + scope 6 (inlined std::ptr::write::) { + debug dst => _1; + debug src => _2; + scope 7 { + } + } + } + scope 4 (inlined std::ptr::read::) { + debug src => _1; + scope 5 { + } + } + } + } + + bb0: { + _0 = (*_1); + (*_1) = _2; + return; + } +} diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir new file mode 100644 index 0000000000000..26919dd98dd27 --- /dev/null +++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir @@ -0,0 +1,33 @@ +// MIR for `mem_replace` after PreCodegen + +fn mem_replace(_1: &mut u32, _2: u32) -> u32 { + debug r => _1; + debug v => _2; + let mut _0: u32; + scope 1 (inlined std::mem::replace::) { + debug dest => _1; + debug src => _2; + scope 2 { + scope 3 { + debug result => _0; + scope 6 (inlined std::ptr::write::) { + debug dst => _1; + debug src => _2; + scope 7 { + } + } + } + scope 4 (inlined std::ptr::read::) { + debug src => _1; + scope 5 { + } + } + } + } + + bb0: { + _0 = (*_1); + (*_1) = _2; + return; + } +} diff --git a/tests/mir-opt/pre-codegen/mem_replace.rs b/tests/mir-opt/pre-codegen/mem_replace.rs index 18c4653d4c6ea..551afea3ba5a8 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.rs +++ b/tests/mir-opt/pre-codegen/mem_replace.rs @@ -1,7 +1,8 @@ // skip-filecheck -// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 +// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 -Zinline-mir // only-64bit // ignore-debug the standard library debug assertions leak into this test +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![crate_type = "lib"] 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 26b2663fa3580..4906c86f8ed97 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 @@ -4,171 +4,165 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug slice => _1; debug f => _2; let mut _0: (); - let mut _13: std::slice::Iter<'_, T>; - let mut _14: std::iter::Enumerate>; - let mut _15: std::iter::Enumerate>; - let mut _16: &mut std::iter::Enumerate>; - let mut _17: std::option::Option<(usize, &T)>; - let mut _18: isize; - let mut _21: &impl Fn(usize, &T); - let mut _22: (usize, &T); - let _23: (); + let mut _15: std::slice::Iter<'_, T>; + let mut _16: std::iter::Enumerate>; + let mut _17: std::iter::Enumerate>; + let mut _18: &mut std::iter::Enumerate>; + let mut _19: std::option::Option<(usize, &T)>; + let mut _20: isize; + let mut _23: &impl Fn(usize, &T); + let mut _24: (usize, &T); + let _25: (); scope 1 { - debug iter => _15; - let _19: usize; - let _20: &T; + debug iter => _17; + let _21: usize; + let _22: &T; scope 2 { - debug i => _19; - debug x => _20; + debug i => _21; + debug x => _22; } } scope 3 (inlined core::slice::::iter) { debug self => _1; scope 4 (inlined std::slice::Iter::<'_, T>::new) { debug slice => _1; - let _4: *const T; - let mut _5: bool; - let mut _6: usize; - let mut _8: usize; - let mut _9: *mut T; - let mut _11: std::ptr::NonNull; - let mut _12: *const T; + let _3: usize; + let mut _5: std::ptr::NonNull<[T]>; + let mut _10: bool; + let mut _11: *mut T; + let mut _12: *mut T; + let mut _14: *const T; scope 5 { - debug ptr => _4; + debug len => _3; + let _9: std::ptr::NonNull; scope 6 { - let _7: *const T; + debug ptr => _9; scope 7 { - debug end_or_len => _7; - scope 13 (inlined NonNull::::new_unchecked) { - debug ptr => _9; - let mut _10: *const T; - let mut _24: *mut T; - scope 14 { - scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _24; - scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _24; - let mut _25: *mut u8; - scope 17 { - scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _25; - scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _25; - scope 20 { - scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _25; - } - } - } - } - } - } - } + let _13: *const T; + scope 8 { + debug end_or_len => _13; + } + scope 14 (inlined invalid::) { + debug addr => _3; + scope 15 { } } - } - scope 9 (inlined invalid::) { - debug addr => _8; - scope 10 { + scope 16 (inlined NonNull::::as_ptr) { + debug self => _9; + } + scope 17 (inlined std::ptr::mut_ptr::::add) { + debug self => _11; + debug count => _3; + scope 18 { + } } } - scope 11 (inlined std::ptr::const_ptr::::add) { - debug self => _4; - debug count => _6; - scope 12 { + } + scope 9 (inlined as From<&[T]>>::from) { + debug reference => _1; + let mut _4: *const [T]; + scope 10 { + } + } + scope 11 (inlined NonNull::<[T]>::cast::) { + debug self => _5; + let mut _6: *mut [T]; + let mut _7: *mut T; + let mut _8: *const T; + scope 12 { + scope 13 (inlined NonNull::<[T]>::as_ptr) { + debug self => _5; } } } } - scope 8 (inlined core::slice::::as_ptr) { - debug self => _1; - let mut _3: *const [T]; - } } } - scope 22 (inlined as Iterator>::enumerate) { - debug self => _13; - scope 23 (inlined Enumerate::>::new) { - debug iter => _13; + scope 19 (inlined as Iterator>::enumerate) { + debug self => _15; + scope 20 (inlined Enumerate::>::new) { + debug iter => _15; } } - scope 24 (inlined > as IntoIterator>::into_iter) { - debug self => _14; + scope 21 (inlined > as IntoIterator>::into_iter) { + debug self => _16; } bb0: { - StorageLive(_13); - StorageLive(_4); + StorageLive(_15); StorageLive(_3); - _3 = &raw const (*_1); - _4 = move _3 as *const T (PtrToPtr); - StorageDead(_3); - StorageLive(_7); + StorageLive(_9); + StorageLive(_4); + StorageLive(_8); + _3 = Len((*_1)); StorageLive(_5); - _5 = const _; - switchInt(move _5) -> [0: bb1, otherwise: bb2]; + _4 = &raw const (*_1); + _5 = NonNull::<[T]> { pointer: _4 }; + StorageLive(_7); + StorageLive(_6); + _6 = _4 as *mut [T] (PtrToPtr); + _7 = move _6 as *mut T (PtrToPtr); + _8 = move _7 as *const T (PointerCoercion(MutToConstPointer)); + StorageDead(_6); + StorageDead(_7); + _9 = NonNull:: { pointer: _8 }; + StorageDead(_5); + StorageLive(_13); + StorageLive(_10); + _10 = const _; + switchInt(move _10) -> [0: bb1, otherwise: bb2]; } bb1: { - StorageLive(_6); - _6 = Len((*_1)); - _7 = Offset(_4, _6); - StorageDead(_6); + StorageLive(_12); + StorageLive(_11); + _11 = _8 as *mut T (PtrToPtr); + _12 = Offset(_11, _3); + StorageDead(_11); + _13 = move _12 as *const T (PointerCoercion(MutToConstPointer)); + StorageDead(_12); goto -> bb3; } bb2: { - StorageLive(_8); - _8 = Len((*_1)); - _7 = _8 as *const T (Transmute); - StorageDead(_8); + _13 = _3 as *const T (Transmute); goto -> bb3; } bb3: { - StorageDead(_5); - StorageLive(_11); - StorageLive(_9); - _9 = _4 as *mut T (PtrToPtr); - StorageLive(_10); - StorageLive(_24); - StorageLive(_25); - _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); - _11 = NonNull:: { pointer: _10 }; - StorageDead(_25); - StorageDead(_24); StorageDead(_10); - StorageDead(_9); - StorageLive(_12); - _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; - StorageDead(_12); - StorageDead(_11); - StorageDead(_7); - StorageDead(_4); - _14 = Enumerate::> { iter: _13, count: const 0_usize }; + StorageLive(_14); + _14 = _13; + _15 = std::slice::Iter::<'_, T> { ptr: _9, end_or_len: move _14, _marker: const ZeroSized: PhantomData<&T> }; + StorageDead(_14); StorageDead(_13); - StorageLive(_15); - _15 = _14; + StorageDead(_8); + StorageDead(_4); + StorageDead(_9); + StorageDead(_3); + _16 = Enumerate::> { iter: _15, count: const 0_usize }; + StorageDead(_15); + StorageLive(_17); + _17 = _16; goto -> bb4; } bb4: { - StorageLive(_17); - StorageLive(_16); - _16 = &mut _15; - _17 = > as Iterator>::next(move _16) -> [return: bb5, unwind unreachable]; + StorageLive(_19); + StorageLive(_18); + _18 = &mut _17; + _19 = > as Iterator>::next(move _18) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_16); - _18 = discriminant(_17); - switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_18); + _20 = discriminant(_19); + switchInt(move _20) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { + StorageDead(_19); StorageDead(_17); - StorageDead(_15); drop(_2) -> [return: bb7, unwind unreachable]; } @@ -177,19 +171,19 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb8: { - _19 = (((_17 as Some).0: (usize, &T)).0: usize); - _20 = (((_17 as Some).0: (usize, &T)).1: &T); - StorageLive(_21); - _21 = &_2; - StorageLive(_22); - _22 = (_19, _20); - _23 = >::call(move _21, move _22) -> [return: bb9, unwind unreachable]; + _21 = (((_19 as Some).0: (usize, &T)).0: usize); + _22 = (((_19 as Some).0: (usize, &T)).1: &T); + StorageLive(_23); + _23 = &_2; + StorageLive(_24); + _24 = (_21, _22); + _25 = >::call(move _23, move _24) -> [return: bb9, unwind unreachable]; } bb9: { - StorageDead(_22); - StorageDead(_21); - StorageDead(_17); + StorageDead(_24); + StorageDead(_23); + StorageDead(_19); goto -> bb4; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir index a055612bd5feb..25a5ecdc6c360 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir @@ -4,171 +4,165 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug slice => _1; debug f => _2; let mut _0: (); - let mut _13: std::slice::Iter<'_, T>; - let mut _14: std::iter::Enumerate>; - let mut _15: std::iter::Enumerate>; - let mut _16: &mut std::iter::Enumerate>; - let mut _17: std::option::Option<(usize, &T)>; - let mut _18: isize; - let mut _21: &impl Fn(usize, &T); - let mut _22: (usize, &T); - let _23: (); + let mut _15: std::slice::Iter<'_, T>; + let mut _16: std::iter::Enumerate>; + let mut _17: std::iter::Enumerate>; + let mut _18: &mut std::iter::Enumerate>; + let mut _19: std::option::Option<(usize, &T)>; + let mut _20: isize; + let mut _23: &impl Fn(usize, &T); + let mut _24: (usize, &T); + let _25: (); scope 1 { - debug iter => _15; - let _19: usize; - let _20: &T; + debug iter => _17; + let _21: usize; + let _22: &T; scope 2 { - debug i => _19; - debug x => _20; + debug i => _21; + debug x => _22; } } scope 3 (inlined core::slice::::iter) { debug self => _1; scope 4 (inlined std::slice::Iter::<'_, T>::new) { debug slice => _1; - let _4: *const T; - let mut _5: bool; - let mut _6: usize; - let mut _8: usize; - let mut _9: *mut T; - let mut _11: std::ptr::NonNull; - let mut _12: *const T; + let _3: usize; + let mut _5: std::ptr::NonNull<[T]>; + let mut _10: bool; + let mut _11: *mut T; + let mut _12: *mut T; + let mut _14: *const T; scope 5 { - debug ptr => _4; + debug len => _3; + let _9: std::ptr::NonNull; scope 6 { - let _7: *const T; + debug ptr => _9; scope 7 { - debug end_or_len => _7; - scope 13 (inlined NonNull::::new_unchecked) { - debug ptr => _9; - let mut _10: *const T; - let mut _24: *mut T; - scope 14 { - scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _24; - scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _24; - let mut _25: *mut u8; - scope 17 { - scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _25; - scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _25; - scope 20 { - scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _25; - } - } - } - } - } - } - } + let _13: *const T; + scope 8 { + debug end_or_len => _13; + } + scope 14 (inlined invalid::) { + debug addr => _3; + scope 15 { } } - } - scope 9 (inlined invalid::) { - debug addr => _8; - scope 10 { + scope 16 (inlined NonNull::::as_ptr) { + debug self => _9; + } + scope 17 (inlined std::ptr::mut_ptr::::add) { + debug self => _11; + debug count => _3; + scope 18 { + } } } - scope 11 (inlined std::ptr::const_ptr::::add) { - debug self => _4; - debug count => _6; - scope 12 { + } + scope 9 (inlined as From<&[T]>>::from) { + debug reference => _1; + let mut _4: *const [T]; + scope 10 { + } + } + scope 11 (inlined NonNull::<[T]>::cast::) { + debug self => _5; + let mut _6: *mut [T]; + let mut _7: *mut T; + let mut _8: *const T; + scope 12 { + scope 13 (inlined NonNull::<[T]>::as_ptr) { + debug self => _5; } } } } - scope 8 (inlined core::slice::::as_ptr) { - debug self => _1; - let mut _3: *const [T]; - } } } - scope 22 (inlined as Iterator>::enumerate) { - debug self => _13; - scope 23 (inlined Enumerate::>::new) { - debug iter => _13; + scope 19 (inlined as Iterator>::enumerate) { + debug self => _15; + scope 20 (inlined Enumerate::>::new) { + debug iter => _15; } } - scope 24 (inlined > as IntoIterator>::into_iter) { - debug self => _14; + scope 21 (inlined > as IntoIterator>::into_iter) { + debug self => _16; } bb0: { - StorageLive(_13); - StorageLive(_4); + StorageLive(_15); StorageLive(_3); - _3 = &raw const (*_1); - _4 = move _3 as *const T (PtrToPtr); - StorageDead(_3); - StorageLive(_7); + StorageLive(_9); + StorageLive(_4); + StorageLive(_8); + _3 = Len((*_1)); StorageLive(_5); - _5 = const _; - switchInt(move _5) -> [0: bb1, otherwise: bb2]; + _4 = &raw const (*_1); + _5 = NonNull::<[T]> { pointer: _4 }; + StorageLive(_7); + StorageLive(_6); + _6 = _4 as *mut [T] (PtrToPtr); + _7 = move _6 as *mut T (PtrToPtr); + _8 = move _7 as *const T (PointerCoercion(MutToConstPointer)); + StorageDead(_6); + StorageDead(_7); + _9 = NonNull:: { pointer: _8 }; + StorageDead(_5); + StorageLive(_13); + StorageLive(_10); + _10 = const _; + switchInt(move _10) -> [0: bb1, otherwise: bb2]; } bb1: { - StorageLive(_6); - _6 = Len((*_1)); - _7 = Offset(_4, _6); - StorageDead(_6); + StorageLive(_12); + StorageLive(_11); + _11 = _8 as *mut T (PtrToPtr); + _12 = Offset(_11, _3); + StorageDead(_11); + _13 = move _12 as *const T (PointerCoercion(MutToConstPointer)); + StorageDead(_12); goto -> bb3; } bb2: { - StorageLive(_8); - _8 = Len((*_1)); - _7 = _8 as *const T (Transmute); - StorageDead(_8); + _13 = _3 as *const T (Transmute); goto -> bb3; } bb3: { - StorageDead(_5); - StorageLive(_11); - StorageLive(_9); - _9 = _4 as *mut T (PtrToPtr); - StorageLive(_10); - StorageLive(_24); - StorageLive(_25); - _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); - _11 = NonNull:: { pointer: _10 }; - StorageDead(_25); - StorageDead(_24); StorageDead(_10); - StorageDead(_9); - StorageLive(_12); - _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; - StorageDead(_12); - StorageDead(_11); - StorageDead(_7); - StorageDead(_4); - _14 = Enumerate::> { iter: _13, count: const 0_usize }; + StorageLive(_14); + _14 = _13; + _15 = std::slice::Iter::<'_, T> { ptr: _9, end_or_len: move _14, _marker: const ZeroSized: PhantomData<&T> }; + StorageDead(_14); StorageDead(_13); - StorageLive(_15); - _15 = _14; + StorageDead(_8); + StorageDead(_4); + StorageDead(_9); + StorageDead(_3); + _16 = Enumerate::> { iter: _15, count: const 0_usize }; + StorageDead(_15); + StorageLive(_17); + _17 = _16; goto -> bb4; } bb4: { - StorageLive(_17); - StorageLive(_16); - _16 = &mut _15; - _17 = > as Iterator>::next(move _16) -> [return: bb5, unwind: bb11]; + StorageLive(_19); + StorageLive(_18); + _18 = &mut _17; + _19 = > as Iterator>::next(move _18) -> [return: bb5, unwind: bb11]; } bb5: { - StorageDead(_16); - _18 = discriminant(_17); - switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_18); + _20 = discriminant(_19); + switchInt(move _20) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { + StorageDead(_19); StorageDead(_17); - StorageDead(_15); drop(_2) -> [return: bb7, unwind continue]; } @@ -177,19 +171,19 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb8: { - _19 = (((_17 as Some).0: (usize, &T)).0: usize); - _20 = (((_17 as Some).0: (usize, &T)).1: &T); - StorageLive(_21); - _21 = &_2; - StorageLive(_22); - _22 = (_19, _20); - _23 = >::call(move _21, move _22) -> [return: bb9, unwind: bb11]; + _21 = (((_19 as Some).0: (usize, &T)).0: usize); + _22 = (((_19 as Some).0: (usize, &T)).1: &T); + StorageLive(_23); + _23 = &_2; + StorageLive(_24); + _24 = (_21, _22); + _25 = >::call(move _23, move _24) -> [return: bb9, unwind: bb11]; } bb9: { - StorageDead(_22); - StorageDead(_21); - StorageDead(_17); + StorageDead(_24); + StorageDead(_23); + StorageDead(_19); goto -> bb4; } 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 471491108e0b6..133d6f53fce11 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 @@ -4,159 +4,153 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { debug slice => _1; debug f => _2; let mut _0: (); - let mut _13: std::slice::Iter<'_, T>; - let mut _14: std::slice::Iter<'_, T>; - let mut _15: &mut std::slice::Iter<'_, T>; - let mut _16: std::option::Option<&T>; - let mut _17: isize; - let mut _19: &impl Fn(&T); - let mut _20: (&T,); - let _21: (); + let mut _15: std::slice::Iter<'_, T>; + let mut _16: std::slice::Iter<'_, T>; + let mut _17: &mut std::slice::Iter<'_, T>; + let mut _18: std::option::Option<&T>; + let mut _19: isize; + let mut _21: &impl Fn(&T); + let mut _22: (&T,); + let _23: (); scope 1 { - debug iter => _14; - let _18: &T; + debug iter => _16; + let _20: &T; scope 2 { - debug x => _18; + debug x => _20; } } scope 3 (inlined core::slice::::iter) { debug self => _1; scope 4 (inlined std::slice::Iter::<'_, T>::new) { debug slice => _1; - let _4: *const T; - let mut _5: bool; - let mut _6: usize; - let mut _8: usize; - let mut _9: *mut T; - let mut _11: std::ptr::NonNull; - let mut _12: *const T; + let _3: usize; + let mut _5: std::ptr::NonNull<[T]>; + let mut _10: bool; + let mut _11: *mut T; + let mut _12: *mut T; + let mut _14: *const T; scope 5 { - debug ptr => _4; + debug len => _3; + let _9: std::ptr::NonNull; scope 6 { - let _7: *const T; + debug ptr => _9; scope 7 { - debug end_or_len => _7; - scope 13 (inlined NonNull::::new_unchecked) { - debug ptr => _9; - let mut _10: *const T; - let mut _22: *mut T; - scope 14 { - scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _22; - scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _22; - let mut _23: *mut u8; - scope 17 { - scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _23; - scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _23; - scope 20 { - scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _23; - } - } - } - } - } - } - } + let _13: *const T; + scope 8 { + debug end_or_len => _13; + } + scope 14 (inlined invalid::) { + debug addr => _3; + scope 15 { } } - } - scope 9 (inlined invalid::) { - debug addr => _8; - scope 10 { + scope 16 (inlined NonNull::::as_ptr) { + debug self => _9; + } + scope 17 (inlined std::ptr::mut_ptr::::add) { + debug self => _11; + debug count => _3; + scope 18 { + } } } - scope 11 (inlined std::ptr::const_ptr::::add) { - debug self => _4; - debug count => _6; - scope 12 { + } + scope 9 (inlined as From<&[T]>>::from) { + debug reference => _1; + let mut _4: *const [T]; + scope 10 { + } + } + scope 11 (inlined NonNull::<[T]>::cast::) { + debug self => _5; + let mut _6: *mut [T]; + let mut _7: *mut T; + let mut _8: *const T; + scope 12 { + scope 13 (inlined NonNull::<[T]>::as_ptr) { + debug self => _5; } } } } - scope 8 (inlined core::slice::::as_ptr) { - debug self => _1; - let mut _3: *const [T]; - } } } - scope 22 (inlined as IntoIterator>::into_iter) { - debug self => _13; + scope 19 (inlined as IntoIterator>::into_iter) { + debug self => _15; } bb0: { - StorageLive(_4); StorageLive(_3); - _3 = &raw const (*_1); - _4 = move _3 as *const T (PtrToPtr); - StorageDead(_3); - StorageLive(_7); + StorageLive(_9); + StorageLive(_4); + StorageLive(_8); + _3 = Len((*_1)); StorageLive(_5); - _5 = const _; - switchInt(move _5) -> [0: bb1, otherwise: bb2]; + _4 = &raw const (*_1); + _5 = NonNull::<[T]> { pointer: _4 }; + StorageLive(_7); + StorageLive(_6); + _6 = _4 as *mut [T] (PtrToPtr); + _7 = move _6 as *mut T (PtrToPtr); + _8 = move _7 as *const T (PointerCoercion(MutToConstPointer)); + StorageDead(_6); + StorageDead(_7); + _9 = NonNull:: { pointer: _8 }; + StorageDead(_5); + StorageLive(_13); + StorageLive(_10); + _10 = const _; + switchInt(move _10) -> [0: bb1, otherwise: bb2]; } bb1: { - StorageLive(_6); - _6 = Len((*_1)); - _7 = Offset(_4, _6); - StorageDead(_6); + StorageLive(_12); + StorageLive(_11); + _11 = _8 as *mut T (PtrToPtr); + _12 = Offset(_11, _3); + StorageDead(_11); + _13 = move _12 as *const T (PointerCoercion(MutToConstPointer)); + StorageDead(_12); goto -> bb3; } bb2: { - StorageLive(_8); - _8 = Len((*_1)); - _7 = _8 as *const T (Transmute); - StorageDead(_8); + _13 = _3 as *const T (Transmute); goto -> bb3; } bb3: { - StorageDead(_5); - StorageLive(_11); - StorageLive(_9); - _9 = _4 as *mut T (PtrToPtr); - StorageLive(_10); - StorageLive(_22); - StorageLive(_23); - _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); - _11 = NonNull:: { pointer: _10 }; - StorageDead(_23); - StorageDead(_22); StorageDead(_10); - StorageDead(_9); - StorageLive(_12); - _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; - StorageDead(_12); - StorageDead(_11); - StorageDead(_7); - StorageDead(_4); StorageLive(_14); _14 = _13; + _15 = std::slice::Iter::<'_, T> { ptr: _9, end_or_len: move _14, _marker: const ZeroSized: PhantomData<&T> }; + StorageDead(_14); + StorageDead(_13); + StorageDead(_8); + StorageDead(_4); + StorageDead(_9); + StorageDead(_3); + StorageLive(_16); + _16 = _15; goto -> bb4; } bb4: { - StorageLive(_16); - StorageLive(_15); - _15 = &mut _14; - _16 = as Iterator>::next(move _15) -> [return: bb5, unwind unreachable]; + StorageLive(_18); + StorageLive(_17); + _17 = &mut _16; + _18 = as Iterator>::next(move _17) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_15); - _17 = discriminant(_16); - switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_17); + _19 = discriminant(_18); + switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { + StorageDead(_18); StorageDead(_16); - StorageDead(_14); drop(_2) -> [return: bb7, unwind unreachable]; } @@ -165,18 +159,18 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb8: { - _18 = ((_16 as Some).0: &T); - StorageLive(_19); - _19 = &_2; - StorageLive(_20); - _20 = (_18,); - _21 = >::call(move _19, move _20) -> [return: bb9, unwind unreachable]; + _20 = ((_18 as Some).0: &T); + StorageLive(_21); + _21 = &_2; + StorageLive(_22); + _22 = (_20,); + _23 = >::call(move _21, move _22) -> [return: bb9, unwind unreachable]; } bb9: { - StorageDead(_20); - StorageDead(_19); - StorageDead(_16); + StorageDead(_22); + StorageDead(_21); + StorageDead(_18); goto -> bb4; } 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 bbf38aba91f08..4e74253e54172 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 @@ -4,159 +4,153 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { debug slice => _1; debug f => _2; let mut _0: (); - let mut _13: std::slice::Iter<'_, T>; - let mut _14: std::slice::Iter<'_, T>; - let mut _15: &mut std::slice::Iter<'_, T>; - let mut _16: std::option::Option<&T>; - let mut _17: isize; - let mut _19: &impl Fn(&T); - let mut _20: (&T,); - let _21: (); + let mut _15: std::slice::Iter<'_, T>; + let mut _16: std::slice::Iter<'_, T>; + let mut _17: &mut std::slice::Iter<'_, T>; + let mut _18: std::option::Option<&T>; + let mut _19: isize; + let mut _21: &impl Fn(&T); + let mut _22: (&T,); + let _23: (); scope 1 { - debug iter => _14; - let _18: &T; + debug iter => _16; + let _20: &T; scope 2 { - debug x => _18; + debug x => _20; } } scope 3 (inlined core::slice::::iter) { debug self => _1; scope 4 (inlined std::slice::Iter::<'_, T>::new) { debug slice => _1; - let _4: *const T; - let mut _5: bool; - let mut _6: usize; - let mut _8: usize; - let mut _9: *mut T; - let mut _11: std::ptr::NonNull; - let mut _12: *const T; + let _3: usize; + let mut _5: std::ptr::NonNull<[T]>; + let mut _10: bool; + let mut _11: *mut T; + let mut _12: *mut T; + let mut _14: *const T; scope 5 { - debug ptr => _4; + debug len => _3; + let _9: std::ptr::NonNull; scope 6 { - let _7: *const T; + debug ptr => _9; scope 7 { - debug end_or_len => _7; - scope 13 (inlined NonNull::::new_unchecked) { - debug ptr => _9; - let mut _10: *const T; - let mut _22: *mut T; - scope 14 { - scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _22; - scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _22; - let mut _23: *mut u8; - scope 17 { - scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _23; - scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _23; - scope 20 { - scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _23; - } - } - } - } - } - } - } + let _13: *const T; + scope 8 { + debug end_or_len => _13; + } + scope 14 (inlined invalid::) { + debug addr => _3; + scope 15 { } } - } - scope 9 (inlined invalid::) { - debug addr => _8; - scope 10 { + scope 16 (inlined NonNull::::as_ptr) { + debug self => _9; + } + scope 17 (inlined std::ptr::mut_ptr::::add) { + debug self => _11; + debug count => _3; + scope 18 { + } } } - scope 11 (inlined std::ptr::const_ptr::::add) { - debug self => _4; - debug count => _6; - scope 12 { + } + scope 9 (inlined as From<&[T]>>::from) { + debug reference => _1; + let mut _4: *const [T]; + scope 10 { + } + } + scope 11 (inlined NonNull::<[T]>::cast::) { + debug self => _5; + let mut _6: *mut [T]; + let mut _7: *mut T; + let mut _8: *const T; + scope 12 { + scope 13 (inlined NonNull::<[T]>::as_ptr) { + debug self => _5; } } } } - scope 8 (inlined core::slice::::as_ptr) { - debug self => _1; - let mut _3: *const [T]; - } } } - scope 22 (inlined as IntoIterator>::into_iter) { - debug self => _13; + scope 19 (inlined as IntoIterator>::into_iter) { + debug self => _15; } bb0: { - StorageLive(_4); StorageLive(_3); - _3 = &raw const (*_1); - _4 = move _3 as *const T (PtrToPtr); - StorageDead(_3); - StorageLive(_7); + StorageLive(_9); + StorageLive(_4); + StorageLive(_8); + _3 = Len((*_1)); StorageLive(_5); - _5 = const _; - switchInt(move _5) -> [0: bb1, otherwise: bb2]; + _4 = &raw const (*_1); + _5 = NonNull::<[T]> { pointer: _4 }; + StorageLive(_7); + StorageLive(_6); + _6 = _4 as *mut [T] (PtrToPtr); + _7 = move _6 as *mut T (PtrToPtr); + _8 = move _7 as *const T (PointerCoercion(MutToConstPointer)); + StorageDead(_6); + StorageDead(_7); + _9 = NonNull:: { pointer: _8 }; + StorageDead(_5); + StorageLive(_13); + StorageLive(_10); + _10 = const _; + switchInt(move _10) -> [0: bb1, otherwise: bb2]; } bb1: { - StorageLive(_6); - _6 = Len((*_1)); - _7 = Offset(_4, _6); - StorageDead(_6); + StorageLive(_12); + StorageLive(_11); + _11 = _8 as *mut T (PtrToPtr); + _12 = Offset(_11, _3); + StorageDead(_11); + _13 = move _12 as *const T (PointerCoercion(MutToConstPointer)); + StorageDead(_12); goto -> bb3; } bb2: { - StorageLive(_8); - _8 = Len((*_1)); - _7 = _8 as *const T (Transmute); - StorageDead(_8); + _13 = _3 as *const T (Transmute); goto -> bb3; } bb3: { - StorageDead(_5); - StorageLive(_11); - StorageLive(_9); - _9 = _4 as *mut T (PtrToPtr); - StorageLive(_10); - StorageLive(_22); - StorageLive(_23); - _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); - _11 = NonNull:: { pointer: _10 }; - StorageDead(_23); - StorageDead(_22); StorageDead(_10); - StorageDead(_9); - StorageLive(_12); - _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; - StorageDead(_12); - StorageDead(_11); - StorageDead(_7); - StorageDead(_4); StorageLive(_14); _14 = _13; + _15 = std::slice::Iter::<'_, T> { ptr: _9, end_or_len: move _14, _marker: const ZeroSized: PhantomData<&T> }; + StorageDead(_14); + StorageDead(_13); + StorageDead(_8); + StorageDead(_4); + StorageDead(_9); + StorageDead(_3); + StorageLive(_16); + _16 = _15; goto -> bb4; } bb4: { - StorageLive(_16); - StorageLive(_15); - _15 = &mut _14; - _16 = as Iterator>::next(move _15) -> [return: bb5, unwind: bb11]; + StorageLive(_18); + StorageLive(_17); + _17 = &mut _16; + _18 = as Iterator>::next(move _17) -> [return: bb5, unwind: bb11]; } bb5: { - StorageDead(_15); - _17 = discriminant(_16); - switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_17); + _19 = discriminant(_18); + switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { + StorageDead(_18); StorageDead(_16); - StorageDead(_14); drop(_2) -> [return: bb7, unwind continue]; } @@ -165,18 +159,18 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb8: { - _18 = ((_16 as Some).0: &T); - StorageLive(_19); - _19 = &_2; - StorageLive(_20); - _20 = (_18,); - _21 = >::call(move _19, move _20) -> [return: bb9, unwind: bb11]; + _20 = ((_18 as Some).0: &T); + StorageLive(_21); + _21 = &_2; + StorageLive(_22); + _22 = (_20,); + _23 = >::call(move _21, move _22) -> [return: bb9, unwind: bb11]; } bb9: { - StorageDead(_20); - StorageDead(_19); - StorageDead(_16); + StorageDead(_22); + StorageDead(_21); + StorageDead(_18); goto -> bb4; } 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 f9c8ab4db60b7..639e1a51430db 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 @@ -4,174 +4,168 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { debug slice => _1; debug f => _2; let mut _0: (); - let mut _13: std::slice::Iter<'_, T>; - let mut _14: std::iter::Rev>; - let mut _15: std::iter::Rev>; - let mut _16: &mut std::iter::Rev>; - let mut _18: std::option::Option<&T>; - let mut _19: isize; - let mut _21: &impl Fn(&T); - let mut _22: (&T,); - let _23: (); + let mut _15: std::slice::Iter<'_, T>; + let mut _16: std::iter::Rev>; + let mut _17: std::iter::Rev>; + let mut _18: &mut std::iter::Rev>; + let mut _20: std::option::Option<&T>; + let mut _21: isize; + let mut _23: &impl Fn(&T); + let mut _24: (&T,); + let _25: (); scope 1 { - debug iter => _15; - let _20: &T; + debug iter => _17; + let _22: &T; scope 2 { - debug x => _20; + debug x => _22; } - scope 25 (inlined > as Iterator>::next) { - debug self => _16; - let mut _17: &mut std::slice::Iter<'_, T>; + scope 22 (inlined > as Iterator>::next) { + debug self => _18; + let mut _19: &mut std::slice::Iter<'_, T>; } } scope 3 (inlined core::slice::::iter) { debug self => _1; scope 4 (inlined std::slice::Iter::<'_, T>::new) { debug slice => _1; - let _4: *const T; - let mut _5: bool; - let mut _6: usize; - let mut _8: usize; - let mut _9: *mut T; - let mut _11: std::ptr::NonNull; - let mut _12: *const T; + let _3: usize; + let mut _5: std::ptr::NonNull<[T]>; + let mut _10: bool; + let mut _11: *mut T; + let mut _12: *mut T; + let mut _14: *const T; scope 5 { - debug ptr => _4; + debug len => _3; + let _9: std::ptr::NonNull; scope 6 { - let _7: *const T; + debug ptr => _9; scope 7 { - debug end_or_len => _7; - scope 13 (inlined NonNull::::new_unchecked) { - debug ptr => _9; - let mut _10: *const T; - let mut _24: *mut T; - scope 14 { - scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _24; - scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _24; - let mut _25: *mut u8; - scope 17 { - scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _25; - scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _25; - scope 20 { - scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _25; - } - } - } - } - } - } - } + let _13: *const T; + scope 8 { + debug end_or_len => _13; + } + scope 14 (inlined invalid::) { + debug addr => _3; + scope 15 { } } - } - scope 9 (inlined invalid::) { - debug addr => _8; - scope 10 { + scope 16 (inlined NonNull::::as_ptr) { + debug self => _9; + } + scope 17 (inlined std::ptr::mut_ptr::::add) { + debug self => _11; + debug count => _3; + scope 18 { + } } } - scope 11 (inlined std::ptr::const_ptr::::add) { - debug self => _4; - debug count => _6; - scope 12 { + } + scope 9 (inlined as From<&[T]>>::from) { + debug reference => _1; + let mut _4: *const [T]; + scope 10 { + } + } + scope 11 (inlined NonNull::<[T]>::cast::) { + debug self => _5; + let mut _6: *mut [T]; + let mut _7: *mut T; + let mut _8: *const T; + scope 12 { + scope 13 (inlined NonNull::<[T]>::as_ptr) { + debug self => _5; } } } } - scope 8 (inlined core::slice::::as_ptr) { - debug self => _1; - let mut _3: *const [T]; - } } } - scope 22 (inlined as Iterator>::rev) { - debug self => _13; - scope 23 (inlined Rev::>::new) { - debug iter => _13; + scope 19 (inlined as Iterator>::rev) { + debug self => _15; + scope 20 (inlined Rev::>::new) { + debug iter => _15; } } - scope 24 (inlined > as IntoIterator>::into_iter) { - debug self => _14; + scope 21 (inlined > as IntoIterator>::into_iter) { + debug self => _16; } bb0: { - StorageLive(_13); - StorageLive(_4); + StorageLive(_15); StorageLive(_3); - _3 = &raw const (*_1); - _4 = move _3 as *const T (PtrToPtr); - StorageDead(_3); - StorageLive(_7); + StorageLive(_9); + StorageLive(_4); + StorageLive(_8); + _3 = Len((*_1)); StorageLive(_5); - _5 = const _; - switchInt(move _5) -> [0: bb1, otherwise: bb2]; + _4 = &raw const (*_1); + _5 = NonNull::<[T]> { pointer: _4 }; + StorageLive(_7); + StorageLive(_6); + _6 = _4 as *mut [T] (PtrToPtr); + _7 = move _6 as *mut T (PtrToPtr); + _8 = move _7 as *const T (PointerCoercion(MutToConstPointer)); + StorageDead(_6); + StorageDead(_7); + _9 = NonNull:: { pointer: _8 }; + StorageDead(_5); + StorageLive(_13); + StorageLive(_10); + _10 = const _; + switchInt(move _10) -> [0: bb1, otherwise: bb2]; } bb1: { - StorageLive(_6); - _6 = Len((*_1)); - _7 = Offset(_4, _6); - StorageDead(_6); + StorageLive(_12); + StorageLive(_11); + _11 = _8 as *mut T (PtrToPtr); + _12 = Offset(_11, _3); + StorageDead(_11); + _13 = move _12 as *const T (PointerCoercion(MutToConstPointer)); + StorageDead(_12); goto -> bb3; } bb2: { - StorageLive(_8); - _8 = Len((*_1)); - _7 = _8 as *const T (Transmute); - StorageDead(_8); + _13 = _3 as *const T (Transmute); goto -> bb3; } bb3: { - StorageDead(_5); - StorageLive(_11); - StorageLive(_9); - _9 = _4 as *mut T (PtrToPtr); - StorageLive(_10); - StorageLive(_24); - StorageLive(_25); - _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); - _11 = NonNull:: { pointer: _10 }; - StorageDead(_25); - StorageDead(_24); StorageDead(_10); - StorageDead(_9); - StorageLive(_12); - _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; - StorageDead(_12); - StorageDead(_11); - StorageDead(_7); - StorageDead(_4); - _14 = Rev::> { iter: _13 }; + StorageLive(_14); + _14 = _13; + _15 = std::slice::Iter::<'_, T> { ptr: _9, end_or_len: move _14, _marker: const ZeroSized: PhantomData<&T> }; + StorageDead(_14); StorageDead(_13); - StorageLive(_15); - _15 = _14; + StorageDead(_8); + StorageDead(_4); + StorageDead(_9); + StorageDead(_3); + _16 = Rev::> { iter: _15 }; + StorageDead(_15); + StorageLive(_17); + _17 = _16; goto -> bb4; } bb4: { - StorageLive(_18); - _16 = &mut _15; - StorageLive(_17); - _17 = &mut (_15.0: std::slice::Iter<'_, T>); - _18 = as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind unreachable]; + StorageLive(_20); + _18 = &mut _17; + StorageLive(_19); + _19 = &mut (_17.0: std::slice::Iter<'_, T>); + _20 = as DoubleEndedIterator>::next_back(move _19) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_17); - _19 = discriminant(_18); - switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_19); + _21 = discriminant(_20); + switchInt(move _21) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { - StorageDead(_18); - StorageDead(_15); + StorageDead(_20); + StorageDead(_17); drop(_2) -> [return: bb7, unwind unreachable]; } @@ -180,18 +174,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb8: { - _20 = ((_18 as Some).0: &T); - StorageLive(_21); - _21 = &_2; - StorageLive(_22); - _22 = (_20,); - _23 = >::call(move _21, move _22) -> [return: bb9, unwind unreachable]; + _22 = ((_20 as Some).0: &T); + StorageLive(_23); + _23 = &_2; + StorageLive(_24); + _24 = (_22,); + _25 = >::call(move _23, move _24) -> [return: bb9, unwind unreachable]; } bb9: { - StorageDead(_22); - StorageDead(_21); - StorageDead(_18); + StorageDead(_24); + StorageDead(_23); + StorageDead(_20); goto -> bb4; } 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 65f423ac326be..2237fd7dbd12c 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 @@ -4,174 +4,168 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { debug slice => _1; debug f => _2; let mut _0: (); - let mut _13: std::slice::Iter<'_, T>; - let mut _14: std::iter::Rev>; - let mut _15: std::iter::Rev>; - let mut _16: &mut std::iter::Rev>; - let mut _18: std::option::Option<&T>; - let mut _19: isize; - let mut _21: &impl Fn(&T); - let mut _22: (&T,); - let _23: (); + let mut _15: std::slice::Iter<'_, T>; + let mut _16: std::iter::Rev>; + let mut _17: std::iter::Rev>; + let mut _18: &mut std::iter::Rev>; + let mut _20: std::option::Option<&T>; + let mut _21: isize; + let mut _23: &impl Fn(&T); + let mut _24: (&T,); + let _25: (); scope 1 { - debug iter => _15; - let _20: &T; + debug iter => _17; + let _22: &T; scope 2 { - debug x => _20; + debug x => _22; } - scope 25 (inlined > as Iterator>::next) { - debug self => _16; - let mut _17: &mut std::slice::Iter<'_, T>; + scope 22 (inlined > as Iterator>::next) { + debug self => _18; + let mut _19: &mut std::slice::Iter<'_, T>; } } scope 3 (inlined core::slice::::iter) { debug self => _1; scope 4 (inlined std::slice::Iter::<'_, T>::new) { debug slice => _1; - let _4: *const T; - let mut _5: bool; - let mut _6: usize; - let mut _8: usize; - let mut _9: *mut T; - let mut _11: std::ptr::NonNull; - let mut _12: *const T; + let _3: usize; + let mut _5: std::ptr::NonNull<[T]>; + let mut _10: bool; + let mut _11: *mut T; + let mut _12: *mut T; + let mut _14: *const T; scope 5 { - debug ptr => _4; + debug len => _3; + let _9: std::ptr::NonNull; scope 6 { - let _7: *const T; + debug ptr => _9; scope 7 { - debug end_or_len => _7; - scope 13 (inlined NonNull::::new_unchecked) { - debug ptr => _9; - let mut _10: *const T; - let mut _24: *mut T; - scope 14 { - scope 15 (inlined NonNull::::new_unchecked::runtime::) { - debug ptr => _24; - scope 16 (inlined std::ptr::mut_ptr::::is_null) { - debug self => _24; - let mut _25: *mut u8; - scope 17 { - scope 18 (inlined std::ptr::mut_ptr::::is_null::runtime_impl) { - debug ptr => _25; - scope 19 (inlined std::ptr::mut_ptr::::addr) { - debug self => _25; - scope 20 { - scope 21 (inlined std::ptr::mut_ptr::::cast::<()>) { - debug self => _25; - } - } - } - } - } - } - } + let _13: *const T; + scope 8 { + debug end_or_len => _13; + } + scope 14 (inlined invalid::) { + debug addr => _3; + scope 15 { } } - } - scope 9 (inlined invalid::) { - debug addr => _8; - scope 10 { + scope 16 (inlined NonNull::::as_ptr) { + debug self => _9; + } + scope 17 (inlined std::ptr::mut_ptr::::add) { + debug self => _11; + debug count => _3; + scope 18 { + } } } - scope 11 (inlined std::ptr::const_ptr::::add) { - debug self => _4; - debug count => _6; - scope 12 { + } + scope 9 (inlined as From<&[T]>>::from) { + debug reference => _1; + let mut _4: *const [T]; + scope 10 { + } + } + scope 11 (inlined NonNull::<[T]>::cast::) { + debug self => _5; + let mut _6: *mut [T]; + let mut _7: *mut T; + let mut _8: *const T; + scope 12 { + scope 13 (inlined NonNull::<[T]>::as_ptr) { + debug self => _5; } } } } - scope 8 (inlined core::slice::::as_ptr) { - debug self => _1; - let mut _3: *const [T]; - } } } - scope 22 (inlined as Iterator>::rev) { - debug self => _13; - scope 23 (inlined Rev::>::new) { - debug iter => _13; + scope 19 (inlined as Iterator>::rev) { + debug self => _15; + scope 20 (inlined Rev::>::new) { + debug iter => _15; } } - scope 24 (inlined > as IntoIterator>::into_iter) { - debug self => _14; + scope 21 (inlined > as IntoIterator>::into_iter) { + debug self => _16; } bb0: { - StorageLive(_13); - StorageLive(_4); + StorageLive(_15); StorageLive(_3); - _3 = &raw const (*_1); - _4 = move _3 as *const T (PtrToPtr); - StorageDead(_3); - StorageLive(_7); + StorageLive(_9); + StorageLive(_4); + StorageLive(_8); + _3 = Len((*_1)); StorageLive(_5); - _5 = const _; - switchInt(move _5) -> [0: bb1, otherwise: bb2]; + _4 = &raw const (*_1); + _5 = NonNull::<[T]> { pointer: _4 }; + StorageLive(_7); + StorageLive(_6); + _6 = _4 as *mut [T] (PtrToPtr); + _7 = move _6 as *mut T (PtrToPtr); + _8 = move _7 as *const T (PointerCoercion(MutToConstPointer)); + StorageDead(_6); + StorageDead(_7); + _9 = NonNull:: { pointer: _8 }; + StorageDead(_5); + StorageLive(_13); + StorageLive(_10); + _10 = const _; + switchInt(move _10) -> [0: bb1, otherwise: bb2]; } bb1: { - StorageLive(_6); - _6 = Len((*_1)); - _7 = Offset(_4, _6); - StorageDead(_6); + StorageLive(_12); + StorageLive(_11); + _11 = _8 as *mut T (PtrToPtr); + _12 = Offset(_11, _3); + StorageDead(_11); + _13 = move _12 as *const T (PointerCoercion(MutToConstPointer)); + StorageDead(_12); goto -> bb3; } bb2: { - StorageLive(_8); - _8 = Len((*_1)); - _7 = _8 as *const T (Transmute); - StorageDead(_8); + _13 = _3 as *const T (Transmute); goto -> bb3; } bb3: { - StorageDead(_5); - StorageLive(_11); - StorageLive(_9); - _9 = _4 as *mut T (PtrToPtr); - StorageLive(_10); - StorageLive(_24); - StorageLive(_25); - _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); - _11 = NonNull:: { pointer: _10 }; - StorageDead(_25); - StorageDead(_24); StorageDead(_10); - StorageDead(_9); - StorageLive(_12); - _12 = _7; - _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> }; - StorageDead(_12); - StorageDead(_11); - StorageDead(_7); - StorageDead(_4); - _14 = Rev::> { iter: _13 }; + StorageLive(_14); + _14 = _13; + _15 = std::slice::Iter::<'_, T> { ptr: _9, end_or_len: move _14, _marker: const ZeroSized: PhantomData<&T> }; + StorageDead(_14); StorageDead(_13); - StorageLive(_15); - _15 = _14; + StorageDead(_8); + StorageDead(_4); + StorageDead(_9); + StorageDead(_3); + _16 = Rev::> { iter: _15 }; + StorageDead(_15); + StorageLive(_17); + _17 = _16; goto -> bb4; } bb4: { - StorageLive(_18); - _16 = &mut _15; - StorageLive(_17); - _17 = &mut (_15.0: std::slice::Iter<'_, T>); - _18 = as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind: bb11]; + StorageLive(_20); + _18 = &mut _17; + StorageLive(_19); + _19 = &mut (_17.0: std::slice::Iter<'_, T>); + _20 = as DoubleEndedIterator>::next_back(move _19) -> [return: bb5, unwind: bb11]; } bb5: { - StorageDead(_17); - _19 = discriminant(_18); - switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_19); + _21 = discriminant(_20); + switchInt(move _21) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { - StorageDead(_18); - StorageDead(_15); + StorageDead(_20); + StorageDead(_17); drop(_2) -> [return: bb7, unwind continue]; } @@ -180,18 +174,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb8: { - _20 = ((_18 as Some).0: &T); - StorageLive(_21); - _21 = &_2; - StorageLive(_22); - _22 = (_20,); - _23 = >::call(move _21, move _22) -> [return: bb9, unwind: bb11]; + _22 = ((_20 as Some).0: &T); + StorageLive(_23); + _23 = &_2; + StorageLive(_24); + _24 = (_22,); + _25 = >::call(move _23, move _24) -> [return: bb9, unwind: bb11]; } bb9: { - StorageDead(_22); - StorageDead(_21); - StorageDead(_18); + StorageDead(_24); + StorageDead(_23); + StorageDead(_20); goto -> bb4; } diff --git a/tests/ui/hygiene/panic-location.run.stderr b/tests/ui/hygiene/panic-location.run.stderr index 5824ef31211be..5c552411da7f3 100644 --- a/tests/ui/hygiene/panic-location.run.stderr +++ b/tests/ui/hygiene/panic-location.run.stderr @@ -1,3 +1,3 @@ -thread 'main' panicked at library/alloc/src/raw_vec.rs:570:5: +thread 'main' panicked at library/alloc/src/raw_vec.rs:571:5: capacity overflow note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace