Auto merge of #120405 - cjgillot:gvn-pointer, r=oli-obk

Fold pointer operations in GVN

This PR proposes 2 combinations of cast operations in MIR GVN:
- a chain of `PtrToPtr` or `MutToConstPointer` casts can be folded together into a single `PtrToPtr` cast;
- we attempt to evaluate more ptr ops when there is no provenance.

In particular, this allows to read from static slices.

This is not yet sufficient to see through slice operations that use `PtrComponents` (because that's a union), but still a step forward.

r? `@ghost`
This commit is contained in:
bors 2024-02-11 04:24:40 +00:00
commit 9aa232ecc7
38 changed files with 2242 additions and 1389 deletions

View file

@ -415,7 +415,7 @@ fn unsize_into_ptr(
}
}
fn unsize_into(
pub fn unsize_into(
&mut self,
src: &OpTy<'tcx, M::Provenance>,
cast_ty: TyAndLayout<'tcx>,

View file

@ -2,7 +2,9 @@
//!
//! Currently, this pass only propagates scalar values.
use rustc_const_eval::interpret::{ImmTy, Immediate, InterpCx, OpTy, PlaceTy, Projectable};
use rustc_const_eval::interpret::{
ImmTy, Immediate, InterpCx, OpTy, PlaceTy, PointerArithmetic, Projectable,
};
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::def::DefKind;
use rustc_middle::mir::interpret::{AllocId, ConstAllocation, InterpResult, Scalar};
@ -936,12 +938,50 @@ fn assert_panic(
}
fn binary_ptr_op(
_ecx: &InterpCx<'mir, 'tcx, Self>,
_bin_op: BinOp,
_left: &rustc_const_eval::interpret::ImmTy<'tcx, Self::Provenance>,
_right: &rustc_const_eval::interpret::ImmTy<'tcx, Self::Provenance>,
ecx: &InterpCx<'mir, 'tcx, Self>,
bin_op: BinOp,
left: &rustc_const_eval::interpret::ImmTy<'tcx, Self::Provenance>,
right: &rustc_const_eval::interpret::ImmTy<'tcx, Self::Provenance>,
) -> interpret::InterpResult<'tcx, (ImmTy<'tcx, Self::Provenance>, bool)> {
throw_machine_stop_str!("can't do pointer arithmetic");
use rustc_middle::mir::BinOp::*;
Ok(match bin_op {
Eq | Ne | Lt | Le | Gt | Ge => {
// Types can differ, e.g. fn ptrs with different `for`.
assert_eq!(left.layout.abi, right.layout.abi);
let size = ecx.pointer_size();
// Just compare the bits. ScalarPairs are compared lexicographically.
// We thus always compare pairs and simply fill scalars up with 0.
// If the pointer has provenance, `to_bits` will return `Err` and we bail out.
let left = match **left {
Immediate::Scalar(l) => (l.to_bits(size)?, 0),
Immediate::ScalarPair(l1, l2) => (l1.to_bits(size)?, l2.to_bits(size)?),
Immediate::Uninit => panic!("we should never see uninit data here"),
};
let right = match **right {
Immediate::Scalar(r) => (r.to_bits(size)?, 0),
Immediate::ScalarPair(r1, r2) => (r1.to_bits(size)?, r2.to_bits(size)?),
Immediate::Uninit => panic!("we should never see uninit data here"),
};
let res = match bin_op {
Eq => left == right,
Ne => left != right,
Lt => left < right,
Le => left <= right,
Gt => left > right,
Ge => left >= right,
_ => bug!(),
};
(ImmTy::from_bool(res, *ecx.tcx), false)
}
// Some more operations are possible with atomics.
// The return value always has the provenance of the *left* operand.
Add | Sub | BitOr | BitAnd | BitXor => {
throw_machine_stop_str!("pointer arithmetic is not handled")
}
_ => span_bug!(ecx.cur_span(), "Invalid operator on pointers: {:?}", bin_op),
})
}
fn expose_ptr(

View file

@ -93,7 +93,6 @@
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;
@ -552,6 +551,29 @@ fn eval_to_const(&mut self, value: VnIndex) -> Option<OpTy<'tcx>> {
}
value.offset(Size::ZERO, to, &self.ecx).ok()?
}
CastKind::PointerCoercion(ty::adjustment::PointerCoercion::Unsize) => {
let src = self.evaluated[value].as_ref()?;
let to = self.ecx.layout_of(to).ok()?;
let dest = self.ecx.allocate(to, MemoryKind::Stack).ok()?;
self.ecx.unsize_into(src, to, &dest.clone().into()).ok()?;
self.ecx
.alloc_mark_immutable(dest.ptr().provenance.unwrap().alloc_id())
.ok()?;
dest.into()
}
CastKind::FnPtrToPtr
| CastKind::PtrToPtr
| CastKind::PointerCoercion(
ty::adjustment::PointerCoercion::MutToConstPointer
| ty::adjustment::PointerCoercion::ArrayToPointer
| ty::adjustment::PointerCoercion::UnsafeFnPointer,
) => {
let src = self.evaluated[value].as_ref()?;
let src = self.ecx.read_immediate(src).ok()?;
let to = self.ecx.layout_of(to).ok()?;
let ret = self.ecx.ptr_to_ptr(&src, to).ok()?;
ret.into()
}
_ => return None,
},
};
@ -778,18 +800,8 @@ fn simplify_rvalue(
// 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 +1047,50 @@ fn simplify_binary(
}
}
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 from == to {
return Some(value);
}
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

@ -31,16 +31,17 @@
StorageDead(_3);
StorageLive(_6);
_6 = const 1_usize;
_7 = Len((*_2));
- _7 = Len((*_2));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
+ _8 = Lt(const 1_usize, _7);
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind unreachable];
+ _7 = const 3_usize;
+ _8 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
- _1 = (*_2)[_6];
+ _1 = (*_2)[1 of 2];
+ _1 = const 2_u32;
StorageDead(_6);
StorageDead(_4);
StorageDead(_2);

View file

@ -31,16 +31,17 @@
StorageDead(_3);
StorageLive(_6);
_6 = const 1_usize;
_7 = Len((*_2));
- _7 = Len((*_2));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
+ _8 = Lt(const 1_usize, _7);
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind continue];
+ _7 = const 3_usize;
+ _8 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue];
}
bb1: {
- _1 = (*_2)[_6];
+ _1 = (*_2)[1 of 2];
+ _1 = const 2_u32;
StorageDead(_6);
StorageDead(_4);
StorageDead(_2);

View file

@ -31,16 +31,17 @@
StorageDead(_3);
StorageLive(_6);
_6 = const 1_usize;
_7 = Len((*_2));
- _7 = Len((*_2));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
+ _8 = Lt(const 1_usize, _7);
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind unreachable];
+ _7 = const 3_usize;
+ _8 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
- _1 = (*_2)[_6];
+ _1 = (*_2)[1 of 2];
+ _1 = const 2_u32;
StorageDead(_6);
StorageDead(_4);
StorageDead(_2);

View file

@ -31,16 +31,17 @@
StorageDead(_3);
StorageLive(_6);
_6 = const 1_usize;
_7 = Len((*_2));
- _7 = Len((*_2));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
+ _8 = Lt(const 1_usize, _7);
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind continue];
+ _7 = const 3_usize;
+ _8 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue];
}
bb1: {
- _1 = (*_2)[_6];
+ _1 = (*_2)[1 of 2];
+ _1 = const 2_u32;
StorageDead(_6);
StorageDead(_4);
StorageDead(_2);

View file

@ -8,9 +8,7 @@ fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug a => [[a:_.*]];
// CHECK: [[slice:_.*]] = const {{.*}} as &[u32] (PointerCoercion(Unsize));
// FIXME(cjgillot) simplify Len and projection into unsized slice.
// CHECK-NOT: assert(const true,
// CHECK: [[a]] = (*[[slice]])[1 of 2];
// CHECK-NOT: [[a]] = const 2_u32;
// CHECK: assert(const true,
// CHECK: [[a]] = const 2_u32;
let a = (&[1u32, 2, 3] as &[u32])[1];
}

View file

@ -69,28 +69,40 @@
}
bb2: {
_10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr);
_9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb3, unwind unreachable];
_10 = const {0x1 as *mut ()};
_9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [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 };
_11 = const {0x1 as *const [bool; 0]};
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
StorageDead(_11);
StorageDead(_10);
StorageDead(_6);
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
_3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
_2 = Box::<[bool]>(_3, const std::alloc::Global);
_2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_9);
StorageDead(_3);
_1 = A { foo: move _2 };
_1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }};
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind unreachable];
}
}
ALLOC2 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
ALLOC1 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
ALLOC0 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}

View file

@ -73,28 +73,40 @@
}
bb3: {
_10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr);
_9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb4, unwind unreachable];
_10 = const {0x1 as *mut ()};
_9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [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 };
_11 = const {0x1 as *const [bool; 0]};
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
StorageDead(_11);
StorageDead(_10);
StorageDead(_6);
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
_3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
_2 = Box::<[bool]>(_3, const std::alloc::Global);
_2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_9);
StorageDead(_3);
_1 = A { foo: move _2 };
_1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }};
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind: bb2];
}
}
ALLOC2 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
ALLOC1 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
ALLOC0 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}

View file

@ -69,28 +69,40 @@
}
bb2: {
_10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr);
_9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb3, unwind unreachable];
_10 = const {0x1 as *mut ()};
_9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [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 };
_11 = const {0x1 as *const [bool; 0]};
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
StorageDead(_11);
StorageDead(_10);
StorageDead(_6);
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
_3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
_2 = Box::<[bool]>(_3, const std::alloc::Global);
_2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_9);
StorageDead(_3);
_1 = A { foo: move _2 };
_1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }};
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind unreachable];
}
}
ALLOC2 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
ALLOC1 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
ALLOC0 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}

View file

@ -73,28 +73,40 @@
}
bb3: {
_10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr);
_9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb4, unwind unreachable];
_10 = const {0x1 as *mut ()};
_9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [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 };
_11 = const {0x1 as *const [bool; 0]};
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
StorageDead(_11);
StorageDead(_10);
StorageDead(_6);
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
_3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
_2 = Box::<[bool]>(_3, const std::alloc::Global);
_2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_9);
StorageDead(_3);
_1 = A { foo: move _2 };
_1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }};
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind: bb2];
}
}
ALLOC2 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
ALLOC1 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
ALLOC0 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}

View file

@ -72,29 +72,47 @@
bb2: {
- _10 = _6 as *mut () (PtrToPtr);
+ _10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr);
_9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb3, unwind unreachable];
- _9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb3, unwind unreachable];
+ _10 = const {0x1 as *mut ()};
+ _9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [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 };
- _5 = NonNull::<[bool; 0]> { pointer: _11 };
+ _11 = const {0x1 as *const [bool; 0]};
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
StorageDead(_11);
StorageDead(_10);
StorageDead(_6);
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
_2 = Box::<[bool]>(_3, const std::alloc::Global);
- _2 = Box::<[bool]>(_3, const std::alloc::Global);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_9);
StorageDead(_3);
_1 = A { foo: move _2 };
- _1 = A { foo: move _2 };
+ _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }};
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind unreachable];
}
+ }
+
+ ALLOC2 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ ALLOC1 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
}

View file

@ -76,29 +76,47 @@
bb3: {
- _10 = _6 as *mut () (PtrToPtr);
+ _10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr);
_9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb4, unwind unreachable];
- _9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb4, unwind unreachable];
+ _10 = const {0x1 as *mut ()};
+ _9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [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 };
- _5 = NonNull::<[bool; 0]> { pointer: _11 };
+ _11 = const {0x1 as *const [bool; 0]};
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
StorageDead(_11);
StorageDead(_10);
StorageDead(_6);
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
_2 = Box::<[bool]>(_3, const std::alloc::Global);
- _2 = Box::<[bool]>(_3, const std::alloc::Global);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_9);
StorageDead(_3);
_1 = A { foo: move _2 };
- _1 = A { foo: move _2 };
+ _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }};
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind: bb2];
}
+ }
+
+ ALLOC2 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ ALLOC1 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
}

View file

@ -72,29 +72,47 @@
bb2: {
- _10 = _6 as *mut () (PtrToPtr);
+ _10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr);
_9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb3, unwind unreachable];
- _9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb3, unwind unreachable];
+ _10 = const {0x1 as *mut ()};
+ _9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [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 };
- _5 = NonNull::<[bool; 0]> { pointer: _11 };
+ _11 = const {0x1 as *const [bool; 0]};
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
StorageDead(_11);
StorageDead(_10);
StorageDead(_6);
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
_2 = Box::<[bool]>(_3, const std::alloc::Global);
- _2 = Box::<[bool]>(_3, const std::alloc::Global);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_9);
StorageDead(_3);
_1 = A { foo: move _2 };
- _1 = A { foo: move _2 };
+ _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }};
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind unreachable];
}
+ }
+
+ ALLOC2 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}

View file

@ -76,29 +76,47 @@
bb3: {
- _10 = _6 as *mut () (PtrToPtr);
+ _10 = const {0x1 as *mut [bool; 0]} as *mut () (PtrToPtr);
_9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb4, unwind unreachable];
- _9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb4, unwind unreachable];
+ _10 = const {0x1 as *mut ()};
+ _9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [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 };
- _5 = NonNull::<[bool; 0]> { pointer: _11 };
+ _11 = const {0x1 as *const [bool; 0]};
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
StorageDead(_11);
StorageDead(_10);
StorageDead(_6);
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
_2 = Box::<[bool]>(_3, const std::alloc::Global);
- _2 = Box::<[bool]>(_3, const std::alloc::Global);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_9);
StorageDead(_3);
_1 = A { foo: move _2 };
- _1 = A { foo: move _2 };
+ _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }};
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind: bb2];
}
+ }
+
+ ALLOC2 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}

View file

@ -16,14 +16,11 @@ struct A {
// CHECK-LABEL: fn main(
fn main() {
// ConstProp will create a constant of type `Box<[bool]>`.
// FIXME: it is not yet a constant.
// Verify that `DataflowConstProp` does not ICE trying to dereference it directly.
// CHECK: debug a => [[a:_.*]];
// We may check other inlined functions as well...
// CHECK: {{_.*}} = Box::<[bool]>(
// FIXME: should be `{{_.*}} = const Box::<[bool]>`
// CHECK: {{_.*}} = const Box::<[bool]>(
let a: A = A { foo: Box::default() };
}

View file

@ -644,25 +644,80 @@ fn constant_index_overflow<T: Copy>(x: &[T]) {
opaque(b)
}
fn wide_ptr_ops() {
/// Check that we do not attempt to simplify anything when there is provenance.
fn wide_ptr_provenance() {
// CHECK-LABEL: fn wide_ptr_provenance(
let a: *const dyn Send = &1 as &dyn Send;
let b: *const dyn Send = &1 as &dyn Send;
let _val = a == b;
let _val = a != b;
let _val = a < b;
let _val = a <= b;
let _val = a > b;
let _val = a >= b;
// CHECK: [[eqp:_.*]] = Eq([[a:_.*]], [[b:_.*]]);
// CHECK: opaque::<bool>(move [[eqp]])
opaque(a == b);
// CHECK: [[nep:_.*]] = Ne([[a]], [[b]]);
// CHECK: opaque::<bool>(move [[nep]])
opaque(a != b);
// CHECK: [[ltp:_.*]] = Lt([[a]], [[b]]);
// CHECK: opaque::<bool>(move [[ltp]])
opaque(a < b);
// CHECK: [[lep:_.*]] = Le([[a]], [[b]]);
// CHECK: opaque::<bool>(move [[lep]])
opaque(a <= b);
// CHECK: [[gtp:_.*]] = Gt([[a]], [[b]]);
// CHECK: opaque::<bool>(move [[gtp]])
opaque(a > b);
// CHECK: [[gep:_.*]] = Ge([[a]], [[b]]);
// CHECK: opaque::<bool>(move [[gep]])
opaque(a >= b);
}
/// Both pointers come form the same allocation, so we could probably fold the comparisons.
fn wide_ptr_same_provenance() {
// CHECK-LABEL: fn wide_ptr_same_provenance(
let slice = &[1, 2];
let a: *const dyn Send = &slice[0] as &dyn Send;
let b: *const dyn Send = &slice[1] as &dyn Send;
// CHECK: [[eqp:_.*]] = Eq([[a:_.*]], [[b:_.*]]);
// CHECK: opaque::<bool>(move [[eqp]])
opaque(a == b);
// CHECK: [[nep:_.*]] = Ne([[a]], [[b]]);
// CHECK: opaque::<bool>(move [[nep]])
opaque(a != b);
// CHECK: [[ltp:_.*]] = Lt([[a]], [[b]]);
// CHECK: opaque::<bool>(move [[ltp]])
opaque(a < b);
// CHECK: [[lep:_.*]] = Le([[a]], [[b]]);
// CHECK: opaque::<bool>(move [[lep]])
opaque(a <= b);
// CHECK: [[gtp:_.*]] = Gt([[a]], [[b]]);
// CHECK: opaque::<bool>(move [[gtp]])
opaque(a > b);
// CHECK: [[gep:_.*]] = Ge([[a]], [[b]]);
// CHECK: opaque::<bool>(move [[gep]])
opaque(a >= b);
}
/// Check that we do simplify when there is no provenance, and do not ICE.
fn wide_ptr_integer() {
// CHECK-LABEL: fn wide_ptr_integer(
// CHECK: debug a => [[a:_.*]];
// CHECK: debug b => [[b:_.*]];
let a: *const [u8] = unsafe { transmute((1usize, 1usize)) };
let b: *const [u8] = unsafe { transmute((1usize, 2usize)) };
opaque(!(a == b));
// CHECK: opaque::<bool>(const false)
opaque(a == b);
// CHECK: opaque::<bool>(const true)
opaque(a != b);
opaque(a <= b);
// CHECK: opaque::<bool>(const true)
opaque(a < b);
opaque(!(a >= b));
opaque(!(a > b));
// CHECK: opaque::<bool>(const true)
opaque(a <= b);
// CHECK: opaque::<bool>(const false)
opaque(a > b);
// CHECK: opaque::<bool>(const false)
opaque(a >= b);
}
fn main() {
@ -685,7 +740,8 @@ fn main() {
fn_pointers();
indirect_static();
constant_index_overflow(&[5, 3]);
wide_ptr_ops();
wide_ptr_provenance();
wide_ptr_integer();
}
#[inline(never)]
@ -714,4 +770,6 @@ fn identity<T>(x: T) -> T {
// EMIT_MIR gvn.fn_pointers.GVN.diff
// EMIT_MIR gvn.indirect_static.GVN.diff
// EMIT_MIR gvn.constant_index_overflow.GVN.diff
// EMIT_MIR gvn.wide_ptr_ops.GVN.diff
// EMIT_MIR gvn.wide_ptr_provenance.GVN.diff
// EMIT_MIR gvn.wide_ptr_same_provenance.GVN.diff
// EMIT_MIR gvn.wide_ptr_integer.GVN.diff

View file

@ -0,0 +1,192 @@
- // MIR for `wide_ptr_integer` before GVN
+ // MIR for `wide_ptr_integer` after GVN
fn wide_ptr_integer() -> () {
let mut _0: ();
let _1: *const [u8];
let mut _2: (usize, usize);
let mut _4: (usize, usize);
let _5: ();
let mut _6: bool;
let mut _7: *const [u8];
let mut _8: *const [u8];
let _9: ();
let mut _10: bool;
let mut _11: *const [u8];
let mut _12: *const [u8];
let _13: ();
let mut _14: bool;
let mut _15: *const [u8];
let mut _16: *const [u8];
let _17: ();
let mut _18: bool;
let mut _19: *const [u8];
let mut _20: *const [u8];
let _21: ();
let mut _22: bool;
let mut _23: *const [u8];
let mut _24: *const [u8];
let _25: ();
let mut _26: bool;
let mut _27: *const [u8];
let mut _28: *const [u8];
scope 1 {
debug a => _1;
let _3: *const [u8];
scope 3 {
debug b => _3;
}
scope 4 {
}
}
scope 2 {
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_2);
- _2 = (const 1_usize, const 1_usize);
- _1 = move _2 as *const [u8] (Transmute);
+ _2 = const (1_usize, 1_usize);
+ _1 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageDead(_2);
- StorageLive(_3);
+ nop;
StorageLive(_4);
- _4 = (const 1_usize, const 2_usize);
- _3 = move _4 as *const [u8] (Transmute);
+ _4 = const (1_usize, 2_usize);
+ _3 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
StorageLive(_7);
- _7 = _1;
+ _7 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_8);
- _8 = _3;
- _6 = Eq(move _7, move _8);
+ _8 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _6 = const false;
StorageDead(_8);
StorageDead(_7);
- _5 = opaque::<bool>(move _6) -> [return: bb1, unwind unreachable];
+ _5 = opaque::<bool>(const false) -> [return: bb1, unwind unreachable];
}
bb1: {
StorageDead(_6);
StorageDead(_5);
StorageLive(_9);
StorageLive(_10);
StorageLive(_11);
- _11 = _1;
+ _11 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_12);
- _12 = _3;
- _10 = Ne(move _11, move _12);
+ _12 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _10 = const true;
StorageDead(_12);
StorageDead(_11);
- _9 = opaque::<bool>(move _10) -> [return: bb2, unwind unreachable];
+ _9 = opaque::<bool>(const true) -> [return: bb2, unwind unreachable];
}
bb2: {
StorageDead(_10);
StorageDead(_9);
StorageLive(_13);
StorageLive(_14);
StorageLive(_15);
- _15 = _1;
+ _15 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_16);
- _16 = _3;
- _14 = Lt(move _15, move _16);
+ _16 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _14 = const true;
StorageDead(_16);
StorageDead(_15);
- _13 = opaque::<bool>(move _14) -> [return: bb3, unwind unreachable];
+ _13 = opaque::<bool>(const true) -> [return: bb3, unwind unreachable];
}
bb3: {
StorageDead(_14);
StorageDead(_13);
StorageLive(_17);
StorageLive(_18);
StorageLive(_19);
- _19 = _1;
+ _19 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_20);
- _20 = _3;
- _18 = Le(move _19, move _20);
+ _20 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _18 = const true;
StorageDead(_20);
StorageDead(_19);
- _17 = opaque::<bool>(move _18) -> [return: bb4, unwind unreachable];
+ _17 = opaque::<bool>(const true) -> [return: bb4, unwind unreachable];
}
bb4: {
StorageDead(_18);
StorageDead(_17);
StorageLive(_21);
StorageLive(_22);
StorageLive(_23);
- _23 = _1;
+ _23 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_24);
- _24 = _3;
- _22 = Gt(move _23, move _24);
+ _24 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _22 = const false;
StorageDead(_24);
StorageDead(_23);
- _21 = opaque::<bool>(move _22) -> [return: bb5, unwind unreachable];
+ _21 = opaque::<bool>(const false) -> [return: bb5, unwind unreachable];
}
bb5: {
StorageDead(_22);
StorageDead(_21);
StorageLive(_25);
StorageLive(_26);
StorageLive(_27);
- _27 = _1;
+ _27 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_28);
- _28 = _3;
- _26 = Ge(move _27, move _28);
+ _28 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _26 = const false;
StorageDead(_28);
StorageDead(_27);
- _25 = opaque::<bool>(move _26) -> [return: bb6, unwind unreachable];
+ _25 = opaque::<bool>(const false) -> [return: bb6, unwind unreachable];
}
bb6: {
StorageDead(_26);
StorageDead(_25);
_0 = const ();
- StorageDead(_3);
- StorageDead(_1);
+ nop;
+ nop;
return;
}
+ }
+
+ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ ................
}

View file

@ -0,0 +1,192 @@
- // MIR for `wide_ptr_integer` before GVN
+ // MIR for `wide_ptr_integer` after GVN
fn wide_ptr_integer() -> () {
let mut _0: ();
let _1: *const [u8];
let mut _2: (usize, usize);
let mut _4: (usize, usize);
let _5: ();
let mut _6: bool;
let mut _7: *const [u8];
let mut _8: *const [u8];
let _9: ();
let mut _10: bool;
let mut _11: *const [u8];
let mut _12: *const [u8];
let _13: ();
let mut _14: bool;
let mut _15: *const [u8];
let mut _16: *const [u8];
let _17: ();
let mut _18: bool;
let mut _19: *const [u8];
let mut _20: *const [u8];
let _21: ();
let mut _22: bool;
let mut _23: *const [u8];
let mut _24: *const [u8];
let _25: ();
let mut _26: bool;
let mut _27: *const [u8];
let mut _28: *const [u8];
scope 1 {
debug a => _1;
let _3: *const [u8];
scope 3 {
debug b => _3;
}
scope 4 {
}
}
scope 2 {
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_2);
- _2 = (const 1_usize, const 1_usize);
- _1 = move _2 as *const [u8] (Transmute);
+ _2 = const (1_usize, 1_usize);
+ _1 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageDead(_2);
- StorageLive(_3);
+ nop;
StorageLive(_4);
- _4 = (const 1_usize, const 2_usize);
- _3 = move _4 as *const [u8] (Transmute);
+ _4 = const (1_usize, 2_usize);
+ _3 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
StorageLive(_7);
- _7 = _1;
+ _7 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_8);
- _8 = _3;
- _6 = Eq(move _7, move _8);
+ _8 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _6 = const false;
StorageDead(_8);
StorageDead(_7);
- _5 = opaque::<bool>(move _6) -> [return: bb1, unwind continue];
+ _5 = opaque::<bool>(const false) -> [return: bb1, unwind continue];
}
bb1: {
StorageDead(_6);
StorageDead(_5);
StorageLive(_9);
StorageLive(_10);
StorageLive(_11);
- _11 = _1;
+ _11 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_12);
- _12 = _3;
- _10 = Ne(move _11, move _12);
+ _12 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _10 = const true;
StorageDead(_12);
StorageDead(_11);
- _9 = opaque::<bool>(move _10) -> [return: bb2, unwind continue];
+ _9 = opaque::<bool>(const true) -> [return: bb2, unwind continue];
}
bb2: {
StorageDead(_10);
StorageDead(_9);
StorageLive(_13);
StorageLive(_14);
StorageLive(_15);
- _15 = _1;
+ _15 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_16);
- _16 = _3;
- _14 = Lt(move _15, move _16);
+ _16 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _14 = const true;
StorageDead(_16);
StorageDead(_15);
- _13 = opaque::<bool>(move _14) -> [return: bb3, unwind continue];
+ _13 = opaque::<bool>(const true) -> [return: bb3, unwind continue];
}
bb3: {
StorageDead(_14);
StorageDead(_13);
StorageLive(_17);
StorageLive(_18);
StorageLive(_19);
- _19 = _1;
+ _19 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_20);
- _20 = _3;
- _18 = Le(move _19, move _20);
+ _20 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _18 = const true;
StorageDead(_20);
StorageDead(_19);
- _17 = opaque::<bool>(move _18) -> [return: bb4, unwind continue];
+ _17 = opaque::<bool>(const true) -> [return: bb4, unwind continue];
}
bb4: {
StorageDead(_18);
StorageDead(_17);
StorageLive(_21);
StorageLive(_22);
StorageLive(_23);
- _23 = _1;
+ _23 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_24);
- _24 = _3;
- _22 = Gt(move _23, move _24);
+ _24 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _22 = const false;
StorageDead(_24);
StorageDead(_23);
- _21 = opaque::<bool>(move _22) -> [return: bb5, unwind continue];
+ _21 = opaque::<bool>(const false) -> [return: bb5, unwind continue];
}
bb5: {
StorageDead(_22);
StorageDead(_21);
StorageLive(_25);
StorageLive(_26);
StorageLive(_27);
- _27 = _1;
+ _27 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_28);
- _28 = _3;
- _26 = Ge(move _27, move _28);
+ _28 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _26 = const false;
StorageDead(_28);
StorageDead(_27);
- _25 = opaque::<bool>(move _26) -> [return: bb6, unwind continue];
+ _25 = opaque::<bool>(const false) -> [return: bb6, unwind continue];
}
bb6: {
StorageDead(_26);
StorageDead(_25);
_0 = const ();
- StorageDead(_3);
- StorageDead(_1);
+ nop;
+ nop;
return;
}
+ }
+
+ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ ................
}

View file

@ -1,386 +0,0 @@
- // MIR for `wide_ptr_ops` before GVN
+ // MIR for `wide_ptr_ops` after GVN
fn wide_ptr_ops() -> () {
let mut _0: ();
let _1: *const dyn std::marker::Send;
let mut _2: *const dyn std::marker::Send;
let _3: &dyn std::marker::Send;
let mut _4: &i32;
let _5: &i32;
let _6: i32;
let mut _8: *const dyn std::marker::Send;
let _9: &dyn std::marker::Send;
let mut _10: &i32;
let _11: &i32;
let _12: i32;
let mut _14: *const dyn std::marker::Send;
let mut _15: *const dyn std::marker::Send;
let mut _16: *const dyn std::marker::Send;
let mut _18: *const dyn std::marker::Send;
let mut _19: *const dyn std::marker::Send;
let mut _20: *const dyn std::marker::Send;
let mut _22: *const dyn std::marker::Send;
let mut _23: *const dyn std::marker::Send;
let mut _24: *const dyn std::marker::Send;
let mut _26: *const dyn std::marker::Send;
let mut _27: *const dyn std::marker::Send;
let mut _28: *const dyn std::marker::Send;
let mut _30: *const dyn std::marker::Send;
let mut _31: *const dyn std::marker::Send;
let mut _32: *const dyn std::marker::Send;
let mut _34: *const dyn std::marker::Send;
let mut _35: *const dyn std::marker::Send;
let mut _36: *const dyn std::marker::Send;
let mut _38: (usize, usize);
let mut _40: (usize, usize);
let _41: ();
let mut _42: bool;
let mut _43: bool;
let mut _44: *const [u8];
let mut _45: *const [u8];
let _46: ();
let mut _47: bool;
let mut _48: *const [u8];
let mut _49: *const [u8];
let _50: ();
let mut _51: bool;
let mut _52: *const [u8];
let mut _53: *const [u8];
let _54: ();
let mut _55: bool;
let mut _56: *const [u8];
let mut _57: *const [u8];
let _58: ();
let mut _59: bool;
let mut _60: bool;
let mut _61: *const [u8];
let mut _62: *const [u8];
let _63: ();
let mut _64: bool;
let mut _65: bool;
let mut _66: *const [u8];
let mut _67: *const [u8];
let mut _69: &i32;
scope 1 {
debug a => _1;
let _7: *const dyn std::marker::Send;
let mut _68: &i32;
scope 2 {
debug b => _7;
let _13: bool;
scope 3 {
debug _val => _13;
let _17: bool;
scope 4 {
debug _val => _17;
let _21: bool;
scope 5 {
debug _val => _21;
let _25: bool;
scope 6 {
debug _val => _25;
let _29: bool;
scope 7 {
debug _val => _29;
let _33: bool;
scope 8 {
debug _val => _33;
let _37: *const [u8];
scope 9 {
debug a => _37;
let _39: *const [u8];
scope 11 {
debug b => _39;
}
scope 12 {
}
}
scope 10 {
}
}
}
}
}
}
}
}
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
StorageLive(_5);
_69 = const _;
_5 = &(*_69);
_4 = &(*_5);
_3 = move _4 as &dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_4);
_2 = &raw const (*_3);
_1 = move _2 as *const dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_2);
StorageDead(_5);
StorageDead(_3);
- StorageLive(_7);
+ nop;
StorageLive(_8);
StorageLive(_9);
StorageLive(_10);
StorageLive(_11);
_68 = const _;
_11 = &(*_68);
_10 = &(*_11);
_9 = move _10 as &dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_10);
_8 = &raw const (*_9);
_7 = move _8 as *const dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_8);
StorageDead(_11);
StorageDead(_9);
StorageLive(_13);
StorageLive(_14);
_14 = _1;
- StorageLive(_15);
+ nop;
StorageLive(_16);
_16 = _7;
- _15 = move _16 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _15 = _7 as *const dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_16);
- _13 = Eq(move _14, move _15);
- StorageDead(_15);
+ _13 = Eq(_1, _15);
+ nop;
StorageDead(_14);
StorageLive(_17);
StorageLive(_18);
_18 = _1;
StorageLive(_19);
StorageLive(_20);
_20 = _7;
- _19 = move _20 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _19 = _15;
StorageDead(_20);
- _17 = Ne(move _18, move _19);
+ _17 = Ne(_1, _15);
StorageDead(_19);
StorageDead(_18);
StorageLive(_21);
StorageLive(_22);
_22 = _1;
StorageLive(_23);
StorageLive(_24);
_24 = _7;
- _23 = move _24 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _23 = _15;
StorageDead(_24);
- _21 = Lt(move _22, move _23);
+ _21 = Lt(_1, _15);
StorageDead(_23);
StorageDead(_22);
StorageLive(_25);
StorageLive(_26);
_26 = _1;
StorageLive(_27);
StorageLive(_28);
_28 = _7;
- _27 = move _28 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _27 = _15;
StorageDead(_28);
- _25 = Le(move _26, move _27);
+ _25 = Le(_1, _15);
StorageDead(_27);
StorageDead(_26);
StorageLive(_29);
StorageLive(_30);
_30 = _1;
StorageLive(_31);
StorageLive(_32);
_32 = _7;
- _31 = move _32 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _31 = _15;
StorageDead(_32);
- _29 = Gt(move _30, move _31);
+ _29 = Gt(_1, _15);
StorageDead(_31);
StorageDead(_30);
StorageLive(_33);
StorageLive(_34);
_34 = _1;
StorageLive(_35);
StorageLive(_36);
_36 = _7;
- _35 = move _36 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _35 = _15;
StorageDead(_36);
- _33 = Ge(move _34, move _35);
+ _33 = Ge(_1, _15);
StorageDead(_35);
StorageDead(_34);
- StorageLive(_37);
+ nop;
StorageLive(_38);
- _38 = (const 1_usize, const 1_usize);
- _37 = move _38 as *const [u8] (Transmute);
+ _38 = const (1_usize, 1_usize);
+ _37 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageDead(_38);
- StorageLive(_39);
+ nop;
StorageLive(_40);
- _40 = (const 1_usize, const 2_usize);
- _39 = move _40 as *const [u8] (Transmute);
+ _40 = const (1_usize, 2_usize);
+ _39 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
StorageDead(_40);
StorageLive(_41);
- StorageLive(_42);
+ nop;
StorageLive(_43);
StorageLive(_44);
- _44 = _37;
+ _44 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_45);
- _45 = _39;
- _43 = Eq(move _44, move _45);
+ _45 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _43 = Eq(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]);
StorageDead(_45);
StorageDead(_44);
_42 = Not(move _43);
StorageDead(_43);
- _41 = opaque::<bool>(move _42) -> [return: bb1, unwind unreachable];
+ _41 = opaque::<bool>(_42) -> [return: bb1, unwind unreachable];
}
bb1: {
- StorageDead(_42);
+ nop;
StorageDead(_41);
StorageLive(_46);
StorageLive(_47);
StorageLive(_48);
- _48 = _37;
+ _48 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_49);
- _49 = _39;
- _47 = Ne(move _48, move _49);
+ _49 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _47 = _42;
StorageDead(_49);
StorageDead(_48);
- _46 = opaque::<bool>(move _47) -> [return: bb2, unwind unreachable];
+ _46 = opaque::<bool>(_42) -> [return: bb2, unwind unreachable];
}
bb2: {
StorageDead(_47);
StorageDead(_46);
StorageLive(_50);
StorageLive(_51);
StorageLive(_52);
- _52 = _37;
+ _52 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_53);
- _53 = _39;
- _51 = Le(move _52, move _53);
+ _53 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _51 = Le(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]);
StorageDead(_53);
StorageDead(_52);
_50 = opaque::<bool>(move _51) -> [return: bb3, unwind unreachable];
}
bb3: {
StorageDead(_51);
StorageDead(_50);
StorageLive(_54);
StorageLive(_55);
StorageLive(_56);
- _56 = _37;
+ _56 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_57);
- _57 = _39;
- _55 = Lt(move _56, move _57);
+ _57 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _55 = Lt(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]);
StorageDead(_57);
StorageDead(_56);
_54 = opaque::<bool>(move _55) -> [return: bb4, unwind unreachable];
}
bb4: {
StorageDead(_55);
StorageDead(_54);
StorageLive(_58);
StorageLive(_59);
StorageLive(_60);
StorageLive(_61);
- _61 = _37;
+ _61 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_62);
- _62 = _39;
- _60 = Ge(move _61, move _62);
+ _62 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _60 = Ge(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]);
StorageDead(_62);
StorageDead(_61);
_59 = Not(move _60);
StorageDead(_60);
_58 = opaque::<bool>(move _59) -> [return: bb5, unwind unreachable];
}
bb5: {
StorageDead(_59);
StorageDead(_58);
StorageLive(_63);
StorageLive(_64);
StorageLive(_65);
StorageLive(_66);
- _66 = _37;
+ _66 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_67);
- _67 = _39;
- _65 = Gt(move _66, move _67);
+ _67 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _65 = Gt(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]);
StorageDead(_67);
StorageDead(_66);
_64 = Not(move _65);
StorageDead(_65);
_63 = opaque::<bool>(move _64) -> [return: bb6, unwind unreachable];
}
bb6: {
StorageDead(_64);
StorageDead(_63);
_0 = const ();
- StorageDead(_39);
- StorageDead(_37);
+ nop;
+ nop;
StorageDead(_33);
StorageDead(_29);
StorageDead(_25);
StorageDead(_21);
StorageDead(_17);
StorageDead(_13);
- StorageDead(_7);
- StorageDead(_1);
+ nop;
+ nop;
return;
}
+ }
+
+ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ ................
}

View file

@ -1,386 +0,0 @@
- // MIR for `wide_ptr_ops` before GVN
+ // MIR for `wide_ptr_ops` after GVN
fn wide_ptr_ops() -> () {
let mut _0: ();
let _1: *const dyn std::marker::Send;
let mut _2: *const dyn std::marker::Send;
let _3: &dyn std::marker::Send;
let mut _4: &i32;
let _5: &i32;
let _6: i32;
let mut _8: *const dyn std::marker::Send;
let _9: &dyn std::marker::Send;
let mut _10: &i32;
let _11: &i32;
let _12: i32;
let mut _14: *const dyn std::marker::Send;
let mut _15: *const dyn std::marker::Send;
let mut _16: *const dyn std::marker::Send;
let mut _18: *const dyn std::marker::Send;
let mut _19: *const dyn std::marker::Send;
let mut _20: *const dyn std::marker::Send;
let mut _22: *const dyn std::marker::Send;
let mut _23: *const dyn std::marker::Send;
let mut _24: *const dyn std::marker::Send;
let mut _26: *const dyn std::marker::Send;
let mut _27: *const dyn std::marker::Send;
let mut _28: *const dyn std::marker::Send;
let mut _30: *const dyn std::marker::Send;
let mut _31: *const dyn std::marker::Send;
let mut _32: *const dyn std::marker::Send;
let mut _34: *const dyn std::marker::Send;
let mut _35: *const dyn std::marker::Send;
let mut _36: *const dyn std::marker::Send;
let mut _38: (usize, usize);
let mut _40: (usize, usize);
let _41: ();
let mut _42: bool;
let mut _43: bool;
let mut _44: *const [u8];
let mut _45: *const [u8];
let _46: ();
let mut _47: bool;
let mut _48: *const [u8];
let mut _49: *const [u8];
let _50: ();
let mut _51: bool;
let mut _52: *const [u8];
let mut _53: *const [u8];
let _54: ();
let mut _55: bool;
let mut _56: *const [u8];
let mut _57: *const [u8];
let _58: ();
let mut _59: bool;
let mut _60: bool;
let mut _61: *const [u8];
let mut _62: *const [u8];
let _63: ();
let mut _64: bool;
let mut _65: bool;
let mut _66: *const [u8];
let mut _67: *const [u8];
let mut _69: &i32;
scope 1 {
debug a => _1;
let _7: *const dyn std::marker::Send;
let mut _68: &i32;
scope 2 {
debug b => _7;
let _13: bool;
scope 3 {
debug _val => _13;
let _17: bool;
scope 4 {
debug _val => _17;
let _21: bool;
scope 5 {
debug _val => _21;
let _25: bool;
scope 6 {
debug _val => _25;
let _29: bool;
scope 7 {
debug _val => _29;
let _33: bool;
scope 8 {
debug _val => _33;
let _37: *const [u8];
scope 9 {
debug a => _37;
let _39: *const [u8];
scope 11 {
debug b => _39;
}
scope 12 {
}
}
scope 10 {
}
}
}
}
}
}
}
}
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
StorageLive(_5);
_69 = const _;
_5 = &(*_69);
_4 = &(*_5);
_3 = move _4 as &dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_4);
_2 = &raw const (*_3);
_1 = move _2 as *const dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_2);
StorageDead(_5);
StorageDead(_3);
- StorageLive(_7);
+ nop;
StorageLive(_8);
StorageLive(_9);
StorageLive(_10);
StorageLive(_11);
_68 = const _;
_11 = &(*_68);
_10 = &(*_11);
_9 = move _10 as &dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_10);
_8 = &raw const (*_9);
_7 = move _8 as *const dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_8);
StorageDead(_11);
StorageDead(_9);
StorageLive(_13);
StorageLive(_14);
_14 = _1;
- StorageLive(_15);
+ nop;
StorageLive(_16);
_16 = _7;
- _15 = move _16 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _15 = _7 as *const dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_16);
- _13 = Eq(move _14, move _15);
- StorageDead(_15);
+ _13 = Eq(_1, _15);
+ nop;
StorageDead(_14);
StorageLive(_17);
StorageLive(_18);
_18 = _1;
StorageLive(_19);
StorageLive(_20);
_20 = _7;
- _19 = move _20 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _19 = _15;
StorageDead(_20);
- _17 = Ne(move _18, move _19);
+ _17 = Ne(_1, _15);
StorageDead(_19);
StorageDead(_18);
StorageLive(_21);
StorageLive(_22);
_22 = _1;
StorageLive(_23);
StorageLive(_24);
_24 = _7;
- _23 = move _24 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _23 = _15;
StorageDead(_24);
- _21 = Lt(move _22, move _23);
+ _21 = Lt(_1, _15);
StorageDead(_23);
StorageDead(_22);
StorageLive(_25);
StorageLive(_26);
_26 = _1;
StorageLive(_27);
StorageLive(_28);
_28 = _7;
- _27 = move _28 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _27 = _15;
StorageDead(_28);
- _25 = Le(move _26, move _27);
+ _25 = Le(_1, _15);
StorageDead(_27);
StorageDead(_26);
StorageLive(_29);
StorageLive(_30);
_30 = _1;
StorageLive(_31);
StorageLive(_32);
_32 = _7;
- _31 = move _32 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _31 = _15;
StorageDead(_32);
- _29 = Gt(move _30, move _31);
+ _29 = Gt(_1, _15);
StorageDead(_31);
StorageDead(_30);
StorageLive(_33);
StorageLive(_34);
_34 = _1;
StorageLive(_35);
StorageLive(_36);
_36 = _7;
- _35 = move _36 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _35 = _15;
StorageDead(_36);
- _33 = Ge(move _34, move _35);
+ _33 = Ge(_1, _15);
StorageDead(_35);
StorageDead(_34);
- StorageLive(_37);
+ nop;
StorageLive(_38);
- _38 = (const 1_usize, const 1_usize);
- _37 = move _38 as *const [u8] (Transmute);
+ _38 = const (1_usize, 1_usize);
+ _37 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageDead(_38);
- StorageLive(_39);
+ nop;
StorageLive(_40);
- _40 = (const 1_usize, const 2_usize);
- _39 = move _40 as *const [u8] (Transmute);
+ _40 = const (1_usize, 2_usize);
+ _39 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
StorageDead(_40);
StorageLive(_41);
- StorageLive(_42);
+ nop;
StorageLive(_43);
StorageLive(_44);
- _44 = _37;
+ _44 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_45);
- _45 = _39;
- _43 = Eq(move _44, move _45);
+ _45 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _43 = Eq(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]);
StorageDead(_45);
StorageDead(_44);
_42 = Not(move _43);
StorageDead(_43);
- _41 = opaque::<bool>(move _42) -> [return: bb1, unwind continue];
+ _41 = opaque::<bool>(_42) -> [return: bb1, unwind continue];
}
bb1: {
- StorageDead(_42);
+ nop;
StorageDead(_41);
StorageLive(_46);
StorageLive(_47);
StorageLive(_48);
- _48 = _37;
+ _48 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_49);
- _49 = _39;
- _47 = Ne(move _48, move _49);
+ _49 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _47 = _42;
StorageDead(_49);
StorageDead(_48);
- _46 = opaque::<bool>(move _47) -> [return: bb2, unwind continue];
+ _46 = opaque::<bool>(_42) -> [return: bb2, unwind continue];
}
bb2: {
StorageDead(_47);
StorageDead(_46);
StorageLive(_50);
StorageLive(_51);
StorageLive(_52);
- _52 = _37;
+ _52 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_53);
- _53 = _39;
- _51 = Le(move _52, move _53);
+ _53 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _51 = Le(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]);
StorageDead(_53);
StorageDead(_52);
_50 = opaque::<bool>(move _51) -> [return: bb3, unwind continue];
}
bb3: {
StorageDead(_51);
StorageDead(_50);
StorageLive(_54);
StorageLive(_55);
StorageLive(_56);
- _56 = _37;
+ _56 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_57);
- _57 = _39;
- _55 = Lt(move _56, move _57);
+ _57 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _55 = Lt(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]);
StorageDead(_57);
StorageDead(_56);
_54 = opaque::<bool>(move _55) -> [return: bb4, unwind continue];
}
bb4: {
StorageDead(_55);
StorageDead(_54);
StorageLive(_58);
StorageLive(_59);
StorageLive(_60);
StorageLive(_61);
- _61 = _37;
+ _61 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_62);
- _62 = _39;
- _60 = Ge(move _61, move _62);
+ _62 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _60 = Ge(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]);
StorageDead(_62);
StorageDead(_61);
_59 = Not(move _60);
StorageDead(_60);
_58 = opaque::<bool>(move _59) -> [return: bb5, unwind continue];
}
bb5: {
StorageDead(_59);
StorageDead(_58);
StorageLive(_63);
StorageLive(_64);
StorageLive(_65);
StorageLive(_66);
- _66 = _37;
+ _66 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8];
StorageLive(_67);
- _67 = _39;
- _65 = Gt(move _66, move _67);
+ _67 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8];
+ _65 = Gt(const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8], const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]);
StorageDead(_67);
StorageDead(_66);
_64 = Not(move _65);
StorageDead(_65);
_63 = opaque::<bool>(move _64) -> [return: bb6, unwind continue];
}
bb6: {
StorageDead(_64);
StorageDead(_63);
_0 = const ();
- StorageDead(_39);
- StorageDead(_37);
+ nop;
+ nop;
StorageDead(_33);
StorageDead(_29);
StorageDead(_25);
StorageDead(_21);
StorageDead(_17);
StorageDead(_13);
- StorageDead(_7);
- StorageDead(_1);
+ nop;
+ nop;
return;
}
+ }
+
+ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ ................
}

View file

@ -0,0 +1,232 @@
- // MIR for `wide_ptr_provenance` before GVN
+ // MIR for `wide_ptr_provenance` after GVN
fn wide_ptr_provenance() -> () {
let mut _0: ();
let _1: *const dyn std::marker::Send;
let mut _2: *const dyn std::marker::Send;
let _3: &dyn std::marker::Send;
let mut _4: &i32;
let _5: &i32;
let _6: i32;
let mut _8: *const dyn std::marker::Send;
let _9: &dyn std::marker::Send;
let mut _10: &i32;
let _11: &i32;
let _12: i32;
let _13: ();
let mut _14: bool;
let mut _15: *const dyn std::marker::Send;
let mut _16: *const dyn std::marker::Send;
let mut _17: *const dyn std::marker::Send;
let _18: ();
let mut _19: bool;
let mut _20: *const dyn std::marker::Send;
let mut _21: *const dyn std::marker::Send;
let mut _22: *const dyn std::marker::Send;
let _23: ();
let mut _24: bool;
let mut _25: *const dyn std::marker::Send;
let mut _26: *const dyn std::marker::Send;
let mut _27: *const dyn std::marker::Send;
let _28: ();
let mut _29: bool;
let mut _30: *const dyn std::marker::Send;
let mut _31: *const dyn std::marker::Send;
let mut _32: *const dyn std::marker::Send;
let _33: ();
let mut _34: bool;
let mut _35: *const dyn std::marker::Send;
let mut _36: *const dyn std::marker::Send;
let mut _37: *const dyn std::marker::Send;
let _38: ();
let mut _39: bool;
let mut _40: *const dyn std::marker::Send;
let mut _41: *const dyn std::marker::Send;
let mut _42: *const dyn std::marker::Send;
let mut _44: &i32;
scope 1 {
debug a => _1;
let _7: *const dyn std::marker::Send;
let mut _43: &i32;
scope 2 {
debug b => _7;
}
}
bb0: {
StorageLive(_1);
- StorageLive(_2);
+ nop;
StorageLive(_3);
StorageLive(_4);
StorageLive(_5);
_44 = const _;
_5 = &(*_44);
_4 = &(*_5);
_3 = move _4 as &dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_4);
_2 = &raw const (*_3);
- _1 = move _2 as *const dyn std::marker::Send (PointerCoercion(Unsize));
- StorageDead(_2);
+ _1 = _2;
+ nop;
StorageDead(_5);
StorageDead(_3);
StorageLive(_7);
- StorageLive(_8);
+ nop;
StorageLive(_9);
StorageLive(_10);
StorageLive(_11);
_43 = const _;
_11 = &(*_43);
_10 = &(*_11);
_9 = move _10 as &dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_10);
_8 = &raw const (*_9);
- _7 = move _8 as *const dyn std::marker::Send (PointerCoercion(Unsize));
- StorageDead(_8);
+ _7 = _8;
+ nop;
StorageDead(_11);
StorageDead(_9);
StorageLive(_13);
StorageLive(_14);
StorageLive(_15);
- _15 = _1;
+ _15 = _2;
StorageLive(_16);
StorageLive(_17);
- _17 = _7;
- _16 = move _17 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _17 = _8;
+ _16 = _8;
StorageDead(_17);
- _14 = Eq(move _15, move _16);
+ _14 = Eq(_2, _8);
StorageDead(_16);
StorageDead(_15);
_13 = opaque::<bool>(move _14) -> [return: bb1, unwind unreachable];
}
bb1: {
StorageDead(_14);
StorageDead(_13);
StorageLive(_18);
StorageLive(_19);
StorageLive(_20);
- _20 = _1;
+ _20 = _2;
StorageLive(_21);
StorageLive(_22);
- _22 = _7;
- _21 = move _22 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _22 = _8;
+ _21 = _8;
StorageDead(_22);
- _19 = Ne(move _20, move _21);
+ _19 = Ne(_2, _8);
StorageDead(_21);
StorageDead(_20);
_18 = opaque::<bool>(move _19) -> [return: bb2, unwind unreachable];
}
bb2: {
StorageDead(_19);
StorageDead(_18);
StorageLive(_23);
StorageLive(_24);
StorageLive(_25);
- _25 = _1;
+ _25 = _2;
StorageLive(_26);
StorageLive(_27);
- _27 = _7;
- _26 = move _27 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _27 = _8;
+ _26 = _8;
StorageDead(_27);
- _24 = Lt(move _25, move _26);
+ _24 = Lt(_2, _8);
StorageDead(_26);
StorageDead(_25);
_23 = opaque::<bool>(move _24) -> [return: bb3, unwind unreachable];
}
bb3: {
StorageDead(_24);
StorageDead(_23);
StorageLive(_28);
StorageLive(_29);
StorageLive(_30);
- _30 = _1;
+ _30 = _2;
StorageLive(_31);
StorageLive(_32);
- _32 = _7;
- _31 = move _32 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _32 = _8;
+ _31 = _8;
StorageDead(_32);
- _29 = Le(move _30, move _31);
+ _29 = Le(_2, _8);
StorageDead(_31);
StorageDead(_30);
_28 = opaque::<bool>(move _29) -> [return: bb4, unwind unreachable];
}
bb4: {
StorageDead(_29);
StorageDead(_28);
StorageLive(_33);
StorageLive(_34);
StorageLive(_35);
- _35 = _1;
+ _35 = _2;
StorageLive(_36);
StorageLive(_37);
- _37 = _7;
- _36 = move _37 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _37 = _8;
+ _36 = _8;
StorageDead(_37);
- _34 = Gt(move _35, move _36);
+ _34 = Gt(_2, _8);
StorageDead(_36);
StorageDead(_35);
_33 = opaque::<bool>(move _34) -> [return: bb5, unwind unreachable];
}
bb5: {
StorageDead(_34);
StorageDead(_33);
StorageLive(_38);
StorageLive(_39);
StorageLive(_40);
- _40 = _1;
+ _40 = _2;
StorageLive(_41);
StorageLive(_42);
- _42 = _7;
- _41 = move _42 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _42 = _8;
+ _41 = _8;
StorageDead(_42);
- _39 = Ge(move _40, move _41);
+ _39 = Ge(_2, _8);
StorageDead(_41);
StorageDead(_40);
_38 = opaque::<bool>(move _39) -> [return: bb6, unwind unreachable];
}
bb6: {
StorageDead(_39);
StorageDead(_38);
_0 = const ();
StorageDead(_7);
StorageDead(_1);
return;
}
}

View file

@ -0,0 +1,232 @@
- // MIR for `wide_ptr_provenance` before GVN
+ // MIR for `wide_ptr_provenance` after GVN
fn wide_ptr_provenance() -> () {
let mut _0: ();
let _1: *const dyn std::marker::Send;
let mut _2: *const dyn std::marker::Send;
let _3: &dyn std::marker::Send;
let mut _4: &i32;
let _5: &i32;
let _6: i32;
let mut _8: *const dyn std::marker::Send;
let _9: &dyn std::marker::Send;
let mut _10: &i32;
let _11: &i32;
let _12: i32;
let _13: ();
let mut _14: bool;
let mut _15: *const dyn std::marker::Send;
let mut _16: *const dyn std::marker::Send;
let mut _17: *const dyn std::marker::Send;
let _18: ();
let mut _19: bool;
let mut _20: *const dyn std::marker::Send;
let mut _21: *const dyn std::marker::Send;
let mut _22: *const dyn std::marker::Send;
let _23: ();
let mut _24: bool;
let mut _25: *const dyn std::marker::Send;
let mut _26: *const dyn std::marker::Send;
let mut _27: *const dyn std::marker::Send;
let _28: ();
let mut _29: bool;
let mut _30: *const dyn std::marker::Send;
let mut _31: *const dyn std::marker::Send;
let mut _32: *const dyn std::marker::Send;
let _33: ();
let mut _34: bool;
let mut _35: *const dyn std::marker::Send;
let mut _36: *const dyn std::marker::Send;
let mut _37: *const dyn std::marker::Send;
let _38: ();
let mut _39: bool;
let mut _40: *const dyn std::marker::Send;
let mut _41: *const dyn std::marker::Send;
let mut _42: *const dyn std::marker::Send;
let mut _44: &i32;
scope 1 {
debug a => _1;
let _7: *const dyn std::marker::Send;
let mut _43: &i32;
scope 2 {
debug b => _7;
}
}
bb0: {
StorageLive(_1);
- StorageLive(_2);
+ nop;
StorageLive(_3);
StorageLive(_4);
StorageLive(_5);
_44 = const _;
_5 = &(*_44);
_4 = &(*_5);
_3 = move _4 as &dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_4);
_2 = &raw const (*_3);
- _1 = move _2 as *const dyn std::marker::Send (PointerCoercion(Unsize));
- StorageDead(_2);
+ _1 = _2;
+ nop;
StorageDead(_5);
StorageDead(_3);
StorageLive(_7);
- StorageLive(_8);
+ nop;
StorageLive(_9);
StorageLive(_10);
StorageLive(_11);
_43 = const _;
_11 = &(*_43);
_10 = &(*_11);
_9 = move _10 as &dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_10);
_8 = &raw const (*_9);
- _7 = move _8 as *const dyn std::marker::Send (PointerCoercion(Unsize));
- StorageDead(_8);
+ _7 = _8;
+ nop;
StorageDead(_11);
StorageDead(_9);
StorageLive(_13);
StorageLive(_14);
StorageLive(_15);
- _15 = _1;
+ _15 = _2;
StorageLive(_16);
StorageLive(_17);
- _17 = _7;
- _16 = move _17 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _17 = _8;
+ _16 = _8;
StorageDead(_17);
- _14 = Eq(move _15, move _16);
+ _14 = Eq(_2, _8);
StorageDead(_16);
StorageDead(_15);
_13 = opaque::<bool>(move _14) -> [return: bb1, unwind continue];
}
bb1: {
StorageDead(_14);
StorageDead(_13);
StorageLive(_18);
StorageLive(_19);
StorageLive(_20);
- _20 = _1;
+ _20 = _2;
StorageLive(_21);
StorageLive(_22);
- _22 = _7;
- _21 = move _22 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _22 = _8;
+ _21 = _8;
StorageDead(_22);
- _19 = Ne(move _20, move _21);
+ _19 = Ne(_2, _8);
StorageDead(_21);
StorageDead(_20);
_18 = opaque::<bool>(move _19) -> [return: bb2, unwind continue];
}
bb2: {
StorageDead(_19);
StorageDead(_18);
StorageLive(_23);
StorageLive(_24);
StorageLive(_25);
- _25 = _1;
+ _25 = _2;
StorageLive(_26);
StorageLive(_27);
- _27 = _7;
- _26 = move _27 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _27 = _8;
+ _26 = _8;
StorageDead(_27);
- _24 = Lt(move _25, move _26);
+ _24 = Lt(_2, _8);
StorageDead(_26);
StorageDead(_25);
_23 = opaque::<bool>(move _24) -> [return: bb3, unwind continue];
}
bb3: {
StorageDead(_24);
StorageDead(_23);
StorageLive(_28);
StorageLive(_29);
StorageLive(_30);
- _30 = _1;
+ _30 = _2;
StorageLive(_31);
StorageLive(_32);
- _32 = _7;
- _31 = move _32 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _32 = _8;
+ _31 = _8;
StorageDead(_32);
- _29 = Le(move _30, move _31);
+ _29 = Le(_2, _8);
StorageDead(_31);
StorageDead(_30);
_28 = opaque::<bool>(move _29) -> [return: bb4, unwind continue];
}
bb4: {
StorageDead(_29);
StorageDead(_28);
StorageLive(_33);
StorageLive(_34);
StorageLive(_35);
- _35 = _1;
+ _35 = _2;
StorageLive(_36);
StorageLive(_37);
- _37 = _7;
- _36 = move _37 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _37 = _8;
+ _36 = _8;
StorageDead(_37);
- _34 = Gt(move _35, move _36);
+ _34 = Gt(_2, _8);
StorageDead(_36);
StorageDead(_35);
_33 = opaque::<bool>(move _34) -> [return: bb5, unwind continue];
}
bb5: {
StorageDead(_34);
StorageDead(_33);
StorageLive(_38);
StorageLive(_39);
StorageLive(_40);
- _40 = _1;
+ _40 = _2;
StorageLive(_41);
StorageLive(_42);
- _42 = _7;
- _41 = move _42 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _42 = _8;
+ _41 = _8;
StorageDead(_42);
- _39 = Ge(move _40, move _41);
+ _39 = Ge(_2, _8);
StorageDead(_41);
StorageDead(_40);
_38 = opaque::<bool>(move _39) -> [return: bb6, unwind continue];
}
bb6: {
StorageDead(_39);
StorageDead(_38);
_0 = const ();
StorageDead(_7);
StorageDead(_1);
return;
}
}

View file

@ -0,0 +1,268 @@
- // MIR for `wide_ptr_same_provenance` before GVN
+ // MIR for `wide_ptr_same_provenance` after GVN
fn wide_ptr_same_provenance() -> () {
let mut _0: ();
let _1: &[i32; 2];
let _2: [i32; 2];
let mut _4: *const dyn std::marker::Send;
let _5: &dyn std::marker::Send;
let mut _6: &i32;
let _7: &i32;
let _8: usize;
let mut _9: usize;
let mut _10: bool;
let mut _12: *const dyn std::marker::Send;
let _13: &dyn std::marker::Send;
let mut _14: &i32;
let _15: &i32;
let _16: usize;
let mut _17: usize;
let mut _18: bool;
let _19: ();
let mut _20: bool;
let mut _21: *const dyn std::marker::Send;
let mut _22: *const dyn std::marker::Send;
let mut _23: *const dyn std::marker::Send;
let _24: ();
let mut _25: bool;
let mut _26: *const dyn std::marker::Send;
let mut _27: *const dyn std::marker::Send;
let mut _28: *const dyn std::marker::Send;
let _29: ();
let mut _30: bool;
let mut _31: *const dyn std::marker::Send;
let mut _32: *const dyn std::marker::Send;
let mut _33: *const dyn std::marker::Send;
let _34: ();
let mut _35: bool;
let mut _36: *const dyn std::marker::Send;
let mut _37: *const dyn std::marker::Send;
let mut _38: *const dyn std::marker::Send;
let _39: ();
let mut _40: bool;
let mut _41: *const dyn std::marker::Send;
let mut _42: *const dyn std::marker::Send;
let mut _43: *const dyn std::marker::Send;
let _44: ();
let mut _45: bool;
let mut _46: *const dyn std::marker::Send;
let mut _47: *const dyn std::marker::Send;
let mut _48: *const dyn std::marker::Send;
let mut _49: &[i32; 2];
scope 1 {
debug slice => _1;
let _3: *const dyn std::marker::Send;
scope 2 {
debug a => _3;
let _11: *const dyn std::marker::Send;
scope 3 {
debug b => _11;
}
}
}
bb0: {
StorageLive(_1);
_49 = const _;
_1 = &(*_49);
StorageLive(_3);
- StorageLive(_4);
+ nop;
StorageLive(_5);
StorageLive(_6);
StorageLive(_7);
StorageLive(_8);
_8 = const 0_usize;
- _9 = Len((*_1));
- _10 = Lt(_8, _9);
- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb1, unwind unreachable];
+ _9 = const 2_usize;
+ _10 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 2_usize, const 0_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
- _7 = &(*_1)[_8];
+ _7 = &(*_1)[0 of 1];
_6 = &(*_7);
_5 = move _6 as &dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_6);
_4 = &raw const (*_5);
- _3 = move _4 as *const dyn std::marker::Send (PointerCoercion(Unsize));
- StorageDead(_4);
+ _3 = _4;
+ nop;
StorageDead(_7);
StorageDead(_5);
StorageLive(_11);
- StorageLive(_12);
+ nop;
StorageLive(_13);
StorageLive(_14);
StorageLive(_15);
StorageLive(_16);
_16 = const 1_usize;
- _17 = Len((*_1));
- _18 = Lt(_16, _17);
- assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb2, unwind unreachable];
+ _17 = const 2_usize;
+ _18 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 2_usize, const 1_usize) -> [success: bb2, unwind unreachable];
}
bb2: {
- _15 = &(*_1)[_16];
+ _15 = &(*_1)[1 of 2];
_14 = &(*_15);
_13 = move _14 as &dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_14);
_12 = &raw const (*_13);
- _11 = move _12 as *const dyn std::marker::Send (PointerCoercion(Unsize));
- StorageDead(_12);
+ _11 = _12;
+ nop;
StorageDead(_15);
StorageDead(_13);
StorageLive(_19);
StorageLive(_20);
StorageLive(_21);
- _21 = _3;
+ _21 = _4;
StorageLive(_22);
StorageLive(_23);
- _23 = _11;
- _22 = move _23 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _23 = _12;
+ _22 = _12;
StorageDead(_23);
- _20 = Eq(move _21, move _22);
+ _20 = Eq(_4, _12);
StorageDead(_22);
StorageDead(_21);
_19 = opaque::<bool>(move _20) -> [return: bb3, unwind unreachable];
}
bb3: {
StorageDead(_20);
StorageDead(_19);
StorageLive(_24);
StorageLive(_25);
StorageLive(_26);
- _26 = _3;
+ _26 = _4;
StorageLive(_27);
StorageLive(_28);
- _28 = _11;
- _27 = move _28 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _28 = _12;
+ _27 = _12;
StorageDead(_28);
- _25 = Ne(move _26, move _27);
+ _25 = Ne(_4, _12);
StorageDead(_27);
StorageDead(_26);
_24 = opaque::<bool>(move _25) -> [return: bb4, unwind unreachable];
}
bb4: {
StorageDead(_25);
StorageDead(_24);
StorageLive(_29);
StorageLive(_30);
StorageLive(_31);
- _31 = _3;
+ _31 = _4;
StorageLive(_32);
StorageLive(_33);
- _33 = _11;
- _32 = move _33 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _33 = _12;
+ _32 = _12;
StorageDead(_33);
- _30 = Lt(move _31, move _32);
+ _30 = Lt(_4, _12);
StorageDead(_32);
StorageDead(_31);
_29 = opaque::<bool>(move _30) -> [return: bb5, unwind unreachable];
}
bb5: {
StorageDead(_30);
StorageDead(_29);
StorageLive(_34);
StorageLive(_35);
StorageLive(_36);
- _36 = _3;
+ _36 = _4;
StorageLive(_37);
StorageLive(_38);
- _38 = _11;
- _37 = move _38 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _38 = _12;
+ _37 = _12;
StorageDead(_38);
- _35 = Le(move _36, move _37);
+ _35 = Le(_4, _12);
StorageDead(_37);
StorageDead(_36);
_34 = opaque::<bool>(move _35) -> [return: bb6, unwind unreachable];
}
bb6: {
StorageDead(_35);
StorageDead(_34);
StorageLive(_39);
StorageLive(_40);
StorageLive(_41);
- _41 = _3;
+ _41 = _4;
StorageLive(_42);
StorageLive(_43);
- _43 = _11;
- _42 = move _43 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _43 = _12;
+ _42 = _12;
StorageDead(_43);
- _40 = Gt(move _41, move _42);
+ _40 = Gt(_4, _12);
StorageDead(_42);
StorageDead(_41);
_39 = opaque::<bool>(move _40) -> [return: bb7, unwind unreachable];
}
bb7: {
StorageDead(_40);
StorageDead(_39);
StorageLive(_44);
StorageLive(_45);
StorageLive(_46);
- _46 = _3;
+ _46 = _4;
StorageLive(_47);
StorageLive(_48);
- _48 = _11;
- _47 = move _48 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _48 = _12;
+ _47 = _12;
StorageDead(_48);
- _45 = Ge(move _46, move _47);
+ _45 = Ge(_4, _12);
StorageDead(_47);
StorageDead(_46);
_44 = opaque::<bool>(move _45) -> [return: bb8, unwind unreachable];
}
bb8: {
StorageDead(_45);
StorageDead(_44);
_0 = const ();
StorageDead(_16);
StorageDead(_11);
StorageDead(_8);
StorageDead(_3);
StorageDead(_1);
return;
}
}

View file

@ -0,0 +1,268 @@
- // MIR for `wide_ptr_same_provenance` before GVN
+ // MIR for `wide_ptr_same_provenance` after GVN
fn wide_ptr_same_provenance() -> () {
let mut _0: ();
let _1: &[i32; 2];
let _2: [i32; 2];
let mut _4: *const dyn std::marker::Send;
let _5: &dyn std::marker::Send;
let mut _6: &i32;
let _7: &i32;
let _8: usize;
let mut _9: usize;
let mut _10: bool;
let mut _12: *const dyn std::marker::Send;
let _13: &dyn std::marker::Send;
let mut _14: &i32;
let _15: &i32;
let _16: usize;
let mut _17: usize;
let mut _18: bool;
let _19: ();
let mut _20: bool;
let mut _21: *const dyn std::marker::Send;
let mut _22: *const dyn std::marker::Send;
let mut _23: *const dyn std::marker::Send;
let _24: ();
let mut _25: bool;
let mut _26: *const dyn std::marker::Send;
let mut _27: *const dyn std::marker::Send;
let mut _28: *const dyn std::marker::Send;
let _29: ();
let mut _30: bool;
let mut _31: *const dyn std::marker::Send;
let mut _32: *const dyn std::marker::Send;
let mut _33: *const dyn std::marker::Send;
let _34: ();
let mut _35: bool;
let mut _36: *const dyn std::marker::Send;
let mut _37: *const dyn std::marker::Send;
let mut _38: *const dyn std::marker::Send;
let _39: ();
let mut _40: bool;
let mut _41: *const dyn std::marker::Send;
let mut _42: *const dyn std::marker::Send;
let mut _43: *const dyn std::marker::Send;
let _44: ();
let mut _45: bool;
let mut _46: *const dyn std::marker::Send;
let mut _47: *const dyn std::marker::Send;
let mut _48: *const dyn std::marker::Send;
let mut _49: &[i32; 2];
scope 1 {
debug slice => _1;
let _3: *const dyn std::marker::Send;
scope 2 {
debug a => _3;
let _11: *const dyn std::marker::Send;
scope 3 {
debug b => _11;
}
}
}
bb0: {
StorageLive(_1);
_49 = const _;
_1 = &(*_49);
StorageLive(_3);
- StorageLive(_4);
+ nop;
StorageLive(_5);
StorageLive(_6);
StorageLive(_7);
StorageLive(_8);
_8 = const 0_usize;
- _9 = Len((*_1));
- _10 = Lt(_8, _9);
- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb1, unwind continue];
+ _9 = const 2_usize;
+ _10 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 2_usize, const 0_usize) -> [success: bb1, unwind continue];
}
bb1: {
- _7 = &(*_1)[_8];
+ _7 = &(*_1)[0 of 1];
_6 = &(*_7);
_5 = move _6 as &dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_6);
_4 = &raw const (*_5);
- _3 = move _4 as *const dyn std::marker::Send (PointerCoercion(Unsize));
- StorageDead(_4);
+ _3 = _4;
+ nop;
StorageDead(_7);
StorageDead(_5);
StorageLive(_11);
- StorageLive(_12);
+ nop;
StorageLive(_13);
StorageLive(_14);
StorageLive(_15);
StorageLive(_16);
_16 = const 1_usize;
- _17 = Len((*_1));
- _18 = Lt(_16, _17);
- assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb2, unwind continue];
+ _17 = const 2_usize;
+ _18 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 2_usize, const 1_usize) -> [success: bb2, unwind continue];
}
bb2: {
- _15 = &(*_1)[_16];
+ _15 = &(*_1)[1 of 2];
_14 = &(*_15);
_13 = move _14 as &dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_14);
_12 = &raw const (*_13);
- _11 = move _12 as *const dyn std::marker::Send (PointerCoercion(Unsize));
- StorageDead(_12);
+ _11 = _12;
+ nop;
StorageDead(_15);
StorageDead(_13);
StorageLive(_19);
StorageLive(_20);
StorageLive(_21);
- _21 = _3;
+ _21 = _4;
StorageLive(_22);
StorageLive(_23);
- _23 = _11;
- _22 = move _23 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _23 = _12;
+ _22 = _12;
StorageDead(_23);
- _20 = Eq(move _21, move _22);
+ _20 = Eq(_4, _12);
StorageDead(_22);
StorageDead(_21);
_19 = opaque::<bool>(move _20) -> [return: bb3, unwind continue];
}
bb3: {
StorageDead(_20);
StorageDead(_19);
StorageLive(_24);
StorageLive(_25);
StorageLive(_26);
- _26 = _3;
+ _26 = _4;
StorageLive(_27);
StorageLive(_28);
- _28 = _11;
- _27 = move _28 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _28 = _12;
+ _27 = _12;
StorageDead(_28);
- _25 = Ne(move _26, move _27);
+ _25 = Ne(_4, _12);
StorageDead(_27);
StorageDead(_26);
_24 = opaque::<bool>(move _25) -> [return: bb4, unwind continue];
}
bb4: {
StorageDead(_25);
StorageDead(_24);
StorageLive(_29);
StorageLive(_30);
StorageLive(_31);
- _31 = _3;
+ _31 = _4;
StorageLive(_32);
StorageLive(_33);
- _33 = _11;
- _32 = move _33 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _33 = _12;
+ _32 = _12;
StorageDead(_33);
- _30 = Lt(move _31, move _32);
+ _30 = Lt(_4, _12);
StorageDead(_32);
StorageDead(_31);
_29 = opaque::<bool>(move _30) -> [return: bb5, unwind continue];
}
bb5: {
StorageDead(_30);
StorageDead(_29);
StorageLive(_34);
StorageLive(_35);
StorageLive(_36);
- _36 = _3;
+ _36 = _4;
StorageLive(_37);
StorageLive(_38);
- _38 = _11;
- _37 = move _38 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _38 = _12;
+ _37 = _12;
StorageDead(_38);
- _35 = Le(move _36, move _37);
+ _35 = Le(_4, _12);
StorageDead(_37);
StorageDead(_36);
_34 = opaque::<bool>(move _35) -> [return: bb6, unwind continue];
}
bb6: {
StorageDead(_35);
StorageDead(_34);
StorageLive(_39);
StorageLive(_40);
StorageLive(_41);
- _41 = _3;
+ _41 = _4;
StorageLive(_42);
StorageLive(_43);
- _43 = _11;
- _42 = move _43 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _43 = _12;
+ _42 = _12;
StorageDead(_43);
- _40 = Gt(move _41, move _42);
+ _40 = Gt(_4, _12);
StorageDead(_42);
StorageDead(_41);
_39 = opaque::<bool>(move _40) -> [return: bb7, unwind continue];
}
bb7: {
StorageDead(_40);
StorageDead(_39);
StorageLive(_44);
StorageLive(_45);
StorageLive(_46);
- _46 = _3;
+ _46 = _4;
StorageLive(_47);
StorageLive(_48);
- _48 = _11;
- _47 = move _48 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ _48 = _12;
+ _47 = _12;
StorageDead(_48);
- _45 = Ge(move _46, move _47);
+ _45 = Ge(_4, _12);
StorageDead(_47);
StorageDead(_46);
_44 = opaque::<bool>(move _45) -> [return: bb8, unwind continue];
}
bb8: {
StorageDead(_45);
StorageDead(_44);
_0 = const ();
StorageDead(_16);
StorageDead(_11);
StorageDead(_8);
StorageDead(_3);
StorageDead(_1);
return;
}
}

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;
}