diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs index 1f55fd49fc86b..08c885d78e7b9 100644 --- a/compiler/rustc_hir_typeck/src/coercion.rs +++ b/compiler/rustc_hir_typeck/src/coercion.rs @@ -505,25 +505,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { } }; - if coerced_a == a && mt_a.mutbl.is_not() && autoderef.step_count() == 1 { - // As a special case, if we would produce `&'a *x`, that's - // a total no-op. We end up with the type `&'a T` just as - // we started with. In that case, just skip it altogether. - // - // Unfortunately, this can actually effect capture analysis - // which in turn means this effects borrow checking. This can - // also effect diagnostics. - // FIXME(BoxyUwU): we should always emit reborrow coercions - // - // Note that for `&mut`, we DO want to reborrow -- - // otherwise, this would be a move, which might be an - // error. For example `foo(self.x)` where `self` and - // `self.x` both have `&mut `type would be a move of - // `self.x`, but we auto-coerce it to `foo(&mut *self.x)`, - // which is a borrow. - assert!(mutbl_b.is_not()); // can only coerce &T -> &U - return success(vec![], coerced_a, obligations); - } + let autoderef_step_count = autoderef.step_count(); let InferOk { value: mut adjustments, obligations: o } = self.adjust_steps_as_infer_ok(&autoderef); @@ -536,10 +518,45 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { coerced_a ); - // Now apply the autoref - let mutbl = AutoBorrowMutability::new(mutbl_b, self.allow_two_phase); - adjustments - .push(Adjustment { kind: Adjust::Borrow(AutoBorrow::Ref(mutbl)), target: coerced_a }); + // As a special case, if we would produce `&'a *x`, that's + // a total no-op. We end up with the type `&'a T` just as + // we started with. In that case, just skip it altogether. + // + // FIXME: Ideally we would also skip `&mut` -> `&mut` reborrow, + // and handle that in MIR. + let can_skip_noop_reborrow = mutbl_b.is_not() + && if self.tcx.is_closure_like(self.body_def_id.to_def_id()) { + // FIXME: Inside a closure, reborrows can affect capture inference. + // So we have to keep the existing elision behavior stable. + // Ideally we wouldn't have to do this, it makes lifetime + // annotations affect codegen + coerced_a == a && autoderef_step_count == 1 + } else { + if let Some(Adjustment { kind: Adjust::Deref(DerefAdjustKind::Builtin), .. }) = + adjustments.last() + // Check type before the last deref adjustment + && let ty::Ref(_, _, ty::Mutability::Not) = if adjustments.len() >= 2 { + *adjustments[adjustments.len() - 2].target.kind() + } else { + ty::Ref(r_a, mt_a.ty, mt_a.mutbl) + } + { + true + } else { + false + } + }; + + if can_skip_noop_reborrow { + adjustments.pop(); + } else { + // Now apply the autoref + let mutbl = AutoBorrowMutability::new(mutbl_b, self.allow_two_phase); + adjustments.push(Adjustment { + kind: Adjust::Borrow(AutoBorrow::Ref(mutbl)), + target: coerced_a, + }); + } debug!("coerce_to_ref: succeeded coerced_a={:?} adjustments={:?}", coerced_a, adjustments); @@ -630,6 +647,16 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { // Handle reborrows before selecting `Source: CoerceUnsized`. let reborrow = match (source.kind(), target.kind()) { + // Don't emit a no-op shared -> shared reborrow. + (&ty::Ref(_, _, ty::Mutability::Not), &ty::Ref(_, _, ty::Mutability::Not)) + // FIXME: Inside a closure, reborrows can affect capture inference. + // So we have to emit them anyway. + // Ideally we wouldn't have to do this, it makes lifetime + // annotations affect codegen + if !self.tcx.is_closure_like(self.body_def_id.to_def_id()) => + { + None + } (&ty::Ref(_, ty_a, mutbl_a), &ty::Ref(_, _, mutbl_b)) => { coerce_mutbls(mutbl_a, mutbl_b)?; diff --git a/compiler/rustc_mir_build/src/thir/cx/expr.rs b/compiler/rustc_mir_build/src/thir/cx/expr.rs index e38e9293ba196..4fb113fd379e5 100644 --- a/compiler/rustc_mir_build/src/thir/cx/expr.rs +++ b/compiler/rustc_mir_build/src/thir/cx/expr.rs @@ -249,10 +249,24 @@ impl<'tcx> ThirBuildCx<'tcx> { deref.span, ) } - Adjust::Borrow(AutoBorrow::Ref(m)) => ExprKind::Borrow { - borrow_kind: m.to_borrow_kind(), - arg: self.thir.exprs.push(expr), - }, + Adjust::Borrow(AutoBorrow::Ref(m)) => { + // Don't emit no-op &T -> &T reborrows + if let AutoBorrowMutability::Not = m + && let ExprKind::Deref { arg: derefed_expr } = expr.kind + && let ty::Ref(_, _, ty::Mutability::Not) = + self.thir.exprs[derefed_expr].ty.kind() + // FIXME: reborrows can currently affect closure capture inference + && !self.tcx.is_closure_like(self.body_owner) + { + debug_assert_eq!(self.thir.exprs.last_index(), Some(derefed_expr)); + return self.thir.exprs.pop().unwrap(); + } else { + ExprKind::Borrow { + borrow_kind: m.to_borrow_kind(), + arg: self.thir.exprs.push(expr), + } + } + } Adjust::Borrow(AutoBorrow::RawPtr(mutability)) => { ExprKind::RawBorrow { mutability, arg: self.thir.exprs.push(expr) } } diff --git a/library/alloc/src/vec/spec_extend.rs b/library/alloc/src/vec/spec_extend.rs index 3f9d4504bde4c..96a1c678f961e 100644 --- a/library/alloc/src/vec/spec_extend.rs +++ b/library/alloc/src/vec/spec_extend.rs @@ -52,6 +52,7 @@ impl<'a, T: 'a, A: Allocator> SpecExtend<&'a T, slice::Iter<'a, T>> for Vec) { let slice = iterator.as_slice(); // ignore-tidy-undocumented-unsafe diff --git a/src/tools/clippy/clippy_lints/src/dereference.rs b/src/tools/clippy/clippy_lints/src/dereference.rs index 6257ec51eb8da..b0ad68f4e85eb 100644 --- a/src/tools/clippy/clippy_lints/src/dereference.rs +++ b/src/tools/clippy/clippy_lints/src/dereference.rs @@ -18,7 +18,7 @@ use rustc_hir::{ Node, OwnerId, Pat, PatKind, Path, QPath, TyKind, UnOp, }; use rustc_lint::{LateContext, LateLintPass, impl_lint_pass}; -use rustc_middle::ty::adjustment::{Adjust, Adjustment, AutoBorrow, AutoBorrowMutability}; +use rustc_middle::ty::adjustment::{Adjust, Adjustment, AutoBorrow, AutoBorrowMutability, DerefAdjustKind}; use rustc_middle::ty::{self, AssocTag, Ty, TyCtxt, TypeVisitableExt as _, TypeckResults, Unnormalized}; use rustc_span::{Span, Symbol, SyntaxContext}; use std::borrow::Cow; @@ -350,6 +350,12 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> { None => break None, } }; + if use_site.adjustments.last().is_some_and(|adj| { + matches!(adj.kind, Adjust::Deref(DerefAdjustKind::Builtin)) + && matches!(adj.target.kind(), ty::Ref(_, _, Mutability::Not)) + }) { + deref_count += 1; + } let use_node = use_site.use_node(cx); let stability = use_node.defined_ty(cx).map_or(TyCoercionStability::None, |ty| { @@ -1041,14 +1047,13 @@ impl<'tcx> Dereferencing<'tcx> { [ Adjustment { kind: Adjust::Deref(_), - .. - }, - Adjustment { - kind: Adjust::Deref(_), - .. + target }, - .. - ] + rest @ .. + ] if match rest.first() { + Some(adj) => matches!(adj.kind,Adjust::Deref(_)), + None => matches!(target.kind(), ty::Ref(_, _, Mutability::Not)), + } ) { match get_parent_expr(cx, e) { diff --git a/src/tools/clippy/clippy_lints/src/methods/clone_on_copy.rs b/src/tools/clippy/clippy_lints/src/methods/clone_on_copy.rs index 0891ffda6e7c3..44a0928461a67 100644 --- a/src/tools/clippy/clippy_lints/src/methods/clone_on_copy.rs +++ b/src/tools/clippy/clippy_lints/src/methods/clone_on_copy.rs @@ -6,9 +6,9 @@ use rustc_attr_ir::lang_items::LangItem; use rustc_errors::Applicability; use rustc_hir::{BindingMode, ByRef, Expr, ExprKind, MatchSource, Node, PatKind}; use rustc_lint::LateContext; -use rustc_middle::ty; -use rustc_middle::ty::adjustment::Adjust; +use rustc_middle::ty::adjustment::{Adjust, Adjustment}; use rustc_middle::ty::print::with_forced_trimmed_paths; +use rustc_middle::ty::{self}; use super::CLONE_ON_COPY; @@ -141,11 +141,23 @@ pub(super) fn check_function(cx: &LateContext<'_>, expr: &Expr<'_>) { let snip = snippet_with_context(cx, peeled_arg.span, func.span.ctxt(), "_", &mut app).0; let arg_adjustments = cx.typeck_results().expr_adjustments(arg); - let deref_count = arg_adjustments - .iter() + + let adjustments_iter = &mut arg_adjustments.iter(); + let mut deref_count = adjustments_iter .take_while(|adj| matches!(adj.kind, Adjust::Deref(_))) - .count() - - ref_count; + .count(); + + if !matches!( + adjustments_iter.next(), + Some(Adjustment { + kind: Adjust::Borrow(_), + .. + }) + ) { + deref_count += 1; + } + + deref_count -= ref_count; let (help, sugg) = if deref_count == 0 { if check_res == ParentIsSuffixExpr::Yes && snip.starts_with('*') { diff --git a/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs b/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs index c7e5e58b57afa..4ac7769cff3a9 100644 --- a/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs +++ b/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs @@ -74,8 +74,20 @@ fn check_addr_of_expr( ) -> bool { if let Some(parent) = get_parent_expr(cx, expr) && let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Not, _) = parent.kind - && let adjustments = cx.typeck_results().expr_adjustments(parent).iter().collect::>() - && let + && let adjustments = cx.typeck_results().expr_adjustments(parent) + && let (referent_ty, target_ty) = match *adjustments { + [] if let target_ty = cx.typeck_results().expr_ty_adjusted(parent) && + let &ty::Ref(_, referent_ty, Mutability::Not) = target_ty.kind() => { + (referent_ty, target_ty) + } + [ + Adjustment { + kind: Adjust::Pointer(_), + target: target_ty, + }, + ] if let &ty::Ref(_, referent_ty, Mutability::Not) = cx.typeck_results().expr_ty(parent).kind() => { + (referent_ty, target_ty) + } // For matching uses of `Cow::from` [ Adjustment { @@ -116,9 +128,11 @@ fn check_addr_of_expr( kind: Adjust::Borrow(_), target: target_ty, }, - ] = adjustments[..] + ] => (referent_ty, target_ty), + _ => return false, + } && let receiver_ty = cx.typeck_results().expr_ty(receiver) - && let (target_ty, n_target_refs, _) = peel_and_count_ty_refs(*target_ty) + && let (target_ty, n_target_refs, _) = peel_and_count_ty_refs(target_ty) && let (receiver_ty, n_receiver_refs, _) = peel_and_count_ty_refs(receiver_ty) // Only flag cases satisfying at least one of the following three conditions: // * the referent and receiver types are distinct @@ -129,8 +143,8 @@ fn check_addr_of_expr( // https://github.com/rust-lang/rust-clippy/issues/8759 // Arrays are a bit of a corner case. Non-copyable arrays are handled by // `redundant_clone`, but copyable arrays are not. - && (*referent_ty != receiver_ty - || (matches!(referent_ty.kind(), ty::Array(..)) && is_copy(cx, *referent_ty)) + && (referent_ty != receiver_ty + || (matches!(referent_ty.kind(), ty::Array(..)) && is_copy(cx, referent_ty)) || is_cow_into_owned(cx, method_name, method_parent_id)) { let mut applicability = Applicability::MachineApplicable; diff --git a/src/tools/clippy/clippy_lints/src/redundant_clone.rs b/src/tools/clippy/clippy_lints/src/redundant_clone.rs index 549b786938a4c..eece2c84f549f 100644 --- a/src/tools/clippy/clippy_lints/src/redundant_clone.rs +++ b/src/tools/clippy/clippy_lints/src/redundant_clone.rs @@ -116,11 +116,6 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClone { continue; } - // `{ arg = &cloned; clone(move arg); }` or `{ arg = &cloned; to_path_buf(arg); }` - let Some((cloned, cannot_move_out)) = find_stmt_assigns_to(cx, mir, arg, from_borrow, bb) else { - continue; - }; - let loc = mir::Location { block: bb, statement_index: bbdata.statements.len(), @@ -128,6 +123,11 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClone { // `Local` to be cloned, and a local of `clone` call's destination let (local, ret_local) = if from_borrow { + // `{ arg = &cloned; clone(move arg); }` or `{ arg = &cloned; to_path_buf(arg); }` + let Some((cloned, cannot_move_out)) = find_stmt_assigns_to(cx, mir, arg, from_borrow, bb) else { + continue; + }; + // `res = clone(arg)` can be turned into `res = move arg;` // if `arg` is the only borrow of `cloned` at this point. @@ -149,7 +149,6 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClone { // receiver of the `deref()` call let (pred_arg, deref_clone_ret) = if let Some((pred_fn_def_id, pred_arg, pred_arg_ty, res)) = is_call_with_ref_arg(cx, mir, &pred_terminator.kind) - && res == cloned && cx.tcx.is_diagnostic_item(sym::deref_method, pred_fn_def_id) && let ty::Adt(pred_arg_def, _) = pred_arg_ty.kind() && let Some(pred_arg_name) = cx.tcx.get_diagnostic_name(pred_arg_def.did()) @@ -178,7 +177,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClone { // StorageDead(pred_arg); // res = to_path_buf(cloned); // ``` - if cannot_move_out || !possible_borrower.only_borrowers(&[arg, cloned], local, loc) { + if cannot_move_out || !possible_borrower.only_borrowers(&[arg, deref_clone_ret], local, loc) { continue; } diff --git a/src/tools/clippy/tests/ui/let_and_return.edition2021.fixed b/src/tools/clippy/tests/ui/let_and_return.edition2021.fixed index c904d882d9472..ac565adfd61cd 100644 --- a/src/tools/clippy/tests/ui/let_and_return.edition2021.fixed +++ b/src/tools/clippy/tests/ui/let_and_return.edition2021.fixed @@ -190,10 +190,10 @@ mod issue_11335 { pub fn inner(&self) -> &T { - (match self { + match self { E::A(x) => x, E::B(x) => x, - }) as _ + } //~^ let_and_return } } diff --git a/src/tools/clippy/tests/ui/let_and_return.edition2021.stderr b/src/tools/clippy/tests/ui/let_and_return.edition2021.stderr index c91b355c42d08..d78f294a67f73 100644 --- a/src/tools/clippy/tests/ui/let_and_return.edition2021.stderr +++ b/src/tools/clippy/tests/ui/let_and_return.edition2021.stderr @@ -72,10 +72,10 @@ help: return the expression directly | LL ~ LL | -LL ~ (match self { +LL ~ match self { LL + E::A(x) => x, LL + E::B(x) => x, -LL + }) as _ +LL + } | error: returning the result of a `let` binding from a block diff --git a/src/tools/clippy/tests/ui/let_and_return.edition2024.fixed b/src/tools/clippy/tests/ui/let_and_return.edition2024.fixed index e931e1ec7ff22..b6f4160e7a6ad 100644 --- a/src/tools/clippy/tests/ui/let_and_return.edition2024.fixed +++ b/src/tools/clippy/tests/ui/let_and_return.edition2024.fixed @@ -190,10 +190,10 @@ mod issue_11335 { pub fn inner(&self) -> &T { - (match self { + match self { E::A(x) => x, E::B(x) => x, - }) as _ + } //~^ let_and_return } } diff --git a/src/tools/clippy/tests/ui/let_and_return.edition2024.stderr b/src/tools/clippy/tests/ui/let_and_return.edition2024.stderr index 7407e504b7c54..cb2340b722add 100644 --- a/src/tools/clippy/tests/ui/let_and_return.edition2024.stderr +++ b/src/tools/clippy/tests/ui/let_and_return.edition2024.stderr @@ -128,10 +128,10 @@ help: return the expression directly | LL ~ LL | -LL ~ (match self { +LL ~ match self { LL + E::A(x) => x, LL + E::B(x) => x, -LL + }) as _ +LL + } | error: returning the result of a `let` binding from a block diff --git a/tests/codegen-llvm/lib-optimizations/append-elements.rs b/tests/codegen-llvm/lib-optimizations/append-elements.rs index 47211e3f388a0..0bf00d0460020 100644 --- a/tests/codegen-llvm/lib-optimizations/append-elements.rs +++ b/tests/codegen-llvm/lib-optimizations/append-elements.rs @@ -13,7 +13,7 @@ #[no_mangle] pub fn vec_append_with_temp_alloc(dst: &mut Vec, src: &[u8]) { // CHECK-NOT: call void @llvm.memcpy - // CHECK: call void @llvm.memcpy.{{.*}}[[DST]].i{{.*}}[[SRC]] + // CHECK: call void @llvm.memcpy.{{.*}}{{.*}}.i{{.*}}[[SRC]] // CHECK-NOT: call void @llvm.memcpy let temp = src.to_vec(); dst.extend(&temp); diff --git a/tests/incremental/hashes/call_expressions.rs b/tests/incremental/hashes/call_expressions.rs index 262ecbe4a7132..fc2dca3a1e41c 100644 --- a/tests/incremental/hashes/call_expressions.rs +++ b/tests/incremental/hashes/call_expressions.rs @@ -158,16 +158,16 @@ pub fn change_argument_method_ufcs() { #[cfg(any(bpass1,bpass4))] pub fn change_to_ufcs() { let s = Struct; - s.method1('x', true); // ------ + s.method1('x', true); } #[cfg(not(any(bpass1,bpass4)))] -#[rustc_clean(cfg="bpass2", except="hir_owner,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass2", except="hir_owner,typeck_root")] #[rustc_clean(cfg="bpass3")] +// MIR changes because spans change, and there is no `-Zincremental-ignore-spans` +// for the last 3 revisions #[rustc_clean(cfg="bpass5", except="hir_owner,optimized_mir,typeck_root")] #[rustc_clean(cfg="bpass6")] -// One might think this would be expanded in the hir_owner/Mir, but it actually -// results in slightly different hir_owner/Mir. pub fn change_to_ufcs() { let s = Struct; Struct::method1(&s, 'x', true); diff --git a/tests/mir-opt/building/index_array_and_slice.index_array.built.after.mir b/tests/mir-opt/building/index_array_and_slice.index_array.built.after.mir index d28a2031013f3..6dd6dc63d7967 100644 --- a/tests/mir-opt/building/index_array_and_slice.index_array.built.after.mir +++ b/tests/mir-opt/building/index_array_and_slice.index_array.built.after.mir @@ -4,23 +4,19 @@ fn index_array(_1: &[i32; 7], _2: usize) -> &i32 { debug array => _1; debug index => _2; let mut _0: &i32; - let _3: &i32; - let _4: usize; - let mut _5: bool; + let _3: usize; + let mut _4: bool; bb0: { StorageLive(_3); - StorageLive(_4); - _4 = copy _2; + _3 = copy _2; FakeRead(ForIndex, (*_1)); - _5 = Lt(copy _4, const 7_usize); - assert(move _5, "index out of bounds: the length is {} but the index is {}", const 7_usize, copy _4) -> [success: bb1, unwind: bb2]; + _4 = Lt(copy _3, const 7_usize); + assert(move _4, "index out of bounds: the length is {} but the index is {}", const 7_usize, copy _3) -> [success: bb1, unwind: bb2]; } bb1: { - _3 = &(*_1)[_4]; - _0 = &(*_3); - StorageDead(_4); + _0 = &(*_1)[_3]; StorageDead(_3); return; } diff --git a/tests/mir-opt/building/index_array_and_slice.index_const_generic_array.built.after.mir b/tests/mir-opt/building/index_array_and_slice.index_const_generic_array.built.after.mir index e9627532c3828..722f878a81052 100644 --- a/tests/mir-opt/building/index_array_and_slice.index_const_generic_array.built.after.mir +++ b/tests/mir-opt/building/index_array_and_slice.index_const_generic_array.built.after.mir @@ -4,23 +4,19 @@ fn index_const_generic_array(_1: &[i32; N], _2: usize) -> &i32 { debug array => _1; debug index => _2; let mut _0: &i32; - let _3: &i32; - let _4: usize; - let mut _5: bool; + let _3: usize; + let mut _4: bool; bb0: { StorageLive(_3); - StorageLive(_4); - _4 = copy _2; + _3 = copy _2; FakeRead(ForIndex, (*_1)); - _5 = Lt(copy _4, const N); - assert(move _5, "index out of bounds: the length is {} but the index is {}", const N, copy _4) -> [success: bb1, unwind: bb2]; + _4 = Lt(copy _3, const N); + assert(move _4, "index out of bounds: the length is {} but the index is {}", const N, copy _3) -> [success: bb1, unwind: bb2]; } bb1: { - _3 = &(*_1)[_4]; - _0 = &(*_3); - StorageDead(_4); + _0 = &(*_1)[_3]; StorageDead(_3); return; } diff --git a/tests/mir-opt/building/index_array_and_slice.index_custom.built.after.mir b/tests/mir-opt/building/index_array_and_slice.index_custom.built.after.mir index e6745ddbf298a..d408c9bc4bf64 100644 --- a/tests/mir-opt/building/index_array_and_slice.index_custom.built.after.mir +++ b/tests/mir-opt/building/index_array_and_slice.index_custom.built.after.mir @@ -4,26 +4,22 @@ fn index_custom(_1: &WithSliceTail, _2: usize) -> &i32 { debug custom => _1; debug index => _2; let mut _0: &i32; - let _3: &i32; - let _4: usize; - let mut _5: *const [i32]; - let mut _6: usize; - let mut _7: bool; + let _3: usize; + let mut _4: *const [i32]; + let mut _5: usize; + let mut _6: bool; bb0: { StorageLive(_3); - StorageLive(_4); - _4 = copy _2; - _5 = &raw const (fake) ((*_1).1: [i32]); - _6 = PtrMetadata(move _5); - _7 = Lt(copy _4, copy _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _4) -> [success: bb1, unwind: bb2]; + _3 = copy _2; + _4 = &raw const (fake) ((*_1).1: [i32]); + _5 = PtrMetadata(move _4); + _6 = Lt(copy _3, copy _5); + assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, copy _3) -> [success: bb1, unwind: bb2]; } bb1: { - _3 = &((*_1).1: [i32])[_4]; - _0 = &(*_3); - StorageDead(_4); + _0 = &((*_1).1: [i32])[_3]; StorageDead(_3); return; } diff --git a/tests/mir-opt/building/index_array_and_slice.index_mut_slice.built.after.mir b/tests/mir-opt/building/index_array_and_slice.index_mut_slice.built.after.mir index c96bcdfc918ad..b6f40a2455bbb 100644 --- a/tests/mir-opt/building/index_array_and_slice.index_mut_slice.built.after.mir +++ b/tests/mir-opt/building/index_array_and_slice.index_mut_slice.built.after.mir @@ -4,26 +4,22 @@ fn index_mut_slice(_1: &mut [i32], _2: usize) -> &i32 { debug slice => _1; debug index => _2; let mut _0: &i32; - let _3: &i32; - let _4: usize; - let mut _5: *const [i32]; - let mut _6: usize; - let mut _7: bool; + let _3: usize; + let mut _4: *const [i32]; + let mut _5: usize; + let mut _6: bool; bb0: { StorageLive(_3); - StorageLive(_4); - _4 = copy _2; - _5 = &raw const (fake) (*_1); - _6 = PtrMetadata(move _5); - _7 = Lt(copy _4, copy _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _4) -> [success: bb1, unwind: bb2]; + _3 = copy _2; + _4 = &raw const (fake) (*_1); + _5 = PtrMetadata(move _4); + _6 = Lt(copy _3, copy _5); + assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, copy _3) -> [success: bb1, unwind: bb2]; } bb1: { - _3 = &(*_1)[_4]; - _0 = &(*_3); - StorageDead(_4); + _0 = &(*_1)[_3]; StorageDead(_3); return; } diff --git a/tests/mir-opt/building/index_array_and_slice.index_slice.built.after.mir b/tests/mir-opt/building/index_array_and_slice.index_slice.built.after.mir index 0911df590497c..c1ed78d78a786 100644 --- a/tests/mir-opt/building/index_array_and_slice.index_slice.built.after.mir +++ b/tests/mir-opt/building/index_array_and_slice.index_slice.built.after.mir @@ -4,24 +4,20 @@ fn index_slice(_1: &[i32], _2: usize) -> &i32 { debug slice => _1; debug index => _2; let mut _0: &i32; - let _3: &i32; - let _4: usize; - let mut _5: usize; - let mut _6: bool; + let _3: usize; + let mut _4: usize; + let mut _5: bool; bb0: { StorageLive(_3); - StorageLive(_4); - _4 = copy _2; - _5 = PtrMetadata(copy _1); - _6 = Lt(copy _4, copy _5); - assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, copy _4) -> [success: bb1, unwind: bb2]; + _3 = copy _2; + _4 = PtrMetadata(copy _1); + _5 = Lt(copy _3, copy _4); + assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind: bb2]; } bb1: { - _3 = &(*_1)[_4]; - _0 = &(*_3); - StorageDead(_4); + _0 = &(*_1)[_3]; StorageDead(_3); return; } diff --git a/tests/mir-opt/building/index_array_and_slice.rs b/tests/mir-opt/building/index_array_and_slice.rs index 47d8255ef57f1..12fb999da1b30 100644 --- a/tests/mir-opt/building/index_array_and_slice.rs +++ b/tests/mir-opt/building/index_array_and_slice.rs @@ -8,8 +8,7 @@ fn index_array(array: &[i32; 7], index: usize) -> &i32 { // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", const 7_usize, copy _3) -> [success: bb1, unwind // CHECK: bb1: - // CHECK: _5 = &(*_1)[_3]; - // CHECK: _0 = &(*_5); + // CHECK: _0 = &(*_1)[_3]; &array[index] } @@ -21,8 +20,7 @@ fn index_const_generic_array(array: &[i32; N], index: usize) -> // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", const N, copy _3) -> [success: bb1, unwind // CHECK: bb1: - // CHECK: _5 = &(*_1)[_3]; - // CHECK: _0 = &(*_5); + // CHECK: _0 = &(*_1)[_3]; &array[index] } @@ -35,8 +33,7 @@ fn index_slice(slice: &[i32], index: usize) -> &i32 { // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", move [[LEN]], copy _3) -> [success: bb1, // CHECK: bb1: - // CHECK: _6 = &(*_1)[_3]; - // CHECK: _0 = &(*_6); + // CHECK: _0 = &(*_1)[_3]; &slice[index] } @@ -53,8 +50,7 @@ fn index_mut_slice(slice: &mut [i32], index: usize) -> &i32 { // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", move [[LEN]], copy _3) -> [success: bb1, // CHECK: bb1: - // CHECK: _7 = &(*_1)[_3]; - // CHECK: _0 = &(*_7); + // CHECK: _0 = &(*_1)[_3]; &slice[index] } @@ -70,8 +66,7 @@ fn index_custom(custom: &WithSliceTail, index: usize) -> &i32 { // CHECK: assert(move [[LT]], "index out of bounds{{.+}}", move [[LEN]], copy _3) -> [success: bb1, // CHECK: bb1: - // CHECK: _7 = &((*_1).1: [i32])[_3]; - // CHECK: _0 = &(*_7); + // CHECK: _0 = &((*_1).1: [i32])[_3]; &custom.1[index] } diff --git a/tests/mir-opt/building/match/never_patterns.opt1.SimplifyCfg-initial.after.mir b/tests/mir-opt/building/match/never_patterns.opt1.SimplifyCfg-initial.after.mir index 78356a90743a6..de8cab6041601 100644 --- a/tests/mir-opt/building/match/never_patterns.opt1.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/building/match/never_patterns.opt1.SimplifyCfg-initial.after.mir @@ -34,7 +34,7 @@ fn opt1(_1: &Result) -> &u32 { bb4: { StorageLive(_3); _3 = &(((*_1) as Ok).0: u32); - _0 = &(*_3); + _0 = copy _3; StorageDead(_3); return; } diff --git a/tests/mir-opt/building/match/never_patterns.opt2.SimplifyCfg-initial.after.mir b/tests/mir-opt/building/match/never_patterns.opt2.SimplifyCfg-initial.after.mir index 979fbb2860dcb..08827649bee3b 100644 --- a/tests/mir-opt/building/match/never_patterns.opt2.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/building/match/never_patterns.opt2.SimplifyCfg-initial.after.mir @@ -23,7 +23,7 @@ fn opt2(_1: &Result) -> &u32 { bb2: { StorageLive(_3); _3 = &(((*_1) as Ok).0: u32); - _0 = &(*_3); + _0 = copy _3; StorageDead(_3); return; } diff --git a/tests/mir-opt/building/match/never_patterns.opt3.SimplifyCfg-initial.after.mir b/tests/mir-opt/building/match/never_patterns.opt3.SimplifyCfg-initial.after.mir index 93ebe600b3ff7..694369b8598b3 100644 --- a/tests/mir-opt/building/match/never_patterns.opt3.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/building/match/never_patterns.opt3.SimplifyCfg-initial.after.mir @@ -28,7 +28,7 @@ fn opt3(_1: &Result) -> &u32 { bb3: { StorageLive(_3); _3 = &(((*_1) as Ok).0: u32); - _0 = &(*_3); + _0 = copy _3; StorageDead(_3); return; } diff --git a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir index 0c73bd8ac6543..0a35e40744698 100644 --- a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir +++ b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir @@ -12,13 +12,12 @@ fn main() -> () { let _2: (); let mut _3: *const Test; let mut _4: *mut Test; - let _6: &&&&*mut Test; - let _7: &&&*mut Test; - let _8: &&*mut Test; - let _9: &*mut Test; - let _10: (); - let mut _11: *const Test; - let mut _12: *mut Test; + let _6: &&&*mut Test; + let _7: &&*mut Test; + let _8: &*mut Test; + let _9: (); + let mut _10: *const Test; + let mut _11: *mut Test; scope 1 { debug ptr => _1; let _5: &&&&*mut Test as UserTypeProjection { base: UserType(2), projs: [] }; @@ -51,31 +50,28 @@ fn main() -> () { StorageLive(_6); StorageLive(_7); StorageLive(_8); - StorageLive(_9); - _9 = &_1; - _8 = &_9; + _8 = &_1; _7 = &_8; _6 = &_7; - _5 = &(*_6); + _5 = &_6; FakeRead(ForLet(None), _5); AscribeUserType(_5, o, UserTypeProjection { base: UserType(3), projs: [] }); - StorageDead(_6); + StorageLive(_9); StorageLive(_10); StorageLive(_11); - StorageLive(_12); - _12 = copy (*(*(*(*_5)))); - _11 = move _12 as *const Test (PointerCoercion(MutToConstPointer, Implicit)); - StorageDead(_12); - _10 = Test::x(move _11) -> [return: bb3, unwind: bb4]; + _11 = copy (*(*(*(*_5)))); + _10 = move _11 as *const Test (PointerCoercion(MutToConstPointer, Implicit)); + StorageDead(_11); + _9 = Test::x(move _10) -> [return: bb3, unwind: bb4]; } bb3: { - StorageDead(_11); StorageDead(_10); - _0 = const (); StorageDead(_9); + _0 = const (); StorageDead(_8); StorageDead(_7); + StorageDead(_6); StorageDead(_5); StorageDead(_1); return; diff --git a/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir b/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir index 4ec1203269087..d84b28f1e4bfe 100644 --- a/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir +++ b/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir @@ -2,12 +2,12 @@ static XXX: &Foo = { let mut _0: &Foo; - let _1: &Foo; - let _2: Foo; - let mut _3: &[(u32, u32)]; - let mut _4: &[(u32, u32); 42]; - let _5: &[(u32, u32); 42]; - let _6: [(u32, u32); 42]; + let _1: Foo; + let mut _2: &[(u32, u32)]; + let mut _3: &[(u32, u32); 42]; + let _4: [(u32, u32); 42]; + let mut _5: (u32, u32); + let mut _6: (u32, u32); let mut _7: (u32, u32); let mut _8: (u32, u32); let mut _9: (u32, u32); @@ -48,8 +48,6 @@ static XXX: &Foo = { let mut _44: (u32, u32); let mut _45: (u32, u32); let mut _46: (u32, u32); - let mut _47: (u32, u32); - let mut _48: (u32, u32); bb0: { StorageLive(_1); @@ -57,94 +55,90 @@ static XXX: &Foo = { StorageLive(_3); StorageLive(_4); StorageLive(_5); + _5 = (const 0_u32, const 1_u32); StorageLive(_6); + _6 = (const 0_u32, const 2_u32); StorageLive(_7); - _7 = (const 0_u32, const 1_u32); + _7 = (const 0_u32, const 3_u32); StorageLive(_8); - _8 = (const 0_u32, const 2_u32); + _8 = (const 0_u32, const 1_u32); StorageLive(_9); - _9 = (const 0_u32, const 3_u32); + _9 = (const 0_u32, const 2_u32); StorageLive(_10); - _10 = (const 0_u32, const 1_u32); + _10 = (const 0_u32, const 3_u32); StorageLive(_11); - _11 = (const 0_u32, const 2_u32); + _11 = (const 0_u32, const 1_u32); StorageLive(_12); - _12 = (const 0_u32, const 3_u32); + _12 = (const 0_u32, const 2_u32); StorageLive(_13); - _13 = (const 0_u32, const 1_u32); + _13 = (const 0_u32, const 3_u32); StorageLive(_14); - _14 = (const 0_u32, const 2_u32); + _14 = (const 0_u32, const 1_u32); StorageLive(_15); - _15 = (const 0_u32, const 3_u32); + _15 = (const 0_u32, const 2_u32); StorageLive(_16); - _16 = (const 0_u32, const 1_u32); + _16 = (const 0_u32, const 3_u32); StorageLive(_17); - _17 = (const 0_u32, const 2_u32); + _17 = (const 0_u32, const 1_u32); StorageLive(_18); - _18 = (const 0_u32, const 3_u32); + _18 = (const 0_u32, const 2_u32); StorageLive(_19); - _19 = (const 0_u32, const 1_u32); + _19 = (const 0_u32, const 3_u32); StorageLive(_20); - _20 = (const 0_u32, const 2_u32); + _20 = (const 0_u32, const 1_u32); StorageLive(_21); - _21 = (const 0_u32, const 3_u32); + _21 = (const 0_u32, const 2_u32); StorageLive(_22); - _22 = (const 0_u32, const 1_u32); + _22 = (const 0_u32, const 3_u32); StorageLive(_23); - _23 = (const 0_u32, const 2_u32); + _23 = (const 0_u32, const 1_u32); StorageLive(_24); - _24 = (const 0_u32, const 3_u32); + _24 = (const 0_u32, const 2_u32); StorageLive(_25); - _25 = (const 0_u32, const 1_u32); + _25 = (const 0_u32, const 3_u32); StorageLive(_26); - _26 = (const 0_u32, const 2_u32); + _26 = (const 0_u32, const 1_u32); StorageLive(_27); - _27 = (const 0_u32, const 3_u32); + _27 = (const 0_u32, const 2_u32); StorageLive(_28); - _28 = (const 0_u32, const 1_u32); + _28 = (const 0_u32, const 3_u32); StorageLive(_29); - _29 = (const 0_u32, const 2_u32); + _29 = (const 0_u32, const 1_u32); StorageLive(_30); - _30 = (const 0_u32, const 3_u32); + _30 = (const 0_u32, const 2_u32); StorageLive(_31); - _31 = (const 0_u32, const 1_u32); + _31 = (const 0_u32, const 3_u32); StorageLive(_32); - _32 = (const 0_u32, const 2_u32); + _32 = (const 0_u32, const 1_u32); StorageLive(_33); - _33 = (const 0_u32, const 3_u32); + _33 = (const 0_u32, const 2_u32); StorageLive(_34); - _34 = (const 0_u32, const 1_u32); + _34 = (const 0_u32, const 3_u32); StorageLive(_35); - _35 = (const 0_u32, const 2_u32); + _35 = (const 0_u32, const 1_u32); StorageLive(_36); - _36 = (const 0_u32, const 3_u32); + _36 = (const 0_u32, const 2_u32); StorageLive(_37); - _37 = (const 0_u32, const 1_u32); + _37 = (const 0_u32, const 3_u32); StorageLive(_38); - _38 = (const 0_u32, const 2_u32); + _38 = (const 0_u32, const 1_u32); StorageLive(_39); - _39 = (const 0_u32, const 3_u32); + _39 = (const 0_u32, const 2_u32); StorageLive(_40); - _40 = (const 0_u32, const 1_u32); + _40 = (const 0_u32, const 3_u32); StorageLive(_41); - _41 = (const 0_u32, const 2_u32); + _41 = (const 0_u32, const 1_u32); StorageLive(_42); - _42 = (const 0_u32, const 3_u32); + _42 = (const 0_u32, const 2_u32); StorageLive(_43); - _43 = (const 0_u32, const 1_u32); + _43 = (const 0_u32, const 3_u32); StorageLive(_44); - _44 = (const 0_u32, const 2_u32); + _44 = (const 0_u32, const 1_u32); StorageLive(_45); - _45 = (const 0_u32, const 3_u32); + _45 = (const 0_u32, const 2_u32); StorageLive(_46); - _46 = (const 0_u32, const 1_u32); - StorageLive(_47); - _47 = (const 0_u32, const 2_u32); - StorageLive(_48); - _48 = (const 0_u32, const 3_u32); - _6 = [move _7, move _8, move _9, move _10, move _11, move _12, move _13, move _14, move _15, move _16, move _17, move _18, move _19, move _20, move _21, move _22, move _23, move _24, move _25, move _26, move _27, move _28, move _29, move _30, move _31, move _32, move _33, move _34, move _35, move _36, move _37, move _38, move _39, move _40, move _41, move _42, move _43, move _44, move _45, move _46, move _47, move _48]; - StorageDead(_48); - StorageDead(_47); + _46 = (const 0_u32, const 3_u32); + _4 = [move _5, move _6, move _7, move _8, move _9, move _10, move _11, move _12, move _13, move _14, move _15, move _16, move _17, move _18, move _19, move _20, move _21, move _22, move _23, move _24, move _25, move _26, move _27, move _28, move _29, move _30, move _31, move _32, move _33, move _34, move _35, move _36, move _37, move _38, move _39, move _40, move _41, move _42, move _43, move _44, move _45, move _46]; StorageDead(_46); StorageDead(_45); StorageDead(_44); @@ -185,16 +179,14 @@ static XXX: &Foo = { StorageDead(_9); StorageDead(_8); StorageDead(_7); - _5 = &_6; - _4 = &(*_5); - _3 = move _4 as &[(u32, u32)] (PointerCoercion(Unsize, Implicit)); - StorageDead(_4); - _2 = Foo { tup: const "hi", data: move _3 }; - StorageDead(_3); - _1 = &_2; - _0 = &(*_1); + StorageDead(_6); StorageDead(_5); - StorageDead(_1); + _3 = &_4; + _2 = move _3 as &[(u32, u32)] (PointerCoercion(Unsize, Implicit)); + StorageDead(_3); + _1 = Foo { tup: const "hi", data: move _2 }; + StorageDead(_2); + _0 = &_1; return; } } diff --git a/tests/mir-opt/building/user_type_annotations.let_else.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_else.built.after.mir index db79f934ac3a3..f6eca80dfa993 100644 --- a/tests/mir-opt/building/user_type_annotations.let_else.built.after.mir +++ b/tests/mir-opt/building/user_type_annotations.let_else.built.after.mir @@ -12,8 +12,7 @@ fn let_else() -> () { let _4: &char as UserTypeProjection { base: UserType(0), projs: [Field(2, ())] }; let mut _5: (u32, u64, &char); let mut _6: &char; - let _7: &char; - let _8: char; + let _7: char; scope 1 { debug x => _2; debug y => _3; @@ -24,10 +23,8 @@ fn let_else() -> () { StorageLive(_5); StorageLive(_6); StorageLive(_7); - StorageLive(_8); - _8 = const 'u'; - _7 = &_8; - _6 = &(*_7); + _7 = const 'u'; + _6 = &_7; _5 = (const 7_u32, const 12_u64, move _6); StorageDead(_6); PlaceMention(_5); @@ -54,20 +51,18 @@ fn let_else() -> () { _3 = copy (_5.1: u64); StorageLive(_4); _4 = copy (_5.2: &char); - StorageDead(_7); StorageDead(_5); _0 = const (); StorageDead(_4); StorageDead(_3); StorageDead(_2); - StorageDead(_8); + StorageDead(_7); return; } bb5: { - StorageDead(_7); StorageDead(_5); - StorageDead(_8); + StorageDead(_7); goto -> bb1; } diff --git a/tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir index 098fc4e7437ae..37212b0a42db9 100644 --- a/tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir +++ b/tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir @@ -9,8 +9,7 @@ fn let_else_bindless() -> () { let mut _1: !; let mut _2: (u32, u64, &char); let mut _3: &char; - let _4: &char; - let _5: char; + let _4: char; scope 1 { } @@ -18,10 +17,8 @@ fn let_else_bindless() -> () { StorageLive(_2); StorageLive(_3); StorageLive(_4); - StorageLive(_5); - _5 = const 'u'; - _4 = &_5; - _3 = &(*_4); + _4 = const 'u'; + _3 = &_4; _2 = (const 7_u32, const 12_u64, move _3); StorageDead(_3); PlaceMention(_2); @@ -42,17 +39,15 @@ fn let_else_bindless() -> () { bb4: { AscribeUserType(_2, +, UserTypeProjection { base: UserType(1), projs: [] }); - StorageDead(_4); StorageDead(_2); _0 = const (); - StorageDead(_5); + StorageDead(_4); return; } bb5: { - StorageDead(_4); StorageDead(_2); - StorageDead(_5); + StorageDead(_4); goto -> bb1; } diff --git a/tests/mir-opt/building/user_type_annotations.let_init.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_init.built.after.mir index dd05ef37de3cc..a9bb7eef0ebc7 100644 --- a/tests/mir-opt/building/user_type_annotations.let_init.built.after.mir +++ b/tests/mir-opt/building/user_type_annotations.let_init.built.after.mir @@ -11,8 +11,7 @@ fn let_init() -> () { let _3: &char as UserTypeProjection { base: UserType(0), projs: [Field(2, ())] }; let mut _4: (u32, u64, &char); let mut _5: &char; - let _6: &char; - let _7: char; + let _6: char; scope 1 { debug x => _1; debug y => _2; @@ -23,10 +22,8 @@ fn let_init() -> () { StorageLive(_4); StorageLive(_5); StorageLive(_6); - StorageLive(_7); - _7 = const 'u'; - _6 = &_7; - _5 = &(*_6); + _6 = const 'u'; + _5 = &_6; _4 = (const 7_u32, const 12_u64, move _5); StorageDead(_5); PlaceMention(_4); @@ -37,13 +34,12 @@ fn let_init() -> () { _2 = copy (_4.1: u64); StorageLive(_3); _3 = copy (_4.2: &char); - StorageDead(_6); StorageDead(_4); _0 = const (); StorageDead(_3); StorageDead(_2); StorageDead(_1); - StorageDead(_7); + StorageDead(_6); return; } diff --git a/tests/mir-opt/building/user_type_annotations.let_init_bindless.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_init_bindless.built.after.mir index d949e1945339b..b269a31afcc45 100644 --- a/tests/mir-opt/building/user_type_annotations.let_init_bindless.built.after.mir +++ b/tests/mir-opt/building/user_type_annotations.let_init_bindless.built.after.mir @@ -8,8 +8,7 @@ fn let_init_bindless() -> () { let mut _0: (); let mut _1: (u32, u64, &char); let mut _2: &char; - let _3: &char; - let _4: char; + let _3: char; scope 1 { } @@ -17,18 +16,15 @@ fn let_init_bindless() -> () { StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _4 = const 'u'; - _3 = &_4; - _2 = &(*_3); + _3 = const 'u'; + _2 = &_3; _1 = (const 7_u32, const 12_u64, move _2); StorageDead(_2); PlaceMention(_1); AscribeUserType(_1, +, UserTypeProjection { base: UserType(1), projs: [] }); - StorageDead(_3); StorageDead(_1); _0 = const (); - StorageDead(_4); + StorageDead(_3); return; } diff --git a/tests/mir-opt/const_promotion_extern_static.BOP.built.after.mir b/tests/mir-opt/const_promotion_extern_static.BOP.built.after.mir index ff80d5eedab91..ed24ccd3a1f75 100644 --- a/tests/mir-opt/const_promotion_extern_static.BOP.built.after.mir +++ b/tests/mir-opt/const_promotion_extern_static.BOP.built.after.mir @@ -2,16 +2,12 @@ static BOP: &i32 = { let mut _0: &i32; - let _1: &i32; - let _2: i32; + let _1: i32; bb0: { StorageLive(_1); - StorageLive(_2); - _2 = const 13_i32; - _1 = &_2; - _0 = &(*_1); - StorageDead(_1); + _1 = const 13_i32; + _0 = &_1; return; } } diff --git a/tests/mir-opt/const_prop/indirect_ref.indirect_ref_1.GVN.diff b/tests/mir-opt/const_prop/indirect_ref.indirect_ref_1.GVN.diff index 0836a10d16594..893321d2ef826 100644 --- a/tests/mir-opt/const_prop/indirect_ref.indirect_ref_1.GVN.diff +++ b/tests/mir-opt/const_prop/indirect_ref.indirect_ref_1.GVN.diff @@ -14,16 +14,13 @@ let _9: (); let mut _10: for<'a> fn(&'a i32); let mut _11: &i32; - let mut _12: &i32; - let mut _13: &i32; bb0: { StorageLive(_4); StorageLive(_5); _5 = copy _2; StorageLive(_6); - _12 = no_retag copy ((*_1).0: &i32); - _6 = &(*_12); + _6 = copy ((*_1).0: &i32); - _4 = move _5(move _6) -> [return: bb1, unwind unreachable]; + _4 = copy _2(move _6) -> [return: bb1, unwind unreachable]; } @@ -46,8 +43,7 @@ StorageLive(_10); _10 = copy _2; StorageLive(_11); - _13 = no_retag copy ((*_1).0: &i32); - _11 = &(*_13); + _11 = copy ((*_1).0: &i32); - _9 = move _10(move _11) -> [return: bb3, unwind unreachable]; + _9 = copy _2(move _11) -> [return: bb3, unwind unreachable]; } diff --git a/tests/mir-opt/const_prop/indirect_ref.indirect_ref_2.GVN.diff b/tests/mir-opt/const_prop/indirect_ref.indirect_ref_2.GVN.diff index ae3df30503676..10ab193bdf165 100644 --- a/tests/mir-opt/const_prop/indirect_ref.indirect_ref_2.GVN.diff +++ b/tests/mir-opt/const_prop/indirect_ref.indirect_ref_2.GVN.diff @@ -15,8 +15,6 @@ let _11: (); let mut _12: for<'a> fn(&'a i32); let mut _13: &i32; - let mut _14: &i32; - let mut _15: &i32; scope 1 { debug y1 => _4; let _10: (&i32,); @@ -32,8 +30,7 @@ StorageLive(_6); _6 = copy _2; StorageLive(_7); - _14 = no_retag copy (_4.0: &i32); - _7 = &(*_14); + _7 = copy (_4.0: &i32); - _5 = move _6(move _7) -> [return: bb1, unwind unreachable]; + _5 = copy _2(move _7) -> [return: bb1, unwind unreachable]; } @@ -58,8 +55,7 @@ StorageLive(_12); _12 = copy _2; StorageLive(_13); - _15 = no_retag copy (_10.0: &i32); - _13 = &(*_15); + _13 = copy (_10.0: &i32); - _11 = move _12(move _13) -> [return: bb3, unwind unreachable]; + _11 = copy _2(move _13) -> [return: bb3, unwind unreachable]; } diff --git a/tests/mir-opt/const_prop/indirect_ref.rs b/tests/mir-opt/const_prop/indirect_ref.rs index 1ec415d88d4bd..cf812e3e1bd10 100644 --- a/tests/mir-opt/const_prop/indirect_ref.rs +++ b/tests/mir-opt/const_prop/indirect_ref.rs @@ -70,12 +70,10 @@ pub fn indirect_deref_2(x: &(&i32,), out: fn(i32), clobber: fn()) { pub fn indirect_ref_1(x: &(&i32,), out: fn(&i32), clobber: fn()) { // CHECK-LABEL: fn indirect_ref_1 // CHECK: out => [[out:_.*]]; - // CHECK: [[y1_0:_.*]] = no_retag copy ((*_1).0: &i32); - // CHECK: [[reborrow_y1_0:_.*]] = &(*[[y1_0]]); - // CHECK: copy [[out]](move [[reborrow_y1_0]]) -> [ - // CHECK: [[y2_0:_.*]] = no_retag copy ((*_1).0: &i32); - // CHECK: [[reborrow_y2_0:_.*]] = &(*[[y2_0]]); - // CHECK: copy [[out]](move [[reborrow_y2_0]]) -> [ + // CHECK: [[y1_0:_.*]] = copy ((*_1).0: &i32); + // CHECK: copy [[out]](move [[y1_0]]) -> [ + // CHECK: [[y2_0:_.*]] = copy ((*_1).0: &i32); + // CHECK: copy [[out]](move [[y2_0]]) -> [ out((*x).0); clobber(); out((*x).0); @@ -87,13 +85,11 @@ pub fn indirect_ref_2(x: &(&i32,), out: fn(&i32), clobber: fn()) { // CHECK-LABEL: fn indirect_ref_2 // CHECK: out => [[out:_.*]]; // CHECK: [[y1:_.*]] = copy (*_1); - // CHECK: [[y1_0:_.*]] = no_retag copy ([[y1]].0: &i32); - // CHECK: [[reborrow_y1_0:_.*]] = &(*[[y1_0]]); - // CHECK: copy [[out]](move [[reborrow_y1_0]]) -> [ + // CHECK: [[y1_0:_.*]] = copy ([[y1]].0: &i32); + // CHECK: copy [[out]](move [[y1_0]]) -> [ // CHECK: [[y2:_.*]] = copy (*_1); - // CHECK: [[y2_0:_.*]] = no_retag copy ([[y2]].0: &i32); - // CHECK: [[reborrow_y2_0:_.*]] = &(*[[y2_0]]); - // CHECK: copy [[out]](move [[reborrow_y2_0]]) -> [ + // CHECK: [[y2_0:_.*]] = copy ([[y2]].0: &i32); + // CHECK: copy [[out]](move [[y2_0]]) -> [ let y1 = *x; out((y1).0); clobber(); diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff index d6e81debccd81..47291302add3d 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff @@ -6,12 +6,11 @@ let _1: u32; let mut _2: &[u32]; let mut _3: &[u32; 3]; - let _4: &[u32; 3]; - let _5: [u32; 3]; - let _6: usize; - let mut _7: usize; - let mut _8: bool; - let mut _9: &[u32; 3]; + let _4: [u32; 3]; + let _5: usize; + let mut _6: usize; + let mut _7: bool; + let mut _8: &[u32; 3]; scope 1 { debug a => _1; } @@ -20,29 +19,25 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _9 = const main::promoted[0]; - _4 = copy _9; -- _3 = copy _4; + _8 = const main::promoted[0]; + _3 = copy _8; - _2 = move _3 as &[u32] (PointerCoercion(Unsize, AsCast)); -+ _3 = copy _9; -+ _2 = copy _9 as &[u32] (PointerCoercion(Unsize, AsCast)); ++ _2 = copy _8 as &[u32] (PointerCoercion(Unsize, AsCast)); StorageDead(_3); - StorageLive(_6); - _6 = const 1_usize; -- _7 = PtrMetadata(copy _2); -- _8 = Lt(copy _6, copy _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable]; -+ _7 = const 3_usize; -+ _8 = const true; + StorageLive(_5); + _5 = const 1_usize; +- _6 = PtrMetadata(copy _2); +- _7 = Lt(copy _5, copy _6); +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb1, unwind unreachable]; ++ _6 = const 3_usize; ++ _7 = 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 = copy (*_2)[_6]; +- _1 = copy (*_2)[_5]; + _1 = const 2_u32; - StorageDead(_6); - StorageDead(_4); + StorageDead(_5); StorageDead(_2); _0 = const (); StorageDead(_1); diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff index 6713e531892ae..23c3600310d44 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff @@ -6,12 +6,11 @@ let _1: u32; let mut _2: &[u32]; let mut _3: &[u32; 3]; - let _4: &[u32; 3]; - let _5: [u32; 3]; - let _6: usize; - let mut _7: usize; - let mut _8: bool; - let mut _9: &[u32; 3]; + let _4: [u32; 3]; + let _5: usize; + let mut _6: usize; + let mut _7: bool; + let mut _8: &[u32; 3]; scope 1 { debug a => _1; } @@ -20,29 +19,25 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _9 = const main::promoted[0]; - _4 = copy _9; -- _3 = copy _4; + _8 = const main::promoted[0]; + _3 = copy _8; - _2 = move _3 as &[u32] (PointerCoercion(Unsize, AsCast)); -+ _3 = copy _9; -+ _2 = copy _9 as &[u32] (PointerCoercion(Unsize, AsCast)); ++ _2 = copy _8 as &[u32] (PointerCoercion(Unsize, AsCast)); StorageDead(_3); - StorageLive(_6); - _6 = const 1_usize; -- _7 = PtrMetadata(copy _2); -- _8 = Lt(copy _6, copy _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue]; -+ _7 = const 3_usize; -+ _8 = const true; + StorageLive(_5); + _5 = const 1_usize; +- _6 = PtrMetadata(copy _2); +- _7 = Lt(copy _5, copy _6); +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb1, unwind continue]; ++ _6 = const 3_usize; ++ _7 = 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 = copy (*_2)[_6]; +- _1 = copy (*_2)[_5]; + _1 = const 2_u32; - StorageDead(_6); - StorageDead(_4); + StorageDead(_5); StorageDead(_2); _0 = const (); StorageDead(_1); diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff index d6e81debccd81..47291302add3d 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff @@ -6,12 +6,11 @@ let _1: u32; let mut _2: &[u32]; let mut _3: &[u32; 3]; - let _4: &[u32; 3]; - let _5: [u32; 3]; - let _6: usize; - let mut _7: usize; - let mut _8: bool; - let mut _9: &[u32; 3]; + let _4: [u32; 3]; + let _5: usize; + let mut _6: usize; + let mut _7: bool; + let mut _8: &[u32; 3]; scope 1 { debug a => _1; } @@ -20,29 +19,25 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _9 = const main::promoted[0]; - _4 = copy _9; -- _3 = copy _4; + _8 = const main::promoted[0]; + _3 = copy _8; - _2 = move _3 as &[u32] (PointerCoercion(Unsize, AsCast)); -+ _3 = copy _9; -+ _2 = copy _9 as &[u32] (PointerCoercion(Unsize, AsCast)); ++ _2 = copy _8 as &[u32] (PointerCoercion(Unsize, AsCast)); StorageDead(_3); - StorageLive(_6); - _6 = const 1_usize; -- _7 = PtrMetadata(copy _2); -- _8 = Lt(copy _6, copy _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable]; -+ _7 = const 3_usize; -+ _8 = const true; + StorageLive(_5); + _5 = const 1_usize; +- _6 = PtrMetadata(copy _2); +- _7 = Lt(copy _5, copy _6); +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb1, unwind unreachable]; ++ _6 = const 3_usize; ++ _7 = 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 = copy (*_2)[_6]; +- _1 = copy (*_2)[_5]; + _1 = const 2_u32; - StorageDead(_6); - StorageDead(_4); + StorageDead(_5); StorageDead(_2); _0 = const (); StorageDead(_1); diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff index 6713e531892ae..23c3600310d44 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff @@ -6,12 +6,11 @@ let _1: u32; let mut _2: &[u32]; let mut _3: &[u32; 3]; - let _4: &[u32; 3]; - let _5: [u32; 3]; - let _6: usize; - let mut _7: usize; - let mut _8: bool; - let mut _9: &[u32; 3]; + let _4: [u32; 3]; + let _5: usize; + let mut _6: usize; + let mut _7: bool; + let mut _8: &[u32; 3]; scope 1 { debug a => _1; } @@ -20,29 +19,25 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _9 = const main::promoted[0]; - _4 = copy _9; -- _3 = copy _4; + _8 = const main::promoted[0]; + _3 = copy _8; - _2 = move _3 as &[u32] (PointerCoercion(Unsize, AsCast)); -+ _3 = copy _9; -+ _2 = copy _9 as &[u32] (PointerCoercion(Unsize, AsCast)); ++ _2 = copy _8 as &[u32] (PointerCoercion(Unsize, AsCast)); StorageDead(_3); - StorageLive(_6); - _6 = const 1_usize; -- _7 = PtrMetadata(copy _2); -- _8 = Lt(copy _6, copy _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue]; -+ _7 = const 3_usize; -+ _8 = const true; + StorageLive(_5); + _5 = const 1_usize; +- _6 = PtrMetadata(copy _2); +- _7 = Lt(copy _5, copy _6); +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb1, unwind continue]; ++ _6 = const 3_usize; ++ _7 = 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 = copy (*_2)[_6]; +- _1 = copy (*_2)[_5]; + _1 = const 2_u32; - StorageDead(_6); - StorageDead(_4); + StorageDead(_5); StorageDead(_2); _0 = const (); StorageDead(_1); diff --git a/tests/mir-opt/copy-prop/borrowed_local.borrow_in_loop.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/borrowed_local.borrow_in_loop.CopyProp.panic-abort.diff index 3d76cd65e0385..66ba99e61d393 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.borrow_in_loop.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/borrowed_local.borrow_in_loop.CopyProp.panic-abort.diff @@ -11,15 +11,14 @@ let mut _9: bool; let mut _10: bool; let mut _11: &bool; - let _12: &bool; + let mut _12: bool; let mut _13: bool; let mut _14: bool; - let mut _15: bool; - let mut _16: !; + let mut _15: !; scope 1 { debug c => _1; let mut _2: &bool; - let mut _17: &bool; + let mut _16: &bool; scope 2 { debug p => _2; let _6: bool; @@ -36,8 +35,8 @@ bb0: { StorageLive(_1); StorageLive(_2); - _17 = const borrow_in_loop::promoted[0]; - _2 = &(*_17); + _16 = const borrow_in_loop::promoted[0]; + _2 = &(*_16); - StorageLive(_4); goto -> bb1; } @@ -59,27 +58,24 @@ - StorageDead(_10); + _1 = copy _6; StorageLive(_11); - StorageLive(_12); - _12 = &_1; - _11 = &(*_12); + _11 = &_1; _2 = move _11; StorageDead(_11); - StorageDead(_12); - StorageLive(_13); + StorageLive(_12); +- StorageLive(_13); +- _13 = copy _6; - StorageLive(_14); -- _14 = copy _6; -- StorageLive(_15); -- _15 = copy _8; -- _13 = Ne(move _14, move _15); -+ _13 = Ne(copy _6, copy _8); - switchInt(move _13) -> [0: bb3, otherwise: bb2]; +- _14 = copy _8; +- _12 = Ne(move _13, move _14); ++ _12 = Ne(copy _6, copy _8); + switchInt(move _12) -> [0: bb3, otherwise: bb2]; } bb2: { -- StorageDead(_15); - StorageDead(_14); +- StorageDead(_13); _0 = const (); - StorageDead(_13); + StorageDead(_12); StorageDead(_8); StorageDead(_6); - StorageDead(_4); @@ -89,10 +85,10 @@ } bb3: { -- StorageDead(_15); - StorageDead(_14); +- StorageDead(_13); - _5 = const (); - StorageDead(_13); + StorageDead(_12); StorageDead(_8); StorageDead(_6); goto -> bb1; diff --git a/tests/mir-opt/copy-prop/borrowed_local.borrow_in_loop.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/borrowed_local.borrow_in_loop.CopyProp.panic-unwind.diff index 3d76cd65e0385..66ba99e61d393 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.borrow_in_loop.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/borrowed_local.borrow_in_loop.CopyProp.panic-unwind.diff @@ -11,15 +11,14 @@ let mut _9: bool; let mut _10: bool; let mut _11: &bool; - let _12: &bool; + let mut _12: bool; let mut _13: bool; let mut _14: bool; - let mut _15: bool; - let mut _16: !; + let mut _15: !; scope 1 { debug c => _1; let mut _2: &bool; - let mut _17: &bool; + let mut _16: &bool; scope 2 { debug p => _2; let _6: bool; @@ -36,8 +35,8 @@ bb0: { StorageLive(_1); StorageLive(_2); - _17 = const borrow_in_loop::promoted[0]; - _2 = &(*_17); + _16 = const borrow_in_loop::promoted[0]; + _2 = &(*_16); - StorageLive(_4); goto -> bb1; } @@ -59,27 +58,24 @@ - StorageDead(_10); + _1 = copy _6; StorageLive(_11); - StorageLive(_12); - _12 = &_1; - _11 = &(*_12); + _11 = &_1; _2 = move _11; StorageDead(_11); - StorageDead(_12); - StorageLive(_13); + StorageLive(_12); +- StorageLive(_13); +- _13 = copy _6; - StorageLive(_14); -- _14 = copy _6; -- StorageLive(_15); -- _15 = copy _8; -- _13 = Ne(move _14, move _15); -+ _13 = Ne(copy _6, copy _8); - switchInt(move _13) -> [0: bb3, otherwise: bb2]; +- _14 = copy _8; +- _12 = Ne(move _13, move _14); ++ _12 = Ne(copy _6, copy _8); + switchInt(move _12) -> [0: bb3, otherwise: bb2]; } bb2: { -- StorageDead(_15); - StorageDead(_14); +- StorageDead(_13); _0 = const (); - StorageDead(_13); + StorageDead(_12); StorageDead(_8); StorageDead(_6); - StorageDead(_4); @@ -89,10 +85,10 @@ } bb3: { -- StorageDead(_15); - StorageDead(_14); +- StorageDead(_13); - _5 = const (); - StorageDead(_13); + StorageDead(_12); StorageDead(_8); StorageDead(_6); goto -> bb1; diff --git a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff index 9823a48785a5b..0c09227c460d9 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff @@ -90,7 +90,7 @@ bb5: { StorageLive(_12); _12 = &(((*_7) as V2).0: i32); - _9 = &(*_12); + _9 = copy _12; StorageDead(_12); goto -> bb7; } diff --git a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff index e4e68483f2557..f84661447f129 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff @@ -90,7 +90,7 @@ bb5: { StorageLive(_12); _12 = &(((*_7) as V2).0: i32); - _9 = &(*_12); + _9 = copy _12; StorageDead(_12); goto -> bb7; } diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff index a0e83265d31c5..829a1df596b99 100644 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff @@ -6,13 +6,12 @@ let mut _1: i32; let _2: (); let mut _3: &i32; - let _4: &i32; - let _5: (); + let _4: (); scope 1 { debug a => _1; - let _6: i32; + let _5: i32; scope 2 { - debug b => _6; + debug b => _5; } } @@ -21,27 +20,24 @@ _1 = const 0_i32; StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _4 = &_1; - _3 = &(*_4); + _3 = &_1; _2 = escape::(move _3) -> [return: bb1, unwind unreachable]; } bb1: { StorageDead(_3); - StorageDead(_4); StorageDead(_2); _1 = const 1_i32; - StorageLive(_5); - _5 = some_function() -> [return: bb2, unwind unreachable]; + StorageLive(_4); + _4 = some_function() -> [return: bb2, unwind unreachable]; } bb2: { - StorageDead(_5); - StorageLive(_6); - _6 = copy _1; + StorageDead(_4); + StorageLive(_5); + _5 = copy _1; _0 = const (); - StorageDead(_6); + StorageDead(_5); StorageDead(_1); return; } diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff index 6dead031a9f6a..37ede922c9a35 100644 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff @@ -6,13 +6,12 @@ let mut _1: i32; let _2: (); let mut _3: &i32; - let _4: &i32; - let _5: (); + let _4: (); scope 1 { debug a => _1; - let _6: i32; + let _5: i32; scope 2 { - debug b => _6; + debug b => _5; } } @@ -21,27 +20,24 @@ _1 = const 0_i32; StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _4 = &_1; - _3 = &(*_4); + _3 = &_1; _2 = escape::(move _3) -> [return: bb1, unwind continue]; } bb1: { StorageDead(_3); - StorageDead(_4); StorageDead(_2); _1 = const 1_i32; - StorageLive(_5); - _5 = some_function() -> [return: bb2, unwind continue]; + StorageLive(_4); + _4 = some_function() -> [return: bb2, unwind continue]; } bb2: { - StorageDead(_5); - StorageLive(_6); - _6 = copy _1; + StorageDead(_4); + StorageLive(_5); + _5 = copy _1; _0 = const (); - StorageDead(_6); + StorageDead(_5); StorageDead(_1); return; } diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff index fd9ef54fe775f..6a748d0580161 100644 --- a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff @@ -6,21 +6,20 @@ let _1: u32; let mut _2: &[u32]; let mut _3: &[u32; 3]; - let _4: &[u32; 3]; - let _5: [u32; 3]; - let _6: usize; - let mut _7: usize; - let mut _8: bool; - let mut _10: &[u32]; - let _11: usize; - let mut _12: usize; - let mut _13: bool; - let mut _14: &[u32; 3]; + let _4: [u32; 3]; + let _5: usize; + let mut _6: usize; + let mut _7: bool; + let mut _9: &[u32]; + let _10: usize; + let mut _11: usize; + let mut _12: bool; + let mut _13: &[u32; 3]; scope 1 { debug local => _1; - let _9: u32; + let _8: u32; scope 2 { - debug constant => _9; + debug constant => _8; } } @@ -28,48 +27,45 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _14 = const main::promoted[0]; - _4 = copy _14; - _3 = copy _4; + _13 = const main::promoted[0]; + _3 = copy _13; _2 = move _3 as &[u32] (PointerCoercion(Unsize, AsCast)); StorageDead(_3); - StorageLive(_6); - _6 = const 1_usize; -- _7 = PtrMetadata(copy _2); -- _8 = Lt(copy _6, copy _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable]; -+ _7 = const 3_usize; -+ _8 = const true; + StorageLive(_5); + _5 = const 1_usize; +- _6 = PtrMetadata(copy _2); +- _7 = Lt(copy _5, copy _6); +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb1, unwind unreachable]; ++ _6 = const 3_usize; ++ _7 = 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 = copy (*_2)[_6]; +- _1 = copy (*_2)[_5]; + _1 = copy (*_2)[1 of 2]; - StorageDead(_6); - StorageDead(_4); + StorageDead(_5); StorageDead(_2); + StorageLive(_8); StorageLive(_9); + _9 = const main::SLICE; StorageLive(_10); - _10 = const main::SLICE; - StorageLive(_11); - _11 = const 1_usize; -- _12 = PtrMetadata(copy _10); -- _13 = Lt(copy _11, copy _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, copy _11) -> [success: bb2, unwind unreachable]; -+ _12 = const 3_usize; -+ _13 = const true; + _10 = const 1_usize; +- _11 = PtrMetadata(copy _9); +- _12 = Lt(copy _10, copy _11); +- assert(move _12, "index out of bounds: the length is {} but the index is {}", move _11, copy _10) -> [success: bb2, unwind unreachable]; ++ _11 = const 3_usize; ++ _12 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind unreachable]; } bb2: { -- _9 = copy (*_10)[_11]; -+ _9 = copy (*_10)[1 of 2]; - StorageDead(_11); +- _8 = copy (*_9)[_10]; ++ _8 = copy (*_9)[1 of 2]; StorageDead(_10); - _0 = const (); StorageDead(_9); + _0 = const (); + StorageDead(_8); StorageDead(_1); return; } diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff index 1fec08c256201..9f2f5c610c735 100644 --- a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff @@ -6,21 +6,20 @@ let _1: u32; let mut _2: &[u32]; let mut _3: &[u32; 3]; - let _4: &[u32; 3]; - let _5: [u32; 3]; - let _6: usize; - let mut _7: usize; - let mut _8: bool; - let mut _10: &[u32]; - let _11: usize; - let mut _12: usize; - let mut _13: bool; - let mut _14: &[u32; 3]; + let _4: [u32; 3]; + let _5: usize; + let mut _6: usize; + let mut _7: bool; + let mut _9: &[u32]; + let _10: usize; + let mut _11: usize; + let mut _12: bool; + let mut _13: &[u32; 3]; scope 1 { debug local => _1; - let _9: u32; + let _8: u32; scope 2 { - debug constant => _9; + debug constant => _8; } } @@ -28,48 +27,45 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _14 = const main::promoted[0]; - _4 = copy _14; - _3 = copy _4; + _13 = const main::promoted[0]; + _3 = copy _13; _2 = move _3 as &[u32] (PointerCoercion(Unsize, AsCast)); StorageDead(_3); - StorageLive(_6); - _6 = const 1_usize; -- _7 = PtrMetadata(copy _2); -- _8 = Lt(copy _6, copy _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue]; -+ _7 = const 3_usize; -+ _8 = const true; + StorageLive(_5); + _5 = const 1_usize; +- _6 = PtrMetadata(copy _2); +- _7 = Lt(copy _5, copy _6); +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb1, unwind continue]; ++ _6 = const 3_usize; ++ _7 = 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 = copy (*_2)[_6]; +- _1 = copy (*_2)[_5]; + _1 = copy (*_2)[1 of 2]; - StorageDead(_6); - StorageDead(_4); + StorageDead(_5); StorageDead(_2); + StorageLive(_8); StorageLive(_9); + _9 = const main::SLICE; StorageLive(_10); - _10 = const main::SLICE; - StorageLive(_11); - _11 = const 1_usize; -- _12 = PtrMetadata(copy _10); -- _13 = Lt(copy _11, copy _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, copy _11) -> [success: bb2, unwind continue]; -+ _12 = const 3_usize; -+ _13 = const true; + _10 = const 1_usize; +- _11 = PtrMetadata(copy _9); +- _12 = Lt(copy _10, copy _11); +- assert(move _12, "index out of bounds: the length is {} but the index is {}", move _11, copy _10) -> [success: bb2, unwind continue]; ++ _11 = const 3_usize; ++ _12 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind continue]; } bb2: { -- _9 = copy (*_10)[_11]; -+ _9 = copy (*_10)[1 of 2]; - StorageDead(_11); +- _8 = copy (*_9)[_10]; ++ _8 = copy (*_9)[1 of 2]; StorageDead(_10); - _0 = const (); StorageDead(_9); + _0 = const (); + StorageDead(_8); StorageDead(_1); return; } diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff index fd9ef54fe775f..6a748d0580161 100644 --- a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff @@ -6,21 +6,20 @@ let _1: u32; let mut _2: &[u32]; let mut _3: &[u32; 3]; - let _4: &[u32; 3]; - let _5: [u32; 3]; - let _6: usize; - let mut _7: usize; - let mut _8: bool; - let mut _10: &[u32]; - let _11: usize; - let mut _12: usize; - let mut _13: bool; - let mut _14: &[u32; 3]; + let _4: [u32; 3]; + let _5: usize; + let mut _6: usize; + let mut _7: bool; + let mut _9: &[u32]; + let _10: usize; + let mut _11: usize; + let mut _12: bool; + let mut _13: &[u32; 3]; scope 1 { debug local => _1; - let _9: u32; + let _8: u32; scope 2 { - debug constant => _9; + debug constant => _8; } } @@ -28,48 +27,45 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _14 = const main::promoted[0]; - _4 = copy _14; - _3 = copy _4; + _13 = const main::promoted[0]; + _3 = copy _13; _2 = move _3 as &[u32] (PointerCoercion(Unsize, AsCast)); StorageDead(_3); - StorageLive(_6); - _6 = const 1_usize; -- _7 = PtrMetadata(copy _2); -- _8 = Lt(copy _6, copy _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable]; -+ _7 = const 3_usize; -+ _8 = const true; + StorageLive(_5); + _5 = const 1_usize; +- _6 = PtrMetadata(copy _2); +- _7 = Lt(copy _5, copy _6); +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb1, unwind unreachable]; ++ _6 = const 3_usize; ++ _7 = 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 = copy (*_2)[_6]; +- _1 = copy (*_2)[_5]; + _1 = copy (*_2)[1 of 2]; - StorageDead(_6); - StorageDead(_4); + StorageDead(_5); StorageDead(_2); + StorageLive(_8); StorageLive(_9); + _9 = const main::SLICE; StorageLive(_10); - _10 = const main::SLICE; - StorageLive(_11); - _11 = const 1_usize; -- _12 = PtrMetadata(copy _10); -- _13 = Lt(copy _11, copy _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, copy _11) -> [success: bb2, unwind unreachable]; -+ _12 = const 3_usize; -+ _13 = const true; + _10 = const 1_usize; +- _11 = PtrMetadata(copy _9); +- _12 = Lt(copy _10, copy _11); +- assert(move _12, "index out of bounds: the length is {} but the index is {}", move _11, copy _10) -> [success: bb2, unwind unreachable]; ++ _11 = const 3_usize; ++ _12 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind unreachable]; } bb2: { -- _9 = copy (*_10)[_11]; -+ _9 = copy (*_10)[1 of 2]; - StorageDead(_11); +- _8 = copy (*_9)[_10]; ++ _8 = copy (*_9)[1 of 2]; StorageDead(_10); - _0 = const (); StorageDead(_9); + _0 = const (); + StorageDead(_8); StorageDead(_1); return; } diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff index 1fec08c256201..9f2f5c610c735 100644 --- a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff @@ -6,21 +6,20 @@ let _1: u32; let mut _2: &[u32]; let mut _3: &[u32; 3]; - let _4: &[u32; 3]; - let _5: [u32; 3]; - let _6: usize; - let mut _7: usize; - let mut _8: bool; - let mut _10: &[u32]; - let _11: usize; - let mut _12: usize; - let mut _13: bool; - let mut _14: &[u32; 3]; + let _4: [u32; 3]; + let _5: usize; + let mut _6: usize; + let mut _7: bool; + let mut _9: &[u32]; + let _10: usize; + let mut _11: usize; + let mut _12: bool; + let mut _13: &[u32; 3]; scope 1 { debug local => _1; - let _9: u32; + let _8: u32; scope 2 { - debug constant => _9; + debug constant => _8; } } @@ -28,48 +27,45 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _14 = const main::promoted[0]; - _4 = copy _14; - _3 = copy _4; + _13 = const main::promoted[0]; + _3 = copy _13; _2 = move _3 as &[u32] (PointerCoercion(Unsize, AsCast)); StorageDead(_3); - StorageLive(_6); - _6 = const 1_usize; -- _7 = PtrMetadata(copy _2); -- _8 = Lt(copy _6, copy _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue]; -+ _7 = const 3_usize; -+ _8 = const true; + StorageLive(_5); + _5 = const 1_usize; +- _6 = PtrMetadata(copy _2); +- _7 = Lt(copy _5, copy _6); +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb1, unwind continue]; ++ _6 = const 3_usize; ++ _7 = 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 = copy (*_2)[_6]; +- _1 = copy (*_2)[_5]; + _1 = copy (*_2)[1 of 2]; - StorageDead(_6); - StorageDead(_4); + StorageDead(_5); StorageDead(_2); + StorageLive(_8); StorageLive(_9); + _9 = const main::SLICE; StorageLive(_10); - _10 = const main::SLICE; - StorageLive(_11); - _11 = const 1_usize; -- _12 = PtrMetadata(copy _10); -- _13 = Lt(copy _11, copy _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, copy _11) -> [success: bb2, unwind continue]; -+ _12 = const 3_usize; -+ _13 = const true; + _10 = const 1_usize; +- _11 = PtrMetadata(copy _9); +- _12 = Lt(copy _10, copy _11); +- assert(move _12, "index out of bounds: the length is {} but the index is {}", move _11, copy _10) -> [success: bb2, unwind continue]; ++ _11 = const 3_usize; ++ _12 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind continue]; } bb2: { -- _9 = copy (*_10)[_11]; -+ _9 = copy (*_10)[1 of 2]; - StorageDead(_11); +- _8 = copy (*_9)[_10]; ++ _8 = copy (*_9)[1 of 2]; StorageDead(_10); - _0 = const (); StorageDead(_9); + _0 = const (); + StorageDead(_8); StorageDead(_1); return; } diff --git a/tests/mir-opt/dead-store-elimination/ref.dead_first.DeadStoreElimination-initial.diff b/tests/mir-opt/dead-store-elimination/ref.dead_first.DeadStoreElimination-initial.diff index 2a793e24990ae..043f1863732b9 100644 --- a/tests/mir-opt/dead-store-elimination/ref.dead_first.DeadStoreElimination-initial.diff +++ b/tests/mir-opt/dead-store-elimination/ref.dead_first.DeadStoreElimination-initial.diff @@ -6,7 +6,6 @@ let mut _0: &i32; let mut _2: &i32; let mut _3: &i32; - let _4: &i32; scope 1 { debug a => _2; } @@ -16,13 +15,10 @@ - _2 = &((*_1).2: i32); + // DBG: _2 = &((*_1).2: i32); StorageLive(_3); - StorageLive(_4); - _4 = &((*_1).0: i32); - _3 = &(*_4); + _3 = &((*_1).0: i32); _2 = move _3; StorageDead(_3); - StorageDead(_4); - _0 = &(*_2); + _0 = copy _2; StorageDead(_2); return; } diff --git a/tests/mir-opt/dead-store-elimination/ref.rs b/tests/mir-opt/dead-store-elimination/ref.rs index 2d3200edab9f6..40672bf51999d 100644 --- a/tests/mir-opt/dead-store-elimination/ref.rs +++ b/tests/mir-opt/dead-store-elimination/ref.rs @@ -23,8 +23,8 @@ pub fn dead_first(v: &Foo) -> &i32 { // CHECK: bb0: // CHECK: DBG: [[var_a]] = &((*_1).2: i32) // CHECK: [[tmp_4:_[0-9]+]] = &((*_1).0: i32) - // CHECK: [[tmp_3:_[0-9]+]] = &(*[[tmp_4]]) - // CHECK: [[var_a]] = move [[tmp_3]] + // CHECK: [[tmp_3:_[0-9]+]] = move [[tmp_4]] + // CHECK: _0 = copy [[tmp_3]] let mut a = &v.c; a = &v.a; a diff --git a/tests/mir-opt/debuginfo/single_use_consts.invalid_debuginfo.SingleUseConsts.diff b/tests/mir-opt/debuginfo/single_use_consts.invalid_debuginfo.SingleUseConsts.diff index 09e9f26546a85..9afc511ef1c8f 100644 --- a/tests/mir-opt/debuginfo/single_use_consts.invalid_debuginfo.SingleUseConsts.diff +++ b/tests/mir-opt/debuginfo/single_use_consts.invalid_debuginfo.SingleUseConsts.diff @@ -7,21 +7,19 @@ scope 1 (inlined foo) { let _2: (); let mut _3: &isize; - let _4: &isize; - let _5: isize; - let mut _6: &isize; + let _4: isize; + let mut _5: &isize; scope 2 (inlined bar) { -- debug x => _4; +- debug x => _3; + debug x => const foo::promoted[0]; - let _7: isize; - let mut _9: &isize; - let _10: &isize; + let _6: isize; + let mut _8: &isize; scope 3 { -- debug a => _7; +- debug a => _6; + debug a => const 1_isize; - let mut _8: &isize; + let mut _7: &isize; scope 4 { -- debug z => _4; +- debug z => _3; + debug z => const foo::promoted[0]; } } @@ -30,17 +28,17 @@ bb0: { StorageLive(_1); - StorageLive(_4); -- _4 = const foo::promoted[0]; + StorageLive(_3); +- _3 = const foo::promoted[0]; + nop; - StorageLive(_7); -- _7 = const 1_isize; -- // DBG: _4 = &_7; + StorageLive(_6); +- _6 = const 1_isize; +- // DBG: _3 = &_6; + nop; - StorageDead(_7); + StorageDead(_6); + StorageDead(_3); - _1 = const (); + nop; - StorageDead(_4); StorageDead(_1); _0 = const (); return; diff --git a/tests/mir-opt/dont_inline_type_id.call.Inline.diff b/tests/mir-opt/dont_inline_type_id.call.Inline.diff index 80cfe07b0cbf6..e2c4ecabba3f9 100644 --- a/tests/mir-opt/dont_inline_type_id.call.Inline.diff +++ b/tests/mir-opt/dont_inline_type_id.call.Inline.diff @@ -8,7 +8,7 @@ bb0: { StorageLive(_2); - _2 = &(*_1); + _2 = copy _1; _0 = ::type_id(move _2) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff index ebf10f94313d5..101e4508d2a19 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff @@ -4,28 +4,27 @@ fn test() -> () { let mut _0: (); let _1: &std::boxed::Box<()>; - let _2: &std::boxed::Box<()>; - let _3: std::boxed::Box<()>; - let mut _4: (); - let mut _7: *const (); - let mut _9: *const [()]; - let mut _10: std::boxed::Box<()>; - let mut _11: *const (); - let mut _14: usize; + let _2: std::boxed::Box<()>; + let mut _3: (); + let mut _6: *const (); + let mut _8: *const [()]; + let mut _9: std::boxed::Box<()>; + let mut _10: *const (); + let mut _13: usize; scope 1 { debug vp_ctx => _1; - let _5: *const (); + let _4: *const (); scope 2 { - debug slf => _5; - let _6: *const [()]; + debug slf => _4; + let _5: *const [()]; scope 3 { - debug bytes => _6; - let _8: *mut (); + debug bytes => _5; + let _7: *mut (); scope 4 { - debug _x => _8; + debug _x => _7; } scope 9 (inlined foo) { - let mut _15: *const [()]; + let mut _14: *const [()]; } } scope 7 (inlined slice_from_raw_parts::<()>) { @@ -35,8 +34,8 @@ } } scope 5 (inlined Box::<()>::new) { - let mut _12: *mut (); - let mut _13: *mut u8; + let mut _11: *mut (); + let mut _12: *mut u8; scope 6 { } } @@ -45,60 +44,57 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); -- _4 = (); -+ _4 = const (); +- _3 = (); ++ _3 = const (); + StorageLive(_11); StorageLive(_12); - StorageLive(_13); -- _13 = boxed::box_new_uninit(const <() as std::mem::SizedTypeProperties>::LAYOUT) -> [return: bb2, unwind unreachable]; -+ _13 = boxed::box_new_uninit(const Layout {{ size: 0_usize, align: std::mem::Alignment {{ _inner_repr_trick: mem::alignment::AlignmentEnum::_Align1Shl0 }} }}) -> [return: bb2, unwind unreachable]; +- _12 = boxed::box_new_uninit(const <() as std::mem::SizedTypeProperties>::LAYOUT) -> [return: bb2, unwind unreachable]; ++ _12 = boxed::box_new_uninit(const Layout {{ size: 0_usize, align: std::mem::Alignment {{ _inner_repr_trick: mem::alignment::AlignmentEnum::_Align1Shl0 }} }}) -> [return: bb2, unwind unreachable]; } bb1: { - StorageDead(_3); + StorageDead(_2); StorageDead(_1); return; } bb2: { - _12 = copy _13 as *mut () (PtrToPtr); -- (*_12) = move _4; -+ (*_12) = const (); - _3 = copy _13 as std::boxed::Box<()> (Transmute); - StorageDead(_13); + _11 = copy _12 as *mut () (PtrToPtr); +- (*_11) = move _3; ++ (*_11) = const (); + _2 = copy _12 as std::boxed::Box<()> (Transmute); StorageDead(_12); - StorageDead(_4); - _2 = &_3; - _1 = &(*_2); - StorageDead(_2); + StorageDead(_11); + StorageDead(_3); + _1 = &_2; + StorageLive(_4); + _9 = no_retag copy (*_1); + _10 = copy (_9.0: std::boxed::BoxRaw<()>) as *const () (BoxDerefTransmute); + _4 = &raw const (*_10); StorageLive(_5); - _10 = no_retag copy (*_1); - _11 = copy (_10.0: std::boxed::BoxRaw<()>) as *const () (BoxDerefTransmute); - _5 = &raw const (*_11); StorageLive(_6); + _6 = copy _4; + StorageLive(_13); + _13 = const 1_usize; +- _5 = *const [()] from (copy _6, copy _13); ++ _5 = *const [()] from (copy _4, const 1_usize); + StorageDead(_13); + StorageDead(_6); StorageLive(_7); - _7 = copy _5; + StorageLive(_8); + _8 = copy _5; StorageLive(_14); - _14 = const 1_usize; -- _6 = *const [()] from (copy _7, copy _14); -+ _6 = *const [()] from (copy _5, const 1_usize); +- _14 = copy _8; +- _7 = copy _8 as *mut () (PtrToPtr); ++ _14 = copy _5; ++ _7 = copy _4 as *mut () (PtrToPtr); StorageDead(_14); - StorageDead(_7); - StorageLive(_8); - StorageLive(_9); - _9 = copy _6; - StorageLive(_15); -- _15 = copy _9; -- _8 = copy _9 as *mut () (PtrToPtr); -+ _15 = copy _6; -+ _8 = copy _5 as *mut () (PtrToPtr); - StorageDead(_15); - StorageDead(_9); - _0 = const (); StorageDead(_8); - StorageDead(_6); + _0 = const (); + StorageDead(_7); StorageDead(_5); - drop(_3) -> [return: bb1, unwind unreachable]; + StorageDead(_4); + drop(_2) -> [return: bb1, unwind unreachable]; } + } + diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff index 503d931849567..47be5904c23c4 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff @@ -4,28 +4,27 @@ fn test() -> () { let mut _0: (); let _1: &std::boxed::Box<()>; - let _2: &std::boxed::Box<()>; - let _3: std::boxed::Box<()>; - let mut _4: (); - let mut _7: *const (); - let mut _9: *const [()]; - let mut _10: std::boxed::Box<()>; - let mut _11: *const (); - let mut _12: usize; + let _2: std::boxed::Box<()>; + let mut _3: (); + let mut _6: *const (); + let mut _8: *const [()]; + let mut _9: std::boxed::Box<()>; + let mut _10: *const (); + let mut _11: usize; scope 1 { debug vp_ctx => _1; - let _5: *const (); + let _4: *const (); scope 2 { - debug slf => _5; - let _6: *const [()]; + debug slf => _4; + let _5: *const [()]; scope 3 { - debug bytes => _6; - let _8: *mut (); + debug bytes => _5; + let _7: *mut (); scope 4 { - debug _x => _8; + debug _x => _7; } scope 7 (inlined foo) { - let mut _13: *const [()]; + let mut _12: *const [()]; } } scope 5 (inlined slice_from_raw_parts::<()>) { @@ -39,50 +38,47 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); -- _4 = (); -- _3 = Box::<()>::new(move _4) -> [return: bb1, unwind continue]; -+ _4 = const (); -+ _3 = Box::<()>::new(const ()) -> [return: bb1, unwind continue]; +- _3 = (); +- _2 = Box::<()>::new(move _3) -> [return: bb1, unwind continue]; ++ _3 = const (); ++ _2 = Box::<()>::new(const ()) -> [return: bb1, unwind continue]; } bb1: { - StorageDead(_4); - _2 = &_3; - _1 = &(*_2); - StorageDead(_2); + StorageDead(_3); + _1 = &_2; + StorageLive(_4); + _9 = no_retag copy (*_1); + _10 = copy (_9.0: std::boxed::BoxRaw<()>) as *const () (BoxDerefTransmute); + _4 = &raw const (*_10); StorageLive(_5); - _10 = no_retag copy (*_1); - _11 = copy (_10.0: std::boxed::BoxRaw<()>) as *const () (BoxDerefTransmute); - _5 = &raw const (*_11); StorageLive(_6); + _6 = copy _4; + StorageLive(_11); + _11 = const 1_usize; +- _5 = *const [()] from (copy _6, copy _11); ++ _5 = *const [()] from (copy _4, const 1_usize); + StorageDead(_11); + StorageDead(_6); StorageLive(_7); - _7 = copy _5; + StorageLive(_8); + _8 = copy _5; StorageLive(_12); - _12 = const 1_usize; -- _6 = *const [()] from (copy _7, copy _12); -+ _6 = *const [()] from (copy _5, const 1_usize); +- _12 = copy _8; +- _7 = copy _8 as *mut () (PtrToPtr); ++ _12 = copy _5; ++ _7 = copy _4 as *mut () (PtrToPtr); StorageDead(_12); - StorageDead(_7); - StorageLive(_8); - StorageLive(_9); - _9 = copy _6; - StorageLive(_13); -- _13 = copy _9; -- _8 = copy _9 as *mut () (PtrToPtr); -+ _13 = copy _6; -+ _8 = copy _5 as *mut () (PtrToPtr); - StorageDead(_13); - StorageDead(_9); - _0 = const (); StorageDead(_8); - StorageDead(_6); + _0 = const (); + StorageDead(_7); StorageDead(_5); - drop(_3) -> [return: bb2, unwind: bb3]; + StorageDead(_4); + drop(_2) -> [return: bb2, unwind: bb3]; } bb2: { - StorageDead(_3); + StorageDead(_2); StorageDead(_1); return; } diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff index 888454e6eb5a9..8ecb7c106e8e5 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff @@ -4,28 +4,27 @@ fn test() -> () { let mut _0: (); let _1: &std::boxed::Box<()>; - let _2: &std::boxed::Box<()>; - let _3: std::boxed::Box<()>; - let mut _4: (); - let mut _7: *const (); - let mut _9: *const [()]; - let mut _10: std::boxed::Box<()>; - let mut _11: *const (); - let mut _14: usize; + let _2: std::boxed::Box<()>; + let mut _3: (); + let mut _6: *const (); + let mut _8: *const [()]; + let mut _9: std::boxed::Box<()>; + let mut _10: *const (); + let mut _13: usize; scope 1 { debug vp_ctx => _1; - let _5: *const (); + let _4: *const (); scope 2 { - debug slf => _5; - let _6: *const [()]; + debug slf => _4; + let _5: *const [()]; scope 3 { - debug bytes => _6; - let _8: *mut (); + debug bytes => _5; + let _7: *mut (); scope 4 { - debug _x => _8; + debug _x => _7; } scope 9 (inlined foo) { - let mut _15: *const [()]; + let mut _14: *const [()]; } } scope 7 (inlined slice_from_raw_parts::<()>) { @@ -35,8 +34,8 @@ } } scope 5 (inlined Box::<()>::new) { - let mut _12: *mut (); - let mut _13: *mut u8; + let mut _11: *mut (); + let mut _12: *mut u8; scope 6 { } } @@ -45,60 +44,57 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); -- _4 = (); -+ _4 = const (); +- _3 = (); ++ _3 = const (); + StorageLive(_11); StorageLive(_12); - StorageLive(_13); -- _13 = boxed::box_new_uninit(const <() as std::mem::SizedTypeProperties>::LAYOUT) -> [return: bb2, unwind unreachable]; -+ _13 = boxed::box_new_uninit(const Layout {{ size: 0_usize, align: std::mem::Alignment {{ _inner_repr_trick: mem::alignment::AlignmentEnum::_Align1Shl0 }} }}) -> [return: bb2, unwind unreachable]; +- _12 = boxed::box_new_uninit(const <() as std::mem::SizedTypeProperties>::LAYOUT) -> [return: bb2, unwind unreachable]; ++ _12 = boxed::box_new_uninit(const Layout {{ size: 0_usize, align: std::mem::Alignment {{ _inner_repr_trick: mem::alignment::AlignmentEnum::_Align1Shl0 }} }}) -> [return: bb2, unwind unreachable]; } bb1: { - StorageDead(_3); + StorageDead(_2); StorageDead(_1); return; } bb2: { - _12 = copy _13 as *mut () (PtrToPtr); -- (*_12) = move _4; -+ (*_12) = const (); - _3 = copy _13 as std::boxed::Box<()> (Transmute); - StorageDead(_13); + _11 = copy _12 as *mut () (PtrToPtr); +- (*_11) = move _3; ++ (*_11) = const (); + _2 = copy _12 as std::boxed::Box<()> (Transmute); StorageDead(_12); - StorageDead(_4); - _2 = &_3; - _1 = &(*_2); - StorageDead(_2); + StorageDead(_11); + StorageDead(_3); + _1 = &_2; + StorageLive(_4); + _9 = no_retag copy (*_1); + _10 = copy (_9.0: std::boxed::BoxRaw<()>) as *const () (BoxDerefTransmute); + _4 = &raw const (*_10); StorageLive(_5); - _10 = no_retag copy (*_1); - _11 = copy (_10.0: std::boxed::BoxRaw<()>) as *const () (BoxDerefTransmute); - _5 = &raw const (*_11); StorageLive(_6); + _6 = copy _4; + StorageLive(_13); + _13 = const 1_usize; +- _5 = *const [()] from (copy _6, copy _13); ++ _5 = *const [()] from (copy _4, const 1_usize); + StorageDead(_13); + StorageDead(_6); StorageLive(_7); - _7 = copy _5; + StorageLive(_8); + _8 = copy _5; StorageLive(_14); - _14 = const 1_usize; -- _6 = *const [()] from (copy _7, copy _14); -+ _6 = *const [()] from (copy _5, const 1_usize); +- _14 = copy _8; +- _7 = copy _8 as *mut () (PtrToPtr); ++ _14 = copy _5; ++ _7 = copy _4 as *mut () (PtrToPtr); StorageDead(_14); - StorageDead(_7); - StorageLive(_8); - StorageLive(_9); - _9 = copy _6; - StorageLive(_15); -- _15 = copy _9; -- _8 = copy _9 as *mut () (PtrToPtr); -+ _15 = copy _6; -+ _8 = copy _5 as *mut () (PtrToPtr); - StorageDead(_15); - StorageDead(_9); - _0 = const (); StorageDead(_8); - StorageDead(_6); + _0 = const (); + StorageDead(_7); StorageDead(_5); - drop(_3) -> [return: bb1, unwind unreachable]; + StorageDead(_4); + drop(_2) -> [return: bb1, unwind unreachable]; } + } + diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff index 503d931849567..47be5904c23c4 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff @@ -4,28 +4,27 @@ fn test() -> () { let mut _0: (); let _1: &std::boxed::Box<()>; - let _2: &std::boxed::Box<()>; - let _3: std::boxed::Box<()>; - let mut _4: (); - let mut _7: *const (); - let mut _9: *const [()]; - let mut _10: std::boxed::Box<()>; - let mut _11: *const (); - let mut _12: usize; + let _2: std::boxed::Box<()>; + let mut _3: (); + let mut _6: *const (); + let mut _8: *const [()]; + let mut _9: std::boxed::Box<()>; + let mut _10: *const (); + let mut _11: usize; scope 1 { debug vp_ctx => _1; - let _5: *const (); + let _4: *const (); scope 2 { - debug slf => _5; - let _6: *const [()]; + debug slf => _4; + let _5: *const [()]; scope 3 { - debug bytes => _6; - let _8: *mut (); + debug bytes => _5; + let _7: *mut (); scope 4 { - debug _x => _8; + debug _x => _7; } scope 7 (inlined foo) { - let mut _13: *const [()]; + let mut _12: *const [()]; } } scope 5 (inlined slice_from_raw_parts::<()>) { @@ -39,50 +38,47 @@ StorageLive(_1); StorageLive(_2); StorageLive(_3); - StorageLive(_4); -- _4 = (); -- _3 = Box::<()>::new(move _4) -> [return: bb1, unwind continue]; -+ _4 = const (); -+ _3 = Box::<()>::new(const ()) -> [return: bb1, unwind continue]; +- _3 = (); +- _2 = Box::<()>::new(move _3) -> [return: bb1, unwind continue]; ++ _3 = const (); ++ _2 = Box::<()>::new(const ()) -> [return: bb1, unwind continue]; } bb1: { - StorageDead(_4); - _2 = &_3; - _1 = &(*_2); - StorageDead(_2); + StorageDead(_3); + _1 = &_2; + StorageLive(_4); + _9 = no_retag copy (*_1); + _10 = copy (_9.0: std::boxed::BoxRaw<()>) as *const () (BoxDerefTransmute); + _4 = &raw const (*_10); StorageLive(_5); - _10 = no_retag copy (*_1); - _11 = copy (_10.0: std::boxed::BoxRaw<()>) as *const () (BoxDerefTransmute); - _5 = &raw const (*_11); StorageLive(_6); + _6 = copy _4; + StorageLive(_11); + _11 = const 1_usize; +- _5 = *const [()] from (copy _6, copy _11); ++ _5 = *const [()] from (copy _4, const 1_usize); + StorageDead(_11); + StorageDead(_6); StorageLive(_7); - _7 = copy _5; + StorageLive(_8); + _8 = copy _5; StorageLive(_12); - _12 = const 1_usize; -- _6 = *const [()] from (copy _7, copy _12); -+ _6 = *const [()] from (copy _5, const 1_usize); +- _12 = copy _8; +- _7 = copy _8 as *mut () (PtrToPtr); ++ _12 = copy _5; ++ _7 = copy _4 as *mut () (PtrToPtr); StorageDead(_12); - StorageDead(_7); - StorageLive(_8); - StorageLive(_9); - _9 = copy _6; - StorageLive(_13); -- _13 = copy _9; -- _8 = copy _9 as *mut () (PtrToPtr); -+ _13 = copy _6; -+ _8 = copy _5 as *mut () (PtrToPtr); - StorageDead(_13); - StorageDead(_9); - _0 = const (); StorageDead(_8); - StorageDead(_6); + _0 = const (); + StorageDead(_7); StorageDead(_5); - drop(_3) -> [return: bb2, unwind: bb3]; + StorageDead(_4); + drop(_2) -> [return: bb2, unwind: bb3]; } bb2: { - StorageDead(_3); + StorageDead(_2); StorageDead(_1); return; } diff --git a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff index 5ce130fbace82..129f3b54b0903 100644 --- a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff @@ -35,8 +35,9 @@ + _5 = const usize::MAX; StorageLive(_6); StorageLive(_7); - _7 = &(*_1); - _6 = core::slice::::len(move _7) -> [return: bb1, unwind unreachable]; + _7 = copy _1; +- _6 = core::slice::::len(move _7) -> [return: bb1, unwind unreachable]; ++ _6 = core::slice::::len(copy _1) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff index f81b8cbecb663..34de8d468fbf0 100644 --- a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff @@ -35,8 +35,9 @@ + _5 = const usize::MAX; StorageLive(_6); StorageLive(_7); - _7 = &(*_1); - _6 = core::slice::::len(move _7) -> [return: bb1, unwind continue]; + _7 = copy _1; +- _6 = core::slice::::len(move _7) -> [return: bb1, unwind continue]; ++ _6 = core::slice::::len(copy _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/gvn.slice_const_length.GVN.panic-abort.diff b/tests/mir-opt/gvn.slice_const_length.GVN.panic-abort.diff index 412f908821ab6..1f0fe56a6809a 100644 --- a/tests/mir-opt/gvn.slice_const_length.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.slice_const_length.GVN.panic-abort.diff @@ -19,8 +19,9 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); - _2 = core::slice::::as_ptr(move _3) -> [return: bb1, unwind unreachable]; + _3 = copy _1; +- _2 = core::slice::::as_ptr(move _3) -> [return: bb1, unwind unreachable]; ++ _2 = core::slice::::as_ptr(copy _1) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/gvn.slice_const_length.GVN.panic-unwind.diff b/tests/mir-opt/gvn.slice_const_length.GVN.panic-unwind.diff index 6f166971631c2..efcf507a023a3 100644 --- a/tests/mir-opt/gvn.slice_const_length.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.slice_const_length.GVN.panic-unwind.diff @@ -19,8 +19,9 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); - _2 = core::slice::::as_ptr(move _3) -> [return: bb1, unwind continue]; + _3 = copy _1; +- _2 = core::slice::::as_ptr(move _3) -> [return: bb1, unwind continue]; ++ _2 = core::slice::::as_ptr(copy _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff index 69c74d11d17e3..7a36ec8aeed30 100644 --- a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff @@ -23,32 +23,28 @@ let _22: !; let mut _23: core::panicking::AssertKind; let mut _24: &*const u8; - let _25: &*const u8; - let mut _26: &*const u8; - let _27: &*const u8; - let mut _28: std::option::Option>; - let mut _30: &str; + let mut _25: &*const u8; + let mut _26: std::option::Option>; + let mut _28: &str; + let _29: (); + let mut _30: &[u8]; let _31: (); - let mut _32: &[u8]; - let _33: (); - let mut _34: (&*const u8, &*const u8); - let mut _35: &*const u8; - let _36: *const u8; - let mut _37: &str; - let mut _38: &*const u8; - let _39: *const u8; - let mut _40: &[u8]; - let mut _43: bool; - let mut _44: *const u8; - let mut _45: *const u8; - let mut _46: !; - let _48: !; - let mut _49: core::panicking::AssertKind; - let mut _50: &*const u8; - let _51: &*const u8; - let mut _52: &*const u8; - let _53: &*const u8; - let mut _54: std::option::Option>; + let mut _32: (&*const u8, &*const u8); + let mut _33: &*const u8; + let _34: *const u8; + let mut _35: &str; + let mut _36: &*const u8; + let _37: *const u8; + let mut _38: &[u8]; + let mut _41: bool; + let mut _42: *const u8; + let mut _43: *const u8; + let mut _44: !; + let _46: !; + let mut _47: core::panicking::AssertKind; + let mut _48: &*const u8; + let mut _49: &*const u8; + let mut _50: std::option::Option>; scope 1 { debug s => _1; let _4: &str; @@ -56,7 +52,7 @@ debug t => _4; let _15: &*const u8; let _16: &*const u8; - let _29: &[u8]; + let _27: &[u8]; scope 3 { debug left_val => _15; debug right_val => _16; @@ -66,15 +62,15 @@ } } scope 5 { - debug u => _29; - let _41: &*const u8; - let _42: &*const u8; + debug u => _27; + let _39: &*const u8; + let _40: &*const u8; scope 6 { - debug left_val => _41; - debug right_val => _42; - let _47: core::panicking::AssertKind; + debug left_val => _39; + debug right_val => _40; + let _45: core::panicking::AssertKind; scope 7 { - debug kind => _47; + debug kind => _45; } } } @@ -115,8 +111,10 @@ + nop; StorageLive(_10); StorageLive(_11); - _11 = &(*_1); - _10 = core::str::::as_ptr(move _11) -> [return: bb3, unwind unreachable]; +- _11 = copy _1; +- _10 = core::str::::as_ptr(move _11) -> [return: bb3, unwind unreachable]; ++ _11 = const "my favourite slice"; ++ _10 = core::str::::as_ptr(const "my favourite slice") -> [return: bb3, unwind unreachable]; } bb3: { @@ -126,9 +124,10 @@ + nop; StorageLive(_13); StorageLive(_14); -- _14 = &(*_4); -+ _14 = &(*_1); - _13 = core::str::::as_ptr(move _14) -> [return: bb4, unwind unreachable]; +- _14 = copy _4; +- _13 = core::str::::as_ptr(move _14) -> [return: bb4, unwind unreachable]; ++ _14 = const "my favourite slice"; ++ _13 = core::str::::as_ptr(const "my favourite slice") -> [return: bb4, unwind unreachable]; } bb4: { @@ -169,16 +168,18 @@ StorageDead(_10); StorageDead(_8); StorageDead(_7); + StorageLive(_27); + StorageLive(_28); +- _28 = copy _1; +- _27 = move _28 as &[u8] (Transmute); ++ _28 = const "my favourite slice"; ++ _27 = const "my favourite slice" as &[u8] (Transmute); + StorageDead(_28); StorageLive(_29); StorageLive(_30); - _30 = &(*_1); - _29 = move _30 as &[u8] (Transmute); - StorageDead(_30); - StorageLive(_31); - StorageLive(_32); - _32 = copy _29; -- _31 = opaque::<&[u8]>(move _32) -> [return: bb7, unwind unreachable]; -+ _31 = opaque::<&[u8]>(copy _29) -> [return: bb7, unwind unreachable]; + _30 = copy _27; +- _29 = opaque::<&[u8]>(move _30) -> [return: bb7, unwind unreachable]; ++ _29 = opaque::<&[u8]>(copy _27) -> [return: bb7, unwind unreachable]; } bb6: { @@ -192,116 +193,111 @@ - _23 = move _21; + _23 = const core::panicking::AssertKind::Eq; StorageLive(_24); +- _24 = &(*_15); ++ _24 = &(*_9); StorageLive(_25); -- _25 = &(*_15); -+ _25 = &(*_9); - _24 = &(*_25); +- _25 = &(*_16); ++ _25 = &(*_12); StorageLive(_26); - StorageLive(_27); -- _27 = &(*_16); -+ _27 = &(*_12); - _26 = &(*_27); - StorageLive(_28); -- _28 = Option::>::None; -- _22 = core::panicking::assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind unreachable; -+ _28 = const Option::>::None; -+ _22 = core::panicking::assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _24, move _26, const Option::>::None) -> unwind unreachable; +- _26 = Option::>::None; +- _22 = core::panicking::assert_failed::<*const u8, *const u8>(move _23, move _24, move _25, move _26) -> unwind unreachable; ++ _26 = const Option::>::None; ++ _22 = core::panicking::assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _24, move _25, const Option::>::None) -> unwind unreachable; } bb7: { - StorageDead(_32); - StorageDead(_31); - StorageLive(_33); - StorageLive(_34); -- StorageLive(_35); + StorageDead(_30); + StorageDead(_29); + StorageLive(_31); + StorageLive(_32); +- StorageLive(_33); + nop; - StorageLive(_36); - StorageLive(_37); - _37 = &(*_1); - _36 = core::str::::as_ptr(move _37) -> [return: bb8, unwind unreachable]; + StorageLive(_34); + StorageLive(_35); +- _35 = copy _1; +- _34 = core::str::::as_ptr(move _35) -> [return: bb8, unwind unreachable]; ++ _35 = const "my favourite slice"; ++ _34 = core::str::::as_ptr(const "my favourite slice") -> [return: bb8, unwind unreachable]; } bb8: { - StorageDead(_37); - _35 = &_36; -- StorageLive(_38); + StorageDead(_35); + _33 = &_34; +- StorageLive(_36); + nop; - StorageLive(_39); - StorageLive(_40); - _40 = &(*_29); - _39 = core::slice::::as_ptr(move _40) -> [return: bb9, unwind unreachable]; + StorageLive(_37); + StorageLive(_38); + _38 = copy _27; +- _37 = core::slice::::as_ptr(move _38) -> [return: bb9, unwind unreachable]; ++ _37 = core::slice::::as_ptr(copy _27) -> [return: bb9, unwind unreachable]; } bb9: { - StorageDead(_40); - _38 = &_39; -- _34 = (move _35, move _38); -- StorageDead(_38); -- StorageDead(_35); -+ _34 = (copy _35, copy _38); + StorageDead(_38); + _36 = &_37; +- _32 = (move _33, move _36); +- StorageDead(_36); +- StorageDead(_33); ++ _32 = (copy _33, copy _36); + nop; + nop; + StorageLive(_39); +- _39 = copy (_32.0: &*const u8); ++ _39 = copy _33; + StorageLive(_40); +- _40 = copy (_32.1: &*const u8); ++ _40 = copy _36; StorageLive(_41); -- _41 = copy (_34.0: &*const u8); -+ _41 = copy _35; StorageLive(_42); -- _42 = copy (_34.1: &*const u8); -+ _42 = copy _38; +- _42 = copy (*_39); ++ _42 = copy _34; StorageLive(_43); - StorageLive(_44); -- _44 = copy (*_41); -+ _44 = copy _36; - StorageLive(_45); -- _45 = copy (*_42); -- _43 = Eq(move _44, move _45); -+ _45 = copy _39; -+ _43 = Eq(copy _36, copy _39); - switchInt(move _43) -> [0: bb11, otherwise: bb10]; +- _43 = copy (*_40); +- _41 = Eq(move _42, move _43); ++ _43 = copy _37; ++ _41 = Eq(copy _34, copy _37); + switchInt(move _41) -> [0: bb11, otherwise: bb10]; } bb10: { - StorageDead(_45); - StorageDead(_44); - _33 = const (); StorageDead(_43); StorageDead(_42); + _31 = const (); StorageDead(_41); + StorageDead(_40); StorageDead(_39); - StorageDead(_36); + StorageDead(_37); StorageDead(_34); - StorageDead(_33); + StorageDead(_32); + StorageDead(_31); _0 = const (); - StorageDead(_29); + StorageDead(_27); StorageDead(_4); StorageDead(_1); return; } bb11: { - StorageDead(_45); - StorageDead(_44); + StorageDead(_43); + StorageDead(_42); + StorageLive(_45); +- _45 = core::panicking::AssertKind::Eq; ++ _45 = const core::panicking::AssertKind::Eq; + StorageLive(_46); StorageLive(_47); -- _47 = core::panicking::AssertKind::Eq; +- _47 = move _45; + _47 = const core::panicking::AssertKind::Eq; StorageLive(_48); +- _48 = &(*_39); ++ _48 = &(*_33); StorageLive(_49); -- _49 = move _47; -+ _49 = const core::panicking::AssertKind::Eq; +- _49 = &(*_40); ++ _49 = &(*_36); StorageLive(_50); - StorageLive(_51); -- _51 = &(*_41); -+ _51 = &(*_35); - _50 = &(*_51); - StorageLive(_52); - StorageLive(_53); -- _53 = &(*_42); -+ _53 = &(*_38); - _52 = &(*_53); - StorageLive(_54); -- _54 = Option::>::None; -- _48 = core::panicking::assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind unreachable; -+ _54 = const Option::>::None; -+ _48 = core::panicking::assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _50, move _52, const Option::>::None) -> unwind unreachable; +- _50 = Option::>::None; +- _46 = core::panicking::assert_failed::<*const u8, *const u8>(move _47, move _48, move _49, move _50) -> unwind unreachable; ++ _50 = const Option::>::None; ++ _46 = core::panicking::assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _48, move _49, const Option::>::None) -> unwind unreachable; } } diff --git a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff index 4a27c577303d7..acb4d3b149d2b 100644 --- a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff @@ -23,32 +23,28 @@ let _22: !; let mut _23: core::panicking::AssertKind; let mut _24: &*const u8; - let _25: &*const u8; - let mut _26: &*const u8; - let _27: &*const u8; - let mut _28: std::option::Option>; - let mut _30: &str; + let mut _25: &*const u8; + let mut _26: std::option::Option>; + let mut _28: &str; + let _29: (); + let mut _30: &[u8]; let _31: (); - let mut _32: &[u8]; - let _33: (); - let mut _34: (&*const u8, &*const u8); - let mut _35: &*const u8; - let _36: *const u8; - let mut _37: &str; - let mut _38: &*const u8; - let _39: *const u8; - let mut _40: &[u8]; - let mut _43: bool; - let mut _44: *const u8; - let mut _45: *const u8; - let mut _46: !; - let _48: !; - let mut _49: core::panicking::AssertKind; - let mut _50: &*const u8; - let _51: &*const u8; - let mut _52: &*const u8; - let _53: &*const u8; - let mut _54: std::option::Option>; + let mut _32: (&*const u8, &*const u8); + let mut _33: &*const u8; + let _34: *const u8; + let mut _35: &str; + let mut _36: &*const u8; + let _37: *const u8; + let mut _38: &[u8]; + let mut _41: bool; + let mut _42: *const u8; + let mut _43: *const u8; + let mut _44: !; + let _46: !; + let mut _47: core::panicking::AssertKind; + let mut _48: &*const u8; + let mut _49: &*const u8; + let mut _50: std::option::Option>; scope 1 { debug s => _1; let _4: &str; @@ -56,7 +52,7 @@ debug t => _4; let _15: &*const u8; let _16: &*const u8; - let _29: &[u8]; + let _27: &[u8]; scope 3 { debug left_val => _15; debug right_val => _16; @@ -66,15 +62,15 @@ } } scope 5 { - debug u => _29; - let _41: &*const u8; - let _42: &*const u8; + debug u => _27; + let _39: &*const u8; + let _40: &*const u8; scope 6 { - debug left_val => _41; - debug right_val => _42; - let _47: core::panicking::AssertKind; + debug left_val => _39; + debug right_val => _40; + let _45: core::panicking::AssertKind; scope 7 { - debug kind => _47; + debug kind => _45; } } } @@ -115,8 +111,10 @@ + nop; StorageLive(_10); StorageLive(_11); - _11 = &(*_1); - _10 = core::str::::as_ptr(move _11) -> [return: bb3, unwind continue]; +- _11 = copy _1; +- _10 = core::str::::as_ptr(move _11) -> [return: bb3, unwind continue]; ++ _11 = const "my favourite slice"; ++ _10 = core::str::::as_ptr(const "my favourite slice") -> [return: bb3, unwind continue]; } bb3: { @@ -126,9 +124,10 @@ + nop; StorageLive(_13); StorageLive(_14); -- _14 = &(*_4); -+ _14 = &(*_1); - _13 = core::str::::as_ptr(move _14) -> [return: bb4, unwind continue]; +- _14 = copy _4; +- _13 = core::str::::as_ptr(move _14) -> [return: bb4, unwind continue]; ++ _14 = const "my favourite slice"; ++ _13 = core::str::::as_ptr(const "my favourite slice") -> [return: bb4, unwind continue]; } bb4: { @@ -169,16 +168,18 @@ StorageDead(_10); StorageDead(_8); StorageDead(_7); + StorageLive(_27); + StorageLive(_28); +- _28 = copy _1; +- _27 = move _28 as &[u8] (Transmute); ++ _28 = const "my favourite slice"; ++ _27 = const "my favourite slice" as &[u8] (Transmute); + StorageDead(_28); StorageLive(_29); StorageLive(_30); - _30 = &(*_1); - _29 = move _30 as &[u8] (Transmute); - StorageDead(_30); - StorageLive(_31); - StorageLive(_32); - _32 = copy _29; -- _31 = opaque::<&[u8]>(move _32) -> [return: bb7, unwind continue]; -+ _31 = opaque::<&[u8]>(copy _29) -> [return: bb7, unwind continue]; + _30 = copy _27; +- _29 = opaque::<&[u8]>(move _30) -> [return: bb7, unwind continue]; ++ _29 = opaque::<&[u8]>(copy _27) -> [return: bb7, unwind continue]; } bb6: { @@ -192,116 +193,111 @@ - _23 = move _21; + _23 = const core::panicking::AssertKind::Eq; StorageLive(_24); +- _24 = &(*_15); ++ _24 = &(*_9); StorageLive(_25); -- _25 = &(*_15); -+ _25 = &(*_9); - _24 = &(*_25); +- _25 = &(*_16); ++ _25 = &(*_12); StorageLive(_26); - StorageLive(_27); -- _27 = &(*_16); -+ _27 = &(*_12); - _26 = &(*_27); - StorageLive(_28); -- _28 = Option::>::None; -- _22 = core::panicking::assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind continue; -+ _28 = const Option::>::None; -+ _22 = core::panicking::assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _24, move _26, const Option::>::None) -> unwind continue; +- _26 = Option::>::None; +- _22 = core::panicking::assert_failed::<*const u8, *const u8>(move _23, move _24, move _25, move _26) -> unwind continue; ++ _26 = const Option::>::None; ++ _22 = core::panicking::assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _24, move _25, const Option::>::None) -> unwind continue; } bb7: { - StorageDead(_32); - StorageDead(_31); - StorageLive(_33); - StorageLive(_34); -- StorageLive(_35); + StorageDead(_30); + StorageDead(_29); + StorageLive(_31); + StorageLive(_32); +- StorageLive(_33); + nop; - StorageLive(_36); - StorageLive(_37); - _37 = &(*_1); - _36 = core::str::::as_ptr(move _37) -> [return: bb8, unwind continue]; + StorageLive(_34); + StorageLive(_35); +- _35 = copy _1; +- _34 = core::str::::as_ptr(move _35) -> [return: bb8, unwind continue]; ++ _35 = const "my favourite slice"; ++ _34 = core::str::::as_ptr(const "my favourite slice") -> [return: bb8, unwind continue]; } bb8: { - StorageDead(_37); - _35 = &_36; -- StorageLive(_38); + StorageDead(_35); + _33 = &_34; +- StorageLive(_36); + nop; - StorageLive(_39); - StorageLive(_40); - _40 = &(*_29); - _39 = core::slice::::as_ptr(move _40) -> [return: bb9, unwind continue]; + StorageLive(_37); + StorageLive(_38); + _38 = copy _27; +- _37 = core::slice::::as_ptr(move _38) -> [return: bb9, unwind continue]; ++ _37 = core::slice::::as_ptr(copy _27) -> [return: bb9, unwind continue]; } bb9: { - StorageDead(_40); - _38 = &_39; -- _34 = (move _35, move _38); -- StorageDead(_38); -- StorageDead(_35); -+ _34 = (copy _35, copy _38); + StorageDead(_38); + _36 = &_37; +- _32 = (move _33, move _36); +- StorageDead(_36); +- StorageDead(_33); ++ _32 = (copy _33, copy _36); + nop; + nop; + StorageLive(_39); +- _39 = copy (_32.0: &*const u8); ++ _39 = copy _33; + StorageLive(_40); +- _40 = copy (_32.1: &*const u8); ++ _40 = copy _36; StorageLive(_41); -- _41 = copy (_34.0: &*const u8); -+ _41 = copy _35; StorageLive(_42); -- _42 = copy (_34.1: &*const u8); -+ _42 = copy _38; +- _42 = copy (*_39); ++ _42 = copy _34; StorageLive(_43); - StorageLive(_44); -- _44 = copy (*_41); -+ _44 = copy _36; - StorageLive(_45); -- _45 = copy (*_42); -- _43 = Eq(move _44, move _45); -+ _45 = copy _39; -+ _43 = Eq(copy _36, copy _39); - switchInt(move _43) -> [0: bb11, otherwise: bb10]; +- _43 = copy (*_40); +- _41 = Eq(move _42, move _43); ++ _43 = copy _37; ++ _41 = Eq(copy _34, copy _37); + switchInt(move _41) -> [0: bb11, otherwise: bb10]; } bb10: { - StorageDead(_45); - StorageDead(_44); - _33 = const (); StorageDead(_43); StorageDead(_42); + _31 = const (); StorageDead(_41); + StorageDead(_40); StorageDead(_39); - StorageDead(_36); + StorageDead(_37); StorageDead(_34); - StorageDead(_33); + StorageDead(_32); + StorageDead(_31); _0 = const (); - StorageDead(_29); + StorageDead(_27); StorageDead(_4); StorageDead(_1); return; } bb11: { - StorageDead(_45); - StorageDead(_44); + StorageDead(_43); + StorageDead(_42); + StorageLive(_45); +- _45 = core::panicking::AssertKind::Eq; ++ _45 = const core::panicking::AssertKind::Eq; + StorageLive(_46); StorageLive(_47); -- _47 = core::panicking::AssertKind::Eq; +- _47 = move _45; + _47 = const core::panicking::AssertKind::Eq; StorageLive(_48); +- _48 = &(*_39); ++ _48 = &(*_33); StorageLive(_49); -- _49 = move _47; -+ _49 = const core::panicking::AssertKind::Eq; +- _49 = &(*_40); ++ _49 = &(*_36); StorageLive(_50); - StorageLive(_51); -- _51 = &(*_41); -+ _51 = &(*_35); - _50 = &(*_51); - StorageLive(_52); - StorageLive(_53); -- _53 = &(*_42); -+ _53 = &(*_38); - _52 = &(*_53); - StorageLive(_54); -- _54 = Option::>::None; -- _48 = core::panicking::assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind continue; -+ _54 = const Option::>::None; -+ _48 = core::panicking::assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _50, move _52, const Option::>::None) -> unwind continue; +- _50 = Option::>::None; +- _46 = core::panicking::assert_failed::<*const u8, *const u8>(move _47, move _48, move _49, move _50) -> unwind continue; ++ _50 = const Option::>::None; ++ _46 = core::panicking::assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _48, move _49, const Option::>::None) -> unwind continue; } } diff --git a/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-abort.diff b/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-abort.diff index 43cd8ba7809a2..cf362720fa96a 100644 --- a/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-abort.diff @@ -7,50 +7,48 @@ 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 _5: i32; + let mut _7: *const dyn std::marker::Send; + let _8: &dyn std::marker::Send; + let mut _9: &i32; + let _10: i32; + let _11: (); + let mut _12: bool; + let mut _13: *const dyn std::marker::Send; + 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 _17: *const dyn std::marker::Send; - let _18: (); - let mut _19: bool; + let _16: (); + let mut _17: bool; + 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 _21: *const dyn std::marker::Send; - let mut _22: *const dyn std::marker::Send; - let _23: (); - let mut _24: bool; + let _21: (); + let mut _22: bool; + let mut _23: *const dyn std::marker::Send; + let mut _24: *const dyn std::marker::Send; 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 _26: (); + let mut _27: bool; + let mut _28: *const dyn std::marker::Send; + let mut _29: *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 _33: (); - let mut _34: bool; + let _31: (); + let mut _32: bool; + let mut _33: *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 _37: *const dyn std::marker::Send; - let _38: (); - let mut _39: bool; + let _36: (); + let mut _37: bool; + let mut _38: *const dyn std::marker::Send; + let mut _39: *const dyn std::marker::Send; 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; + let mut _42: &i32; scope 1 { debug a => _1; - let _7: *const dyn std::marker::Send; - let mut _43: &i32; + let _6: *const dyn std::marker::Send; + let mut _41: &i32; scope 2 { - debug b => _7; + debug b => _6; } } @@ -60,10 +58,8 @@ + nop; StorageLive(_3); StorageLive(_4); - StorageLive(_5); - _44 = const wide_ptr_provenance::promoted[1]; - _5 = &(*_44); - _4 = &(*_5); + _42 = const wide_ptr_provenance::promoted[1]; + _4 = &(*_42); _3 = move _4 as &dyn std::marker::Send (PointerCoercion(Unsize, AsCast)); StorageDead(_4); _2 = &raw const (*_3); @@ -71,160 +67,156 @@ - StorageDead(_2); + _1 = copy _2; + nop; - StorageDead(_5); StorageDead(_3); - StorageLive(_7); -- StorageLive(_8); + StorageLive(_6); +- StorageLive(_7); + nop; + StorageLive(_8); StorageLive(_9); - StorageLive(_10); - StorageLive(_11); - _43 = const wide_ptr_provenance::promoted[0]; - _11 = &(*_43); - _10 = &(*_11); - _9 = move _10 as &dyn std::marker::Send (PointerCoercion(Unsize, AsCast)); - StorageDead(_10); - _8 = &raw const (*_9); -- _7 = move _8 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -- StorageDead(_8); -+ _7 = copy _8; -+ nop; - StorageDead(_11); + _41 = const wide_ptr_provenance::promoted[0]; + _9 = &(*_41); + _8 = move _9 as &dyn std::marker::Send (PointerCoercion(Unsize, AsCast)); StorageDead(_9); + _7 = &raw const (*_8); +- _6 = move _7 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); +- StorageDead(_7); ++ _6 = copy _7; ++ nop; + StorageDead(_8); + StorageLive(_11); + StorageLive(_12); StorageLive(_13); +- _13 = copy _1; ++ _13 = copy _2; StorageLive(_14); StorageLive(_15); -- _15 = copy _1; -+ _15 = copy _2; - StorageLive(_16); - StorageLive(_17); -- _17 = copy _7; -- _16 = move _17 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _17 = copy _8; -+ _16 = copy _8; - StorageDead(_17); -- _14 = Eq(move _15, move _16); -+ _14 = Eq(copy _2, copy _8); - StorageDead(_16); +- _15 = copy _6; +- _14 = move _15 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _15 = copy _7; ++ _14 = copy _7; StorageDead(_15); - _13 = opaque::(move _14) -> [return: bb1, unwind unreachable]; +- _12 = Eq(move _13, move _14); ++ _12 = Eq(copy _2, copy _7); + StorageDead(_14); + StorageDead(_13); + _11 = opaque::(move _12) -> [return: bb1, unwind unreachable]; } bb1: { - StorageDead(_14); - StorageDead(_13); + StorageDead(_12); + StorageDead(_11); + StorageLive(_16); + StorageLive(_17); StorageLive(_18); +- _18 = copy _1; ++ _18 = copy _2; StorageLive(_19); StorageLive(_20); -- _20 = copy _1; -+ _20 = copy _2; - StorageLive(_21); - StorageLive(_22); -- _22 = copy _7; -- _21 = move _22 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _22 = copy _8; -+ _21 = copy _8; - StorageDead(_22); -- _19 = Ne(move _20, move _21); -+ _19 = Ne(copy _2, copy _8); - StorageDead(_21); +- _20 = copy _6; +- _19 = move _20 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _20 = copy _7; ++ _19 = copy _7; StorageDead(_20); - _18 = opaque::(move _19) -> [return: bb2, unwind unreachable]; +- _17 = Ne(move _18, move _19); ++ _17 = Ne(copy _2, copy _7); + StorageDead(_19); + StorageDead(_18); + _16 = opaque::(move _17) -> [return: bb2, unwind unreachable]; } bb2: { - StorageDead(_19); - StorageDead(_18); + StorageDead(_17); + StorageDead(_16); + StorageLive(_21); + StorageLive(_22); StorageLive(_23); +- _23 = copy _1; ++ _23 = copy _2; StorageLive(_24); StorageLive(_25); -- _25 = copy _1; -+ _25 = copy _2; - StorageLive(_26); - StorageLive(_27); -- _27 = copy _7; -- _26 = move _27 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _27 = copy _8; -+ _26 = copy _8; - StorageDead(_27); -- _24 = Lt(move _25, move _26); -+ _24 = Lt(copy _2, copy _8); - StorageDead(_26); +- _25 = copy _6; +- _24 = move _25 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _25 = copy _7; ++ _24 = copy _7; StorageDead(_25); - _23 = opaque::(move _24) -> [return: bb3, unwind unreachable]; +- _22 = Lt(move _23, move _24); ++ _22 = Lt(copy _2, copy _7); + StorageDead(_24); + StorageDead(_23); + _21 = opaque::(move _22) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_24); - StorageDead(_23); + StorageDead(_22); + StorageDead(_21); + StorageLive(_26); + StorageLive(_27); StorageLive(_28); +- _28 = copy _1; ++ _28 = copy _2; StorageLive(_29); StorageLive(_30); -- _30 = copy _1; -+ _30 = copy _2; - StorageLive(_31); - StorageLive(_32); -- _32 = copy _7; -- _31 = move _32 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _32 = copy _8; -+ _31 = copy _8; - StorageDead(_32); -- _29 = Le(move _30, move _31); -+ _29 = Le(copy _2, copy _8); - StorageDead(_31); +- _30 = copy _6; +- _29 = move _30 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _30 = copy _7; ++ _29 = copy _7; StorageDead(_30); - _28 = opaque::(move _29) -> [return: bb4, unwind unreachable]; +- _27 = Le(move _28, move _29); ++ _27 = Le(copy _2, copy _7); + StorageDead(_29); + StorageDead(_28); + _26 = opaque::(move _27) -> [return: bb4, unwind unreachable]; } bb4: { - StorageDead(_29); - StorageDead(_28); + StorageDead(_27); + StorageDead(_26); + StorageLive(_31); + StorageLive(_32); StorageLive(_33); +- _33 = copy _1; ++ _33 = copy _2; StorageLive(_34); StorageLive(_35); -- _35 = copy _1; -+ _35 = copy _2; - StorageLive(_36); - StorageLive(_37); -- _37 = copy _7; -- _36 = move _37 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _37 = copy _8; -+ _36 = copy _8; - StorageDead(_37); -- _34 = Gt(move _35, move _36); -+ _34 = Gt(copy _2, copy _8); - StorageDead(_36); +- _35 = copy _6; +- _34 = move _35 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _35 = copy _7; ++ _34 = copy _7; StorageDead(_35); - _33 = opaque::(move _34) -> [return: bb5, unwind unreachable]; +- _32 = Gt(move _33, move _34); ++ _32 = Gt(copy _2, copy _7); + StorageDead(_34); + StorageDead(_33); + _31 = opaque::(move _32) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_34); - StorageDead(_33); + StorageDead(_32); + StorageDead(_31); + StorageLive(_36); + StorageLive(_37); StorageLive(_38); +- _38 = copy _1; ++ _38 = copy _2; StorageLive(_39); StorageLive(_40); -- _40 = copy _1; -+ _40 = copy _2; - StorageLive(_41); - StorageLive(_42); -- _42 = copy _7; -- _41 = move _42 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _42 = copy _8; -+ _41 = copy _8; - StorageDead(_42); -- _39 = Ge(move _40, move _41); -+ _39 = Ge(copy _2, copy _8); - StorageDead(_41); +- _40 = copy _6; +- _39 = move _40 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _40 = copy _7; ++ _39 = copy _7; StorageDead(_40); - _38 = opaque::(move _39) -> [return: bb6, unwind unreachable]; +- _37 = Ge(move _38, move _39); ++ _37 = Ge(copy _2, copy _7); + StorageDead(_39); + StorageDead(_38); + _36 = opaque::(move _37) -> [return: bb6, unwind unreachable]; } bb6: { - StorageDead(_39); - StorageDead(_38); + StorageDead(_37); + StorageDead(_36); _0 = const (); - StorageDead(_7); + StorageDead(_6); StorageDead(_1); return; } diff --git a/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-unwind.diff index 49cca20153bd4..65a69b0400cd9 100644 --- a/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-unwind.diff @@ -7,50 +7,48 @@ 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 _5: i32; + let mut _7: *const dyn std::marker::Send; + let _8: &dyn std::marker::Send; + let mut _9: &i32; + let _10: i32; + let _11: (); + let mut _12: bool; + let mut _13: *const dyn std::marker::Send; + 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 _17: *const dyn std::marker::Send; - let _18: (); - let mut _19: bool; + let _16: (); + let mut _17: bool; + 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 _21: *const dyn std::marker::Send; - let mut _22: *const dyn std::marker::Send; - let _23: (); - let mut _24: bool; + let _21: (); + let mut _22: bool; + let mut _23: *const dyn std::marker::Send; + let mut _24: *const dyn std::marker::Send; 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 _26: (); + let mut _27: bool; + let mut _28: *const dyn std::marker::Send; + let mut _29: *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 _33: (); - let mut _34: bool; + let _31: (); + let mut _32: bool; + let mut _33: *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 _37: *const dyn std::marker::Send; - let _38: (); - let mut _39: bool; + let _36: (); + let mut _37: bool; + let mut _38: *const dyn std::marker::Send; + let mut _39: *const dyn std::marker::Send; 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; + let mut _42: &i32; scope 1 { debug a => _1; - let _7: *const dyn std::marker::Send; - let mut _43: &i32; + let _6: *const dyn std::marker::Send; + let mut _41: &i32; scope 2 { - debug b => _7; + debug b => _6; } } @@ -60,10 +58,8 @@ + nop; StorageLive(_3); StorageLive(_4); - StorageLive(_5); - _44 = const wide_ptr_provenance::promoted[1]; - _5 = &(*_44); - _4 = &(*_5); + _42 = const wide_ptr_provenance::promoted[1]; + _4 = &(*_42); _3 = move _4 as &dyn std::marker::Send (PointerCoercion(Unsize, AsCast)); StorageDead(_4); _2 = &raw const (*_3); @@ -71,160 +67,156 @@ - StorageDead(_2); + _1 = copy _2; + nop; - StorageDead(_5); StorageDead(_3); - StorageLive(_7); -- StorageLive(_8); + StorageLive(_6); +- StorageLive(_7); + nop; + StorageLive(_8); StorageLive(_9); - StorageLive(_10); - StorageLive(_11); - _43 = const wide_ptr_provenance::promoted[0]; - _11 = &(*_43); - _10 = &(*_11); - _9 = move _10 as &dyn std::marker::Send (PointerCoercion(Unsize, AsCast)); - StorageDead(_10); - _8 = &raw const (*_9); -- _7 = move _8 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -- StorageDead(_8); -+ _7 = copy _8; -+ nop; - StorageDead(_11); + _41 = const wide_ptr_provenance::promoted[0]; + _9 = &(*_41); + _8 = move _9 as &dyn std::marker::Send (PointerCoercion(Unsize, AsCast)); StorageDead(_9); + _7 = &raw const (*_8); +- _6 = move _7 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); +- StorageDead(_7); ++ _6 = copy _7; ++ nop; + StorageDead(_8); + StorageLive(_11); + StorageLive(_12); StorageLive(_13); +- _13 = copy _1; ++ _13 = copy _2; StorageLive(_14); StorageLive(_15); -- _15 = copy _1; -+ _15 = copy _2; - StorageLive(_16); - StorageLive(_17); -- _17 = copy _7; -- _16 = move _17 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _17 = copy _8; -+ _16 = copy _8; - StorageDead(_17); -- _14 = Eq(move _15, move _16); -+ _14 = Eq(copy _2, copy _8); - StorageDead(_16); +- _15 = copy _6; +- _14 = move _15 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _15 = copy _7; ++ _14 = copy _7; StorageDead(_15); - _13 = opaque::(move _14) -> [return: bb1, unwind continue]; +- _12 = Eq(move _13, move _14); ++ _12 = Eq(copy _2, copy _7); + StorageDead(_14); + StorageDead(_13); + _11 = opaque::(move _12) -> [return: bb1, unwind continue]; } bb1: { - StorageDead(_14); - StorageDead(_13); + StorageDead(_12); + StorageDead(_11); + StorageLive(_16); + StorageLive(_17); StorageLive(_18); +- _18 = copy _1; ++ _18 = copy _2; StorageLive(_19); StorageLive(_20); -- _20 = copy _1; -+ _20 = copy _2; - StorageLive(_21); - StorageLive(_22); -- _22 = copy _7; -- _21 = move _22 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _22 = copy _8; -+ _21 = copy _8; - StorageDead(_22); -- _19 = Ne(move _20, move _21); -+ _19 = Ne(copy _2, copy _8); - StorageDead(_21); +- _20 = copy _6; +- _19 = move _20 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _20 = copy _7; ++ _19 = copy _7; StorageDead(_20); - _18 = opaque::(move _19) -> [return: bb2, unwind continue]; +- _17 = Ne(move _18, move _19); ++ _17 = Ne(copy _2, copy _7); + StorageDead(_19); + StorageDead(_18); + _16 = opaque::(move _17) -> [return: bb2, unwind continue]; } bb2: { - StorageDead(_19); - StorageDead(_18); + StorageDead(_17); + StorageDead(_16); + StorageLive(_21); + StorageLive(_22); StorageLive(_23); +- _23 = copy _1; ++ _23 = copy _2; StorageLive(_24); StorageLive(_25); -- _25 = copy _1; -+ _25 = copy _2; - StorageLive(_26); - StorageLive(_27); -- _27 = copy _7; -- _26 = move _27 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _27 = copy _8; -+ _26 = copy _8; - StorageDead(_27); -- _24 = Lt(move _25, move _26); -+ _24 = Lt(copy _2, copy _8); - StorageDead(_26); +- _25 = copy _6; +- _24 = move _25 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _25 = copy _7; ++ _24 = copy _7; StorageDead(_25); - _23 = opaque::(move _24) -> [return: bb3, unwind continue]; +- _22 = Lt(move _23, move _24); ++ _22 = Lt(copy _2, copy _7); + StorageDead(_24); + StorageDead(_23); + _21 = opaque::(move _22) -> [return: bb3, unwind continue]; } bb3: { - StorageDead(_24); - StorageDead(_23); + StorageDead(_22); + StorageDead(_21); + StorageLive(_26); + StorageLive(_27); StorageLive(_28); +- _28 = copy _1; ++ _28 = copy _2; StorageLive(_29); StorageLive(_30); -- _30 = copy _1; -+ _30 = copy _2; - StorageLive(_31); - StorageLive(_32); -- _32 = copy _7; -- _31 = move _32 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _32 = copy _8; -+ _31 = copy _8; - StorageDead(_32); -- _29 = Le(move _30, move _31); -+ _29 = Le(copy _2, copy _8); - StorageDead(_31); +- _30 = copy _6; +- _29 = move _30 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _30 = copy _7; ++ _29 = copy _7; StorageDead(_30); - _28 = opaque::(move _29) -> [return: bb4, unwind continue]; +- _27 = Le(move _28, move _29); ++ _27 = Le(copy _2, copy _7); + StorageDead(_29); + StorageDead(_28); + _26 = opaque::(move _27) -> [return: bb4, unwind continue]; } bb4: { - StorageDead(_29); - StorageDead(_28); + StorageDead(_27); + StorageDead(_26); + StorageLive(_31); + StorageLive(_32); StorageLive(_33); +- _33 = copy _1; ++ _33 = copy _2; StorageLive(_34); StorageLive(_35); -- _35 = copy _1; -+ _35 = copy _2; - StorageLive(_36); - StorageLive(_37); -- _37 = copy _7; -- _36 = move _37 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _37 = copy _8; -+ _36 = copy _8; - StorageDead(_37); -- _34 = Gt(move _35, move _36); -+ _34 = Gt(copy _2, copy _8); - StorageDead(_36); +- _35 = copy _6; +- _34 = move _35 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _35 = copy _7; ++ _34 = copy _7; StorageDead(_35); - _33 = opaque::(move _34) -> [return: bb5, unwind continue]; +- _32 = Gt(move _33, move _34); ++ _32 = Gt(copy _2, copy _7); + StorageDead(_34); + StorageDead(_33); + _31 = opaque::(move _32) -> [return: bb5, unwind continue]; } bb5: { - StorageDead(_34); - StorageDead(_33); + StorageDead(_32); + StorageDead(_31); + StorageLive(_36); + StorageLive(_37); StorageLive(_38); +- _38 = copy _1; ++ _38 = copy _2; StorageLive(_39); StorageLive(_40); -- _40 = copy _1; -+ _40 = copy _2; - StorageLive(_41); - StorageLive(_42); -- _42 = copy _7; -- _41 = move _42 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _42 = copy _8; -+ _41 = copy _8; - StorageDead(_42); -- _39 = Ge(move _40, move _41); -+ _39 = Ge(copy _2, copy _8); - StorageDead(_41); +- _40 = copy _6; +- _39 = move _40 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _40 = copy _7; ++ _39 = copy _7; StorageDead(_40); - _38 = opaque::(move _39) -> [return: bb6, unwind continue]; +- _37 = Ge(move _38, move _39); ++ _37 = Ge(copy _2, copy _7); + StorageDead(_39); + StorageDead(_38); + _36 = opaque::(move _37) -> [return: bb6, unwind continue]; } bb6: { - StorageDead(_39); - StorageDead(_38); + StorageDead(_37); + StorageDead(_36); _0 = const (); - StorageDead(_7); + StorageDead(_6); StorageDead(_1); return; } diff --git a/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-abort.diff b/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-abort.diff index 0165136fda4ca..646d42cf0f9ee 100644 --- a/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-abort.diff @@ -8,80 +8,76 @@ 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: bool; - let mut _11: *const dyn std::marker::Send; - let _12: &dyn std::marker::Send; - let mut _13: &i32; - let _14: &i32; - let _15: usize; + let _7: usize; + let mut _8: bool; + let mut _10: *const dyn std::marker::Send; + let _11: &dyn std::marker::Send; + let mut _12: &i32; + let _13: usize; + let mut _14: bool; + let _15: (); let mut _16: bool; - let _17: (); - let mut _18: bool; + let mut _17: *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 _21: *const dyn std::marker::Send; - let _22: (); - let mut _23: bool; + let _20: (); + let mut _21: bool; + 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 _25: *const dyn std::marker::Send; - let mut _26: *const dyn std::marker::Send; - let _27: (); - let mut _28: bool; + let _25: (); + let mut _26: bool; + let mut _27: *const dyn std::marker::Send; + let mut _28: *const dyn std::marker::Send; let mut _29: *const dyn std::marker::Send; - let mut _30: *const dyn std::marker::Send; - let mut _31: *const dyn std::marker::Send; - let _32: (); - let mut _33: bool; + let _30: (); + let mut _31: bool; + let mut _32: *const dyn std::marker::Send; + let mut _33: *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 _37: (); - let mut _38: bool; + let _35: (); + let mut _36: bool; + let mut _37: *const dyn std::marker::Send; + let mut _38: *const dyn std::marker::Send; let mut _39: *const dyn std::marker::Send; - let mut _40: *const dyn std::marker::Send; - let mut _41: *const dyn std::marker::Send; - let _42: (); - let mut _43: bool; + let _40: (); + let mut _41: bool; + let mut _42: *const dyn std::marker::Send; + let mut _43: *const dyn std::marker::Send; let mut _44: *const dyn std::marker::Send; - let mut _45: *const dyn std::marker::Send; - let mut _46: *const dyn std::marker::Send; - let mut _47: &[i32; 2]; + let mut _45: &[i32; 2]; scope 1 { debug slice => _1; let _3: *const dyn std::marker::Send; scope 2 { debug a => _3; - let _10: *const dyn std::marker::Send; + let _9: *const dyn std::marker::Send; scope 3 { - debug b => _10; + debug b => _9; } } } bb0: { StorageLive(_1); - _47 = const wide_ptr_same_provenance::promoted[0]; - _1 = &(*_47); + _45 = const wide_ptr_same_provenance::promoted[0]; + _1 = &(*_45); StorageLive(_3); - StorageLive(_4); + nop; StorageLive(_5); StorageLive(_6); StorageLive(_7); - StorageLive(_8); - _8 = const 0_usize; -- _9 = Lt(copy _8, const 2_usize); -- assert(move _9, "index out of bounds: the length is {} but the index is {}", const 2_usize, copy _8) -> [success: bb1, unwind unreachable]; -+ _9 = const true; + _7 = const 0_usize; +- _8 = Lt(copy _7, const 2_usize); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", const 2_usize, copy _7) -> [success: bb1, unwind unreachable]; ++ _8 = 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); +- _6 = &(*_1)[_7]; ++ _6 = &(*_1)[0 of 1]; _5 = move _6 as &dyn std::marker::Send (PointerCoercion(Unsize, AsCast)); StorageDead(_6); _4 = &raw const (*_5); @@ -89,171 +85,167 @@ - StorageDead(_4); + _3 = copy _4; + nop; - StorageDead(_8); StorageDead(_7); StorageDead(_5); - StorageLive(_10); -- StorageLive(_11); + StorageLive(_9); +- StorageLive(_10); + nop; + StorageLive(_11); StorageLive(_12); StorageLive(_13); - StorageLive(_14); - StorageLive(_15); - _15 = const 1_usize; -- _16 = Lt(copy _15, const 2_usize); -- assert(move _16, "index out of bounds: the length is {} but the index is {}", const 2_usize, copy _15) -> [success: bb2, unwind unreachable]; -+ _16 = const true; + _13 = const 1_usize; +- _14 = Lt(copy _13, const 2_usize); +- assert(move _14, "index out of bounds: the length is {} but the index is {}", const 2_usize, copy _13) -> [success: bb2, unwind unreachable]; ++ _14 = 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: { -- _14 = &(*_1)[_15]; -+ _14 = &(*_1)[1 of 2]; - _13 = &(*_14); - _12 = move _13 as &dyn std::marker::Send (PointerCoercion(Unsize, AsCast)); - StorageDead(_13); - _11 = &raw const (*_12); -- _10 = move _11 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -- StorageDead(_11); -+ _10 = copy _11; -+ nop; - StorageDead(_15); - StorageDead(_14); +- _12 = &(*_1)[_13]; ++ _12 = &(*_1)[1 of 2]; + _11 = move _12 as &dyn std::marker::Send (PointerCoercion(Unsize, AsCast)); StorageDead(_12); + _10 = &raw const (*_11); +- _9 = move _10 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); +- StorageDead(_10); ++ _9 = copy _10; ++ nop; + StorageDead(_13); + StorageDead(_11); + StorageLive(_15); + StorageLive(_16); StorageLive(_17); +- _17 = copy _3; ++ _17 = copy _4; StorageLive(_18); StorageLive(_19); -- _19 = copy _3; -+ _19 = copy _4; - StorageLive(_20); - StorageLive(_21); -- _21 = copy _10; -- _20 = move _21 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _21 = copy _11; -+ _20 = copy _11; - StorageDead(_21); -- _18 = Eq(move _19, move _20); -+ _18 = Eq(copy _4, copy _11); - StorageDead(_20); +- _19 = copy _9; +- _18 = move _19 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _19 = copy _10; ++ _18 = copy _10; StorageDead(_19); - _17 = opaque::(move _18) -> [return: bb3, unwind unreachable]; +- _16 = Eq(move _17, move _18); ++ _16 = Eq(copy _4, copy _10); + StorageDead(_18); + StorageDead(_17); + _15 = opaque::(move _16) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_18); - StorageDead(_17); + StorageDead(_16); + StorageDead(_15); + StorageLive(_20); + StorageLive(_21); StorageLive(_22); +- _22 = copy _3; ++ _22 = copy _4; StorageLive(_23); StorageLive(_24); -- _24 = copy _3; -+ _24 = copy _4; - StorageLive(_25); - StorageLive(_26); -- _26 = copy _10; -- _25 = move _26 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _26 = copy _11; -+ _25 = copy _11; - StorageDead(_26); -- _23 = Ne(move _24, move _25); -+ _23 = Ne(copy _4, copy _11); - StorageDead(_25); +- _24 = copy _9; +- _23 = move _24 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _24 = copy _10; ++ _23 = copy _10; StorageDead(_24); - _22 = opaque::(move _23) -> [return: bb4, unwind unreachable]; +- _21 = Ne(move _22, move _23); ++ _21 = Ne(copy _4, copy _10); + StorageDead(_23); + StorageDead(_22); + _20 = opaque::(move _21) -> [return: bb4, unwind unreachable]; } bb4: { - StorageDead(_23); - StorageDead(_22); + StorageDead(_21); + StorageDead(_20); + StorageLive(_25); + StorageLive(_26); StorageLive(_27); +- _27 = copy _3; ++ _27 = copy _4; StorageLive(_28); StorageLive(_29); -- _29 = copy _3; -+ _29 = copy _4; - StorageLive(_30); - StorageLive(_31); -- _31 = copy _10; -- _30 = move _31 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _31 = copy _11; -+ _30 = copy _11; - StorageDead(_31); -- _28 = Lt(move _29, move _30); -+ _28 = Lt(copy _4, copy _11); - StorageDead(_30); +- _29 = copy _9; +- _28 = move _29 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _29 = copy _10; ++ _28 = copy _10; StorageDead(_29); - _27 = opaque::(move _28) -> [return: bb5, unwind unreachable]; +- _26 = Lt(move _27, move _28); ++ _26 = Lt(copy _4, copy _10); + StorageDead(_28); + StorageDead(_27); + _25 = opaque::(move _26) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_28); - StorageDead(_27); + StorageDead(_26); + StorageDead(_25); + StorageLive(_30); + StorageLive(_31); StorageLive(_32); +- _32 = copy _3; ++ _32 = copy _4; StorageLive(_33); StorageLive(_34); -- _34 = copy _3; -+ _34 = copy _4; - StorageLive(_35); - StorageLive(_36); -- _36 = copy _10; -- _35 = move _36 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _36 = copy _11; -+ _35 = copy _11; - StorageDead(_36); -- _33 = Le(move _34, move _35); -+ _33 = Le(copy _4, copy _11); - StorageDead(_35); +- _34 = copy _9; +- _33 = move _34 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _34 = copy _10; ++ _33 = copy _10; StorageDead(_34); - _32 = opaque::(move _33) -> [return: bb6, unwind unreachable]; +- _31 = Le(move _32, move _33); ++ _31 = Le(copy _4, copy _10); + StorageDead(_33); + StorageDead(_32); + _30 = opaque::(move _31) -> [return: bb6, unwind unreachable]; } bb6: { - StorageDead(_33); - StorageDead(_32); + StorageDead(_31); + StorageDead(_30); + StorageLive(_35); + StorageLive(_36); StorageLive(_37); +- _37 = copy _3; ++ _37 = copy _4; StorageLive(_38); StorageLive(_39); -- _39 = copy _3; -+ _39 = copy _4; - StorageLive(_40); - StorageLive(_41); -- _41 = copy _10; -- _40 = move _41 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _41 = copy _11; -+ _40 = copy _11; - StorageDead(_41); -- _38 = Gt(move _39, move _40); -+ _38 = Gt(copy _4, copy _11); - StorageDead(_40); +- _39 = copy _9; +- _38 = move _39 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _39 = copy _10; ++ _38 = copy _10; StorageDead(_39); - _37 = opaque::(move _38) -> [return: bb7, unwind unreachable]; +- _36 = Gt(move _37, move _38); ++ _36 = Gt(copy _4, copy _10); + StorageDead(_38); + StorageDead(_37); + _35 = opaque::(move _36) -> [return: bb7, unwind unreachable]; } bb7: { - StorageDead(_38); - StorageDead(_37); + StorageDead(_36); + StorageDead(_35); + StorageLive(_40); + StorageLive(_41); StorageLive(_42); +- _42 = copy _3; ++ _42 = copy _4; StorageLive(_43); StorageLive(_44); -- _44 = copy _3; -+ _44 = copy _4; - StorageLive(_45); - StorageLive(_46); -- _46 = copy _10; -- _45 = move _46 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _46 = copy _11; -+ _45 = copy _11; - StorageDead(_46); -- _43 = Ge(move _44, move _45); -+ _43 = Ge(copy _4, copy _11); - StorageDead(_45); +- _44 = copy _9; +- _43 = move _44 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _44 = copy _10; ++ _43 = copy _10; StorageDead(_44); - _42 = opaque::(move _43) -> [return: bb8, unwind unreachable]; +- _41 = Ge(move _42, move _43); ++ _41 = Ge(copy _4, copy _10); + StorageDead(_43); + StorageDead(_42); + _40 = opaque::(move _41) -> [return: bb8, unwind unreachable]; } bb8: { - StorageDead(_43); - StorageDead(_42); + StorageDead(_41); + StorageDead(_40); _0 = const (); - StorageDead(_10); + StorageDead(_9); StorageDead(_3); StorageDead(_1); return; diff --git a/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-unwind.diff index bbaab46b47560..9fa88a39f280a 100644 --- a/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-unwind.diff @@ -8,80 +8,76 @@ 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: bool; - let mut _11: *const dyn std::marker::Send; - let _12: &dyn std::marker::Send; - let mut _13: &i32; - let _14: &i32; - let _15: usize; + let _7: usize; + let mut _8: bool; + let mut _10: *const dyn std::marker::Send; + let _11: &dyn std::marker::Send; + let mut _12: &i32; + let _13: usize; + let mut _14: bool; + let _15: (); let mut _16: bool; - let _17: (); - let mut _18: bool; + let mut _17: *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 _21: *const dyn std::marker::Send; - let _22: (); - let mut _23: bool; + let _20: (); + let mut _21: bool; + 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 _25: *const dyn std::marker::Send; - let mut _26: *const dyn std::marker::Send; - let _27: (); - let mut _28: bool; + let _25: (); + let mut _26: bool; + let mut _27: *const dyn std::marker::Send; + let mut _28: *const dyn std::marker::Send; let mut _29: *const dyn std::marker::Send; - let mut _30: *const dyn std::marker::Send; - let mut _31: *const dyn std::marker::Send; - let _32: (); - let mut _33: bool; + let _30: (); + let mut _31: bool; + let mut _32: *const dyn std::marker::Send; + let mut _33: *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 _37: (); - let mut _38: bool; + let _35: (); + let mut _36: bool; + let mut _37: *const dyn std::marker::Send; + let mut _38: *const dyn std::marker::Send; let mut _39: *const dyn std::marker::Send; - let mut _40: *const dyn std::marker::Send; - let mut _41: *const dyn std::marker::Send; - let _42: (); - let mut _43: bool; + let _40: (); + let mut _41: bool; + let mut _42: *const dyn std::marker::Send; + let mut _43: *const dyn std::marker::Send; let mut _44: *const dyn std::marker::Send; - let mut _45: *const dyn std::marker::Send; - let mut _46: *const dyn std::marker::Send; - let mut _47: &[i32; 2]; + let mut _45: &[i32; 2]; scope 1 { debug slice => _1; let _3: *const dyn std::marker::Send; scope 2 { debug a => _3; - let _10: *const dyn std::marker::Send; + let _9: *const dyn std::marker::Send; scope 3 { - debug b => _10; + debug b => _9; } } } bb0: { StorageLive(_1); - _47 = const wide_ptr_same_provenance::promoted[0]; - _1 = &(*_47); + _45 = const wide_ptr_same_provenance::promoted[0]; + _1 = &(*_45); StorageLive(_3); - StorageLive(_4); + nop; StorageLive(_5); StorageLive(_6); StorageLive(_7); - StorageLive(_8); - _8 = const 0_usize; -- _9 = Lt(copy _8, const 2_usize); -- assert(move _9, "index out of bounds: the length is {} but the index is {}", const 2_usize, copy _8) -> [success: bb1, unwind continue]; -+ _9 = const true; + _7 = const 0_usize; +- _8 = Lt(copy _7, const 2_usize); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", const 2_usize, copy _7) -> [success: bb1, unwind continue]; ++ _8 = 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); +- _6 = &(*_1)[_7]; ++ _6 = &(*_1)[0 of 1]; _5 = move _6 as &dyn std::marker::Send (PointerCoercion(Unsize, AsCast)); StorageDead(_6); _4 = &raw const (*_5); @@ -89,171 +85,167 @@ - StorageDead(_4); + _3 = copy _4; + nop; - StorageDead(_8); StorageDead(_7); StorageDead(_5); - StorageLive(_10); -- StorageLive(_11); + StorageLive(_9); +- StorageLive(_10); + nop; + StorageLive(_11); StorageLive(_12); StorageLive(_13); - StorageLive(_14); - StorageLive(_15); - _15 = const 1_usize; -- _16 = Lt(copy _15, const 2_usize); -- assert(move _16, "index out of bounds: the length is {} but the index is {}", const 2_usize, copy _15) -> [success: bb2, unwind continue]; -+ _16 = const true; + _13 = const 1_usize; +- _14 = Lt(copy _13, const 2_usize); +- assert(move _14, "index out of bounds: the length is {} but the index is {}", const 2_usize, copy _13) -> [success: bb2, unwind continue]; ++ _14 = 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: { -- _14 = &(*_1)[_15]; -+ _14 = &(*_1)[1 of 2]; - _13 = &(*_14); - _12 = move _13 as &dyn std::marker::Send (PointerCoercion(Unsize, AsCast)); - StorageDead(_13); - _11 = &raw const (*_12); -- _10 = move _11 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -- StorageDead(_11); -+ _10 = copy _11; -+ nop; - StorageDead(_15); - StorageDead(_14); +- _12 = &(*_1)[_13]; ++ _12 = &(*_1)[1 of 2]; + _11 = move _12 as &dyn std::marker::Send (PointerCoercion(Unsize, AsCast)); StorageDead(_12); + _10 = &raw const (*_11); +- _9 = move _10 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); +- StorageDead(_10); ++ _9 = copy _10; ++ nop; + StorageDead(_13); + StorageDead(_11); + StorageLive(_15); + StorageLive(_16); StorageLive(_17); +- _17 = copy _3; ++ _17 = copy _4; StorageLive(_18); StorageLive(_19); -- _19 = copy _3; -+ _19 = copy _4; - StorageLive(_20); - StorageLive(_21); -- _21 = copy _10; -- _20 = move _21 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _21 = copy _11; -+ _20 = copy _11; - StorageDead(_21); -- _18 = Eq(move _19, move _20); -+ _18 = Eq(copy _4, copy _11); - StorageDead(_20); +- _19 = copy _9; +- _18 = move _19 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _19 = copy _10; ++ _18 = copy _10; StorageDead(_19); - _17 = opaque::(move _18) -> [return: bb3, unwind continue]; +- _16 = Eq(move _17, move _18); ++ _16 = Eq(copy _4, copy _10); + StorageDead(_18); + StorageDead(_17); + _15 = opaque::(move _16) -> [return: bb3, unwind continue]; } bb3: { - StorageDead(_18); - StorageDead(_17); + StorageDead(_16); + StorageDead(_15); + StorageLive(_20); + StorageLive(_21); StorageLive(_22); +- _22 = copy _3; ++ _22 = copy _4; StorageLive(_23); StorageLive(_24); -- _24 = copy _3; -+ _24 = copy _4; - StorageLive(_25); - StorageLive(_26); -- _26 = copy _10; -- _25 = move _26 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _26 = copy _11; -+ _25 = copy _11; - StorageDead(_26); -- _23 = Ne(move _24, move _25); -+ _23 = Ne(copy _4, copy _11); - StorageDead(_25); +- _24 = copy _9; +- _23 = move _24 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _24 = copy _10; ++ _23 = copy _10; StorageDead(_24); - _22 = opaque::(move _23) -> [return: bb4, unwind continue]; +- _21 = Ne(move _22, move _23); ++ _21 = Ne(copy _4, copy _10); + StorageDead(_23); + StorageDead(_22); + _20 = opaque::(move _21) -> [return: bb4, unwind continue]; } bb4: { - StorageDead(_23); - StorageDead(_22); + StorageDead(_21); + StorageDead(_20); + StorageLive(_25); + StorageLive(_26); StorageLive(_27); +- _27 = copy _3; ++ _27 = copy _4; StorageLive(_28); StorageLive(_29); -- _29 = copy _3; -+ _29 = copy _4; - StorageLive(_30); - StorageLive(_31); -- _31 = copy _10; -- _30 = move _31 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _31 = copy _11; -+ _30 = copy _11; - StorageDead(_31); -- _28 = Lt(move _29, move _30); -+ _28 = Lt(copy _4, copy _11); - StorageDead(_30); +- _29 = copy _9; +- _28 = move _29 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _29 = copy _10; ++ _28 = copy _10; StorageDead(_29); - _27 = opaque::(move _28) -> [return: bb5, unwind continue]; +- _26 = Lt(move _27, move _28); ++ _26 = Lt(copy _4, copy _10); + StorageDead(_28); + StorageDead(_27); + _25 = opaque::(move _26) -> [return: bb5, unwind continue]; } bb5: { - StorageDead(_28); - StorageDead(_27); + StorageDead(_26); + StorageDead(_25); + StorageLive(_30); + StorageLive(_31); StorageLive(_32); +- _32 = copy _3; ++ _32 = copy _4; StorageLive(_33); StorageLive(_34); -- _34 = copy _3; -+ _34 = copy _4; - StorageLive(_35); - StorageLive(_36); -- _36 = copy _10; -- _35 = move _36 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _36 = copy _11; -+ _35 = copy _11; - StorageDead(_36); -- _33 = Le(move _34, move _35); -+ _33 = Le(copy _4, copy _11); - StorageDead(_35); +- _34 = copy _9; +- _33 = move _34 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _34 = copy _10; ++ _33 = copy _10; StorageDead(_34); - _32 = opaque::(move _33) -> [return: bb6, unwind continue]; +- _31 = Le(move _32, move _33); ++ _31 = Le(copy _4, copy _10); + StorageDead(_33); + StorageDead(_32); + _30 = opaque::(move _31) -> [return: bb6, unwind continue]; } bb6: { - StorageDead(_33); - StorageDead(_32); + StorageDead(_31); + StorageDead(_30); + StorageLive(_35); + StorageLive(_36); StorageLive(_37); +- _37 = copy _3; ++ _37 = copy _4; StorageLive(_38); StorageLive(_39); -- _39 = copy _3; -+ _39 = copy _4; - StorageLive(_40); - StorageLive(_41); -- _41 = copy _10; -- _40 = move _41 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _41 = copy _11; -+ _40 = copy _11; - StorageDead(_41); -- _38 = Gt(move _39, move _40); -+ _38 = Gt(copy _4, copy _11); - StorageDead(_40); +- _39 = copy _9; +- _38 = move _39 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _39 = copy _10; ++ _38 = copy _10; StorageDead(_39); - _37 = opaque::(move _38) -> [return: bb7, unwind continue]; +- _36 = Gt(move _37, move _38); ++ _36 = Gt(copy _4, copy _10); + StorageDead(_38); + StorageDead(_37); + _35 = opaque::(move _36) -> [return: bb7, unwind continue]; } bb7: { - StorageDead(_38); - StorageDead(_37); + StorageDead(_36); + StorageDead(_35); + StorageLive(_40); + StorageLive(_41); StorageLive(_42); +- _42 = copy _3; ++ _42 = copy _4; StorageLive(_43); StorageLive(_44); -- _44 = copy _3; -+ _44 = copy _4; - StorageLive(_45); - StorageLive(_46); -- _46 = copy _10; -- _45 = move _46 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); -+ _46 = copy _11; -+ _45 = copy _11; - StorageDead(_46); -- _43 = Ge(move _44, move _45); -+ _43 = Ge(copy _4, copy _11); - StorageDead(_45); +- _44 = copy _9; +- _43 = move _44 as *const dyn std::marker::Send (PointerCoercion(Unsize, Implicit)); ++ _44 = copy _10; ++ _43 = copy _10; StorageDead(_44); - _42 = opaque::(move _43) -> [return: bb8, unwind continue]; +- _41 = Ge(move _42, move _43); ++ _41 = Ge(copy _4, copy _10); + StorageDead(_43); + StorageDead(_42); + _40 = opaque::(move _41) -> [return: bb8, unwind continue]; } bb8: { - StorageDead(_43); - StorageDead(_42); + StorageDead(_41); + StorageDead(_40); _0 = const (); - StorageDead(_10); + StorageDead(_9); StorageDead(_3); StorageDead(_1); return; diff --git a/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff b/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff index 9381c7c0af537..fc0ebd354bd64 100644 --- a/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff +++ b/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff @@ -6,20 +6,15 @@ let mut _0: AllCopy; let mut _2: i32; let mut _3: &i32; - let _4: &i32; - let mut _5: u64; - let mut _6: &u64; - let _7: &u64; - let mut _8: [i8; 3]; - let mut _9: &[i8; 3]; - let _10: &[i8; 3]; + let mut _4: u64; + let mut _5: &u64; + let mut _6: [i8; 3]; + let mut _7: &[i8; 3]; bb0: { StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _4 = &((*_1).0: i32); - _3 = copy _4; + _3 = &((*_1).0: i32); - _2 = copy (*_3); + _2 = copy ((*_1).0: i32); goto -> bb1; @@ -27,36 +22,29 @@ bb1: { StorageDead(_3); + StorageLive(_4); StorageLive(_5); - StorageLive(_6); - StorageLive(_7); - _7 = &((*_1).1: u64); - _6 = copy _7; -- _5 = copy (*_6); -+ _5 = copy ((*_1).1: u64); + _5 = &((*_1).1: u64); +- _4 = copy (*_5); ++ _4 = copy ((*_1).1: u64); goto -> bb2; } bb2: { - StorageDead(_6); - StorageLive(_8); - StorageLive(_9); - StorageLive(_10); - _10 = &((*_1).2: [i8; 3]); - _9 = copy _10; -- _8 = copy (*_9); -+ _8 = copy ((*_1).2: [i8; 3]); + StorageDead(_5); + StorageLive(_6); + StorageLive(_7); + _7 = &((*_1).2: [i8; 3]); +- _6 = copy (*_7); ++ _6 = copy ((*_1).2: [i8; 3]); goto -> bb3; } bb3: { - StorageDead(_9); -- _0 = AllCopy { a: move _2, b: move _5, c: move _8 }; -+ _0 = copy (*_1); - StorageDead(_10); - StorageDead(_8); StorageDead(_7); - StorageDead(_5); +- _0 = AllCopy { a: move _2, b: move _4, c: move _6 }; ++ _0 = copy (*_1); + StorageDead(_6); StorageDead(_4); StorageDead(_2); return; diff --git a/tests/mir-opt/gvn_copy_aggregate.deref_nonssa_2.GVN.diff b/tests/mir-opt/gvn_copy_aggregate.deref_nonssa_2.GVN.diff index c0e8622a5c43d..0b9d4ae601d58 100644 --- a/tests/mir-opt/gvn_copy_aggregate.deref_nonssa_2.GVN.diff +++ b/tests/mir-opt/gvn_copy_aggregate.deref_nonssa_2.GVN.diff @@ -5,20 +5,19 @@ let mut _0: Single; let mut _1: Single; let mut _3: &Single; - let _4: &Single; - let mut _7: Single; - let mut _8: u8; + let mut _6: Single; + let mut _7: u8; scope 1 { debug a => _1; let _2: SingleRef<'_>; scope 2 { debug r => _2; - let _5: &Single; + let _4: &Single; scope 3 { - debug b => _5; - let _6: u8; + debug b => _4; + let _5: u8; scope 4 { - debug c => _6; + debug c => _5; } } } @@ -31,33 +30,30 @@ StorageLive(_2); - StorageLive(_3); + nop; - StorageLive(_4); - _4 = &_1; - _3 = &(*_4); + _3 = &_1; - _2 = SingleRef::<'_>(move _3); - StorageDead(_3); + _2 = SingleRef::<'_>(copy _3); + nop; - StorageDead(_4); + StorageLive(_4); +- _4 = copy (_2.0: &Single); ++ _4 = copy _3; StorageLive(_5); -- _5 = copy (_2.0: &Single); -+ _5 = copy _3; +- _5 = copy ((*_4).0: u8); ++ _5 = copy ((*_3).0: u8); StorageLive(_6); -- _6 = copy ((*_5).0: u8); -+ _6 = copy ((*_3).0: u8); - StorageLive(_7); -- _7 = Single(const 1_u8); -- _1 = move _7; -+ _7 = const Single(1_u8); +- _6 = Single(const 1_u8); +- _1 = move _6; ++ _6 = const Single(1_u8); + _1 = const Single(1_u8); - StorageDead(_7); - StorageLive(_8); - _8 = copy _6; -- _0 = Single(move _8); -+ _0 = Single(copy _6); - StorageDead(_8); StorageDead(_6); + StorageLive(_7); + _7 = copy _5; +- _0 = Single(move _7); ++ _0 = Single(copy _5); + StorageDead(_7); StorageDead(_5); + StorageDead(_4); StorageDead(_2); StorageDead(_1); return; diff --git a/tests/mir-opt/gvn_copy_constant_projection.compare_constant_index.GVN.panic-abort.diff b/tests/mir-opt/gvn_copy_constant_projection.compare_constant_index.GVN.panic-abort.diff index c107eec9ee65b..df9a05b716d37 100644 --- a/tests/mir-opt/gvn_copy_constant_projection.compare_constant_index.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn_copy_constant_projection.compare_constant_index.GVN.panic-abort.diff @@ -5,10 +5,10 @@ debug x => _1; debug y => _2; let mut _0: std::cmp::Ordering; - let _3: &i32; + let mut _3: &i32; let _4: usize; let mut _5: bool; - let _6: &i32; + let mut _6: &i32; let _7: usize; let mut _8: bool; scope 1 (inlined std::cmp::impls::::cmp) { @@ -17,6 +17,7 @@ } bb0: { + StorageLive(_3); StorageLive(_4); _4 = const 0_usize; - _5 = Lt(copy _4, const 1_usize); @@ -28,6 +29,7 @@ bb1: { - _3 = &_1[_4]; + _3 = &_1[0 of 1]; + StorageLive(_6); StorageLive(_7); _7 = const 0_usize; - _8 = Lt(copy _7, const 1_usize); @@ -48,6 +50,8 @@ _0 = Cmp(move _9, move _10); StorageDead(_10); StorageDead(_9); + StorageDead(_6); + StorageDead(_3); StorageDead(_7); StorageDead(_4); return; diff --git a/tests/mir-opt/gvn_copy_constant_projection.compare_constant_index.GVN.panic-unwind.diff b/tests/mir-opt/gvn_copy_constant_projection.compare_constant_index.GVN.panic-unwind.diff index 498df5adc1ef7..89031c71ce153 100644 --- a/tests/mir-opt/gvn_copy_constant_projection.compare_constant_index.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn_copy_constant_projection.compare_constant_index.GVN.panic-unwind.diff @@ -5,10 +5,10 @@ debug x => _1; debug y => _2; let mut _0: std::cmp::Ordering; - let _3: &i32; + let mut _3: &i32; let _4: usize; let mut _5: bool; - let _6: &i32; + let mut _6: &i32; let _7: usize; let mut _8: bool; scope 1 (inlined std::cmp::impls::::cmp) { @@ -17,6 +17,7 @@ } bb0: { + StorageLive(_3); StorageLive(_4); _4 = const 0_usize; - _5 = Lt(copy _4, const 1_usize); @@ -28,6 +29,7 @@ bb1: { - _3 = &_1[_4]; + _3 = &_1[0 of 1]; + StorageLive(_6); StorageLive(_7); _7 = const 0_usize; - _8 = Lt(copy _7, const 1_usize); @@ -48,6 +50,8 @@ _0 = Cmp(move _9, move _10); StorageDead(_10); StorageDead(_9); + StorageDead(_6); + StorageDead(_3); StorageDead(_7); StorageDead(_4); return; diff --git a/tests/mir-opt/gvn_loop.loop_deref_mut.GVN.diff b/tests/mir-opt/gvn_loop.loop_deref_mut.GVN.diff index 4e491782c8cd0..198618adf0750 100644 --- a/tests/mir-opt/gvn_loop.loop_deref_mut.GVN.diff +++ b/tests/mir-opt/gvn_loop.loop_deref_mut.GVN.diff @@ -5,45 +5,45 @@ debug val => _1; let mut _0: Value; let _2: &Value; - let _3: &Value; - let mut _4: &Value; - let mut _6: !; - let mut _8: isize; - let mut _9: !; - let mut _10: (); - let mut _12: i32; - let _13: (); - let mut _14: bool; - let mut _15: !; - let mut _16: Value; + let mut _3: &Value; + let mut _5: !; + let mut _7: isize; + let mut _8: !; + let mut _9: (); + let mut _11: i32; + let _12: (); + let mut _13: bool; + let mut _14: !; + let mut _15: Value; scope 1 { - debug val_alias => _3; - let mut _5: bool; + debug val_alias => _2; + let mut _4: bool; scope 2 { - debug stop => _5; - let _7: i32; + debug stop => _4; + let _6: i32; scope 3 { - debug v => _7; - let _11: Value; + debug v => _6; + let _10: Value; scope 4 { - debug v => _11; + debug v => _10; } } } } bb0: { - StorageLive(_4); - _4 = &(*_1); - _3 = get::(copy _4) -> [return: bb1, unwind unreachable]; + StorageLive(_2); + StorageLive(_3); + _3 = &(*_1); + _2 = get::(copy _3) -> [return: bb1, unwind unreachable]; } bb1: { - StorageDead(_4); - StorageLive(_5); - _5 = const false; - _8 = discriminant((*_3)); - switchInt(move _8) -> [0: bb3, otherwise: bb2]; + StorageDead(_3); + StorageLive(_4); + _4 = const false; + _7 = discriminant((*_2)); + switchInt(move _7) -> [0: bb3, otherwise: bb2]; } bb2: { @@ -51,42 +51,50 @@ } bb3: { - StorageLive(_7); - _7 = copy (((*_3) as V0).0: i32); + StorageLive(_6); + _6 = copy (((*_2) as V0).0: i32); + StorageLive(_8); goto -> bb4; } bb4: { + StorageLive(_10); StorageLive(_11); + _11 = copy _6; +- _10 = Value::V0(move _11); ++ _10 = Value::V0(copy _6); + StorageDead(_11); StorageLive(_12); - _12 = copy _7; -- _11 = Value::V0(move _12); -+ _11 = Value::V0(copy _7); - StorageDead(_12); - StorageLive(_14); - _14 = copy _5; - switchInt(move _14) -> [0: bb6, otherwise: bb5]; + StorageLive(_13); + _13 = copy _4; + switchInt(move _13) -> [0: bb6, otherwise: bb5]; } bb5: { - _0 = move _11; - StorageDead(_14); - StorageDead(_11); - StorageDead(_7); - StorageDead(_5); + _0 = move _10; + StorageDead(_13); + StorageDead(_12); + StorageDead(_10); + StorageDead(_8); + StorageDead(_6); + StorageDead(_4); + StorageDead(_2); return; } bb6: { - StorageDead(_14); - _5 = const true; - StorageLive(_16); -- _16 = Value::V1; -- (*_1) = move _16; -+ _16 = const Value::V1; + _12 = const (); + StorageDead(_13); + StorageDead(_12); + _4 = const true; + StorageLive(_15); +- _15 = Value::V1; +- (*_1) = move _15; ++ _15 = const Value::V1; + (*_1) = const Value::V1; - StorageDead(_16); - StorageDead(_11); + StorageDead(_15); + _9 = const (); + StorageDead(_10); goto -> bb4; } } diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir index 2d88f9e55249f..d0470c1cb92eb 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir @@ -3,19 +3,15 @@ fn c(_1: &[T]) -> &[T] { debug x => _1; let mut _0: &[T]; - let _2: &[T]; - let mut _3: &[T]; + let mut _2: &[T]; scope 1 (inlined <[T] as AsRef<[T]>>::as_ref) { - debug self => _3; + debug self => _2; } bb0: { StorageLive(_2); - StorageLive(_3); - _3 = copy _1; - _2 = copy _3; + _2 = copy _1; _0 = copy _2; - StorageDead(_3); StorageDead(_2); return; } diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir index e2e2aaf8c45d9..0446cf1560f25 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir @@ -3,26 +3,22 @@ fn d(_1: &Box) -> &T { debug x => _1; let mut _0: &T; - let _2: &T; - let mut _3: &std::boxed::Box; + let mut _2: &std::boxed::Box; scope 1 (inlined as AsRef>::as_ref) { - debug self => _3; - let mut _4: *const T; - let mut _5: std::boxed::BoxRaw; + debug self => _2; + let mut _3: *const T; + let mut _4: std::boxed::BoxRaw; } bb0: { StorageLive(_2); + _2 = copy _1; StorageLive(_3); - _3 = copy _1; StorageLive(_4); - StorageLive(_5); - _5 = no_retag copy ((*_3).0: std::boxed::BoxRaw); - _4 = copy _5 as *const T (BoxDerefTransmute); - _2 = &(*_4); - StorageDead(_5); + _4 = no_retag copy ((*_2).0: std::boxed::BoxRaw); + _3 = copy _4 as *const T (BoxDerefTransmute); + _0 = &(*_3); StorageDead(_4); - _0 = copy _2; StorageDead(_3); StorageDead(_2); return; diff --git a/tests/mir-opt/inline_generically_if_sized.call.Inline.diff b/tests/mir-opt/inline_generically_if_sized.call.Inline.diff index fc5833f54ec66..d6b137404a5f1 100644 --- a/tests/mir-opt/inline_generically_if_sized.call.Inline.diff +++ b/tests/mir-opt/inline_generically_if_sized.call.Inline.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); - _2 = &(*_1); + _2 = copy _1; - _0 = ::bar(move _2) -> [return: bb1, unwind unreachable]; - } - diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff index 5f9a8fe9547dd..6e63394bd185b 100644 --- a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff @@ -6,57 +6,42 @@ let mut _0: MyThing; let mut _2: T; let mut _3: &T; - let _4: &T; - let mut _5: u64; - let mut _6: &u64; - let _7: &u64; - let mut _8: [f32; 3]; - let mut _9: &[f32; 3]; - let _10: &[f32; 3]; + let mut _4: u64; + let mut _5: &u64; + let mut _6: [f32; 3]; + let mut _7: &[f32; 3]; bb0: { StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _4 = &((*_1).0: T); -- _3 = &(*_4); -+ _3 = copy _4; + _3 = &((*_1).0: T); _2 = ::clone(move _3) -> [return: bb1, unwind unreachable]; } bb1: { StorageDead(_3); + StorageLive(_4); StorageLive(_5); - StorageLive(_6); - StorageLive(_7); - _7 = &((*_1).1: u64); -- _6 = &(*_7); -- _5 = ::clone(move _6) -> [return: bb2, unwind unreachable]; -+ _6 = copy _7; -+ _5 = copy (*_6); + _5 = &((*_1).1: u64); +- _4 = ::clone(move _5) -> [return: bb2, unwind unreachable]; ++ _4 = copy (*_5); + goto -> bb2; } bb2: { - StorageDead(_6); - StorageLive(_8); - StorageLive(_9); - StorageLive(_10); - _10 = &((*_1).2: [f32; 3]); -- _9 = &(*_10); -- _8 = <[f32; 3] as Clone>::clone(move _9) -> [return: bb3, unwind unreachable]; -+ _9 = copy _10; -+ _8 = copy (*_9); + StorageDead(_5); + StorageLive(_6); + StorageLive(_7); + _7 = &((*_1).2: [f32; 3]); +- _6 = <[f32; 3] as Clone>::clone(move _7) -> [return: bb3, unwind unreachable]; ++ _6 = copy (*_7); + goto -> bb3; } bb3: { - StorageDead(_9); - _0 = MyThing:: { v: move _2, i: move _5, a: move _8 }; - StorageDead(_10); - StorageDead(_8); StorageDead(_7); - StorageDead(_5); + _0 = MyThing:: { v: move _2, i: move _4, a: move _6 }; + StorageDead(_6); StorageDead(_4); StorageDead(_2); return; diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff index 0a02c2d4c0f1b..a01ccc6cff3a8 100644 --- a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff @@ -6,57 +6,42 @@ let mut _0: MyThing; let mut _2: T; let mut _3: &T; - let _4: &T; - let mut _5: u64; - let mut _6: &u64; - let _7: &u64; - let mut _8: [f32; 3]; - let mut _9: &[f32; 3]; - let _10: &[f32; 3]; + let mut _4: u64; + let mut _5: &u64; + let mut _6: [f32; 3]; + let mut _7: &[f32; 3]; bb0: { StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _4 = &((*_1).0: T); -- _3 = &(*_4); -+ _3 = copy _4; + _3 = &((*_1).0: T); _2 = ::clone(move _3) -> [return: bb1, unwind continue]; } bb1: { StorageDead(_3); + StorageLive(_4); StorageLive(_5); - StorageLive(_6); - StorageLive(_7); - _7 = &((*_1).1: u64); -- _6 = &(*_7); -- _5 = ::clone(move _6) -> [return: bb2, unwind: bb4]; -+ _6 = copy _7; -+ _5 = copy (*_6); + _5 = &((*_1).1: u64); +- _4 = ::clone(move _5) -> [return: bb2, unwind: bb4]; ++ _4 = copy (*_5); + goto -> bb2; } bb2: { - StorageDead(_6); - StorageLive(_8); - StorageLive(_9); - StorageLive(_10); - _10 = &((*_1).2: [f32; 3]); -- _9 = &(*_10); -- _8 = <[f32; 3] as Clone>::clone(move _9) -> [return: bb3, unwind: bb4]; -+ _9 = copy _10; -+ _8 = copy (*_9); + StorageDead(_5); + StorageLive(_6); + StorageLive(_7); + _7 = &((*_1).2: [f32; 3]); +- _6 = <[f32; 3] as Clone>::clone(move _7) -> [return: bb3, unwind: bb4]; ++ _6 = copy (*_7); + goto -> bb3; } bb3: { - StorageDead(_9); - _0 = MyThing:: { v: move _2, i: move _5, a: move _8 }; - StorageDead(_10); - StorageDead(_8); StorageDead(_7); - StorageDead(_5); + _0 = MyThing:: { v: move _2, i: move _4, a: move _6 }; + StorageDead(_6); StorageDead(_4); StorageDead(_2); return; diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff index 95f9b5997d4f6..72489e68fe55a 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff @@ -5,7 +5,7 @@ debug x => _1; let mut _0: (); let _2: &[T]; - let _3: &[T; 3]; + let mut _3: &[T; 3]; let _4: [T; 3]; let mut _8: !; scope 1 { diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff index 87449b043fd5e..cb6a318b22ed4 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff @@ -5,7 +5,7 @@ debug x => _1; let mut _0: (); let _2: &[T]; - let _3: &[T; 3]; + let mut _3: &[T; 3]; let _4: [T; 3]; let mut _8: !; scope 1 { diff --git a/tests/mir-opt/issue_78192.f.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/issue_78192.f.InstSimplify-after-simplifycfg.diff index aae0570973df3..20e51515808c5 100644 --- a/tests/mir-opt/issue_78192.f.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/issue_78192.f.InstSimplify-after-simplifycfg.diff @@ -5,8 +5,7 @@ debug a => _1; let mut _0: *const T; let _2: &*const T; - let _3: &*const T; - let _4: *const T; + let _3: *const T; scope 1 { debug b => _2; } @@ -14,13 +13,10 @@ bb0: { StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _4 = &raw const (*_1); - _3 = &_4; - _2 = copy _3; - StorageDead(_3); + _3 = &raw const (*_1); + _2 = &_3; _0 = copy (*_2); - StorageDead(_4); + StorageDead(_3); StorageDead(_2); return; } diff --git a/tests/mir-opt/issue_91633.fun.built.after.mir b/tests/mir-opt/issue_91633.fun.built.after.mir index 7468e591b37b2..8fa1fef40f57a 100644 --- a/tests/mir-opt/issue_91633.fun.built.after.mir +++ b/tests/mir-opt/issue_91633.fun.built.after.mir @@ -24,7 +24,7 @@ fn fun(_1: &[T]) -> &T { _2 = &(*_1)[_3]; FakeRead(ForLet(None), _2); StorageDead(_3); - _0 = &(*_2); + _0 = copy _2; StorageDead(_2); return; } diff --git a/tests/mir-opt/issue_91633.hey.built.after.mir b/tests/mir-opt/issue_91633.hey.built.after.mir index a537e509996d7..a213be339bb43 100644 --- a/tests/mir-opt/issue_91633.hey.built.after.mir +++ b/tests/mir-opt/issue_91633.hey.built.after.mir @@ -13,7 +13,7 @@ fn hey(_1: &[T]) -> () { StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = &(*_1); + _4 = copy _1; _3 = <[T] as Index>::index(move _4, const 0_usize) -> [return: bb1, unwind: bb3]; } diff --git a/tests/mir-opt/issue_99325.main.built.after.32bit.mir b/tests/mir-opt/issue_99325.main.built.after.32bit.mir index ea20caa3ca2c7..5e44c8fa4c741 100644 --- a/tests/mir-opt/issue_99325.main.built.after.32bit.mir +++ b/tests/mir-opt/issue_99325.main.built.after.32bit.mir @@ -22,29 +22,25 @@ fn main() -> () { let _15: !; let mut _16: core::panicking::AssertKind; let mut _17: &&[u8]; - let _18: &&[u8]; - let mut _19: &&[u8; 4]; - let _20: &&[u8; 4]; - let mut _21: std::option::Option>; - let _22: (); - let mut _23: (&&[u8], &&[u8; 4]); - let mut _24: &&[u8]; - let _25: &[u8]; - let mut _26: &&[u8; 4]; - let _27: &[u8; 4]; - let _28: &&[u8]; - let _29: &&[u8; 4]; - let mut _30: bool; - let mut _31: &&[u8]; - let mut _32: &&[u8; 4]; - let mut _33: !; - let _35: !; - let mut _36: core::panicking::AssertKind; - let mut _37: &&[u8]; - let _38: &&[u8]; - let mut _39: &&[u8; 4]; - let _40: &&[u8; 4]; - let mut _41: std::option::Option>; + let mut _18: &&[u8; 4]; + let mut _19: std::option::Option>; + let _20: (); + let mut _21: (&&[u8], &&[u8; 4]); + let mut _22: &&[u8]; + let _23: &[u8]; + let mut _24: &&[u8; 4]; + let _25: &[u8; 4]; + let _26: &&[u8]; + let _27: &&[u8; 4]; + let mut _28: bool; + let mut _29: &&[u8]; + let mut _30: &&[u8; 4]; + let mut _31: !; + let _33: !; + let mut _34: core::panicking::AssertKind; + let mut _35: &&[u8]; + let mut _36: &&[u8; 4]; + let mut _37: std::option::Option>; scope 1 { debug left_val => _8; debug right_val => _9; @@ -54,11 +50,11 @@ fn main() -> () { } } scope 3 { - debug left_val => _28; - debug right_val => _29; - let _34: core::panicking::AssertKind; + debug left_val => _26; + debug right_val => _27; + let _32: core::panicking::AssertKind; scope 4 { - debug kind => _34; + debug kind => _32; } } @@ -88,9 +84,9 @@ fn main() -> () { _9 = copy (_2.1: &&[u8; 4]); StorageLive(_10); StorageLive(_11); - _11 = &(*_8); + _11 = copy _8; StorageLive(_12); - _12 = &(*_9); + _12 = copy _9; _10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb3, unwind: bb23]; } @@ -123,25 +119,19 @@ fn main() -> () { StorageLive(_16); _16 = move _14; StorageLive(_17); + _17 = &(*_8); StorageLive(_18); - _18 = &(*_8); - _17 = &(*_18); + _18 = &(*_9); StorageLive(_19); - StorageLive(_20); - _20 = &(*_9); - _19 = &(*_20); - StorageLive(_21); - _21 = Option::>::None; - _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> [return: bb7, unwind: bb23]; + _19 = Option::>::None; + _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _18, move _19) -> [return: bb7, unwind: bb23]; } bb7: { - StorageDead(_21); StorageDead(_19); + StorageDead(_18); StorageDead(_17); StorageDead(_16); - StorageDead(_20); - StorageDead(_18); StorageDead(_15); StorageDead(_14); unreachable; @@ -169,47 +159,47 @@ fn main() -> () { StorageDead(_4); StorageDead(_2); StorageDead(_1); + StorageLive(_20); + StorageLive(_21); StorageLive(_22); StorageLive(_23); - StorageLive(_24); - StorageLive(_25); - _25 = function_with_bytes::<&*b"AAAA">() -> [return: bb12, unwind: bb23]; + _23 = function_with_bytes::<&*b"AAAA">() -> [return: bb12, unwind: bb23]; } bb12: { + _22 = &_23; + StorageLive(_24); + StorageLive(_25); + _25 = const b"AAAA"; _24 = &_25; + _21 = (move _22, move _24); + StorageDead(_24); + StorageDead(_22); + PlaceMention(_21); StorageLive(_26); + _26 = copy (_21.0: &&[u8]); StorageLive(_27); - _27 = const b"AAAA"; - _26 = &_27; - _23 = (move _24, move _26); - StorageDead(_26); - StorageDead(_24); - PlaceMention(_23); + _27 = copy (_21.1: &&[u8; 4]); StorageLive(_28); - _28 = copy (_23.0: &&[u8]); StorageLive(_29); - _29 = copy (_23.1: &&[u8; 4]); + _29 = copy _26; StorageLive(_30); - StorageLive(_31); - _31 = &(*_28); - StorageLive(_32); - _32 = &(*_29); - _30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb14, unwind: bb23]; + _30 = copy _27; + _28 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _29, move _30) -> [return: bb14, unwind: bb23]; } bb13: { - FakeRead(ForMatchedPlace(None), _23); + FakeRead(ForMatchedPlace(None), _21); unreachable; } bb14: { - switchInt(move _30) -> [0: bb16, otherwise: bb15]; + switchInt(move _28) -> [0: bb16, otherwise: bb15]; } bb15: { - StorageDead(_32); - StorageDead(_31); + StorageDead(_30); + StorageDead(_29); goto -> bb20; } @@ -218,36 +208,30 @@ fn main() -> () { } bb17: { - StorageDead(_32); - StorageDead(_31); + StorageDead(_30); + StorageDead(_29); + StorageLive(_32); + _32 = core::panicking::AssertKind::Eq; + FakeRead(ForLet(None), _32); + StorageLive(_33); StorageLive(_34); - _34 = core::panicking::AssertKind::Eq; - FakeRead(ForLet(None), _34); + _34 = move _32; StorageLive(_35); + _35 = &(*_26); StorageLive(_36); - _36 = move _34; + _36 = &(*_27); StorageLive(_37); - StorageLive(_38); - _38 = &(*_28); - _37 = &(*_38); - StorageLive(_39); - StorageLive(_40); - _40 = &(*_29); - _39 = &(*_40); - StorageLive(_41); - _41 = Option::>::None; - _35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> [return: bb18, unwind: bb23]; + _37 = Option::>::None; + _33 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _34, move _35, move _36, move _37) -> [return: bb18, unwind: bb23]; } bb18: { - StorageDead(_41); - StorageDead(_39); StorageDead(_37); StorageDead(_36); - StorageDead(_40); - StorageDead(_38); StorageDead(_35); StorageDead(_34); + StorageDead(_33); + StorageDead(_32); unreachable; } @@ -256,22 +240,22 @@ fn main() -> () { } bb20: { - _22 = const (); + _20 = const (); goto -> bb21; } bb21: { - StorageDead(_30); - StorageDead(_29); StorageDead(_28); + StorageDead(_27); + StorageDead(_26); goto -> bb22; } bb22: { - StorageDead(_27); StorageDead(_25); StorageDead(_23); - StorageDead(_22); + StorageDead(_21); + StorageDead(_20); _0 = const (); return; } diff --git a/tests/mir-opt/issue_99325.main.built.after.64bit.mir b/tests/mir-opt/issue_99325.main.built.after.64bit.mir index ea20caa3ca2c7..5e44c8fa4c741 100644 --- a/tests/mir-opt/issue_99325.main.built.after.64bit.mir +++ b/tests/mir-opt/issue_99325.main.built.after.64bit.mir @@ -22,29 +22,25 @@ fn main() -> () { let _15: !; let mut _16: core::panicking::AssertKind; let mut _17: &&[u8]; - let _18: &&[u8]; - let mut _19: &&[u8; 4]; - let _20: &&[u8; 4]; - let mut _21: std::option::Option>; - let _22: (); - let mut _23: (&&[u8], &&[u8; 4]); - let mut _24: &&[u8]; - let _25: &[u8]; - let mut _26: &&[u8; 4]; - let _27: &[u8; 4]; - let _28: &&[u8]; - let _29: &&[u8; 4]; - let mut _30: bool; - let mut _31: &&[u8]; - let mut _32: &&[u8; 4]; - let mut _33: !; - let _35: !; - let mut _36: core::panicking::AssertKind; - let mut _37: &&[u8]; - let _38: &&[u8]; - let mut _39: &&[u8; 4]; - let _40: &&[u8; 4]; - let mut _41: std::option::Option>; + let mut _18: &&[u8; 4]; + let mut _19: std::option::Option>; + let _20: (); + let mut _21: (&&[u8], &&[u8; 4]); + let mut _22: &&[u8]; + let _23: &[u8]; + let mut _24: &&[u8; 4]; + let _25: &[u8; 4]; + let _26: &&[u8]; + let _27: &&[u8; 4]; + let mut _28: bool; + let mut _29: &&[u8]; + let mut _30: &&[u8; 4]; + let mut _31: !; + let _33: !; + let mut _34: core::panicking::AssertKind; + let mut _35: &&[u8]; + let mut _36: &&[u8; 4]; + let mut _37: std::option::Option>; scope 1 { debug left_val => _8; debug right_val => _9; @@ -54,11 +50,11 @@ fn main() -> () { } } scope 3 { - debug left_val => _28; - debug right_val => _29; - let _34: core::panicking::AssertKind; + debug left_val => _26; + debug right_val => _27; + let _32: core::panicking::AssertKind; scope 4 { - debug kind => _34; + debug kind => _32; } } @@ -88,9 +84,9 @@ fn main() -> () { _9 = copy (_2.1: &&[u8; 4]); StorageLive(_10); StorageLive(_11); - _11 = &(*_8); + _11 = copy _8; StorageLive(_12); - _12 = &(*_9); + _12 = copy _9; _10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb3, unwind: bb23]; } @@ -123,25 +119,19 @@ fn main() -> () { StorageLive(_16); _16 = move _14; StorageLive(_17); + _17 = &(*_8); StorageLive(_18); - _18 = &(*_8); - _17 = &(*_18); + _18 = &(*_9); StorageLive(_19); - StorageLive(_20); - _20 = &(*_9); - _19 = &(*_20); - StorageLive(_21); - _21 = Option::>::None; - _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> [return: bb7, unwind: bb23]; + _19 = Option::>::None; + _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _18, move _19) -> [return: bb7, unwind: bb23]; } bb7: { - StorageDead(_21); StorageDead(_19); + StorageDead(_18); StorageDead(_17); StorageDead(_16); - StorageDead(_20); - StorageDead(_18); StorageDead(_15); StorageDead(_14); unreachable; @@ -169,47 +159,47 @@ fn main() -> () { StorageDead(_4); StorageDead(_2); StorageDead(_1); + StorageLive(_20); + StorageLive(_21); StorageLive(_22); StorageLive(_23); - StorageLive(_24); - StorageLive(_25); - _25 = function_with_bytes::<&*b"AAAA">() -> [return: bb12, unwind: bb23]; + _23 = function_with_bytes::<&*b"AAAA">() -> [return: bb12, unwind: bb23]; } bb12: { + _22 = &_23; + StorageLive(_24); + StorageLive(_25); + _25 = const b"AAAA"; _24 = &_25; + _21 = (move _22, move _24); + StorageDead(_24); + StorageDead(_22); + PlaceMention(_21); StorageLive(_26); + _26 = copy (_21.0: &&[u8]); StorageLive(_27); - _27 = const b"AAAA"; - _26 = &_27; - _23 = (move _24, move _26); - StorageDead(_26); - StorageDead(_24); - PlaceMention(_23); + _27 = copy (_21.1: &&[u8; 4]); StorageLive(_28); - _28 = copy (_23.0: &&[u8]); StorageLive(_29); - _29 = copy (_23.1: &&[u8; 4]); + _29 = copy _26; StorageLive(_30); - StorageLive(_31); - _31 = &(*_28); - StorageLive(_32); - _32 = &(*_29); - _30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb14, unwind: bb23]; + _30 = copy _27; + _28 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _29, move _30) -> [return: bb14, unwind: bb23]; } bb13: { - FakeRead(ForMatchedPlace(None), _23); + FakeRead(ForMatchedPlace(None), _21); unreachable; } bb14: { - switchInt(move _30) -> [0: bb16, otherwise: bb15]; + switchInt(move _28) -> [0: bb16, otherwise: bb15]; } bb15: { - StorageDead(_32); - StorageDead(_31); + StorageDead(_30); + StorageDead(_29); goto -> bb20; } @@ -218,36 +208,30 @@ fn main() -> () { } bb17: { - StorageDead(_32); - StorageDead(_31); + StorageDead(_30); + StorageDead(_29); + StorageLive(_32); + _32 = core::panicking::AssertKind::Eq; + FakeRead(ForLet(None), _32); + StorageLive(_33); StorageLive(_34); - _34 = core::panicking::AssertKind::Eq; - FakeRead(ForLet(None), _34); + _34 = move _32; StorageLive(_35); + _35 = &(*_26); StorageLive(_36); - _36 = move _34; + _36 = &(*_27); StorageLive(_37); - StorageLive(_38); - _38 = &(*_28); - _37 = &(*_38); - StorageLive(_39); - StorageLive(_40); - _40 = &(*_29); - _39 = &(*_40); - StorageLive(_41); - _41 = Option::>::None; - _35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> [return: bb18, unwind: bb23]; + _37 = Option::>::None; + _33 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _34, move _35, move _36, move _37) -> [return: bb18, unwind: bb23]; } bb18: { - StorageDead(_41); - StorageDead(_39); StorageDead(_37); StorageDead(_36); - StorageDead(_40); - StorageDead(_38); StorageDead(_35); StorageDead(_34); + StorageDead(_33); + StorageDead(_32); unreachable; } @@ -256,22 +240,22 @@ fn main() -> () { } bb20: { - _22 = const (); + _20 = const (); goto -> bb21; } bb21: { - StorageDead(_30); - StorageDead(_29); StorageDead(_28); + StorageDead(_27); + StorageDead(_26); goto -> bb22; } bb22: { - StorageDead(_27); StorageDead(_25); StorageDead(_23); - StorageDead(_22); + StorageDead(_21); + StorageDead(_20); _0 = const (); return; } diff --git a/tests/mir-opt/jump_threading.chained_conditions.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.chained_conditions.JumpThreading.panic-abort.diff index fb406b8dfefc9..24bdf12f2adc4 100644 --- a/tests/mir-opt/jump_threading.chained_conditions.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.chained_conditions.JumpThreading.panic-abort.diff @@ -45,9 +45,9 @@ let mut _28: &str; scope 5 (inlined >::eq) { scope 6 (inlined #[track_caller] >::index) { - let _29: &str; + let mut _29: &str; scope 7 (inlined String::as_str) { - let _30: &[u8]; + let mut _30: &[u8]; scope 8 (inlined Vec::::as_slice) { let _31: *const [u8]; let mut _32: *const u8; @@ -117,9 +117,9 @@ let mut _48: &str; scope 31 (inlined >::eq) { scope 32 (inlined #[track_caller] >::index) { - let _49: &str; + let mut _49: &str; scope 33 (inlined String::as_str) { - let _50: &[u8]; + let mut _50: &[u8]; scope 34 (inlined Vec::::as_slice) { let _51: *const [u8]; let mut _52: *const u8; @@ -222,9 +222,9 @@ _21 = const chained_conditions::promoted[1]; _10 = &(*_21); StorageLive(_27); + _27 = copy (*_8); StorageLive(_28); - _27 = no_retag copy (*_8); - _28 = no_retag copy (*_10); + _28 = copy (*_10); StorageLive(_29); StorageLive(_30); StorageLive(_31); @@ -284,9 +284,9 @@ _20 = const chained_conditions::promoted[0]; _17 = &(*_20); StorageLive(_47); + _47 = copy (*_15); StorageLive(_48); - _47 = no_retag copy (*_15); - _48 = no_retag copy (*_17); + _48 = copy (*_17); StorageLive(_49); StorageLive(_50); StorageLive(_51); diff --git a/tests/mir-opt/jump_threading.chained_conditions.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.chained_conditions.JumpThreading.panic-unwind.diff index d291e3d1eb51e..c1a069d022fb8 100644 --- a/tests/mir-opt/jump_threading.chained_conditions.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.chained_conditions.JumpThreading.panic-unwind.diff @@ -45,9 +45,9 @@ let mut _28: &str; scope 5 (inlined >::eq) { scope 6 (inlined #[track_caller] >::index) { - let _29: &str; + let mut _29: &str; scope 7 (inlined String::as_str) { - let _30: &[u8]; + let mut _30: &[u8]; scope 8 (inlined Vec::::as_slice) { let _31: *const [u8]; let mut _32: *const u8; @@ -117,9 +117,9 @@ let mut _48: &str; scope 31 (inlined >::eq) { scope 32 (inlined #[track_caller] >::index) { - let _49: &str; + let mut _49: &str; scope 33 (inlined String::as_str) { - let _50: &[u8]; + let mut _50: &[u8]; scope 34 (inlined Vec::::as_slice) { let _51: *const [u8]; let mut _52: *const u8; @@ -222,9 +222,9 @@ _21 = const chained_conditions::promoted[1]; _10 = &(*_21); StorageLive(_27); + _27 = copy (*_8); StorageLive(_28); - _27 = no_retag copy (*_8); - _28 = no_retag copy (*_10); + _28 = copy (*_10); StorageLive(_29); StorageLive(_30); StorageLive(_31); @@ -284,9 +284,9 @@ _20 = const chained_conditions::promoted[0]; _17 = &(*_20); StorageLive(_47); + _47 = copy (*_15); StorageLive(_48); - _47 = no_retag copy (*_15); - _48 = no_retag copy (*_17); + _48 = copy (*_17); StorageLive(_49); StorageLive(_50); StorageLive(_51); diff --git a/tests/mir-opt/lower_array_len.array_bound.GVN.panic-abort.diff b/tests/mir-opt/lower_array_len.array_bound.GVN.panic-abort.diff index c0500ca3bb835..4cad644ecb1cb 100644 --- a/tests/mir-opt/lower_array_len.array_bound.GVN.panic-abort.diff +++ b/tests/mir-opt/lower_array_len.array_bound.GVN.panic-abort.diff @@ -20,8 +20,9 @@ StorageLive(_5); StorageLive(_6); StorageLive(_7); - _7 = &(*_2); - _6 = move _7 as &[u8] (PointerCoercion(Unsize, Implicit)); + _7 = copy _2; +- _6 = move _7 as &[u8] (PointerCoercion(Unsize, Implicit)); ++ _6 = copy _2 as &[u8] (PointerCoercion(Unsize, Implicit)); StorageDead(_7); - _5 = PtrMetadata(move _6); + _5 = const N; diff --git a/tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff index 9e6d01764ccd5..2bd72588f4549 100644 --- a/tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff +++ b/tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff @@ -20,8 +20,9 @@ StorageLive(_5); StorageLive(_6); StorageLive(_7); - _7 = &(*_2); - _6 = move _7 as &[u8] (PointerCoercion(Unsize, Implicit)); + _7 = copy _2; +- _6 = move _7 as &[u8] (PointerCoercion(Unsize, Implicit)); ++ _6 = copy _2 as &[u8] (PointerCoercion(Unsize, Implicit)); StorageDead(_7); - _5 = PtrMetadata(move _6); + _5 = const N; diff --git a/tests/mir-opt/lower_array_len.array_len.GVN.panic-abort.diff b/tests/mir-opt/lower_array_len.array_len.GVN.panic-abort.diff index 369bd2f473297..5b63f491741df 100644 --- a/tests/mir-opt/lower_array_len.array_len.GVN.panic-abort.diff +++ b/tests/mir-opt/lower_array_len.array_len.GVN.panic-abort.diff @@ -10,8 +10,9 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); - _2 = move _3 as &[u8] (PointerCoercion(Unsize, Implicit)); + _3 = copy _1; +- _2 = move _3 as &[u8] (PointerCoercion(Unsize, Implicit)); ++ _2 = copy _1 as &[u8] (PointerCoercion(Unsize, Implicit)); StorageDead(_3); - _0 = PtrMetadata(move _2); + _0 = const N; diff --git a/tests/mir-opt/lower_array_len.array_len.GVN.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_len.GVN.panic-unwind.diff index 369bd2f473297..5b63f491741df 100644 --- a/tests/mir-opt/lower_array_len.array_len.GVN.panic-unwind.diff +++ b/tests/mir-opt/lower_array_len.array_len.GVN.panic-unwind.diff @@ -10,8 +10,9 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); - _2 = move _3 as &[u8] (PointerCoercion(Unsize, Implicit)); + _3 = copy _1; +- _2 = move _3 as &[u8] (PointerCoercion(Unsize, Implicit)); ++ _2 = copy _1 as &[u8] (PointerCoercion(Unsize, Implicit)); StorageDead(_3); - _0 = PtrMetadata(move _2); + _0 = const N; diff --git a/tests/mir-opt/lower_array_len.array_len_raw.GVN.panic-abort.diff b/tests/mir-opt/lower_array_len.array_len_raw.GVN.panic-abort.diff index 714a12804e692..c29e01a9fa5e5 100644 --- a/tests/mir-opt/lower_array_len.array_len_raw.GVN.panic-abort.diff +++ b/tests/mir-opt/lower_array_len.array_len_raw.GVN.panic-abort.diff @@ -6,42 +6,34 @@ let mut _0: usize; let _2: &[u8]; let mut _3: &[u8; N]; - let _4: &[u8; N]; - let mut _6: &[u8]; - let _7: &[u8]; + let mut _5: &[u8]; scope 1 { debug arr => _2; - let _5: *const [u8]; + let _4: *const [u8]; scope 2 { - debug arr => _5; + debug arr => _4; } } bb0: { StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _4 = &_1; - _3 = &(*_4); + _3 = &_1; _2 = move _3 as &[u8] (PointerCoercion(Unsize, Implicit)); StorageDead(_3); - StorageDead(_4); + StorageLive(_4); + _4 = &raw const (*_2); StorageLive(_5); - _5 = &raw const (*_2); - StorageLive(_6); - StorageLive(_7); - _7 = &(*_5); - _6 = &(*_7); -- _0 = PtrMetadata(move _6); + _5 = &(*_4); +- _0 = PtrMetadata(move _5); + _0 = const N; goto -> bb1; } bb1: { - StorageDead(_6); StorageDead(_5); + StorageDead(_4); StorageDead(_2); - StorageDead(_7); return; } } diff --git a/tests/mir-opt/lower_array_len.array_len_raw.GVN.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_len_raw.GVN.panic-unwind.diff index 714a12804e692..c29e01a9fa5e5 100644 --- a/tests/mir-opt/lower_array_len.array_len_raw.GVN.panic-unwind.diff +++ b/tests/mir-opt/lower_array_len.array_len_raw.GVN.panic-unwind.diff @@ -6,42 +6,34 @@ let mut _0: usize; let _2: &[u8]; let mut _3: &[u8; N]; - let _4: &[u8; N]; - let mut _6: &[u8]; - let _7: &[u8]; + let mut _5: &[u8]; scope 1 { debug arr => _2; - let _5: *const [u8]; + let _4: *const [u8]; scope 2 { - debug arr => _5; + debug arr => _4; } } bb0: { StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _4 = &_1; - _3 = &(*_4); + _3 = &_1; _2 = move _3 as &[u8] (PointerCoercion(Unsize, Implicit)); StorageDead(_3); - StorageDead(_4); + StorageLive(_4); + _4 = &raw const (*_2); StorageLive(_5); - _5 = &raw const (*_2); - StorageLive(_6); - StorageLive(_7); - _7 = &(*_5); - _6 = &(*_7); -- _0 = PtrMetadata(move _6); + _5 = &(*_4); +- _0 = PtrMetadata(move _5); + _0 = const N; goto -> bb1; } bb1: { - StorageDead(_6); StorageDead(_5); + StorageDead(_4); StorageDead(_2); - StorageDead(_7); return; } } diff --git a/tests/mir-opt/lower_array_len.array_len_reborrow.GVN.panic-abort.diff b/tests/mir-opt/lower_array_len.array_len_reborrow.GVN.panic-abort.diff index b236b22f067d8..a88fffa238b73 100644 --- a/tests/mir-opt/lower_array_len.array_len_reborrow.GVN.panic-abort.diff +++ b/tests/mir-opt/lower_array_len.array_len_reborrow.GVN.panic-abort.diff @@ -28,7 +28,7 @@ StorageLive(_5); _5 = &(*_2); StorageLive(_6); - _6 = &(*_5); + _6 = copy _5; - _0 = PtrMetadata(move _6); + _0 = const N; goto -> bb1; diff --git a/tests/mir-opt/lower_array_len.array_len_reborrow.GVN.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_len_reborrow.GVN.panic-unwind.diff index b236b22f067d8..a88fffa238b73 100644 --- a/tests/mir-opt/lower_array_len.array_len_reborrow.GVN.panic-unwind.diff +++ b/tests/mir-opt/lower_array_len.array_len_reborrow.GVN.panic-unwind.diff @@ -28,7 +28,7 @@ StorageLive(_5); _5 = &(*_2); StorageLive(_6); - _6 = &(*_5); + _6 = copy _5; - _0 = PtrMetadata(move _6); + _0 = const N; goto -> bb1; diff --git a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-abort.diff index 564f07ff26d4f..a3fb6aba6204b 100644 --- a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-abort.diff @@ -6,29 +6,23 @@ let mut _0: (); let _2: ::Discriminant; let mut _3: &T; - let _4: &T; - let _5: u8; - let mut _6: &i32; - let _7: &i32; - let _8: i32; - let _9: u8; - let mut _10: &(); - let _11: &(); - let _12: (); - let _13: isize; - let mut _14: &E; - let _15: &E; - let _16: E; - let mut _17: &E; - let mut _18: &(); - let mut _19: &i32; + let _4: u8; + let mut _5: &i32; + let _6: i32; + let _7: u8; + let mut _8: &(); + let _9: (); + let _10: isize; + let mut _11: &E; + let _12: E; + let mut _13: &E; + let mut _14: &(); + let mut _15: &i32; bb0: { StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _4 = &_1; - _3 = &(*_4); + _3 = &_1; - _2 = discriminant_value::(move _3) -> [return: bb1, unwind unreachable]; + _2 = discriminant((*_3)); + goto -> bb1; @@ -36,53 +30,43 @@ bb1: { StorageDead(_3); - StorageDead(_4); StorageDead(_2); + StorageLive(_4); StorageLive(_5); - StorageLive(_6); - StorageLive(_7); - _19 = const discriminant::::promoted[2]; - _7 = &(*_19); - _6 = &(*_7); -- _5 = discriminant_value::(move _6) -> [return: bb2, unwind unreachable]; -+ _5 = discriminant((*_6)); + _15 = const discriminant::::promoted[2]; + _5 = &(*_15); +- _4 = discriminant_value::(move _5) -> [return: bb2, unwind unreachable]; ++ _4 = discriminant((*_5)); + goto -> bb2; } bb2: { - StorageDead(_6); - StorageDead(_7); StorageDead(_5); - StorageLive(_9); - StorageLive(_10); - StorageLive(_11); - _18 = const discriminant::::promoted[1]; - _11 = &(*_18); - _10 = &(*_11); -- _9 = discriminant_value::<()>(move _10) -> [return: bb3, unwind unreachable]; -+ _9 = discriminant((*_10)); + StorageDead(_4); + StorageLive(_7); + StorageLive(_8); + _14 = const discriminant::::promoted[1]; + _8 = &(*_14); +- _7 = discriminant_value::<()>(move _8) -> [return: bb3, unwind unreachable]; ++ _7 = discriminant((*_8)); + goto -> bb3; } bb3: { - StorageDead(_10); - StorageDead(_11); - StorageDead(_9); - StorageLive(_13); - StorageLive(_14); - StorageLive(_15); - _17 = const discriminant::::promoted[0]; - _15 = &(*_17); - _14 = &(*_15); -- _13 = discriminant_value::(move _14) -> [return: bb4, unwind unreachable]; -+ _13 = discriminant((*_14)); + StorageDead(_8); + StorageDead(_7); + StorageLive(_10); + StorageLive(_11); + _13 = const discriminant::::promoted[0]; + _11 = &(*_13); +- _10 = discriminant_value::(move _11) -> [return: bb4, unwind unreachable]; ++ _10 = discriminant((*_11)); + goto -> bb4; } bb4: { - StorageDead(_14); - StorageDead(_15); - StorageDead(_13); + StorageDead(_11); + StorageDead(_10); _0 = const (); drop(_1) -> [return: bb5, unwind unreachable]; } diff --git a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-unwind.diff index 7410af284dcd0..d4a60fa817ea8 100644 --- a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-unwind.diff @@ -6,29 +6,23 @@ let mut _0: (); let _2: ::Discriminant; let mut _3: &T; - let _4: &T; - let _5: u8; - let mut _6: &i32; - let _7: &i32; - let _8: i32; - let _9: u8; - let mut _10: &(); - let _11: &(); - let _12: (); - let _13: isize; - let mut _14: &E; - let _15: &E; - let _16: E; - let mut _17: &E; - let mut _18: &(); - let mut _19: &i32; + let _4: u8; + let mut _5: &i32; + let _6: i32; + let _7: u8; + let mut _8: &(); + let _9: (); + let _10: isize; + let mut _11: &E; + let _12: E; + let mut _13: &E; + let mut _14: &(); + let mut _15: &i32; bb0: { StorageLive(_2); StorageLive(_3); - StorageLive(_4); - _4 = &_1; - _3 = &(*_4); + _3 = &_1; - _2 = discriminant_value::(move _3) -> [return: bb1, unwind unreachable]; + _2 = discriminant((*_3)); + goto -> bb1; @@ -36,53 +30,43 @@ bb1: { StorageDead(_3); - StorageDead(_4); StorageDead(_2); + StorageLive(_4); StorageLive(_5); - StorageLive(_6); - StorageLive(_7); - _19 = const discriminant::::promoted[2]; - _7 = &(*_19); - _6 = &(*_7); -- _5 = discriminant_value::(move _6) -> [return: bb2, unwind unreachable]; -+ _5 = discriminant((*_6)); + _15 = const discriminant::::promoted[2]; + _5 = &(*_15); +- _4 = discriminant_value::(move _5) -> [return: bb2, unwind unreachable]; ++ _4 = discriminant((*_5)); + goto -> bb2; } bb2: { - StorageDead(_6); - StorageDead(_7); StorageDead(_5); - StorageLive(_9); - StorageLive(_10); - StorageLive(_11); - _18 = const discriminant::::promoted[1]; - _11 = &(*_18); - _10 = &(*_11); -- _9 = discriminant_value::<()>(move _10) -> [return: bb3, unwind unreachable]; -+ _9 = discriminant((*_10)); + StorageDead(_4); + StorageLive(_7); + StorageLive(_8); + _14 = const discriminant::::promoted[1]; + _8 = &(*_14); +- _7 = discriminant_value::<()>(move _8) -> [return: bb3, unwind unreachable]; ++ _7 = discriminant((*_8)); + goto -> bb3; } bb3: { - StorageDead(_10); - StorageDead(_11); - StorageDead(_9); - StorageLive(_13); - StorageLive(_14); - StorageLive(_15); - _17 = const discriminant::::promoted[0]; - _15 = &(*_17); - _14 = &(*_15); -- _13 = discriminant_value::(move _14) -> [return: bb4, unwind unreachable]; -+ _13 = discriminant((*_14)); + StorageDead(_8); + StorageDead(_7); + StorageLive(_10); + StorageLive(_11); + _13 = const discriminant::::promoted[0]; + _11 = &(*_13); +- _10 = discriminant_value::(move _11) -> [return: bb4, unwind unreachable]; ++ _10 = discriminant((*_11)); + goto -> bb4; } bb4: { - StorageDead(_14); - StorageDead(_15); - StorageDead(_13); + StorageDead(_11); + StorageDead(_10); _0 = const (); drop(_1) -> [return: bb5, unwind: bb6]; } diff --git a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff index 4b39e18d16cfc..2dbb8e49825ac 100644 --- a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff +++ b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff @@ -19,7 +19,7 @@ _4 = copy _1; StorageLive(_5); StorageLive(_6); - _6 = &(*_2); + _6 = copy _2; - _5 = core::slice::::len(move _6) -> [return: bb1, unwind unreachable]; + _5 = PtrMetadata(move _6); + goto -> bb1; diff --git a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff index f0d4afa21ae4b..53897ad4674cb 100644 --- a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff +++ b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff @@ -19,7 +19,7 @@ _4 = copy _1; StorageLive(_5); StorageLive(_6); - _6 = &(*_2); + _6 = copy _2; - _5 = core::slice::::len(move _6) -> [return: bb1, unwind continue]; + _5 = PtrMetadata(move _6); + goto -> bb1; diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir index 404de884ab562..2c856881de52b 100644 --- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir +++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir @@ -4,27 +4,19 @@ fn main() -> () { let mut _0: (); let _1: (); let mut _2: std::string::String; - let mut _3: &str; - let _4: &str; bb0: { StorageLive(_1); StorageLive(_2); - StorageLive(_3); - StorageLive(_4); - _4 = const ""; - _3 = &(*_4); - _2 = ::to_string(move _3) -> [return: bb1, unwind: bb4]; + _2 = ::to_string(const "") -> [return: bb1, unwind: bb4]; } bb1: { - StorageDead(_3); _1 = std::mem::drop::(move _2) -> [return: bb2, unwind: bb3]; } bb2: { StorageDead(_2); - StorageDead(_4); StorageDead(_1); _0 = const (); return; diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir index 47a0878ffae1c..5064286e637a7 100644 --- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir +++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir @@ -4,27 +4,19 @@ fn main() -> () { let mut _0: (); let _1: (); let mut _2: std::string::String; - let mut _3: &str; - let _4: &str; bb0: { StorageLive(_1); StorageLive(_2); - StorageLive(_3); - StorageLive(_4); - _4 = const ""; - _3 = &(*_4); - _2 = ::to_string(move _3) -> [return: bb1, unwind continue]; + _2 = ::to_string(const "") -> [return: bb1, unwind continue]; } bb1: { - StorageDead(_3); _1 = std::mem::drop::(move _2) -> [return: bb2, unwind: bb3]; } bb2: { StorageDead(_2); - StorageDead(_4); StorageDead(_1); _0 = const (); return; diff --git a/tests/mir-opt/pre-codegen/clone_as_copy.clone_as_copy.runtime-optimized.after.mir b/tests/mir-opt/pre-codegen/clone_as_copy.clone_as_copy.runtime-optimized.after.mir index 18069a37ed90d..7f1cacb5632fb 100644 --- a/tests/mir-opt/pre-codegen/clone_as_copy.clone_as_copy.runtime-optimized.after.mir +++ b/tests/mir-opt/pre-codegen/clone_as_copy.clone_as_copy.runtime-optimized.after.mir @@ -5,7 +5,7 @@ fn clone_as_copy(_1: &NestCopy) -> NestCopy { let mut _0: NestCopy; scope 1 (inlined ::clone) { debug self => _1; - let _2: &AllCopy; + let mut _2: &AllCopy; scope 2 (inlined ::clone) { debug self => _2; } diff --git a/tests/mir-opt/pre-codegen/clone_as_copy.enum_clone_as_copy.runtime-optimized.after.mir b/tests/mir-opt/pre-codegen/clone_as_copy.enum_clone_as_copy.runtime-optimized.after.mir index ef907c83c10e0..a478e89dd97cc 100644 --- a/tests/mir-opt/pre-codegen/clone_as_copy.enum_clone_as_copy.runtime-optimized.after.mir +++ b/tests/mir-opt/pre-codegen/clone_as_copy.enum_clone_as_copy.runtime-optimized.after.mir @@ -17,7 +17,7 @@ fn enum_clone_as_copy(_1: &Enum1) -> Enum1 { debug __self_0 => _3; scope 4 (inlined ::clone) { debug self => _3; - let _4: &AllCopy; + let mut _4: &AllCopy; scope 5 (inlined ::clone) { debug self => _4; } diff --git a/tests/mir-opt/pre-codegen/clone_as_copy.rs b/tests/mir-opt/pre-codegen/clone_as_copy.rs index 3c8d07c89c8a0..f3095d9d95880 100644 --- a/tests/mir-opt/pre-codegen/clone_as_copy.rs +++ b/tests/mir-opt/pre-codegen/clone_as_copy.rs @@ -25,7 +25,7 @@ enum Enum1 { // EMIT_MIR clone_as_copy.clone_as_copy.runtime-optimized.after.mir fn clone_as_copy(v: &NestCopy) -> NestCopy { // CHECK-LABEL: fn clone_as_copy( - // CHECK: let [[DEAD_VAR:_.*]]: &AllCopy; + // CHECK: let mut [[DEAD_VAR:_.*]]: &AllCopy; // CHECK: bb0: { // CHECK-NEXT: DBG: [[DEAD_VAR]] = &((*_1).1: AllCopy) // CHECK-NEXT: _0 = copy (*_1); diff --git a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.runtime-optimized.after.panic-abort.mir b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.runtime-optimized.after.panic-abort.mir index 004de976667d3..b6005915003f6 100644 --- a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.runtime-optimized.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.runtime-optimized.after.panic-abort.mir @@ -4,12 +4,12 @@ fn ::cmp(_1: &MultiField, _2: &Mul debug self => _1; debug other => _2; let mut _0: std::cmp::Ordering; - let _3: &char; - let _4: &char; + let mut _3: &char; + let mut _4: &char; let mut _5: std::cmp::Ordering; let mut _6: i8; - let _7: &i16; - let _8: &i16; + let mut _7: &i16; + let mut _8: &i16; scope 1 { debug cmp => _5; } @@ -17,7 +17,7 @@ fn ::cmp(_1: &MultiField, _2: &Mul bb0: { _3 = &((*_1).0: char); _4 = &((*_2).0: char); - _5 = ::cmp(copy _3, copy _4) -> [return: bb1, unwind unreachable]; + _5 = ::cmp(move _3, move _4) -> [return: bb1, unwind unreachable]; } bb1: { @@ -28,7 +28,7 @@ fn ::cmp(_1: &MultiField, _2: &Mul bb2: { _7 = &((*_1).1: i16); _8 = &((*_2).1: i16); - _0 = ::cmp(copy _7, copy _8) -> [return: bb4, unwind unreachable]; + _0 = ::cmp(move _7, move _8) -> [return: bb4, unwind unreachable]; } bb3: { diff --git a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.runtime-optimized.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.runtime-optimized.after.panic-unwind.mir index 5df51f2b3f253..05b5a50697f81 100644 --- a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.runtime-optimized.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.runtime-optimized.after.panic-unwind.mir @@ -4,12 +4,12 @@ fn ::cmp(_1: &MultiField, _2: &Mul debug self => _1; debug other => _2; let mut _0: std::cmp::Ordering; - let _3: &char; - let _4: &char; + let mut _3: &char; + let mut _4: &char; let mut _5: std::cmp::Ordering; let mut _6: i8; - let _7: &i16; - let _8: &i16; + let mut _7: &i16; + let mut _8: &i16; scope 1 { debug cmp => _5; } @@ -17,7 +17,7 @@ fn ::cmp(_1: &MultiField, _2: &Mul bb0: { _3 = &((*_1).0: char); _4 = &((*_2).0: char); - _5 = ::cmp(copy _3, copy _4) -> [return: bb1, unwind continue]; + _5 = ::cmp(move _3, move _4) -> [return: bb1, unwind continue]; } bb1: { @@ -28,7 +28,7 @@ fn ::cmp(_1: &MultiField, _2: &Mul bb2: { _7 = &((*_1).1: i16); _8 = &((*_2).1: i16); - _0 = ::cmp(copy _7, copy _8) -> [return: bb4, unwind continue]; + _0 = ::cmp(move _7, move _8) -> [return: bb4, unwind continue]; } bb3: { diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff index a0526d279a863..db036bec6dbe9 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff @@ -24,7 +24,7 @@ let _11: std::alloc::AllocError; let mut _12: !; let mut _13: &dyn std::fmt::Debug; - let _14: &std::alloc::AllocError; + let mut _14: &std::alloc::AllocError; scope 8 { } scope 9 { @@ -88,6 +88,7 @@ StorageLive(_14); _14 = &_11; _13 = copy _14 as &dyn std::fmt::Debug (PointerCoercion(Unsize, Implicit)); + StorageDead(_14); _12 = result::unwrap_failed(const "called `Result::unwrap()` on an `Err` value", move _13) -> unwind unreachable; } diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff index 3a6b52b0f2496..cec4f478b05d1 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff @@ -24,7 +24,7 @@ let _11: std::alloc::AllocError; let mut _12: !; let mut _13: &dyn std::fmt::Debug; - let _14: &std::alloc::AllocError; + let mut _14: &std::alloc::AllocError; scope 8 { } scope 9 { @@ -88,6 +88,7 @@ StorageLive(_14); _14 = &_11; _13 = copy _14 as &dyn std::fmt::Debug (PointerCoercion(Unsize, Implicit)); + StorageDead(_14); _12 = result::unwrap_failed(const "called `Result::unwrap()` on an `Err` value", move _13) -> unwind unreachable; } diff --git a/tests/mir-opt/pre-codegen/loops.vec_move.runtime-optimized.after.mir b/tests/mir-opt/pre-codegen/loops.vec_move.runtime-optimized.after.mir index 6815c22fc9552..86100296ee22f 100644 --- a/tests/mir-opt/pre-codegen/loops.vec_move.runtime-optimized.after.mir +++ b/tests/mir-opt/pre-codegen/loops.vec_move.runtime-optimized.after.mir @@ -24,13 +24,13 @@ fn vec_move(_1: Vec) -> () { let mut _9: *mut impl Sized; let mut _10: *const impl Sized; let mut _11: usize; - let _28: &std::vec::Vec; + let mut _28: &std::vec::Vec; let mut _29: &std::mem::ManuallyDrop>; let mut _30: &alloc::raw_vec::RawVec; let mut _31: &std::mem::ManuallyDrop>; - let _32: &std::vec::Vec; + let mut _32: &std::vec::Vec; let mut _33: &std::mem::ManuallyDrop>; - let _34: &std::vec::Vec; + let mut _34: &std::vec::Vec; let mut _35: &std::mem::ManuallyDrop>; let mut _36: &alloc::raw_vec::RawVec; let mut _37: &std::mem::ManuallyDrop>; diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.runtime-optimized.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.runtime-optimized.after.panic-abort.mir index b42087b5c822d..d652b8cd67db5 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.runtime-optimized.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.runtime-optimized.after.panic-abort.mir @@ -53,7 +53,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let _15: std::ptr::NonNull; let mut _18: bool; let mut _24: usize; - let _26: &T; + let mut _26: &T; scope 29 { let _14: *const T; scope 30 { diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.runtime-optimized.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.runtime-optimized.after.panic-abort.mir index 2e662fc36ac67..15e757eec8387 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.runtime-optimized.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.runtime-optimized.after.panic-abort.mir @@ -22,7 +22,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { let _14: std::ptr::NonNull; let mut _17: bool; let mut _20: usize; - let _22: &T; + let mut _22: &T; scope 17 { let _13: *const T; scope 18 { diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.runtime-optimized.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.runtime-optimized.after.panic-unwind.mir index dc5feaa1344b0..d9437647d1c32 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.runtime-optimized.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.runtime-optimized.after.panic-unwind.mir @@ -22,7 +22,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { let _14: std::ptr::NonNull; let mut _17: bool; let mut _20: usize; - let _22: &T; + let mut _22: &T; scope 17 { let _13: *const T; scope 18 { diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.runtime-optimized.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.runtime-optimized.after.panic-abort.mir index c2c521729b75c..d1020e63f45ae 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.runtime-optimized.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.runtime-optimized.after.panic-abort.mir @@ -22,7 +22,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let mut _15: *const T; let mut _20: bool; let mut _21: *const T; - let _34: &T; + let mut _34: &T; scope 20 { let _16: std::ptr::NonNull; let _22: usize; diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.runtime-optimized.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.runtime-optimized.after.panic-unwind.mir index c11eab18521dd..9bcabe0e1ab02 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.runtime-optimized.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.runtime-optimized.after.panic-unwind.mir @@ -22,7 +22,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let mut _15: *const T; let mut _20: bool; let mut _21: *const T; - let _34: &T; + let mut _34: &T; scope 20 { let _16: std::ptr::NonNull; let _22: usize; diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.runtime-optimized.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.runtime-optimized.after.panic-abort.mir index 889d7c1e69afb..a5caa9d06534f 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.runtime-optimized.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.runtime-optimized.after.panic-abort.mir @@ -9,7 +9,7 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { let mut _7: bool; let mut _9: std::ptr::NonNull; let mut _11: usize; - let _13: &T; + let mut _13: &T; scope 2 { let _3: *const T; scope 3 { diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.runtime-optimized.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.runtime-optimized.after.panic-unwind.mir index 889d7c1e69afb..a5caa9d06534f 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.runtime-optimized.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.runtime-optimized.after.panic-unwind.mir @@ -9,7 +9,7 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { let mut _7: bool; let mut _9: std::ptr::NonNull; let mut _11: usize; - let _13: &T; + let mut _13: &T; scope 2 { let _3: *const T; scope 3 { diff --git a/tests/mir-opt/pre-codegen/spans.outer.runtime-optimized.after.panic-abort.mir b/tests/mir-opt/pre-codegen/spans.outer.runtime-optimized.after.panic-abort.mir index d8b15701bbd9b..effcf715dd710 100644 --- a/tests/mir-opt/pre-codegen/spans.outer.runtime-optimized.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/spans.outer.runtime-optimized.after.panic-abort.mir @@ -3,7 +3,7 @@ fn outer(_1: u8) -> u8 { debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15 let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26 - let _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 + let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 scope 1 (inlined inner) { // at $DIR/spans.rs:11:5: 11:14 debug x => _2; // in scope 1 at $DIR/spans.rs:14:14: 14:15 } diff --git a/tests/mir-opt/pre-codegen/spans.outer.runtime-optimized.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/spans.outer.runtime-optimized.after.panic-unwind.mir index d8b15701bbd9b..effcf715dd710 100644 --- a/tests/mir-opt/pre-codegen/spans.outer.runtime-optimized.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/spans.outer.runtime-optimized.after.panic-unwind.mir @@ -3,7 +3,7 @@ fn outer(_1: u8) -> u8 { debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15 let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26 - let _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 + let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 scope 1 (inlined inner) { // at $DIR/spans.rs:11:5: 11:14 debug x => _2; // in scope 1 at $DIR/spans.rs:14:14: 14:15 } diff --git a/tests/mir-opt/range/ssa_range.on_assert.SsaRangePropagation.diff b/tests/mir-opt/range/ssa_range.on_assert.SsaRangePropagation.diff index ae3f49a8847b0..75bfda0b3b383 100644 --- a/tests/mir-opt/range/ssa_range.on_assert.SsaRangePropagation.diff +++ b/tests/mir-opt/range/ssa_range.on_assert.SsaRangePropagation.diff @@ -26,7 +26,7 @@ _5 = copy _1; nop; StorageLive(_7); - _7 = &(*_2); + _7 = copy _2; _6 = PtrMetadata(copy _2); StorageDead(_7); _4 = Lt(copy _1, copy _6); diff --git a/tests/mir-opt/range/ssa_range.on_assume.SsaRangePropagation.diff b/tests/mir-opt/range/ssa_range.on_assume.SsaRangePropagation.diff index 3be6f083604d3..ff220c0d13982 100644 --- a/tests/mir-opt/range/ssa_range.on_assume.SsaRangePropagation.diff +++ b/tests/mir-opt/range/ssa_range.on_assume.SsaRangePropagation.diff @@ -27,7 +27,7 @@ _6 = copy _1; nop; StorageLive(_8); - _8 = &(*_2); + _8 = copy _2; _7 = PtrMetadata(copy _2); StorageDead(_8); _5 = Lt(copy _1, copy _7); diff --git a/tests/mir-opt/range/ssa_range.on_if.SsaRangePropagation.diff b/tests/mir-opt/range/ssa_range.on_if.SsaRangePropagation.diff index d097ddf619f0a..256dc8134891d 100644 --- a/tests/mir-opt/range/ssa_range.on_if.SsaRangePropagation.diff +++ b/tests/mir-opt/range/ssa_range.on_if.SsaRangePropagation.diff @@ -23,7 +23,7 @@ _4 = copy _1; nop; StorageLive(_6); - _6 = &(*_2); + _6 = copy _2; _5 = PtrMetadata(copy _2); StorageDead(_6); _3 = Lt(copy _1, copy _5); diff --git a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff index 0f90cc40a3d8b..19af5f4dd8314 100644 --- a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff @@ -12,42 +12,40 @@ let _9: (); let _10: usize; let mut _13: &usize; - let _14: &usize; - let _16: (); - let mut _17: (); - let _18: (); - let _19: usize; - let _23: (); - let mut _24: &&usize; - let _25: (); - let _26: usize; - let _30: (); - let mut _31: *mut &usize; - let _32: (); - let _33: usize; - let _36: (); - let mut _37: &usize; - let _38: (); - let _39: usize; - let _45: (); - let mut _46: &usize; - let _47: (); - let _48: &T; - let _50: (); - let mut _51: (); - let _52: (); - let _53: &T; - let mut _54: &T; - let _55: &T; + let _15: (); + let mut _16: (); + let _17: (); + let _18: usize; + let _22: (); + let mut _23: &&usize; + let _24: (); + let _25: usize; + let _29: (); + let mut _30: *mut &usize; + let _31: (); + let _32: usize; + let _35: (); + let mut _36: &usize; + let _37: (); + let _38: usize; + let _44: (); + let mut _45: &usize; + let _46: (); + let _47: &T; + let _49: (); + let mut _50: (); + let _51: (); + let _52: &T; + let mut _53: &T; + let _55: (); + let mut _56: (); let _57: (); - let mut _58: (); - let _59: (); - let _60: usize; - let _64: (); - let mut _65: (); - let _66: usize; - let _70: (); - let mut _71: (); + let _58: usize; + let _62: (); + let mut _63: (); + let _64: usize; + let _68: (); + let mut _69: (); scope 1 { debug a => _4; let _5: &usize; @@ -67,71 +65,71 @@ let mut _12: &usize; scope 6 { debug b => _12; - let _15: usize; + let _14: usize; scope 7 { - debug c => _15; + debug c => _14; } } } } scope 8 { - debug a => _19; - let _20: &usize; + debug a => _18; + let _19: &usize; scope 9 { - debug b => _20; - let _21: &&usize; + debug b => _19; + let _20: &&usize; scope 10 { - debug d => _21; - let _22: usize; + debug d => _20; + let _21: usize; scope 11 { - debug c => _22; + debug c => _21; } } } } scope 12 { - debug a => _26; - let mut _27: &usize; + debug a => _25; + let mut _26: &usize; scope 13 { - debug b => _27; - let _28: *mut &usize; + debug b => _26; + let _27: *mut &usize; scope 14 { - debug d => _28; - let _29: usize; + debug d => _27; + let _28: usize; scope 15 { - debug c => _29; + debug c => _28; } } } } scope 16 { - debug a => _33; - let _34: &usize; + debug a => _32; + let _33: &usize; scope 17 { - debug b => _34; - let _35: usize; + debug b => _33; + let _34: usize; scope 18 { - debug c => _35; + debug c => _34; } } } scope 19 { - debug a => _39; - let _40: &usize; + debug a => _38; + let _39: &usize; scope 20 { - debug b1 => _40; - let _41: usize; + debug b1 => _39; + let _40: usize; scope 21 { - debug c => _41; - let _42: &usize; + debug c => _40; + let _41: &usize; scope 22 { - debug b2 => _42; - let _43: usize; + debug b2 => _41; + let _42: usize; scope 23 { - debug c2 => _43; - let _44: &usize; + debug c2 => _42; + let _43: &usize; scope 24 { - debug b3 => _44; + debug b3 => _43; } } } @@ -139,46 +137,46 @@ } } scope 25 { -- debug a => _48; +- debug a => _47; + debug a => _1; - let _49: T; + let _48: T; scope 26 { - debug b => _49; + debug b => _48; } } scope 27 { - debug a => _53; - let _56: T; + debug a => _52; + let _54: T; scope 28 { - debug b => _56; + debug b => _54; } } scope 29 { - debug a => _60; - let _61: &usize; + debug a => _58; + let _59: &usize; scope 30 { - debug b => _61; - let _62: &&usize; + debug b => _59; + let _60: &&usize; scope 31 { - debug d => _62; - let _63: usize; + debug d => _60; + let _61: usize; scope 32 { - debug c => _63; + debug c => _61; } } } } scope 33 { - debug a => _66; - let mut _67: &usize; + debug a => _64; + let mut _65: &usize; scope 34 { - debug b => _67; - let _68: &mut &usize; + debug b => _65; + let _66: &mut &usize; scope 35 { - debug d => _68; - let _69: usize; + debug d => _66; + let _67: usize; scope 36 { - debug c => _69; + debug c => _67; } } } @@ -215,231 +213,223 @@ StorageLive(_12); _12 = &_10; StorageLive(_13); -- StorageLive(_14); -- _14 = &_11; -- _13 = &(*_14); + _13 = &_11; - _12 = move _13; -+ _13 = &_11; + _12 = copy _13; StorageDead(_13); -- StorageDead(_14); + StorageLive(_14); + _14 = copy (*_12); StorageLive(_15); - _15 = copy (*_12); StorageLive(_16); - StorageLive(_17); - _17 = (); - _16 = opaque::<()>(move _17) -> [return: bb2, unwind continue]; + _16 = (); + _15 = opaque::<()>(move _16) -> [return: bb2, unwind continue]; } bb2: { - StorageDead(_17); StorageDead(_16); -- _9 = const (); StorageDead(_15); +- _9 = const (); + StorageDead(_14); StorageDead(_12); StorageDead(_11); StorageDead(_10); - StorageDead(_9); -- StorageLive(_18); +- StorageLive(_17); + StorageLive(_18); + _18 = const 5_usize; StorageLive(_19); - _19 = const 5_usize; + _19 = &_18; StorageLive(_20); _20 = &_19; StorageLive(_21); - _21 = &_20; +- _21 = copy (*_19); ++ _21 = copy _18; StorageLive(_22); -- _22 = copy (*_20); -+ _22 = copy _19; StorageLive(_23); - StorageLive(_24); - _24 = copy _21; -- _23 = opaque::<&&usize>(move _24) -> [return: bb3, unwind continue]; -+ _23 = opaque::<&&usize>(copy _24) -> [return: bb3, unwind continue]; + _23 = copy _20; +- _22 = opaque::<&&usize>(move _23) -> [return: bb3, unwind continue]; ++ _22 = opaque::<&&usize>(copy _23) -> [return: bb3, unwind continue]; } bb3: { - StorageDead(_24); StorageDead(_23); -- _18 = const (); StorageDead(_22); +- _17 = const (); StorageDead(_21); StorageDead(_20); StorageDead(_19); -- StorageDead(_18); -- StorageLive(_25); + StorageDead(_18); +- StorageDead(_17); +- StorageLive(_24); + StorageLive(_25); + _25 = const 5_usize; StorageLive(_26); - _26 = const 5_usize; + _26 = &_25; StorageLive(_27); - _27 = &_26; + _27 = &raw mut _26; StorageLive(_28); - _28 = &raw mut _27; + _28 = copy (*_26); StorageLive(_29); - _29 = copy (*_27); StorageLive(_30); - StorageLive(_31); - _31 = copy _28; -- _30 = opaque::<*mut &usize>(move _31) -> [return: bb4, unwind continue]; -+ _30 = opaque::<*mut &usize>(copy _31) -> [return: bb4, unwind continue]; + _30 = copy _27; +- _29 = opaque::<*mut &usize>(move _30) -> [return: bb4, unwind continue]; ++ _29 = opaque::<*mut &usize>(copy _30) -> [return: bb4, unwind continue]; } bb4: { - StorageDead(_31); StorageDead(_30); -- _25 = const (); StorageDead(_29); +- _24 = const (); StorageDead(_28); StorageDead(_27); StorageDead(_26); -- StorageDead(_25); -- StorageLive(_32); + StorageDead(_25); +- StorageDead(_24); +- StorageLive(_31); + StorageLive(_32); + _32 = const 7_usize; StorageLive(_33); - _33 = const 7_usize; + _33 = &_32; StorageLive(_34); - _34 = &_33; +- _34 = copy (*_33); ++ _34 = copy _32; StorageLive(_35); -- _35 = copy (*_34); -+ _35 = copy _33; StorageLive(_36); - StorageLive(_37); - _37 = copy _34; -- _36 = opaque::<&usize>(move _37) -> [return: bb5, unwind continue]; -+ _36 = opaque::<&usize>(copy _37) -> [return: bb5, unwind continue]; + _36 = copy _33; +- _35 = opaque::<&usize>(move _36) -> [return: bb5, unwind continue]; ++ _35 = opaque::<&usize>(copy _36) -> [return: bb5, unwind continue]; } bb5: { - StorageDead(_37); StorageDead(_36); -- _32 = const (); StorageDead(_35); +- _31 = const (); StorageDead(_34); StorageDead(_33); -- StorageDead(_32); -- StorageLive(_38); + StorageDead(_32); +- StorageDead(_31); +- StorageLive(_37); + StorageLive(_38); + _38 = const 7_usize; StorageLive(_39); - _39 = const 7_usize; + _39 = &_38; StorageLive(_40); - _40 = &_39; +- _40 = copy (*_39); ++ _40 = copy _38; StorageLive(_41); -- _41 = copy (*_40); -+ _41 = copy _39; + _41 = copy _39; StorageLive(_42); - _42 = copy _40; +- _42 = copy (*_41); ++ _42 = copy _38; StorageLive(_43); -- _43 = copy (*_42); -+ _43 = copy _39; + _43 = copy _41; StorageLive(_44); - _44 = copy _42; StorageLive(_45); - StorageLive(_46); - _46 = copy _44; -- _45 = opaque::<&usize>(move _46) -> [return: bb6, unwind continue]; -+ _45 = opaque::<&usize>(copy _46) -> [return: bb6, unwind continue]; + _45 = copy _43; +- _44 = opaque::<&usize>(move _45) -> [return: bb6, unwind continue]; ++ _44 = opaque::<&usize>(copy _45) -> [return: bb6, unwind continue]; } bb6: { - StorageDead(_46); StorageDead(_45); -- _38 = const (); StorageDead(_44); +- _37 = const (); StorageDead(_43); StorageDead(_42); StorageDead(_41); StorageDead(_40); StorageDead(_39); -- StorageDead(_38); + StorageDead(_38); +- StorageDead(_37); +- StorageLive(_46); - StorageLive(_47); -- StorageLive(_48); -- _48 = &(*_1); +- _47 = &(*_1); + StorageLive(_48); +- _48 = copy (*_47); ++ _48 = copy (*_1); StorageLive(_49); -- _49 = copy (*_48); -+ _49 = copy (*_1); StorageLive(_50); - StorageLive(_51); - _51 = (); - _50 = opaque::<()>(move _51) -> [return: bb7, unwind continue]; + _50 = (); + _49 = opaque::<()>(move _50) -> [return: bb7, unwind continue]; } bb7: { - StorageDead(_51); StorageDead(_50); -- _47 = const (); StorageDead(_49); -- StorageDead(_48); +- _46 = const (); + StorageDead(_48); - StorageDead(_47); -- StorageLive(_52); +- StorageDead(_46); +- StorageLive(_51); + StorageLive(_52); + _52 = &(*_2); StorageLive(_53); - _53 = &(*_2); + _53 = &(*_1); +- _2 = move _53; ++ _2 = copy _53; + StorageDead(_53); StorageLive(_54); -- StorageLive(_55); -- _55 = &(*_1); -- _54 = &(*_55); -- _2 = move _54; -+ _54 = &(*_1); -+ _2 = copy _54; - StorageDead(_54); -- StorageDead(_55); + _54 = copy (*_52); + StorageLive(_55); StorageLive(_56); - _56 = copy (*_53); - StorageLive(_57); - StorageLive(_58); - _58 = (); - _57 = opaque::<()>(move _58) -> [return: bb8, unwind continue]; + _56 = (); + _55 = opaque::<()>(move _56) -> [return: bb8, unwind continue]; } bb8: { - StorageDead(_58); - StorageDead(_57); -- _52 = const (); StorageDead(_56); - StorageDead(_53); -- StorageDead(_52); -- StorageLive(_59); + StorageDead(_55); +- _51 = const (); + StorageDead(_54); + StorageDead(_52); +- StorageDead(_51); +- StorageLive(_57); + StorageLive(_58); + _58 = const 5_usize; + StorageLive(_59); + _59 = &_58; StorageLive(_60); - _60 = const 5_usize; + _60 = &_59; StorageLive(_61); - _61 = &_60; +- _61 = copy (*_59); ++ _61 = copy _58; StorageLive(_62); - _62 = &_61; StorageLive(_63); -- _63 = copy (*_61); -+ _63 = copy _60; - StorageLive(_64); - StorageLive(_65); - _65 = (); - _64 = opaque::<()>(move _65) -> [return: bb9, unwind continue]; + _63 = (); + _62 = opaque::<()>(move _63) -> [return: bb9, unwind continue]; } bb9: { - StorageDead(_65); - StorageDead(_64); -- _59 = const (); StorageDead(_63); StorageDead(_62); +- _57 = const (); StorageDead(_61); StorageDead(_60); -- StorageDead(_59); + StorageDead(_59); + StorageDead(_58); +- StorageDead(_57); + StorageLive(_64); + _64 = const 5_usize; + StorageLive(_65); + _65 = &_64; StorageLive(_66); - _66 = const 5_usize; + _66 = &mut _65; StorageLive(_67); - _67 = &_66; + _67 = copy (*_65); StorageLive(_68); - _68 = &mut _67; StorageLive(_69); - _69 = copy (*_67); - StorageLive(_70); - StorageLive(_71); - _71 = (); - _70 = opaque::<()>(move _71) -> [return: bb10, unwind continue]; + _69 = (); + _68 = opaque::<()>(move _69) -> [return: bb10, unwind continue]; } bb10: { - StorageDead(_71); - StorageDead(_70); - _0 = const (); StorageDead(_69); StorageDead(_68); + _0 = const (); StorageDead(_67); StorageDead(_66); + StorageDead(_65); + StorageDead(_64); return; } } diff --git a/tests/mir-opt/simplify_locals.c.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.c.SimplifyLocals-before-const-prop.diff index 37a669d72b85e..7925f75135f5a 100644 --- a/tests/mir-opt/simplify_locals.c.SimplifyLocals-before-const-prop.diff +++ b/tests/mir-opt/simplify_locals.c.SimplifyLocals-before-const-prop.diff @@ -6,7 +6,6 @@ let _1: [u8; 10]; - let mut _2: &[u8]; - let mut _3: &[u8; 10]; -- let _4: &[u8; 10]; scope 1 { debug bytes => _1; scope 2 { @@ -18,12 +17,9 @@ _1 = [const 0_u8; 10]; - StorageLive(_2); - StorageLive(_3); -- StorageLive(_4); -- _4 = &_1; -- _3 = &(*_4); +- _3 = &_1; - _2 = move _3 as &[u8] (PointerCoercion(Unsize, Implicit)); - StorageDead(_3); -- StorageDead(_4); - StorageDead(_2); _0 = const (); StorageDead(_1); diff --git a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff index 87340ebf0b90f..d44b9b138be4e 100644 --- a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff @@ -17,22 +17,17 @@ let mut _17: &std::boxed::Box; let mut _18: core::fmt::rt::Argument<'_>; let mut _19: &u32; - let mut _20: &[u8; 7]; - let _21: &[u8; 7]; - let mut _22: &[core::fmt::rt::Argument<'_>; 2]; - let _23: &[core::fmt::rt::Argument<'_>; 2]; - let mut _24: &std::boxed::Box; - let mut _25: &u32; - let mut _26: bool; - let mut _27: isize; - let mut _28: isize; - let mut _29: isize; -+ let _30: std::result::Result, ::Err>; -+ let _31: u32; + let mut _20: &[core::fmt::rt::Argument<'_>; 2]; + let mut _21: bool; + let mut _22: isize; + let mut _23: isize; + let mut _24: isize; ++ let _25: std::result::Result, ::Err>; ++ let _26: u32; scope 1 { - debug foo => _1; -+ debug ((foo: Foo).0: std::result::Result, ::Err>) => _30; -+ debug ((foo: Foo).1: u32) => _31; ++ debug ((foo: Foo).0: std::result::Result, ::Err>) => _25; ++ debug ((foo: Foo).1: u32) => _26; let _5: std::result::Result, ::Err>; scope 2 { debug x => _5; @@ -43,12 +38,12 @@ debug x => _8; let _8: std::boxed::Box; let _12: (&std::boxed::Box, &u32); -+ let _32: &std::boxed::Box; -+ let _33: &u32; ++ let _27: &std::boxed::Box; ++ let _28: &u32; scope 5 { - debug args => _12; -+ debug ((args: (&Box, &u32)).0: &std::boxed::Box) => _32; -+ debug ((args: (&Box, &u32)).1: &u32) => _33; ++ debug ((args: (&Box, &u32)).0: &std::boxed::Box) => _27; ++ debug ((args: (&Box, &u32)).1: &u32) => _28; let _15: [core::fmt::rt::Argument<'_>; 2]; scope 6 { debug args => _15; @@ -60,10 +55,10 @@ } bb0: { - _26 = const false; + _21 = const false; - StorageLive(_1); -+ StorageLive(_30); -+ StorageLive(_31); ++ StorageLive(_25); ++ StorageLive(_26); + nop; StorageLive(_2); StorageLive(_3); @@ -77,17 +72,17 @@ _2 = Result::, ::Err>::Ok(move _3); StorageDead(_3); - _1 = Foo:: { x: move _2, y: const 7_u32 }; -+ _30 = move _2; -+ _31 = const 7_u32; ++ _25 = move _2; ++ _26 = const 7_u32; + nop; StorageDead(_2); StorageLive(_5); - _26 = const true; + _21 = const true; - _5 = move (_1.0: std::result::Result, ::Err>); -+ _5 = move _30; ++ _5 = move _25; StorageLive(_6); - _6 = copy (_1.1: u32); -+ _6 = copy _31; ++ _6 = copy _26; _7 = discriminant(_5); switchInt(move _7) -> [0: bb2, otherwise: bb7]; } @@ -99,25 +94,24 @@ StorageLive(_10); StorageLive(_11); - StorageLive(_12); -+ StorageLive(_32); -+ StorageLive(_33); ++ StorageLive(_27); ++ StorageLive(_28); + nop; StorageLive(_13); _13 = &_8; StorageLive(_14); _14 = &_6; - _12 = (move _13, move _14); -+ _32 = move _13; -+ _33 = move _14; ++ _27 = move _13; ++ _28 = move _14; + nop; StorageDead(_14); StorageDead(_13); StorageLive(_15); StorageLive(_16); StorageLive(_17); -- _24 = no_retag copy (_12.0: &std::boxed::Box); -+ _24 = no_retag copy _32; - _17 = &(*_24); +- _17 = copy (_12.0: &std::boxed::Box); ++ _17 = copy _27; _16 = core::fmt::rt::Argument::<'_>::new_display::>(move _17) -> [return: bb3, unwind unreachable]; } @@ -125,9 +119,8 @@ StorageDead(_17); StorageLive(_18); StorageLive(_19); -- _25 = no_retag copy (_12.1: &u32); -+ _25 = no_retag copy _33; - _19 = &(*_25); +- _19 = copy (_12.1: &u32); ++ _19 = copy _28; _18 = core::fmt::rt::Argument::<'_>::new_display::(move _19) -> [return: bb4, unwind unreachable]; } @@ -137,20 +130,11 @@ StorageDead(_18); StorageDead(_16); StorageLive(_20); - StorageLive(_21); - _21 = const b"\xc0\x01 \xc0\x01\n\x00"; - _20 = &(*_21); - StorageLive(_22); - StorageLive(_23); - _23 = &_15; - _22 = &(*_23); - _11 = Arguments::<'_>::new::<7, 2>(move _20, move _22) -> [return: bb5, unwind unreachable]; + _20 = &_15; + _11 = Arguments::<'_>::new::<7, 2>(const b"\xc0\x01 \xc0\x01\n\x00", move _20) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_23); - StorageDead(_22); - StorageDead(_21); StorageDead(_20); _10 = std::io::_eprint(move _11) -> [return: bb6, unwind unreachable]; } @@ -159,8 +143,8 @@ StorageDead(_11); StorageDead(_15); - StorageDead(_12); -+ StorageDead(_32); -+ StorageDead(_33); ++ StorageDead(_27); ++ StorageDead(_28); + nop; StorageDead(_10); _9 = const (); @@ -181,16 +165,16 @@ bb9: { StorageDead(_6); - _27 = discriminant(_5); - switchInt(move _27) -> [0: bb10, otherwise: bb11]; + _22 = discriminant(_5); + switchInt(move _22) -> [0: bb10, otherwise: bb11]; } bb10: { - _26 = const false; + _21 = const false; StorageDead(_5); - StorageDead(_1); -+ StorageDead(_30); -+ StorageDead(_31); ++ StorageDead(_25); ++ StorageDead(_26); + nop; return; } diff --git a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir index 4e1a59cea791c..c0ec752c2b613 100644 --- a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir +++ b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir @@ -5,44 +5,41 @@ fn method_1(_1: Guard) -> () { let mut _0: (); let mut _2: std::result::Result; let mut _3: &Guard; - let _4: &Guard; - let _5: Guard; - let mut _6: &Guard; - let mut _7: isize; - let _8: OtherDrop; - let _9: (); - let mut _10: bool; + let _4: Guard; + let mut _5: &Guard; + let mut _6: isize; + let _7: OtherDrop; + let _8: (); + let mut _9: bool; scope 1 { - debug other_drop => _8; + debug other_drop => _7; } scope 2 { - debug err => _9; + debug err => _8; } bb0: { - _10 = const false; + _9 = const false; StorageLive(_2); StorageLive(_3); StorageLive(_4); StorageLive(_5); - StorageLive(_6); - _6 = &_1; - _5 = ::clone(move _6) -> [return: bb1, unwind: bb13]; + _5 = &_1; + _4 = ::clone(move _5) -> [return: bb1, unwind: bb13]; } bb1: { - StorageDead(_6); - _4 = &_5; - _3 = &(*_4); + StorageDead(_5); + _3 = &_4; _2 = method_2(move _3) -> [return: bb2, unwind: bb12]; } bb2: { - _10 = const true; + _9 = const true; StorageDead(_3); PlaceMention(_2); - _7 = discriminant(_2); - switchInt(move _7) -> [0: bb5, 1: bb4, otherwise: bb3]; + _6 = discriminant(_2); + switchInt(move _6) -> [0: bb5, 1: bb4, otherwise: bb3]; } bb3: { @@ -50,22 +47,22 @@ fn method_1(_1: Guard) -> () { } bb4: { - StorageLive(_9); - _9 = copy ((_2 as Err).0: ()); + StorageLive(_8); + _8 = copy ((_2 as Err).0: ()); _0 = const (); - StorageDead(_9); + StorageDead(_8); goto -> bb7; } bb5: { - StorageLive(_8); - _8 = move ((_2 as Ok).0: OtherDrop); + StorageLive(_7); + _7 = move ((_2 as Ok).0: OtherDrop); _0 = const (); - drop(_8) -> [return: bb6, unwind: bb11]; + drop(_7) -> [return: bb6, unwind: bb11]; } bb6: { - StorageDead(_8); + StorageDead(_7); goto -> bb7; } @@ -74,13 +71,12 @@ fn method_1(_1: Guard) -> () { } bb8: { - drop(_5) -> [return: bb9, unwind: bb13]; + drop(_4) -> [return: bb9, unwind: bb13]; } bb9: { - StorageDead(_5); StorageDead(_4); - _10 = const false; + _9 = const false; StorageDead(_2); drop(_1) -> [return: bb10, unwind: bb14]; } @@ -94,7 +90,7 @@ fn method_1(_1: Guard) -> () { } bb12 (cleanup): { - drop(_5) -> [return: bb13, unwind terminate(cleanup)]; + drop(_4) -> [return: bb13, unwind terminate(cleanup)]; } bb13 (cleanup): { diff --git a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir index 4e1a59cea791c..c0ec752c2b613 100644 --- a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir +++ b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir @@ -5,44 +5,41 @@ fn method_1(_1: Guard) -> () { let mut _0: (); let mut _2: std::result::Result; let mut _3: &Guard; - let _4: &Guard; - let _5: Guard; - let mut _6: &Guard; - let mut _7: isize; - let _8: OtherDrop; - let _9: (); - let mut _10: bool; + let _4: Guard; + let mut _5: &Guard; + let mut _6: isize; + let _7: OtherDrop; + let _8: (); + let mut _9: bool; scope 1 { - debug other_drop => _8; + debug other_drop => _7; } scope 2 { - debug err => _9; + debug err => _8; } bb0: { - _10 = const false; + _9 = const false; StorageLive(_2); StorageLive(_3); StorageLive(_4); StorageLive(_5); - StorageLive(_6); - _6 = &_1; - _5 = ::clone(move _6) -> [return: bb1, unwind: bb13]; + _5 = &_1; + _4 = ::clone(move _5) -> [return: bb1, unwind: bb13]; } bb1: { - StorageDead(_6); - _4 = &_5; - _3 = &(*_4); + StorageDead(_5); + _3 = &_4; _2 = method_2(move _3) -> [return: bb2, unwind: bb12]; } bb2: { - _10 = const true; + _9 = const true; StorageDead(_3); PlaceMention(_2); - _7 = discriminant(_2); - switchInt(move _7) -> [0: bb5, 1: bb4, otherwise: bb3]; + _6 = discriminant(_2); + switchInt(move _6) -> [0: bb5, 1: bb4, otherwise: bb3]; } bb3: { @@ -50,22 +47,22 @@ fn method_1(_1: Guard) -> () { } bb4: { - StorageLive(_9); - _9 = copy ((_2 as Err).0: ()); + StorageLive(_8); + _8 = copy ((_2 as Err).0: ()); _0 = const (); - StorageDead(_9); + StorageDead(_8); goto -> bb7; } bb5: { - StorageLive(_8); - _8 = move ((_2 as Ok).0: OtherDrop); + StorageLive(_7); + _7 = move ((_2 as Ok).0: OtherDrop); _0 = const (); - drop(_8) -> [return: bb6, unwind: bb11]; + drop(_7) -> [return: bb6, unwind: bb11]; } bb6: { - StorageDead(_8); + StorageDead(_7); goto -> bb7; } @@ -74,13 +71,12 @@ fn method_1(_1: Guard) -> () { } bb8: { - drop(_5) -> [return: bb9, unwind: bb13]; + drop(_4) -> [return: bb9, unwind: bb13]; } bb9: { - StorageDead(_5); StorageDead(_4); - _10 = const false; + _9 = const false; StorageDead(_2); drop(_1) -> [return: bb10, unwind: bb14]; } @@ -94,7 +90,7 @@ fn method_1(_1: Guard) -> () { } bb12 (cleanup): { - drop(_5) -> [return: bb13, unwind terminate(cleanup)]; + drop(_4) -> [return: bb13, unwind terminate(cleanup)]; } bb13 (cleanup): { diff --git a/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-abort.diff index 610a1a4624f75..43dfd7d5c1a1f 100644 --- a/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-abort.diff @@ -9,13 +9,7 @@ let mut _4: &Test3; let mut _5: isize; let _6: &str; - let _7: &str; - let _8: &str; - let _9: &str; - let mut _10: isize; - let _11: &str; - let _12: &str; - let _13: &str; + let mut _7: isize; scope 1 { debug plop => _1; } @@ -39,26 +33,17 @@ } bb2: { - StorageLive(_8); - _8 = const "D"; - _3 = &(*_8); - StorageDead(_8); + _3 = const "D"; goto -> bb6; } bb3: { - StorageLive(_7); - _7 = const "C"; - _3 = &(*_7); - StorageDead(_7); + _3 = const "C"; goto -> bb6; } bb4: { - StorageLive(_6); - _6 = const "B(Empty)"; - _3 = &(*_6); - StorageDead(_6); + _3 = const "B(Empty)"; goto -> bb6; } @@ -70,43 +55,34 @@ bb6: { StorageDead(_4); StorageDead(_3); - StorageLive(_9); - _10 = discriminant((_1.1: Test3)); -- switchInt(move _10) -> [0: bb10, 1: bb9, 2: bb8, 3: bb7, otherwise: bb1]; -+ switchInt(move _10) -> [0: bb1, 1: bb1, 2: bb8, 3: bb7, otherwise: bb1]; + StorageLive(_6); + _7 = discriminant((_1.1: Test3)); +- switchInt(move _7) -> [0: bb10, 1: bb9, 2: bb8, 3: bb7, otherwise: bb1]; ++ switchInt(move _7) -> [0: bb1, 1: bb1, 2: bb8, 3: bb7, otherwise: bb1]; } bb7: { - StorageLive(_13); - _13 = const "D"; - _9 = &(*_13); - StorageDead(_13); + _6 = const "D"; goto -> bb11; } bb8: { - StorageLive(_12); - _12 = const "C"; - _9 = &(*_12); - StorageDead(_12); + _6 = const "C"; goto -> bb11; } bb9: { - StorageLive(_11); - _11 = const "B(Empty)"; - _9 = &(*_11); - StorageDead(_11); + _6 = const "B(Empty)"; goto -> bb11; } bb10: { - _9 = const "A(Empty)"; + _6 = const "A(Empty)"; goto -> bb11; } bb11: { - StorageDead(_9); + StorageDead(_6); _0 = const (); StorageDead(_1); return; diff --git a/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-unwind.diff index 610a1a4624f75..43dfd7d5c1a1f 100644 --- a/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-unwind.diff @@ -9,13 +9,7 @@ let mut _4: &Test3; let mut _5: isize; let _6: &str; - let _7: &str; - let _8: &str; - let _9: &str; - let mut _10: isize; - let _11: &str; - let _12: &str; - let _13: &str; + let mut _7: isize; scope 1 { debug plop => _1; } @@ -39,26 +33,17 @@ } bb2: { - StorageLive(_8); - _8 = const "D"; - _3 = &(*_8); - StorageDead(_8); + _3 = const "D"; goto -> bb6; } bb3: { - StorageLive(_7); - _7 = const "C"; - _3 = &(*_7); - StorageDead(_7); + _3 = const "C"; goto -> bb6; } bb4: { - StorageLive(_6); - _6 = const "B(Empty)"; - _3 = &(*_6); - StorageDead(_6); + _3 = const "B(Empty)"; goto -> bb6; } @@ -70,43 +55,34 @@ bb6: { StorageDead(_4); StorageDead(_3); - StorageLive(_9); - _10 = discriminant((_1.1: Test3)); -- switchInt(move _10) -> [0: bb10, 1: bb9, 2: bb8, 3: bb7, otherwise: bb1]; -+ switchInt(move _10) -> [0: bb1, 1: bb1, 2: bb8, 3: bb7, otherwise: bb1]; + StorageLive(_6); + _7 = discriminant((_1.1: Test3)); +- switchInt(move _7) -> [0: bb10, 1: bb9, 2: bb8, 3: bb7, otherwise: bb1]; ++ switchInt(move _7) -> [0: bb1, 1: bb1, 2: bb8, 3: bb7, otherwise: bb1]; } bb7: { - StorageLive(_13); - _13 = const "D"; - _9 = &(*_13); - StorageDead(_13); + _6 = const "D"; goto -> bb11; } bb8: { - StorageLive(_12); - _12 = const "C"; - _9 = &(*_12); - StorageDead(_12); + _6 = const "C"; goto -> bb11; } bb9: { - StorageLive(_11); - _11 = const "B(Empty)"; - _9 = &(*_11); - StorageDead(_11); + _6 = const "B(Empty)"; goto -> bb11; } bb10: { - _9 = const "A(Empty)"; + _6 = const "A(Empty)"; goto -> bb11; } bb11: { - StorageDead(_9); + StorageDead(_6); _0 = const (); StorageDead(_1); return; diff --git a/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-abort.diff index 97c71762f22e6..df7c48e89306b 100644 --- a/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-abort.diff @@ -6,7 +6,6 @@ let _1: &str; let mut _2: Test2; let mut _3: isize; - let _4: &str; bb0: { StorageLive(_1); @@ -21,10 +20,7 @@ } bb2: { - StorageLive(_4); - _4 = const "E"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "E"; goto -> bb4; } diff --git a/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-unwind.diff index 97c71762f22e6..df7c48e89306b 100644 --- a/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-unwind.diff @@ -6,7 +6,6 @@ let _1: &str; let mut _2: Test2; let mut _3: isize; - let _4: &str; bb0: { StorageLive(_1); @@ -21,10 +20,7 @@ } bb2: { - StorageLive(_4); - _4 = const "E"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "E"; goto -> bb4; } diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-abort.diff index 7e798abcd4ed3..27954f057c873 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-abort.diff @@ -6,8 +6,6 @@ let _1: &str; let mut _2: Test1; let mut _3: isize; - let _4: &str; - let _5: &str; bb0: { StorageLive(_1); @@ -19,18 +17,12 @@ } bb1: { - StorageLive(_5); - _5 = const "C"; - _1 = &(*_5); - StorageDead(_5); + _1 = const "C"; goto -> bb4; } bb2: { - StorageLive(_4); - _4 = const "B(Empty)"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "B(Empty)"; goto -> bb4; } diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-unwind.diff index 7e798abcd4ed3..27954f057c873 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-unwind.diff @@ -6,8 +6,6 @@ let _1: &str; let mut _2: Test1; let mut _3: isize; - let _4: &str; - let _5: &str; bb0: { StorageLive(_1); @@ -19,18 +17,12 @@ } bb1: { - StorageLive(_5); - _5 = const "C"; - _1 = &(*_5); - StorageDead(_5); + _1 = const "C"; goto -> bb4; } bb2: { - StorageLive(_4); - _4 = const "B(Empty)"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "B(Empty)"; goto -> bb4; } diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-abort.diff index ac9b047624b1f..f6a9b793f3b24 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-abort.diff @@ -6,7 +6,6 @@ let _1: &str; let mut _2: Test2; let mut _3: isize; - let _4: &str; bb0: { StorageLive(_1); @@ -18,10 +17,7 @@ } bb1: { - StorageLive(_4); - _4 = const "E"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "E"; goto -> bb3; } diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-unwind.diff index ac9b047624b1f..f6a9b793f3b24 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-unwind.diff @@ -6,7 +6,6 @@ let _1: &str; let mut _2: Test2; let mut _3: isize; - let _4: &str; bb0: { StorageLive(_1); @@ -18,10 +17,7 @@ } bb1: { - StorageLive(_4); - _4 = const "E"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "E"; goto -> bb3; } diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-abort.diff index 9e85e56c583bf..84b84fcd1c881 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-abort.diff @@ -6,8 +6,6 @@ let _1: &str; let mut _2: Test3; let mut _3: isize; - let _4: &str; - let _5: &str; bb0: { StorageLive(_1); @@ -19,18 +17,12 @@ } bb1: { - StorageLive(_5); - _5 = const "C"; - _1 = &(*_5); - StorageDead(_5); + _1 = const "C"; goto -> bb4; } bb2: { - StorageLive(_4); - _4 = const "B(Empty)"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "B(Empty)"; goto -> bb4; } diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-unwind.diff index 9e85e56c583bf..84b84fcd1c881 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-unwind.diff @@ -6,8 +6,6 @@ let _1: &str; let mut _2: Test3; let mut _3: isize; - let _4: &str; - let _5: &str; bb0: { StorageLive(_1); @@ -19,18 +17,12 @@ } bb1: { - StorageLive(_5); - _5 = const "C"; - _1 = &(*_5); - StorageDead(_5); + _1 = const "C"; goto -> bb4; } bb2: { - StorageLive(_4); - _4 = const "B(Empty)"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "B(Empty)"; goto -> bb4; } diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-abort.diff index e83c6131fa587..ac27cbf653ca8 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-abort.diff @@ -6,8 +6,6 @@ let _1: &str; let mut _2: Test4; let mut _3: isize; - let _4: &str; - let _5: &str; bb0: { StorageLive(_1); @@ -18,18 +16,12 @@ } bb1: { - StorageLive(_5); - _5 = const "CD"; - _1 = &(*_5); - StorageDead(_5); + _1 = const "CD"; goto -> bb4; } bb2: { - StorageLive(_4); - _4 = const "B(i32)"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "B(i32)"; goto -> bb4; } diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-unwind.diff index e83c6131fa587..ac27cbf653ca8 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-unwind.diff @@ -6,8 +6,6 @@ let _1: &str; let mut _2: Test4; let mut _3: isize; - let _4: &str; - let _5: &str; bb0: { StorageLive(_1); @@ -18,18 +16,12 @@ } bb1: { - StorageLive(_5); - _5 = const "CD"; - _1 = &(*_5); - StorageDead(_5); + _1 = const "CD"; goto -> bb4; } bb2: { - StorageLive(_4); - _4 = const "B(i32)"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "B(i32)"; goto -> bb4; } diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-abort.diff index 33e33ebddec6a..6157f7382684b 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-abort.diff @@ -6,9 +6,6 @@ let _1: &str; let mut _2: Test4; let mut _3: isize; - let _4: &str; - let _5: &str; - let _6: &str; bb0: { StorageLive(_1); @@ -20,26 +17,17 @@ } bb1: { - StorageLive(_6); - _6 = const "D"; - _1 = &(*_6); - StorageDead(_6); + _1 = const "D"; goto -> bb5; } bb2: { - StorageLive(_5); - _5 = const "C"; - _1 = &(*_5); - StorageDead(_5); + _1 = const "C"; goto -> bb5; } bb3: { - StorageLive(_4); - _4 = const "B(i32)"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "B(i32)"; goto -> bb5; } diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-unwind.diff index 33e33ebddec6a..6157f7382684b 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-unwind.diff @@ -6,9 +6,6 @@ let _1: &str; let mut _2: Test4; let mut _3: isize; - let _4: &str; - let _5: &str; - let _6: &str; bb0: { StorageLive(_1); @@ -20,26 +17,17 @@ } bb1: { - StorageLive(_6); - _6 = const "D"; - _1 = &(*_6); - StorageDead(_6); + _1 = const "D"; goto -> bb5; } bb2: { - StorageLive(_5); - _5 = const "C"; - _1 = &(*_5); - StorageDead(_5); + _1 = const "C"; goto -> bb5; } bb3: { - StorageLive(_4); - _4 = const "B(i32)"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "B(i32)"; goto -> bb5; } diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff index d11c07c4ba301..bfbe54f5a80c2 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff @@ -6,10 +6,6 @@ let _1: &str; let mut _2: Test4; let mut _3: isize; - let _4: &str; - let _5: &str; - let _6: &str; - let _7: &str; bb0: { StorageLive(_1); @@ -21,10 +17,7 @@ } bb1: { - StorageLive(_7); - _7 = const "A(other)D"; - _1 = &(*_7); - StorageDead(_7); + _1 = const "A(other)D"; goto -> bb7; } @@ -33,26 +26,17 @@ } bb3: { - StorageLive(_6); - _6 = const "C"; - _1 = &(*_6); - StorageDead(_6); + _1 = const "C"; goto -> bb7; } bb4: { - StorageLive(_5); - _5 = const "B(i32)"; - _1 = &(*_5); - StorageDead(_5); + _1 = const "B(i32)"; goto -> bb7; } bb5: { - StorageLive(_4); - _4 = const "A(2)"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "A(2)"; goto -> bb7; } diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff index d11c07c4ba301..bfbe54f5a80c2 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff @@ -6,10 +6,6 @@ let _1: &str; let mut _2: Test4; let mut _3: isize; - let _4: &str; - let _5: &str; - let _6: &str; - let _7: &str; bb0: { StorageLive(_1); @@ -21,10 +17,7 @@ } bb1: { - StorageLive(_7); - _7 = const "A(other)D"; - _1 = &(*_7); - StorageDead(_7); + _1 = const "A(other)D"; goto -> bb7; } @@ -33,26 +26,17 @@ } bb3: { - StorageLive(_6); - _6 = const "C"; - _1 = &(*_6); - StorageDead(_6); + _1 = const "C"; goto -> bb7; } bb4: { - StorageLive(_5); - _5 = const "B(i32)"; - _1 = &(*_5); - StorageDead(_5); + _1 = const "B(i32)"; goto -> bb7; } bb5: { - StorageLive(_4); - _4 = const "A(2)"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "A(2)"; goto -> bb7; } diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-abort.diff index ae1ca6efd4348..26fc801723412 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-abort.diff @@ -6,9 +6,6 @@ let _1: &str; let mut _2: Test5; let mut _3: i8; - let _4: &str; - let _5: &str; - let _6: &str; bb0: { StorageLive(_1); @@ -20,26 +17,17 @@ } bb1: { - StorageLive(_6); - _6 = const "D"; - _1 = &(*_6); - StorageDead(_6); + _1 = const "D"; goto -> bb5; } bb2: { - StorageLive(_5); - _5 = const "C"; - _1 = &(*_5); - StorageDead(_5); + _1 = const "C"; goto -> bb5; } bb3: { - StorageLive(_4); - _4 = const "B(T)"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "B(T)"; goto -> bb5; } diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-unwind.diff index 1e660036e46ae..95369d4f9ddcf 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-unwind.diff @@ -6,9 +6,6 @@ let _1: &str; let mut _2: Test5; let mut _3: i8; - let _4: &str; - let _5: &str; - let _6: &str; bb0: { StorageLive(_1); @@ -20,26 +17,17 @@ } bb1: { - StorageLive(_6); - _6 = const "D"; - _1 = &(*_6); - StorageDead(_6); + _1 = const "D"; goto -> bb5; } bb2: { - StorageLive(_5); - _5 = const "C"; - _1 = &(*_5); - StorageDead(_5); + _1 = const "C"; goto -> bb5; } bb3: { - StorageLive(_4); - _4 = const "B(T)"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "B(T)"; goto -> bb5; } diff --git a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff index befee026d6cb4..260a77eeb82f8 100644 --- a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff @@ -6,8 +6,6 @@ let _1: &str; let mut _2: Test1; let mut _3: isize; - let _4: &str; - let _5: &str; bb0: { StorageLive(_1); @@ -23,18 +21,12 @@ } bb2: { - StorageLive(_5); - _5 = const "C"; - _1 = &(*_5); - StorageDead(_5); + _1 = const "C"; goto -> bb5; } bb3: { - StorageLive(_4); - _4 = const "B(Empty)"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "B(Empty)"; goto -> bb5; } diff --git a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff index befee026d6cb4..260a77eeb82f8 100644 --- a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff @@ -6,8 +6,6 @@ let _1: &str; let mut _2: Test1; let mut _3: isize; - let _4: &str; - let _5: &str; bb0: { StorageLive(_1); @@ -23,18 +21,12 @@ } bb2: { - StorageLive(_5); - _5 = const "C"; - _1 = &(*_5); - StorageDead(_5); + _1 = const "C"; goto -> bb5; } bb3: { - StorageLive(_4); - _4 = const "B(Empty)"; - _1 = &(*_4); - StorageDead(_4); + _1 = const "B(Empty)"; goto -> bb5; } diff --git a/tests/ui/const-generics/const-generic-default-wont-borrowck.stderr b/tests/ui/const-generics/const-generic-default-wont-borrowck.stderr index 83e7f88eda79b..1ffdec070a6fa 100644 --- a/tests/ui/const-generics/const-generic-default-wont-borrowck.stderr +++ b/tests/ui/const-generics/const-generic-default-wont-borrowck.stderr @@ -2,7 +2,7 @@ error[E0381]: used binding `s` isn't initialized --> $DIR/const-generic-default-wont-borrowck.rs:3:26 | LL | let s: &'static str; s.len() - | - ^ `*s` used here but it isn't initialized + | - ^ `s` used here but it isn't initialized | | | binding declared here but left uninitialized | diff --git a/tests/ui/dropck/dropck_trait_cycle_checked.stderr b/tests/ui/dropck/dropck_trait_cycle_checked.stderr index f32736f1a674c..c7f724d0d0e08 100644 --- a/tests/ui/dropck/dropck_trait_cycle_checked.stderr +++ b/tests/ui/dropck/dropck_trait_cycle_checked.stderr @@ -2,7 +2,7 @@ error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:111:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -- binding `o2` declared here -------- coercion requires that `o2` is borrowed for `'static` + | -- binding `o2` declared here -------- coercion requires that `o2` is borrowed for `'static` LL | o1.set0(&o2); | ^^^ borrowed value does not live long enough ... @@ -15,7 +15,7 @@ error[E0597]: `o3` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:112:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -- binding `o3` declared here -------- coercion requires that `o3` is borrowed for `'static` + | -- binding `o3` declared here -------- coercion requires that `o3` is borrowed for `'static` LL | o1.set0(&o2); LL | o1.set1(&o3); | ^^^ borrowed value does not live long enough @@ -43,7 +43,7 @@ error[E0597]: `o3` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:114:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -- binding `o3` declared here -------- coercion requires that `o3` is borrowed for `'static` + | -- binding `o3` declared here -------- coercion requires that `o3` is borrowed for `'static` ... LL | o2.set1(&o3); | ^^^ borrowed value does not live long enough @@ -57,7 +57,7 @@ error[E0597]: `o1` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:115:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -- binding `o1` declared here -------- coercion requires that `o1` is borrowed for `'static` + | -- binding `o1` declared here -------- coercion requires that `o1` is borrowed for `'static` ... LL | o3.set0(&o1); | ^^^ borrowed value does not live long enough @@ -71,7 +71,7 @@ error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:116:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); - | -- binding `o2` declared here -------- coercion requires that `o2` is borrowed for `'static` + | -- binding `o2` declared here -------- coercion requires that `o2` is borrowed for `'static` ... LL | o3.set1(&o2); | ^^^ borrowed value does not live long enough diff --git a/tests/ui/dst/dst-object-from-unsized-type.next.stderr b/tests/ui/dst/dst-object-from-unsized-type.next.stderr index 032ba0cb14aeb..f94464984c6bb 100644 --- a/tests/ui/dst/dst-object-from-unsized-type.next.stderr +++ b/tests/ui/dst/dst-object-from-unsized-type.next.stderr @@ -32,14 +32,14 @@ LL - fn test2(t: &T) { LL + fn test2(t: &T) { | -error[E0277]: the trait bound `&str: CoerceUnsized<&dyn Foo>` is not satisfied in `str` +error[E0277]: the trait bound `&'static str: CoerceUnsized<&dyn Foo>` is not satisfied in `str` --> $DIR/dst-object-from-unsized-type.rs:23:28 | LL | let _: &[&dyn Foo] = &["hi"]; | ^^^^ within `str`, the trait `Sized` is not implemented for `str` | = note: `str` is considered to contain a `[u8]` slice for auto trait purposes - = note: required for `&str` to implement `CoerceUnsized<&dyn Foo>` + = note: required for `&'static str` to implement `CoerceUnsized<&dyn Foo>` = note: required for the cast from `&'static str` to `&dyn Foo` error[E0277]: the trait bound `&[u8]: CoerceUnsized<&dyn Foo>` is not satisfied in `[u8]` diff --git a/tests/ui/dst/dst-object-from-unsized-type.rs b/tests/ui/dst/dst-object-from-unsized-type.rs index 1e6113b3fc6fb..7807549c7625f 100644 --- a/tests/ui/dst/dst-object-from-unsized-type.rs +++ b/tests/ui/dst/dst-object-from-unsized-type.rs @@ -22,7 +22,7 @@ fn test2(t: &T) { fn test3() { let _: &[&dyn Foo] = &["hi"]; //[current]~^ ERROR the size for values of type - //[next]~^^ ERROR the trait bound `&str: CoerceUnsized<&dyn Foo>` is not satisfied in `str` + //[next]~^^ ERROR the trait bound `&'static str: CoerceUnsized<&dyn Foo>` is not satisfied in `str` } fn test4(x: &[u8]) { diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr index f5527eeb2cdba..623ac276b2d69 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -41,7 +41,7 @@ LL | | }); | |______^ argument requires that `'a` must outlive `'b` | = help: consider adding the following bound: `'a: 'b` - = note: requirement occurs because of the type `Cell<&'?11 u32>`, which makes the generic argument `&'?11 u32` invariant + = note: requirement occurs because of the type `Cell<&'?9 u32>`, which makes the generic argument `&'?9 u32` invariant = note: the struct `Cell` is invariant over the parameter `T` = help: see for more information about variance diff --git a/tests/ui/regions/regions-free-region-ordering-incorrect.rs b/tests/ui/regions/regions-free-region-ordering-incorrect.rs index 1aee6e87644e9..de0040f3b8b9a 100644 --- a/tests/ui/regions/regions-free-region-ordering-incorrect.rs +++ b/tests/ui/regions/regions-free-region-ordering-incorrect.rs @@ -7,14 +7,14 @@ struct Node<'b, T: 'b> { val: T, - next: Option<&'b Node<'b, T>> + next: Option<&'b Node<'b, T>>, } impl<'b, T> Node<'b, T> { fn get<'a>(&'a self) -> &'b T { - match self.next { //~ ERROR lifetime may not live long enough + match self.next { Some(ref next) => next.get(), - None => &self.val + None => &self.val, //~ ERROR lifetime may not live long enough } } } diff --git a/tests/ui/regions/regions-free-region-ordering-incorrect.stderr b/tests/ui/regions/regions-free-region-ordering-incorrect.stderr index 9025f0c3cbd21..2b3968e9ff0e0 100644 --- a/tests/ui/regions/regions-free-region-ordering-incorrect.stderr +++ b/tests/ui/regions/regions-free-region-ordering-incorrect.stderr @@ -1,15 +1,13 @@ error: lifetime may not live long enough - --> $DIR/regions-free-region-ordering-incorrect.rs:15:9 + --> $DIR/regions-free-region-ordering-incorrect.rs:17:21 | -LL | impl<'b, T> Node<'b, T> { - | -- lifetime `'b` defined here -LL | fn get<'a>(&'a self) -> &'b T { - | -- lifetime `'a` defined here -LL | / match self.next { -LL | | Some(ref next) => next.get(), -LL | | None => &self.val -LL | | } - | |_________^ method was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` +LL | impl<'b, T> Node<'b, T> { + | -- lifetime `'b` defined here +LL | fn get<'a>(&'a self) -> &'b T { + | -- lifetime `'a` defined here +... +LL | None => &self.val, + | ^^^^^^^^^ method was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` | = help: consider adding the following bound: `'a: 'b` diff --git a/tests/ui/rustc_public-ir-print/operands.stdout b/tests/ui/rustc_public-ir-print/operands.stdout index c8d31c6339cf2..56ca7509a9d14 100644 --- a/tests/ui/rustc_public-ir-print/operands.stdout +++ b/tests/ui/rustc_public-ir-print/operands.stdout @@ -25,77 +25,68 @@ fn operands(_1: u8) -> () { let _22: !; let mut _23: core::panicking::AssertKind; let mut _24: &u8; - let _25: &u8; - let mut _26: &u8; + let mut _25: &u8; + let mut _26: Option>; let _27: &u8; - let mut _28: Option>; - let _29: &u8; - let _30: u8; - let _31: (); - let mut _32: (&u8, &u8); - let mut _33: &u8; - let mut _34: &u8; - let _35: &u8; - let _36: &u8; - let mut _37: bool; - let mut _38: u8; - let mut _39: u8; - let mut _40: !; - let _41: core::panicking::AssertKind; - let _42: !; - let mut _43: core::panicking::AssertKind; - let mut _44: &u8; - let _45: &u8; - let mut _46: &u8; - let _47: &u8; - let mut _48: Option>; - let _49: (u8, u8); - let mut _50: u8; - let mut _51: u8; - let _52: u8; - let _53: u8; - let _54: (); - let mut _55: (&u8, &u8); - let mut _56: &u8; - let mut _57: &u8; - let _58: &u8; - let _59: &u8; - let mut _60: bool; - let mut _61: u8; - let mut _62: u8; - let mut _63: !; - let _64: core::panicking::AssertKind; - let _65: !; - let mut _66: core::panicking::AssertKind; - let mut _67: &u8; - let _68: &u8; - let mut _69: &u8; - let _70: &u8; - let mut _71: Option>; - let _72: usize; - let mut _73: &[u8]; - let mut _74: &[u8; 10]; - let _75: usize; - let mut _76: &usize; - let _77: &usize; - let _78: (); - let mut _79: (&usize, &usize); - let mut _80: &usize; - let mut _81: &usize; - let _82: &usize; - let _83: &usize; - let mut _84: bool; - let mut _85: usize; - let mut _86: usize; - let mut _87: !; - let _88: core::panicking::AssertKind; - let _89: !; - let mut _90: core::panicking::AssertKind; - let mut _91: &usize; - let _92: &usize; - let mut _93: &usize; - let _94: &usize; - let mut _95: Option>; + let _28: u8; + let _29: (); + let mut _30: (&u8, &u8); + let mut _31: &u8; + let mut _32: &u8; + let _33: &u8; + let _34: &u8; + let mut _35: bool; + let mut _36: u8; + let mut _37: u8; + let mut _38: !; + let _39: core::panicking::AssertKind; + let _40: !; + let mut _41: core::panicking::AssertKind; + let mut _42: &u8; + let mut _43: &u8; + let mut _44: Option>; + let _45: (u8, u8); + let mut _46: u8; + let mut _47: u8; + let _48: u8; + let _49: u8; + let _50: (); + let mut _51: (&u8, &u8); + let mut _52: &u8; + let mut _53: &u8; + let _54: &u8; + let _55: &u8; + let mut _56: bool; + let mut _57: u8; + let mut _58: u8; + let mut _59: !; + let _60: core::panicking::AssertKind; + let _61: !; + let mut _62: core::panicking::AssertKind; + let mut _63: &u8; + let mut _64: &u8; + let mut _65: Option>; + let _66: usize; + let mut _67: &[u8]; + let mut _68: &[u8; 10]; + let _69: usize; + let mut _70: &usize; + let _71: (); + let mut _72: (&usize, &usize); + let mut _73: &usize; + let mut _74: &usize; + let _75: &usize; + let _76: &usize; + let mut _77: bool; + let mut _78: usize; + let mut _79: usize; + let mut _80: !; + let _81: core::panicking::AssertKind; + let _82: !; + let mut _83: core::panicking::AssertKind; + let mut _84: &usize; + let mut _85: &usize; + let mut _86: Option>; debug val => _1; debug array => _2; debug first => _4; @@ -103,22 +94,22 @@ fn operands(_1: u8) -> () { debug left_val => _15; debug right_val => _16; debug kind => _21; - debug reference => _29; - debug dereferenced => _30; - debug left_val => _35; - debug right_val => _36; - debug kind => _41; - debug tuple => _49; - debug first_again => _52; - debug first_again_again => _53; - debug left_val => _58; - debug right_val => _59; - debug kind => _64; - debug length => _72; - debug size_of => _75; - debug left_val => _82; - debug right_val => _83; - debug kind => _88; + debug reference => _27; + debug dereferenced => _28; + debug left_val => _33; + debug right_val => _34; + debug kind => _39; + debug tuple => _45; + debug first_again => _48; + debug first_again_again => _49; + debug left_val => _54; + debug right_val => _55; + debug kind => _60; + debug length => _66; + debug size_of => _69; + debug left_val => _75; + debug right_val => _76; + debug kind => _81; bb0: { StorageLive(_2); StorageLive(_3); @@ -177,30 +168,30 @@ fn operands(_1: u8) -> () { StorageDead(_15); StorageDead(_12); StorageDead(_11); + StorageLive(_27); + _27 = &_4; + StorageLive(_28); + _28 = (*_27); StorageLive(_29); - _29 = &_4; StorageLive(_30); - _30 = (*_29); StorageLive(_31); + _31 = &_28; StorageLive(_32); + _32 = &_4; + _30 = (move _31, move _32); + StorageDead(_32); + StorageDead(_31); StorageLive(_33); - _33 = &_30; + _33 = (_30.0: &u8); StorageLive(_34); - _34 = &_4; - _32 = (move _33, move _34); - StorageDead(_34); - StorageDead(_33); + _34 = (_30.1: &u8); StorageLive(_35); - _35 = (_32.0: &u8); StorageLive(_36); - _36 = (_32.1: &u8); + _36 = (*_33); StorageLive(_37); - StorageLive(_38); - _38 = (*_35); - StorageLive(_39); - _39 = (*_36); - _37 = Eq(move _38, move _39); - switchInt(move _37) -> [0: bb7, otherwise: bb6]; + _37 = (*_34); + _35 = Eq(move _36, move _37); + switchInt(move _35) -> [0: bb7, otherwise: bb6]; } bb5: { StorageDead(_19); @@ -211,190 +202,171 @@ fn operands(_1: u8) -> () { StorageLive(_23); _23 = move _21; StorageLive(_24); + _24 = &(*_15); StorageLive(_25); - _25 = &(*_15); - _24 = &(*_25); + _25 = &(*_16); StorageLive(_26); - StorageLive(_27); - _27 = &(*_16); - _26 = &(*_27); - StorageLive(_28); - _28 = Option::None; - _22 = core::panicking::assert_failed::(move _23, move _24, move _26, move _28) -> unwind unreachable; + _26 = Option::None; + _22 = core::panicking::assert_failed::(move _23, move _24, move _25, move _26) -> unwind unreachable; } bb6: { - StorageDead(_39); - StorageDead(_38); - _31 = (); StorageDead(_37); StorageDead(_36); + _29 = (); StorageDead(_35); - StorageDead(_32); - StorageDead(_31); + StorageDead(_34); + StorageDead(_33); + StorageDead(_30); + StorageDead(_29); + StorageLive(_45); + StorageLive(_46); + _46 = _4; + StorageLive(_47); + _47 = _7; + _45 = (move _46, move _47); + StorageDead(_47); + StorageDead(_46); + StorageLive(_48); + _48 = (_45.0: u8); StorageLive(_49); + _49 = (_45.0: u8); StorageLive(_50); - _50 = _4; StorageLive(_51); - _51 = _7; - _49 = (move _50, move _51); - StorageDead(_51); - StorageDead(_50); StorageLive(_52); - _52 = (_49.0: u8); + _52 = &_48; StorageLive(_53); - _53 = (_49.0: u8); + _53 = &_49; + _51 = (move _52, move _53); + StorageDead(_53); + StorageDead(_52); StorageLive(_54); + _54 = (_51.0: &u8); StorageLive(_55); + _55 = (_51.1: &u8); StorageLive(_56); - _56 = &_52; StorageLive(_57); - _57 = &_53; - _55 = (move _56, move _57); - StorageDead(_57); - StorageDead(_56); + _57 = (*_54); StorageLive(_58); - _58 = (_55.0: &u8); - StorageLive(_59); - _59 = (_55.1: &u8); - StorageLive(_60); - StorageLive(_61); - _61 = (*_58); - StorageLive(_62); - _62 = (*_59); - _60 = Eq(move _61, move _62); - switchInt(move _60) -> [0: bb9, otherwise: bb8]; + _58 = (*_55); + _56 = Eq(move _57, move _58); + switchInt(move _56) -> [0: bb9, otherwise: bb8]; } bb7: { - StorageDead(_39); - StorageDead(_38); + StorageDead(_37); + StorageDead(_36); + StorageLive(_39); + _39 = AssertKind::Eq; + StorageLive(_40); StorageLive(_41); - _41 = AssertKind::Eq; + _41 = move _39; StorageLive(_42); + _42 = &(*_33); StorageLive(_43); - _43 = move _41; + _43 = &(*_34); StorageLive(_44); - StorageLive(_45); - _45 = &(*_35); - _44 = &(*_45); - StorageLive(_46); - StorageLive(_47); - _47 = &(*_36); - _46 = &(*_47); - StorageLive(_48); - _48 = Option::None; - _42 = core::panicking::assert_failed::(move _43, move _44, move _46, move _48) -> unwind unreachable; + _44 = Option::None; + _40 = core::panicking::assert_failed::(move _41, move _42, move _43, move _44) -> unwind unreachable; } bb8: { - StorageDead(_62); - StorageDead(_61); - _54 = (); - StorageDead(_60); - StorageDead(_59); StorageDead(_58); + StorageDead(_57); + _50 = (); + StorageDead(_56); StorageDead(_55); StorageDead(_54); - StorageLive(_72); - StorageLive(_73); - StorageLive(_74); - _74 = &_2; - _73 = move _74 as &[u8]; - StorageDead(_74); - _72 = core::slice::::len(move _73) -> [return: bb10, unwind unreachable]; + StorageDead(_51); + StorageDead(_50); + StorageLive(_66); + StorageLive(_67); + StorageLive(_68); + _68 = &_2; + _67 = move _68 as &[u8]; + StorageDead(_68); + _66 = core::slice::::len(move _67) -> [return: bb10, unwind unreachable]; } bb9: { - StorageDead(_62); - StorageDead(_61); + StorageDead(_58); + StorageDead(_57); + StorageLive(_60); + _60 = AssertKind::Eq; + StorageLive(_61); + StorageLive(_62); + _62 = move _60; + StorageLive(_63); + _63 = &(*_54); StorageLive(_64); - _64 = AssertKind::Eq; + _64 = &(*_55); StorageLive(_65); - StorageLive(_66); - _66 = move _64; - StorageLive(_67); - StorageLive(_68); - _68 = &(*_58); - _67 = &(*_68); + _65 = Option::None; + _61 = core::panicking::assert_failed::(move _62, move _63, move _64, move _65) -> unwind unreachable; + } + bb10: { + StorageDead(_67); StorageLive(_69); StorageLive(_70); - _70 = &(*_59); - _69 = &(*_70); - StorageLive(_71); - _71 = Option::None; - _65 = core::panicking::assert_failed::(move _66, move _67, move _69, move _71) -> unwind unreachable; + _70 = &_66; + _69 = std::mem::size_of_val::(move _70) -> [return: bb11, unwind unreachable]; } - bb10: { + bb11: { + StorageDead(_70); + StorageLive(_71); + StorageLive(_72); + StorageLive(_73); + _73 = &_66; + StorageLive(_74); + _74 = &_69; + _72 = (move _73, move _74); + StorageDead(_74); StorageDead(_73); StorageLive(_75); + _75 = (_72.0: &usize); StorageLive(_76); + _76 = (_72.1: &usize); StorageLive(_77); - _77 = &_72; - _76 = &(*_77); - _75 = std::mem::size_of_val::(move _76) -> [return: bb11, unwind unreachable]; - } - bb11: { - StorageDead(_76); - StorageDead(_77); StorageLive(_78); + _78 = (*_75); StorageLive(_79); - StorageLive(_80); - _80 = &_72; - StorageLive(_81); - _81 = &_75; - _79 = (move _80, move _81); - StorageDead(_81); - StorageDead(_80); - StorageLive(_82); - _82 = (_79.0: &usize); - StorageLive(_83); - _83 = (_79.1: &usize); - StorageLive(_84); - StorageLive(_85); - _85 = (*_82); - StorageLive(_86); - _86 = (*_83); - _84 = Eq(move _85, move _86); - switchInt(move _84) -> [0: bb13, otherwise: bb12]; + _79 = (*_76); + _77 = Eq(move _78, move _79); + switchInt(move _77) -> [0: bb13, otherwise: bb12]; } bb12: { - StorageDead(_86); - StorageDead(_85); - _78 = (); - StorageDead(_84); - StorageDead(_83); - StorageDead(_82); StorageDead(_79); StorageDead(_78); - _0 = (); + _71 = (); + StorageDead(_77); + StorageDead(_76); StorageDead(_75); StorageDead(_72); - StorageDead(_53); - StorageDead(_52); + StorageDead(_71); + _0 = (); + StorageDead(_69); + StorageDead(_66); StorageDead(_49); - StorageDead(_30); - StorageDead(_29); + StorageDead(_48); + StorageDead(_45); + StorageDead(_28); + StorageDead(_27); StorageDead(_7); StorageDead(_4); StorageDead(_2); return; } bb13: { - StorageDead(_86); - StorageDead(_85); - StorageLive(_88); - _88 = AssertKind::Eq; - StorageLive(_89); - StorageLive(_90); - _90 = move _88; - StorageLive(_91); - StorageLive(_92); - _92 = &(*_82); - _91 = &(*_92); - StorageLive(_93); - StorageLive(_94); - _94 = &(*_83); - _93 = &(*_94); - StorageLive(_95); - _95 = Option::None; - _89 = core::panicking::assert_failed::(move _90, move _91, move _93, move _95) -> unwind unreachable; + StorageDead(_79); + StorageDead(_78); + StorageLive(_81); + _81 = AssertKind::Eq; + StorageLive(_82); + StorageLive(_83); + _83 = move _81; + StorageLive(_84); + _84 = &(*_75); + StorageLive(_85); + _85 = &(*_76); + StorageLive(_86); + _86 = Option::None; + _82 = core::panicking::assert_failed::(move _83, move _84, move _85, move _86) -> unwind unreachable; } } fn more_operands() -> [Ctors; 3] {