Fold consecutive PtrToPtr casts.

This commit is contained in:
Camille GILLOT 2023-10-11 19:39:18 +00:00
parent f4cfd87202
commit 1f544ca0cc
13 changed files with 507 additions and 509 deletions

View File

@ -93,7 +93,6 @@ use rustc_index::IndexVec;
use rustc_middle::mir::interpret::GlobalAlloc;
use rustc_middle::mir::visit::*;
use rustc_middle::mir::*;
use rustc_middle::ty::adjustment::PointerCoercion;
use rustc_middle::ty::layout::LayoutOf;
use rustc_middle::ty::{self, Ty, TyCtxt, TypeAndMut};
use rustc_span::def_id::DefId;
@ -778,18 +777,8 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
// Operations.
Rvalue::Len(ref mut place) => return self.simplify_len(place, location),
Rvalue::Cast(kind, ref mut value, to) => {
let from = value.ty(self.local_decls, self.tcx);
let value = self.simplify_operand(value, location)?;
if let CastKind::PointerCoercion(
PointerCoercion::ReifyFnPointer | PointerCoercion::ClosureFnPointer(_),
) = kind
{
// Each reification of a generic fn may get a different pointer.
// Do not try to merge them.
return self.new_opaque();
}
Value::Cast { kind, value, from, to }
Rvalue::Cast(ref mut kind, ref mut value, to) => {
return self.simplify_cast(kind, value, to, location);
}
Rvalue::BinaryOp(op, box (ref mut lhs, ref mut rhs)) => {
let ty = lhs.ty(self.local_decls, self.tcx);
@ -1035,6 +1024,47 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
}
}
fn simplify_cast(
&mut self,
kind: &mut CastKind,
operand: &mut Operand<'tcx>,
to: Ty<'tcx>,
location: Location,
) -> Option<VnIndex> {
use rustc_middle::ty::adjustment::PointerCoercion::*;
use CastKind::*;
let mut from = operand.ty(self.local_decls, self.tcx);
let mut value = self.simplify_operand(operand, location)?;
if let CastKind::PointerCoercion(ReifyFnPointer | ClosureFnPointer(_)) = kind {
// Each reification of a generic fn may get a different pointer.
// Do not try to merge them.
return self.new_opaque();
}
if let PtrToPtr | PointerCoercion(MutToConstPointer) = kind
&& let Value::Cast { kind: inner_kind, value: inner_value, from: inner_from, to: _ } =
*self.get(value)
&& let PtrToPtr | PointerCoercion(MutToConstPointer) = inner_kind
{
from = inner_from;
value = inner_value;
*kind = PtrToPtr;
if inner_from == to {
return Some(inner_value);
}
if let Some(const_) = self.try_as_constant(value) {
*operand = Operand::Constant(Box::new(const_));
} else if let Some(local) = self.try_as_local(value, location) {
*operand = Operand::Copy(local.into());
self.reused_locals.insert(local);
}
}
Some(self.insert(Value::Cast { kind: *kind, value, from, to }))
}
fn simplify_len(&mut self, place: &mut Place<'tcx>, location: Location) -> Option<VnIndex> {
// Trivial case: we are fetching a statically known length.
let place_ty = place.ty(self.local_decls, self.tcx).ty;

View File

@ -111,12 +111,16 @@
StorageDead(_15);
StorageDead(_12);
StorageDead(_6);
StorageLive(_18);
- StorageLive(_18);
+ nop;
_18 = (_5.0: *const [u8]);
_4 = move _18 as *mut [u8] (PtrToPtr);
StorageDead(_18);
- _4 = move _18 as *mut [u8] (PtrToPtr);
- StorageDead(_18);
+ _4 = _18 as *mut [u8] (PtrToPtr);
+ nop;
StorageDead(_5);
_3 = move _4 as *mut u8 (PtrToPtr);
- _3 = move _4 as *mut u8 (PtrToPtr);
+ _3 = _18 as *mut u8 (PtrToPtr);
StorageDead(_4);
StorageDead(_3);
- StorageDead(_1);

View File

@ -50,12 +50,16 @@
bb1: {
StorageDead(_6);
StorageLive(_12);
- StorageLive(_12);
+ nop;
_12 = (_5.0: *const [u8]);
_4 = move _12 as *mut [u8] (PtrToPtr);
StorageDead(_12);
- _4 = move _12 as *mut [u8] (PtrToPtr);
- StorageDead(_12);
+ _4 = _12 as *mut [u8] (PtrToPtr);
+ nop;
StorageDead(_5);
_3 = move _4 as *mut u8 (PtrToPtr);
- _3 = move _4 as *mut u8 (PtrToPtr);
+ _3 = _12 as *mut u8 (PtrToPtr);
StorageDead(_4);
StorageDead(_3);
- StorageDead(_1);

View File

@ -111,12 +111,16 @@
StorageDead(_15);
StorageDead(_12);
StorageDead(_6);
StorageLive(_18);
- StorageLive(_18);
+ nop;
_18 = (_5.0: *const [u8]);
_4 = move _18 as *mut [u8] (PtrToPtr);
StorageDead(_18);
- _4 = move _18 as *mut [u8] (PtrToPtr);
- StorageDead(_18);
+ _4 = _18 as *mut [u8] (PtrToPtr);
+ nop;
StorageDead(_5);
_3 = move _4 as *mut u8 (PtrToPtr);
- _3 = move _4 as *mut u8 (PtrToPtr);
+ _3 = _18 as *mut u8 (PtrToPtr);
StorageDead(_4);
StorageDead(_3);
- StorageDead(_1);

View File

@ -50,12 +50,16 @@
bb1: {
StorageDead(_6);
StorageLive(_12);
- StorageLive(_12);
+ nop;
_12 = (_5.0: *const [u8]);
_4 = move _12 as *mut [u8] (PtrToPtr);
StorageDead(_12);
- _4 = move _12 as *mut [u8] (PtrToPtr);
- StorageDead(_12);
+ _4 = _12 as *mut [u8] (PtrToPtr);
+ nop;
StorageDead(_5);
_3 = move _4 as *mut u8 (PtrToPtr);
- _3 = move _4 as *mut u8 (PtrToPtr);
+ _3 = _12 as *mut u8 (PtrToPtr);
StorageDead(_4);
StorageDead(_3);
- StorageDead(_1);

View File

@ -89,7 +89,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
StorageLive(_12);
StorageLive(_11);
StorageLive(_10);
_10 = _9 as *const () (PointerCoercion(MutToConstPointer));
_10 = _8 as *const () (PtrToPtr);
_11 = std::ptr::metadata::PtrComponents::<[u32]> { data_pointer: move _10, metadata: _6 };
StorageDead(_10);
_12 = std::ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _11 };

View File

@ -89,7 +89,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
StorageLive(_12);
StorageLive(_11);
StorageLive(_10);
_10 = _9 as *const () (PointerCoercion(MutToConstPointer));
_10 = _8 as *const () (PtrToPtr);
_11 = std::ptr::metadata::PtrComponents::<[u32]> { data_pointer: move _10, metadata: _6 };
StorageDead(_10);
_12 = std::ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _11 };

View File

@ -4,22 +4,22 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
debug slice => _1;
debug f => _2;
let mut _0: ();
let mut _15: std::slice::Iter<'_, T>;
let mut _16: std::iter::Enumerate<std::slice::Iter<'_, T>>;
let mut _17: std::iter::Enumerate<std::slice::Iter<'_, T>>;
let mut _18: &mut std::iter::Enumerate<std::slice::Iter<'_, T>>;
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: ();
let mut _13: std::slice::Iter<'_, T>;
let mut _14: std::iter::Enumerate<std::slice::Iter<'_, T>>;
let mut _15: std::iter::Enumerate<std::slice::Iter<'_, T>>;
let mut _16: &mut std::iter::Enumerate<std::slice::Iter<'_, T>>;
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: ();
scope 1 {
debug iter => _17;
let _21: usize;
let _22: &T;
debug iter => _15;
let _19: usize;
let _20: &T;
scope 2 {
debug i => _21;
debug x => _22;
debug i => _19;
debug x => _20;
}
}
scope 3 (inlined core::slice::<impl [T]>::iter) {
@ -28,19 +28,19 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
debug slice => _1;
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;
let mut _8: bool;
let mut _9: *mut T;
let mut _10: *mut T;
let mut _12: *const T;
scope 5 {
debug len => _3;
let _9: std::ptr::NonNull<T>;
let _7: std::ptr::NonNull<T>;
scope 6 {
debug ptr => _9;
debug ptr => _7;
scope 7 {
let _13: *const T;
let _11: *const T;
scope 8 {
debug end_or_len => _13;
debug end_or_len => _11;
}
scope 14 (inlined invalid::<T>) {
debug addr => _3;
@ -48,10 +48,10 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
}
scope 16 (inlined NonNull::<T>::as_ptr) {
debug self => _9;
debug self => _7;
}
scope 17 (inlined std::ptr::mut_ptr::<impl *mut T>::add) {
debug self => _11;
debug self => _9;
debug count => _3;
scope 18 {
}
@ -66,9 +66,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
scope 11 (inlined NonNull::<[T]>::cast::<T>) {
debug self => _5;
let mut _6: *mut [T];
let mut _7: *mut T;
let mut _8: *const T;
let mut _6: *const T;
scope 12 {
scope 13 (inlined NonNull::<[T]>::as_ptr) {
debug self => _5;
@ -79,90 +77,84 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
}
scope 19 (inlined <std::slice::Iter<'_, T> as Iterator>::enumerate) {
debug self => _15;
debug self => _13;
scope 20 (inlined Enumerate::<std::slice::Iter<'_, T>>::new) {
debug iter => _15;
debug iter => _13;
}
}
scope 21 (inlined <Enumerate<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) {
debug self => _16;
debug self => _14;
}
bb0: {
StorageLive(_15);
StorageLive(_13);
StorageLive(_3);
StorageLive(_9);
StorageLive(_7);
StorageLive(_4);
StorageLive(_8);
StorageLive(_6);
_3 = Len((*_1));
StorageLive(_5);
_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::<T> { pointer: _8 };
_6 = _4 as *const T (PtrToPtr);
_7 = NonNull::<T> { pointer: _6 };
StorageDead(_5);
StorageLive(_13);
StorageLive(_10);
_10 = const _;
switchInt(move _10) -> [0: bb1, otherwise: bb2];
StorageLive(_11);
StorageLive(_8);
_8 = const _;
switchInt(move _8) -> [0: bb1, otherwise: bb2];
}
bb1: {
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);
StorageLive(_10);
StorageLive(_9);
_9 = _4 as *mut T (PtrToPtr);
_10 = Offset(_9, _3);
StorageDead(_9);
_11 = move _10 as *const T (PointerCoercion(MutToConstPointer));
StorageDead(_10);
goto -> bb3;
}
bb2: {
_13 = _3 as *const T (Transmute);
_11 = _3 as *const T (Transmute);
goto -> bb3;
}
bb3: {
StorageDead(_10);
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);
StorageLive(_12);
_12 = _11;
_13 = std::slice::Iter::<'_, T> { ptr: _7, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
StorageDead(_12);
StorageDead(_11);
StorageDead(_6);
StorageDead(_4);
StorageDead(_9);
StorageDead(_7);
StorageDead(_3);
_16 = Enumerate::<std::slice::Iter<'_, T>> { iter: _15, count: const 0_usize };
StorageDead(_15);
StorageLive(_17);
_17 = _16;
_14 = Enumerate::<std::slice::Iter<'_, T>> { iter: _13, count: const 0_usize };
StorageDead(_13);
StorageLive(_15);
_15 = _14;
goto -> bb4;
}
bb4: {
StorageLive(_19);
StorageLive(_18);
_18 = &mut _17;
_19 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(move _18) -> [return: bb5, unwind unreachable];
StorageLive(_17);
StorageLive(_16);
_16 = &mut _15;
_17 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(move _16) -> [return: bb5, unwind unreachable];
}
bb5: {
StorageDead(_18);
_20 = discriminant(_19);
switchInt(move _20) -> [0: bb6, 1: bb8, otherwise: bb10];
StorageDead(_16);
_18 = discriminant(_17);
switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
StorageDead(_19);
StorageDead(_17);
StorageDead(_15);
drop(_2) -> [return: bb7, unwind unreachable];
}
@ -171,19 +163,19 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb8: {
_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 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _23, move _24) -> [return: bb9, unwind unreachable];
_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 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _21, move _22) -> [return: bb9, unwind unreachable];
}
bb9: {
StorageDead(_24);
StorageDead(_23);
StorageDead(_19);
StorageDead(_22);
StorageDead(_21);
StorageDead(_17);
goto -> bb4;
}

View File

@ -4,22 +4,22 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
debug slice => _1;
debug f => _2;
let mut _0: ();
let mut _15: std::slice::Iter<'_, T>;
let mut _16: std::iter::Enumerate<std::slice::Iter<'_, T>>;
let mut _17: std::iter::Enumerate<std::slice::Iter<'_, T>>;
let mut _18: &mut std::iter::Enumerate<std::slice::Iter<'_, T>>;
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: ();
let mut _13: std::slice::Iter<'_, T>;
let mut _14: std::iter::Enumerate<std::slice::Iter<'_, T>>;
let mut _15: std::iter::Enumerate<std::slice::Iter<'_, T>>;
let mut _16: &mut std::iter::Enumerate<std::slice::Iter<'_, T>>;
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: ();
scope 1 {
debug iter => _17;
let _21: usize;
let _22: &T;
debug iter => _15;
let _19: usize;
let _20: &T;
scope 2 {
debug i => _21;
debug x => _22;
debug i => _19;
debug x => _20;
}
}
scope 3 (inlined core::slice::<impl [T]>::iter) {
@ -28,19 +28,19 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
debug slice => _1;
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;
let mut _8: bool;
let mut _9: *mut T;
let mut _10: *mut T;
let mut _12: *const T;
scope 5 {
debug len => _3;
let _9: std::ptr::NonNull<T>;
let _7: std::ptr::NonNull<T>;
scope 6 {
debug ptr => _9;
debug ptr => _7;
scope 7 {
let _13: *const T;
let _11: *const T;
scope 8 {
debug end_or_len => _13;
debug end_or_len => _11;
}
scope 14 (inlined invalid::<T>) {
debug addr => _3;
@ -48,10 +48,10 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
}
scope 16 (inlined NonNull::<T>::as_ptr) {
debug self => _9;
debug self => _7;
}
scope 17 (inlined std::ptr::mut_ptr::<impl *mut T>::add) {
debug self => _11;
debug self => _9;
debug count => _3;
scope 18 {
}
@ -66,9 +66,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
scope 11 (inlined NonNull::<[T]>::cast::<T>) {
debug self => _5;
let mut _6: *mut [T];
let mut _7: *mut T;
let mut _8: *const T;
let mut _6: *const T;
scope 12 {
scope 13 (inlined NonNull::<[T]>::as_ptr) {
debug self => _5;
@ -79,90 +77,84 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
}
scope 19 (inlined <std::slice::Iter<'_, T> as Iterator>::enumerate) {
debug self => _15;
debug self => _13;
scope 20 (inlined Enumerate::<std::slice::Iter<'_, T>>::new) {
debug iter => _15;
debug iter => _13;
}
}
scope 21 (inlined <Enumerate<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) {
debug self => _16;
debug self => _14;
}
bb0: {
StorageLive(_15);
StorageLive(_13);
StorageLive(_3);
StorageLive(_9);
StorageLive(_7);
StorageLive(_4);
StorageLive(_8);
StorageLive(_6);
_3 = Len((*_1));
StorageLive(_5);
_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::<T> { pointer: _8 };
_6 = _4 as *const T (PtrToPtr);
_7 = NonNull::<T> { pointer: _6 };
StorageDead(_5);
StorageLive(_13);
StorageLive(_10);
_10 = const _;
switchInt(move _10) -> [0: bb1, otherwise: bb2];
StorageLive(_11);
StorageLive(_8);
_8 = const _;
switchInt(move _8) -> [0: bb1, otherwise: bb2];
}
bb1: {
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);
StorageLive(_10);
StorageLive(_9);
_9 = _4 as *mut T (PtrToPtr);
_10 = Offset(_9, _3);
StorageDead(_9);
_11 = move _10 as *const T (PointerCoercion(MutToConstPointer));
StorageDead(_10);
goto -> bb3;
}
bb2: {
_13 = _3 as *const T (Transmute);
_11 = _3 as *const T (Transmute);
goto -> bb3;
}
bb3: {
StorageDead(_10);
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);
StorageLive(_12);
_12 = _11;
_13 = std::slice::Iter::<'_, T> { ptr: _7, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
StorageDead(_12);
StorageDead(_11);
StorageDead(_6);
StorageDead(_4);
StorageDead(_9);
StorageDead(_7);
StorageDead(_3);
_16 = Enumerate::<std::slice::Iter<'_, T>> { iter: _15, count: const 0_usize };
StorageDead(_15);
StorageLive(_17);
_17 = _16;
_14 = Enumerate::<std::slice::Iter<'_, T>> { iter: _13, count: const 0_usize };
StorageDead(_13);
StorageLive(_15);
_15 = _14;
goto -> bb4;
}
bb4: {
StorageLive(_19);
StorageLive(_18);
_18 = &mut _17;
_19 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(move _18) -> [return: bb5, unwind: bb11];
StorageLive(_17);
StorageLive(_16);
_16 = &mut _15;
_17 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(move _16) -> [return: bb5, unwind: bb11];
}
bb5: {
StorageDead(_18);
_20 = discriminant(_19);
switchInt(move _20) -> [0: bb6, 1: bb8, otherwise: bb10];
StorageDead(_16);
_18 = discriminant(_17);
switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
StorageDead(_19);
StorageDead(_17);
StorageDead(_15);
drop(_2) -> [return: bb7, unwind continue];
}
@ -171,19 +163,19 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb8: {
_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 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _23, move _24) -> [return: bb9, unwind: bb11];
_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 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _21, move _22) -> [return: bb9, unwind: bb11];
}
bb9: {
StorageDead(_24);
StorageDead(_23);
StorageDead(_19);
StorageDead(_22);
StorageDead(_21);
StorageDead(_17);
goto -> bb4;
}

View File

@ -4,19 +4,19 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
debug slice => _1;
debug f => _2;
let mut _0: ();
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: ();
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: ();
scope 1 {
debug iter => _16;
let _20: &T;
debug iter => _14;
let _18: &T;
scope 2 {
debug x => _20;
debug x => _18;
}
}
scope 3 (inlined core::slice::<impl [T]>::iter) {
@ -25,19 +25,19 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
debug slice => _1;
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;
let mut _8: bool;
let mut _9: *mut T;
let mut _10: *mut T;
let mut _12: *const T;
scope 5 {
debug len => _3;
let _9: std::ptr::NonNull<T>;
let _7: std::ptr::NonNull<T>;
scope 6 {
debug ptr => _9;
debug ptr => _7;
scope 7 {
let _13: *const T;
let _11: *const T;
scope 8 {
debug end_or_len => _13;
debug end_or_len => _11;
}
scope 14 (inlined invalid::<T>) {
debug addr => _3;
@ -45,10 +45,10 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
}
scope 16 (inlined NonNull::<T>::as_ptr) {
debug self => _9;
debug self => _7;
}
scope 17 (inlined std::ptr::mut_ptr::<impl *mut T>::add) {
debug self => _11;
debug self => _9;
debug count => _3;
scope 18 {
}
@ -63,9 +63,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
scope 11 (inlined NonNull::<[T]>::cast::<T>) {
debug self => _5;
let mut _6: *mut [T];
let mut _7: *mut T;
let mut _8: *const T;
let mut _6: *const T;
scope 12 {
scope 13 (inlined NonNull::<[T]>::as_ptr) {
debug self => _5;
@ -76,81 +74,75 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
}
scope 19 (inlined <std::slice::Iter<'_, T> as IntoIterator>::into_iter) {
debug self => _15;
debug self => _13;
}
bb0: {
StorageLive(_3);
StorageLive(_9);
StorageLive(_7);
StorageLive(_4);
StorageLive(_8);
StorageLive(_6);
_3 = Len((*_1));
StorageLive(_5);
_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::<T> { pointer: _8 };
_6 = _4 as *const T (PtrToPtr);
_7 = NonNull::<T> { pointer: _6 };
StorageDead(_5);
StorageLive(_13);
StorageLive(_10);
_10 = const _;
switchInt(move _10) -> [0: bb1, otherwise: bb2];
StorageLive(_11);
StorageLive(_8);
_8 = const _;
switchInt(move _8) -> [0: bb1, otherwise: bb2];
}
bb1: {
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);
StorageLive(_10);
StorageLive(_9);
_9 = _4 as *mut T (PtrToPtr);
_10 = Offset(_9, _3);
StorageDead(_9);
_11 = move _10 as *const T (PointerCoercion(MutToConstPointer));
StorageDead(_10);
goto -> bb3;
}
bb2: {
_13 = _3 as *const T (Transmute);
_11 = _3 as *const T (Transmute);
goto -> bb3;
}
bb3: {
StorageDead(_10);
StorageDead(_8);
StorageLive(_12);
_12 = _11;
_13 = std::slice::Iter::<'_, T> { ptr: _7, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
StorageDead(_12);
StorageDead(_11);
StorageDead(_6);
StorageDead(_4);
StorageDead(_7);
StorageDead(_3);
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(_18);
StorageLive(_17);
_17 = &mut _16;
_18 = <std::slice::Iter<'_, T> as Iterator>::next(move _17) -> [return: bb5, unwind unreachable];
StorageLive(_16);
StorageLive(_15);
_15 = &mut _14;
_16 = <std::slice::Iter<'_, T> as Iterator>::next(move _15) -> [return: bb5, unwind unreachable];
}
bb5: {
StorageDead(_17);
_19 = discriminant(_18);
switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10];
StorageDead(_15);
_17 = discriminant(_16);
switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
StorageDead(_18);
StorageDead(_16);
StorageDead(_14);
drop(_2) -> [return: bb7, unwind unreachable];
}
@ -159,18 +151,18 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb8: {
_20 = ((_18 as Some).0: &T);
StorageLive(_21);
_21 = &_2;
StorageLive(_22);
_22 = (_20,);
_23 = <impl Fn(&T) as Fn<(&T,)>>::call(move _21, move _22) -> [return: bb9, unwind unreachable];
_18 = ((_16 as Some).0: &T);
StorageLive(_19);
_19 = &_2;
StorageLive(_20);
_20 = (_18,);
_21 = <impl Fn(&T) as Fn<(&T,)>>::call(move _19, move _20) -> [return: bb9, unwind unreachable];
}
bb9: {
StorageDead(_22);
StorageDead(_21);
StorageDead(_18);
StorageDead(_20);
StorageDead(_19);
StorageDead(_16);
goto -> bb4;
}

View File

@ -4,19 +4,19 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
debug slice => _1;
debug f => _2;
let mut _0: ();
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: ();
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: ();
scope 1 {
debug iter => _16;
let _20: &T;
debug iter => _14;
let _18: &T;
scope 2 {
debug x => _20;
debug x => _18;
}
}
scope 3 (inlined core::slice::<impl [T]>::iter) {
@ -25,19 +25,19 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
debug slice => _1;
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;
let mut _8: bool;
let mut _9: *mut T;
let mut _10: *mut T;
let mut _12: *const T;
scope 5 {
debug len => _3;
let _9: std::ptr::NonNull<T>;
let _7: std::ptr::NonNull<T>;
scope 6 {
debug ptr => _9;
debug ptr => _7;
scope 7 {
let _13: *const T;
let _11: *const T;
scope 8 {
debug end_or_len => _13;
debug end_or_len => _11;
}
scope 14 (inlined invalid::<T>) {
debug addr => _3;
@ -45,10 +45,10 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
}
scope 16 (inlined NonNull::<T>::as_ptr) {
debug self => _9;
debug self => _7;
}
scope 17 (inlined std::ptr::mut_ptr::<impl *mut T>::add) {
debug self => _11;
debug self => _9;
debug count => _3;
scope 18 {
}
@ -63,9 +63,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
scope 11 (inlined NonNull::<[T]>::cast::<T>) {
debug self => _5;
let mut _6: *mut [T];
let mut _7: *mut T;
let mut _8: *const T;
let mut _6: *const T;
scope 12 {
scope 13 (inlined NonNull::<[T]>::as_ptr) {
debug self => _5;
@ -76,81 +74,75 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
}
scope 19 (inlined <std::slice::Iter<'_, T> as IntoIterator>::into_iter) {
debug self => _15;
debug self => _13;
}
bb0: {
StorageLive(_3);
StorageLive(_9);
StorageLive(_7);
StorageLive(_4);
StorageLive(_8);
StorageLive(_6);
_3 = Len((*_1));
StorageLive(_5);
_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::<T> { pointer: _8 };
_6 = _4 as *const T (PtrToPtr);
_7 = NonNull::<T> { pointer: _6 };
StorageDead(_5);
StorageLive(_13);
StorageLive(_10);
_10 = const _;
switchInt(move _10) -> [0: bb1, otherwise: bb2];
StorageLive(_11);
StorageLive(_8);
_8 = const _;
switchInt(move _8) -> [0: bb1, otherwise: bb2];
}
bb1: {
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);
StorageLive(_10);
StorageLive(_9);
_9 = _4 as *mut T (PtrToPtr);
_10 = Offset(_9, _3);
StorageDead(_9);
_11 = move _10 as *const T (PointerCoercion(MutToConstPointer));
StorageDead(_10);
goto -> bb3;
}
bb2: {
_13 = _3 as *const T (Transmute);
_11 = _3 as *const T (Transmute);
goto -> bb3;
}
bb3: {
StorageDead(_10);
StorageDead(_8);
StorageLive(_12);
_12 = _11;
_13 = std::slice::Iter::<'_, T> { ptr: _7, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
StorageDead(_12);
StorageDead(_11);
StorageDead(_6);
StorageDead(_4);
StorageDead(_7);
StorageDead(_3);
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(_18);
StorageLive(_17);
_17 = &mut _16;
_18 = <std::slice::Iter<'_, T> as Iterator>::next(move _17) -> [return: bb5, unwind: bb11];
StorageLive(_16);
StorageLive(_15);
_15 = &mut _14;
_16 = <std::slice::Iter<'_, T> as Iterator>::next(move _15) -> [return: bb5, unwind: bb11];
}
bb5: {
StorageDead(_17);
_19 = discriminant(_18);
switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10];
StorageDead(_15);
_17 = discriminant(_16);
switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
StorageDead(_18);
StorageDead(_16);
StorageDead(_14);
drop(_2) -> [return: bb7, unwind continue];
}
@ -159,18 +151,18 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb8: {
_20 = ((_18 as Some).0: &T);
StorageLive(_21);
_21 = &_2;
StorageLive(_22);
_22 = (_20,);
_23 = <impl Fn(&T) as Fn<(&T,)>>::call(move _21, move _22) -> [return: bb9, unwind: bb11];
_18 = ((_16 as Some).0: &T);
StorageLive(_19);
_19 = &_2;
StorageLive(_20);
_20 = (_18,);
_21 = <impl Fn(&T) as Fn<(&T,)>>::call(move _19, move _20) -> [return: bb9, unwind: bb11];
}
bb9: {
StorageDead(_22);
StorageDead(_21);
StorageDead(_18);
StorageDead(_20);
StorageDead(_19);
StorageDead(_16);
goto -> bb4;
}

View File

@ -4,24 +4,24 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
debug slice => _1;
debug f => _2;
let mut _0: ();
let mut _15: std::slice::Iter<'_, T>;
let mut _16: std::iter::Rev<std::slice::Iter<'_, T>>;
let mut _17: std::iter::Rev<std::slice::Iter<'_, T>>;
let mut _18: &mut std::iter::Rev<std::slice::Iter<'_, T>>;
let mut _20: std::option::Option<&T>;
let mut _21: isize;
let mut _23: &impl Fn(&T);
let mut _24: (&T,);
let _25: ();
let mut _13: std::slice::Iter<'_, T>;
let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>;
let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>;
let mut _16: &mut std::iter::Rev<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 => _17;
let _22: &T;
debug iter => _15;
let _20: &T;
scope 2 {
debug x => _22;
debug x => _20;
}
scope 22 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) {
debug self => _18;
let mut _19: &mut std::slice::Iter<'_, T>;
debug self => _16;
let mut _17: &mut std::slice::Iter<'_, T>;
}
}
scope 3 (inlined core::slice::<impl [T]>::iter) {
@ -30,19 +30,19 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
debug slice => _1;
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;
let mut _8: bool;
let mut _9: *mut T;
let mut _10: *mut T;
let mut _12: *const T;
scope 5 {
debug len => _3;
let _9: std::ptr::NonNull<T>;
let _7: std::ptr::NonNull<T>;
scope 6 {
debug ptr => _9;
debug ptr => _7;
scope 7 {
let _13: *const T;
let _11: *const T;
scope 8 {
debug end_or_len => _13;
debug end_or_len => _11;
}
scope 14 (inlined invalid::<T>) {
debug addr => _3;
@ -50,10 +50,10 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
}
scope 16 (inlined NonNull::<T>::as_ptr) {
debug self => _9;
debug self => _7;
}
scope 17 (inlined std::ptr::mut_ptr::<impl *mut T>::add) {
debug self => _11;
debug self => _9;
debug count => _3;
scope 18 {
}
@ -68,9 +68,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
scope 11 (inlined NonNull::<[T]>::cast::<T>) {
debug self => _5;
let mut _6: *mut [T];
let mut _7: *mut T;
let mut _8: *const T;
let mut _6: *const T;
scope 12 {
scope 13 (inlined NonNull::<[T]>::as_ptr) {
debug self => _5;
@ -81,91 +79,85 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
}
scope 19 (inlined <std::slice::Iter<'_, T> as Iterator>::rev) {
debug self => _15;
debug self => _13;
scope 20 (inlined Rev::<std::slice::Iter<'_, T>>::new) {
debug iter => _15;
debug iter => _13;
}
}
scope 21 (inlined <Rev<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) {
debug self => _16;
debug self => _14;
}
bb0: {
StorageLive(_15);
StorageLive(_13);
StorageLive(_3);
StorageLive(_9);
StorageLive(_7);
StorageLive(_4);
StorageLive(_8);
StorageLive(_6);
_3 = Len((*_1));
StorageLive(_5);
_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::<T> { pointer: _8 };
_6 = _4 as *const T (PtrToPtr);
_7 = NonNull::<T> { pointer: _6 };
StorageDead(_5);
StorageLive(_13);
StorageLive(_10);
_10 = const _;
switchInt(move _10) -> [0: bb1, otherwise: bb2];
StorageLive(_11);
StorageLive(_8);
_8 = const _;
switchInt(move _8) -> [0: bb1, otherwise: bb2];
}
bb1: {
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);
StorageLive(_10);
StorageLive(_9);
_9 = _4 as *mut T (PtrToPtr);
_10 = Offset(_9, _3);
StorageDead(_9);
_11 = move _10 as *const T (PointerCoercion(MutToConstPointer));
StorageDead(_10);
goto -> bb3;
}
bb2: {
_13 = _3 as *const T (Transmute);
_11 = _3 as *const T (Transmute);
goto -> bb3;
}
bb3: {
StorageDead(_10);
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);
StorageLive(_12);
_12 = _11;
_13 = std::slice::Iter::<'_, T> { ptr: _7, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
StorageDead(_12);
StorageDead(_11);
StorageDead(_6);
StorageDead(_4);
StorageDead(_9);
StorageDead(_7);
StorageDead(_3);
_16 = Rev::<std::slice::Iter<'_, T>> { iter: _15 };
StorageDead(_15);
StorageLive(_17);
_17 = _16;
_14 = Rev::<std::slice::Iter<'_, T>> { iter: _13 };
StorageDead(_13);
StorageLive(_15);
_15 = _14;
goto -> bb4;
}
bb4: {
StorageLive(_20);
_18 = &mut _17;
StorageLive(_19);
_19 = &mut (_17.0: std::slice::Iter<'_, T>);
_20 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _19) -> [return: bb5, unwind unreachable];
StorageLive(_18);
_16 = &mut _15;
StorageLive(_17);
_17 = &mut (_15.0: std::slice::Iter<'_, T>);
_18 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind unreachable];
}
bb5: {
StorageDead(_19);
_21 = discriminant(_20);
switchInt(move _21) -> [0: bb6, 1: bb8, otherwise: bb10];
StorageDead(_17);
_19 = discriminant(_18);
switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
StorageDead(_20);
StorageDead(_17);
StorageDead(_18);
StorageDead(_15);
drop(_2) -> [return: bb7, unwind unreachable];
}
@ -174,18 +166,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb8: {
_22 = ((_20 as Some).0: &T);
StorageLive(_23);
_23 = &_2;
StorageLive(_24);
_24 = (_22,);
_25 = <impl Fn(&T) as Fn<(&T,)>>::call(move _23, move _24) -> [return: bb9, unwind unreachable];
_20 = ((_18 as Some).0: &T);
StorageLive(_21);
_21 = &_2;
StorageLive(_22);
_22 = (_20,);
_23 = <impl Fn(&T) as Fn<(&T,)>>::call(move _21, move _22) -> [return: bb9, unwind unreachable];
}
bb9: {
StorageDead(_24);
StorageDead(_23);
StorageDead(_20);
StorageDead(_22);
StorageDead(_21);
StorageDead(_18);
goto -> bb4;
}

View File

@ -4,24 +4,24 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
debug slice => _1;
debug f => _2;
let mut _0: ();
let mut _15: std::slice::Iter<'_, T>;
let mut _16: std::iter::Rev<std::slice::Iter<'_, T>>;
let mut _17: std::iter::Rev<std::slice::Iter<'_, T>>;
let mut _18: &mut std::iter::Rev<std::slice::Iter<'_, T>>;
let mut _20: std::option::Option<&T>;
let mut _21: isize;
let mut _23: &impl Fn(&T);
let mut _24: (&T,);
let _25: ();
let mut _13: std::slice::Iter<'_, T>;
let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>;
let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>;
let mut _16: &mut std::iter::Rev<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 => _17;
let _22: &T;
debug iter => _15;
let _20: &T;
scope 2 {
debug x => _22;
debug x => _20;
}
scope 22 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) {
debug self => _18;
let mut _19: &mut std::slice::Iter<'_, T>;
debug self => _16;
let mut _17: &mut std::slice::Iter<'_, T>;
}
}
scope 3 (inlined core::slice::<impl [T]>::iter) {
@ -30,19 +30,19 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
debug slice => _1;
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;
let mut _8: bool;
let mut _9: *mut T;
let mut _10: *mut T;
let mut _12: *const T;
scope 5 {
debug len => _3;
let _9: std::ptr::NonNull<T>;
let _7: std::ptr::NonNull<T>;
scope 6 {
debug ptr => _9;
debug ptr => _7;
scope 7 {
let _13: *const T;
let _11: *const T;
scope 8 {
debug end_or_len => _13;
debug end_or_len => _11;
}
scope 14 (inlined invalid::<T>) {
debug addr => _3;
@ -50,10 +50,10 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
}
scope 16 (inlined NonNull::<T>::as_ptr) {
debug self => _9;
debug self => _7;
}
scope 17 (inlined std::ptr::mut_ptr::<impl *mut T>::add) {
debug self => _11;
debug self => _9;
debug count => _3;
scope 18 {
}
@ -68,9 +68,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
scope 11 (inlined NonNull::<[T]>::cast::<T>) {
debug self => _5;
let mut _6: *mut [T];
let mut _7: *mut T;
let mut _8: *const T;
let mut _6: *const T;
scope 12 {
scope 13 (inlined NonNull::<[T]>::as_ptr) {
debug self => _5;
@ -81,91 +79,85 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
}
scope 19 (inlined <std::slice::Iter<'_, T> as Iterator>::rev) {
debug self => _15;
debug self => _13;
scope 20 (inlined Rev::<std::slice::Iter<'_, T>>::new) {
debug iter => _15;
debug iter => _13;
}
}
scope 21 (inlined <Rev<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) {
debug self => _16;
debug self => _14;
}
bb0: {
StorageLive(_15);
StorageLive(_13);
StorageLive(_3);
StorageLive(_9);
StorageLive(_7);
StorageLive(_4);
StorageLive(_8);
StorageLive(_6);
_3 = Len((*_1));
StorageLive(_5);
_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::<T> { pointer: _8 };
_6 = _4 as *const T (PtrToPtr);
_7 = NonNull::<T> { pointer: _6 };
StorageDead(_5);
StorageLive(_13);
StorageLive(_10);
_10 = const _;
switchInt(move _10) -> [0: bb1, otherwise: bb2];
StorageLive(_11);
StorageLive(_8);
_8 = const _;
switchInt(move _8) -> [0: bb1, otherwise: bb2];
}
bb1: {
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);
StorageLive(_10);
StorageLive(_9);
_9 = _4 as *mut T (PtrToPtr);
_10 = Offset(_9, _3);
StorageDead(_9);
_11 = move _10 as *const T (PointerCoercion(MutToConstPointer));
StorageDead(_10);
goto -> bb3;
}
bb2: {
_13 = _3 as *const T (Transmute);
_11 = _3 as *const T (Transmute);
goto -> bb3;
}
bb3: {
StorageDead(_10);
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);
StorageLive(_12);
_12 = _11;
_13 = std::slice::Iter::<'_, T> { ptr: _7, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
StorageDead(_12);
StorageDead(_11);
StorageDead(_6);
StorageDead(_4);
StorageDead(_9);
StorageDead(_7);
StorageDead(_3);
_16 = Rev::<std::slice::Iter<'_, T>> { iter: _15 };
StorageDead(_15);
StorageLive(_17);
_17 = _16;
_14 = Rev::<std::slice::Iter<'_, T>> { iter: _13 };
StorageDead(_13);
StorageLive(_15);
_15 = _14;
goto -> bb4;
}
bb4: {
StorageLive(_20);
_18 = &mut _17;
StorageLive(_19);
_19 = &mut (_17.0: std::slice::Iter<'_, T>);
_20 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _19) -> [return: bb5, unwind: bb11];
StorageLive(_18);
_16 = &mut _15;
StorageLive(_17);
_17 = &mut (_15.0: std::slice::Iter<'_, T>);
_18 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind: bb11];
}
bb5: {
StorageDead(_19);
_21 = discriminant(_20);
switchInt(move _21) -> [0: bb6, 1: bb8, otherwise: bb10];
StorageDead(_17);
_19 = discriminant(_18);
switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
StorageDead(_20);
StorageDead(_17);
StorageDead(_18);
StorageDead(_15);
drop(_2) -> [return: bb7, unwind continue];
}
@ -174,18 +166,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb8: {
_22 = ((_20 as Some).0: &T);
StorageLive(_23);
_23 = &_2;
StorageLive(_24);
_24 = (_22,);
_25 = <impl Fn(&T) as Fn<(&T,)>>::call(move _23, move _24) -> [return: bb9, unwind: bb11];
_20 = ((_18 as Some).0: &T);
StorageLive(_21);
_21 = &_2;
StorageLive(_22);
_22 = (_20,);
_23 = <impl Fn(&T) as Fn<(&T,)>>::call(move _21, move _22) -> [return: bb9, unwind: bb11];
}
bb9: {
StorageDead(_24);
StorageDead(_23);
StorageDead(_20);
StorageDead(_22);
StorageDead(_21);
StorageDead(_18);
goto -> bb4;
}