From ae681c940dd0813f75770fecd4f565d376b37d37 Mon Sep 17 00:00:00 2001 From: DianQK Date: Sat, 27 Jul 2024 14:36:17 +0800 Subject: [PATCH] Perform instsimplify before inline to eliminate some trivial calls --- .../rustc_mir_transform/src/instsimplify.rs | 18 ++++++++++++- compiler/rustc_mir_transform/src/lib.rs | 5 +++- compiler/rustc_mir_transform/src/shim.rs | 2 +- tests/incremental/hashes/call_expressions.rs | 2 +- tests/mir-opt/const_prop/slice_len.rs | 2 +- .../mir-opt/dataflow-const-prop/slice_len.rs | 2 +- ...yn_trait.get_query.Inline.panic-abort.diff | 4 +-- ...n_trait.get_query.Inline.panic-unwind.diff | 4 +-- ...dyn_trait.mk_cycle.Inline.panic-abort.diff | 2 +- ...yn_trait.mk_cycle.Inline.panic-unwind.diff | 2 +- ....try_execute_query.Inline.panic-abort.diff | 2 +- ...try_execute_query.Inline.panic-unwind.diff | 2 +- ...e_closure_borrows_arg.foo.Inline.after.mir | 4 +-- .../inline/inline_retag.bar.Inline.after.mir | 8 +++--- ...t_method.test.Inline.after.panic-abort.mir | 2 +- ..._method.test.Inline.after.panic-unwind.mir | 2 +- ...ethod_2.test2.Inline.after.panic-abort.mir | 4 +-- ...thod_2.test2.Inline.after.panic-unwind.mir | 4 +-- ...67_inline_as_ref_as_mut.a.Inline.after.mir | 6 ++--- ...67_inline_as_ref_as_mut.b.Inline.after.mir | 6 ++--- ...67_inline_as_ref_as_mut.c.Inline.after.mir | 4 +-- ...67_inline_as_ref_as_mut.d.Inline.after.mir | 4 +-- ...false.InstSimplify-after-simplifycfg.diff} | 4 +-- ..._true.InstSimplify-after-simplifycfg.diff} | 4 +-- ...se_eq.InstSimplify-after-simplifycfg.diff} | 4 +-- ...se_ne.InstSimplify-after-simplifycfg.diff} | 4 +-- ...false.InstSimplify-after-simplifycfg.diff} | 4 +-- ..._true.InstSimplify-after-simplifycfg.diff} | 4 +-- tests/mir-opt/instsimplify/bool_compare.rs | 18 ++++++------- ...ue_eq.InstSimplify-after-simplifycfg.diff} | 4 +-- ...ue_ne.InstSimplify-after-simplifycfg.diff} | 4 +-- ...ndant.InstSimplify-after-simplifycfg.diff} | 4 +-- ...dtrip.InstSimplify-after-simplifycfg.diff} | 4 +-- tests/mir-opt/instsimplify/casts.rs | 8 +++--- ...mplify-after-simplifycfg.panic-abort.diff} | 4 +-- ...plify-after-simplifycfg.panic-unwind.diff} | 4 +-- .../mir-opt/instsimplify/combine_array_len.rs | 4 +-- .../combine_clone_of_primitives.rs | 4 +-- ...mplify-after-simplifycfg.panic-abort.diff} | 4 +-- ...plify-after-simplifycfg.panic-unwind.diff} | 4 +-- ...mutes.InstSimplify-after-simplifycfg.diff} | 4 +-- ...mutes.InstSimplify-after-simplifycfg.diff} | 4 +-- ...mutes.InstSimplify-after-simplifycfg.diff} | 4 +-- .../instsimplify/combine_transmutes.rs | 8 +++--- ..._zero.InstSimplify-after-simplifycfg.diff} | 4 +-- .../instsimplify/duplicate_switch_targets.rs | 4 +-- ...neric.InstSimplify-after-simplifycfg.diff} | 4 +-- ...c_ref.InstSimplify-after-simplifycfg.diff} | 4 +-- ...anics.InstSimplify-after-simplifycfg.diff} | 4 +-- ...vable.InstSimplify-after-simplifycfg.diff} | 4 +-- .../mir-opt/instsimplify/intrinsic_asserts.rs | 10 +++---- ...nters.InstSimplify-after-simplifycfg.diff} | 4 +-- ...ences.InstSimplify-after-simplifycfg.diff} | 4 +-- tests/mir-opt/instsimplify/ref_of_deref.rs | 6 ++--- tests/mir-opt/instsimplify/ub_check.rs | 4 +-- ...ecked.InstSimplify-after-simplifycfg.diff} | 4 +-- ...implifyComparisonIntegral.panic-abort.diff | 6 ++--- ...mplifyComparisonIntegral.panic-unwind.diff | 6 ++--- ...192.f.InstSimplify-after-simplifycfg.diff} | 7 +++-- tests/mir-opt/issue_78192.rs | 2 +- ...d_constant.main.GVN.32bit.panic-abort.diff | 8 +++--- ...d_constant.main.GVN.64bit.panic-abort.diff | 8 +++--- .../loops.vec_move.PreCodegen.after.mir | 2 -- tests/mir-opt/pre-codegen/no_inlined_clone.rs | 12 +++++++++ ..._clone.{impl#0}-clone.PreCodegen.after.mir | 15 +++++++++++ ...acementOfAggregates.32bit.panic-abort.diff | 2 +- ...cementOfAggregates.32bit.panic-unwind.diff | 2 +- ...acementOfAggregates.64bit.panic-abort.diff | 2 +- ...cementOfAggregates.64bit.panic-unwind.diff | 2 +- ...sive_loop.PreCodegen.after.panic-abort.mir | 2 -- ...ive_loop.PreCodegen.after.panic-unwind.mir | 2 -- ...variant_a-{closure#0}.PreCodegen.after.mir | 27 +++++++++++++------ ...mut_usize.PreCodegen.after.panic-abort.mir | 10 +++---- ...ut_usize.PreCodegen.after.panic-unwind.mir | 10 +++---- ...mut_range.PreCodegen.after.panic-abort.mir | 2 ++ ...ut_range.PreCodegen.after.panic-unwind.mir | 2 ++ ...ted_loop.PreCodegen.after.panic-unwind.mir | 2 -- ...ward_loop.PreCodegen.after.panic-abort.mir | 2 -- ...ard_loop.PreCodegen.after.panic-unwind.mir | 2 -- ...ans.outer.PreCodegen.after.panic-abort.mir | 4 +-- ...ns.outer.PreCodegen.after.panic-unwind.mir | 4 +-- ..._to_slice.PreCodegen.after.panic-abort.mir | 4 ++- ...to_slice.PreCodegen.after.panic-unwind.mir | 4 ++- 83 files changed, 226 insertions(+), 182 deletions(-) rename tests/mir-opt/instsimplify/{bool_compare.eq_false.InstSimplify.diff => bool_compare.eq_false.InstSimplify-after-simplifycfg.diff} (83%) rename tests/mir-opt/instsimplify/{bool_compare.eq_true.InstSimplify.diff => bool_compare.eq_true.InstSimplify-after-simplifycfg.diff} (83%) rename tests/mir-opt/instsimplify/{bool_compare.false_eq.InstSimplify.diff => bool_compare.false_eq.InstSimplify-after-simplifycfg.diff} (83%) rename tests/mir-opt/instsimplify/{bool_compare.false_ne.InstSimplify.diff => bool_compare.false_ne.InstSimplify-after-simplifycfg.diff} (83%) rename tests/mir-opt/instsimplify/{bool_compare.ne_false.InstSimplify.diff => bool_compare.ne_false.InstSimplify-after-simplifycfg.diff} (83%) rename tests/mir-opt/instsimplify/{bool_compare.ne_true.InstSimplify.diff => bool_compare.ne_true.InstSimplify-after-simplifycfg.diff} (83%) rename tests/mir-opt/instsimplify/{bool_compare.true_eq.InstSimplify.diff => bool_compare.true_eq.InstSimplify-after-simplifycfg.diff} (83%) rename tests/mir-opt/instsimplify/{bool_compare.true_ne.InstSimplify.diff => bool_compare.true_ne.InstSimplify-after-simplifycfg.diff} (83%) rename tests/mir-opt/instsimplify/{casts.redundant.InstSimplify.diff => casts.redundant.InstSimplify-after-simplifycfg.diff} (85%) rename tests/mir-opt/instsimplify/{casts.roundtrip.InstSimplify.diff => casts.roundtrip.InstSimplify-after-simplifycfg.diff} (82%) rename tests/mir-opt/instsimplify/{combine_array_len.norm2.InstSimplify.panic-abort.diff => combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-abort.diff} (94%) rename tests/mir-opt/instsimplify/{combine_array_len.norm2.InstSimplify.panic-unwind.diff => combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-unwind.diff} (94%) rename tests/mir-opt/instsimplify/{combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff => combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff} (94%) rename tests/mir-opt/instsimplify/{combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff => combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff} (94%) rename tests/mir-opt/instsimplify/{combine_transmutes.adt_transmutes.InstSimplify.diff => combine_transmutes.adt_transmutes.InstSimplify-after-simplifycfg.diff} (94%) rename tests/mir-opt/instsimplify/{combine_transmutes.identity_transmutes.InstSimplify.diff => combine_transmutes.identity_transmutes.InstSimplify-after-simplifycfg.diff} (85%) rename tests/mir-opt/instsimplify/{combine_transmutes.integer_transmutes.InstSimplify.diff => combine_transmutes.integer_transmutes.InstSimplify-after-simplifycfg.diff} (80%) rename tests/mir-opt/instsimplify/{duplicate_switch_targets.assert_zero.InstSimplify.diff => duplicate_switch_targets.assert_zero.InstSimplify-after-simplifycfg.diff} (70%) rename tests/mir-opt/instsimplify/{intrinsic_asserts.generic.InstSimplify.diff => intrinsic_asserts.generic.InstSimplify-after-simplifycfg.diff} (84%) rename tests/mir-opt/instsimplify/{intrinsic_asserts.generic_ref.InstSimplify.diff => intrinsic_asserts.generic_ref.InstSimplify-after-simplifycfg.diff} (70%) rename tests/mir-opt/instsimplify/{intrinsic_asserts.panics.InstSimplify.diff => intrinsic_asserts.panics.InstSimplify-after-simplifycfg.diff} (87%) rename tests/mir-opt/instsimplify/{intrinsic_asserts.removable.InstSimplify.diff => intrinsic_asserts.removable.InstSimplify-after-simplifycfg.diff} (85%) rename tests/mir-opt/instsimplify/{ref_of_deref.pointers.InstSimplify.diff => ref_of_deref.pointers.InstSimplify-after-simplifycfg.diff} (92%) rename tests/mir-opt/instsimplify/{ref_of_deref.references.InstSimplify.diff => ref_of_deref.references.InstSimplify-after-simplifycfg.diff} (91%) rename tests/mir-opt/instsimplify/{ub_check.unwrap_unchecked.InstSimplify.diff => ub_check.unwrap_unchecked.InstSimplify-after-simplifycfg.diff} (90%) rename tests/mir-opt/{issue_78192.f.InstSimplify.diff => issue_78192.f.InstSimplify-after-simplifycfg.diff} (79%) create mode 100644 tests/mir-opt/pre-codegen/no_inlined_clone.rs create mode 100644 tests/mir-opt/pre-codegen/no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir diff --git a/compiler/rustc_mir_transform/src/instsimplify.rs b/compiler/rustc_mir_transform/src/instsimplify.rs index cdd9e4af3b32c..2fc5f7e536ba8 100644 --- a/compiler/rustc_mir_transform/src/instsimplify.rs +++ b/compiler/rustc_mir_transform/src/instsimplify.rs @@ -13,9 +13,25 @@ use rustc_target::spec::abi::Abi; use crate::simplify::simplify_duplicate_switch_targets; use crate::take_array; -pub struct InstSimplify; +pub enum InstSimplify { + BeforeInline, + AfterSimplifyCfg, +} + +impl InstSimplify { + pub fn name(&self) -> &'static str { + match self { + InstSimplify::BeforeInline => "InstSimplify-before-inline", + InstSimplify::AfterSimplifyCfg => "InstSimplify-after-simplifycfg", + } + } +} impl<'tcx> MirPass<'tcx> for InstSimplify { + fn name(&self) -> &'static str { + self.name() + } + fn is_enabled(&self, sess: &rustc_session::Session) -> bool { sess.mir_opt_level() > 0 } diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index f338d8283181c..ac3a44c803a5f 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -571,6 +571,8 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { // Has to be done before inlining, otherwise actual call will be almost always inlined. // Also simple, so can just do first &lower_slice_len::LowerSliceLenCalls, + // Perform instsimplify before inline to eliminate some trivial calls (like clone shims). + &instsimplify::InstSimplify::BeforeInline, // Perform inlining, which may add a lot of code. &inline::Inline, // Code from other crates may have storage markers, so this needs to happen after inlining. @@ -590,7 +592,8 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { &match_branches::MatchBranchSimplification, // inst combine is after MatchBranchSimplification to clean up Ne(_1, false) &multiple_return_terminators::MultipleReturnTerminators, - &instsimplify::InstSimplify, + // After simplifycfg, it allows us to discover new opportunities for peephole optimizations. + &instsimplify::InstSimplify::AfterSimplifyCfg, &simplify::SimplifyLocals::BeforeConstProp, &dead_store_elimination::DeadStoreElimination::Initial, &gvn::GVN, diff --git a/compiler/rustc_mir_transform/src/shim.rs b/compiler/rustc_mir_transform/src/shim.rs index a2c232dfd3caa..e2fafa3a1a30b 100644 --- a/compiler/rustc_mir_transform/src/shim.rs +++ b/compiler/rustc_mir_transform/src/shim.rs @@ -155,7 +155,7 @@ fn make_shim<'tcx>(tcx: TyCtxt<'tcx>, instance: ty::InstanceKind<'tcx>) -> Body< &deref_separator::Derefer, &remove_noop_landing_pads::RemoveNoopLandingPads, &simplify::SimplifyCfg::MakeShim, - &instsimplify::InstSimplify, + &instsimplify::InstSimplify::BeforeInline, &abort_unwinding_calls::AbortUnwindingCalls, &add_call_guards::CriticalCallEdges, ], diff --git a/tests/incremental/hashes/call_expressions.rs b/tests/incremental/hashes/call_expressions.rs index 36b6980bcc67f..71423ef6aff66 100644 --- a/tests/incremental/hashes/call_expressions.rs +++ b/tests/incremental/hashes/call_expressions.rs @@ -162,7 +162,7 @@ pub fn change_to_ufcs() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,typeck")] +#[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail6")] diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs index 265a496f39a36..221fb18f92c61 100644 --- a/tests/mir-opt/const_prop/slice_len.rs +++ b/tests/mir-opt/const_prop/slice_len.rs @@ -1,5 +1,5 @@ //@ test-mir-pass: GVN -//@ compile-flags: -Zmir-enable-passes=+InstSimplify -Zdump-mir-exclude-alloc-bytes +//@ compile-flags: -Zmir-enable-passes=+InstSimplify-after-simplifycfg -Zdump-mir-exclude-alloc-bytes // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_BIT_WIDTH diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.rs b/tests/mir-opt/dataflow-const-prop/slice_len.rs index 5d9733f498c91..64c043cca795b 100644 --- a/tests/mir-opt/dataflow-const-prop/slice_len.rs +++ b/tests/mir-opt/dataflow-const-prop/slice_len.rs @@ -1,6 +1,6 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //@ test-mir-pass: DataflowConstProp -//@ compile-flags: -Zmir-enable-passes=+InstSimplify +//@ compile-flags: -Zmir-enable-passes=+InstSimplify-after-simplifycfg // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR slice_len.main.DataflowConstProp.diff diff --git a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff index 9d5042caae2cb..4e495c37fbc9a 100644 --- a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff @@ -21,14 +21,14 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); + _3 = _1; _2 = ::cache::(move _3) -> [return: bb1, unwind unreachable]; } bb1: { StorageDead(_3); StorageLive(_4); - _4 = &(*_2); + _4 = _2; - _0 = try_execute_query::<::C>(move _4) -> [return: bb2, unwind unreachable]; + StorageLive(_5); + _5 = _4 as &dyn Cache::V> (PointerCoercion(Unsize)); diff --git a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff index 9bd3855c58f84..7fdb7618212a9 100644 --- a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff @@ -21,14 +21,14 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); + _3 = _1; _2 = ::cache::(move _3) -> [return: bb1, unwind continue]; } bb1: { StorageDead(_3); StorageLive(_4); - _4 = &(*_2); + _4 = _2; - _0 = try_execute_query::<::C>(move _4) -> [return: bb2, unwind continue]; + StorageLive(_5); + _5 = _4 as &dyn Cache::V> (PointerCoercion(Unsize)); diff --git a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff index d7801b7a0cc22..8df4408690b74 100644 --- a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff @@ -8,7 +8,7 @@ bb0: { StorageLive(_2); - _2 = &(*_1); + _2 = _1; _0 = as Cache>::store_nocache(move _2) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff index 7b1cf895a8737..43a0621f766d4 100644 --- a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff @@ -8,7 +8,7 @@ bb0: { StorageLive(_2); - _2 = &(*_1); + _2 = _1; _0 = as Cache>::store_nocache(move _2) -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff index 96e16d023ba1b..e72c312f54966 100644 --- a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff @@ -13,7 +13,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); + _3 = _1; _2 = move _3 as &dyn Cache::V> (PointerCoercion(Unsize)); StorageDead(_3); - _0 = mk_cycle::<::V>(move _2) -> [return: bb1, unwind unreachable]; diff --git a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff index 06d65abcbc125..46728f9e2e659 100644 --- a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff @@ -13,7 +13,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); + _3 = _1; _2 = move _3 as &dyn Cache::V> (PointerCoercion(Unsize)); StorageDead(_3); - _0 = mk_cycle::<::V>(move _2) -> [return: bb1, unwind continue]; diff --git a/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir b/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir index a6198ca053bc4..f524b054b61bd 100644 --- a/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir +++ b/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir @@ -26,9 +26,9 @@ fn foo(_1: T, _2: &i32) -> i32 { _4 = &_3; StorageLive(_5); StorageLive(_6); - _6 = &(*_2); + _6 = _2; StorageLive(_7); - _7 = &(*_2); + _7 = _2; _5 = (move _6, move _7); StorageLive(_8); _8 = move (_5.0: &i32); diff --git a/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir b/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir index dcce4aad444af..ec3c79e2a3749 100644 --- a/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir +++ b/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir @@ -31,14 +31,14 @@ fn bar() -> bool { StorageLive(_4); _10 = const bar::promoted[1]; Retag(_10); - _4 = &(*_10); - _3 = &(*_4); + _4 = _10; + _3 = _4; StorageLive(_6); StorageLive(_7); _9 = const bar::promoted[0]; Retag(_9); - _7 = &(*_9); - _6 = &(*_7); + _7 = _9; + _6 = _7; Retag(_3); Retag(_6); StorageLive(_11); diff --git a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir index 2441e3f1c2c2f..d7b4302b06d9f 100644 --- a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir +++ b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir @@ -7,7 +7,7 @@ fn test(_1: &dyn X) -> u32 { bb0: { StorageLive(_2); - _2 = &(*_1); + _2 = _1; _0 = ::y(move _2) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir index da18a5adc376b..0d6f3e61f71f3 100644 --- a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir +++ b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir @@ -7,7 +7,7 @@ fn test(_1: &dyn X) -> u32 { bb0: { StorageLive(_2); - _2 = &(*_1); + _2 = _1; _0 = ::y(move _2) -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir index f0d1cfe0359e1..af79c7ce1968a 100644 --- a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir +++ b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir @@ -12,8 +12,8 @@ fn test2(_1: &dyn X) -> bool { bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); - _2 = move _3 as &dyn X (PointerCoercion(Unsize)); + _3 = _1; + _2 = move _3; StorageDead(_3); _0 = ::y(move _2) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir index f37b081430137..bf5a56b8e6240 100644 --- a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir +++ b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir @@ -12,8 +12,8 @@ fn test2(_1: &dyn X) -> bool { bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); - _2 = move _3 as &dyn X (PointerCoercion(Unsize)); + _3 = _1; + _2 = move _3; StorageDead(_3); _0 = ::y(move _2) -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir index 7cc65efe07b4b..8c457037ec971 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir @@ -14,11 +14,11 @@ fn a(_1: &mut [T]) -> &mut [T] { StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = &mut (*_1); + _4 = _1; _3 = _4; - _2 = &mut (*_3); + _2 = _3; StorageDead(_4); - _0 = &mut (*_2); + _0 = _2; StorageDead(_3); StorageDead(_2); return; diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir index 408cc5bb3419a..e27d9fe38c7e2 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir @@ -16,7 +16,7 @@ fn b(_1: &mut Box) -> &mut T { StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = &mut (*_1); + _4 = _1; StorageLive(_5); StorageLive(_6); _5 = (*_4); @@ -24,9 +24,9 @@ fn b(_1: &mut Box) -> &mut T { _3 = &mut (*_6); StorageDead(_6); StorageDead(_5); - _2 = &mut (*_3); + _2 = _3; StorageDead(_4); - _0 = &mut (*_2); + _0 = _2; StorageDead(_3); StorageDead(_2); return; 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 bad7f31ae9b4a..da0464c64d697 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 @@ -12,9 +12,9 @@ fn c(_1: &[T]) -> &[T] { bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); + _3 = _1; _2 = _3; - _0 = &(*_2); + _0 = _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 4d20f6c441993..25eaedfc842d2 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 @@ -14,7 +14,7 @@ fn d(_1: &Box) -> &T { bb0: { StorageLive(_2); StorageLive(_3); - _3 = &(*_1); + _3 = _1; StorageLive(_4); StorageLive(_5); _4 = (*_3); @@ -22,7 +22,7 @@ fn d(_1: &Box) -> &T { _2 = &(*_5); StorageDead(_5); StorageDead(_4); - _0 = &(*_2); + _0 = _2; StorageDead(_3); StorageDead(_2); return; diff --git a/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify-after-simplifycfg.diff similarity index 83% rename from tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff rename to tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify-after-simplifycfg.diff index 5c09963d43344..fea5f4f02ceb9 100644 --- a/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `eq_false` before InstSimplify -+ // MIR for `eq_false` after InstSimplify +- // MIR for `eq_false` before InstSimplify-after-simplifycfg ++ // MIR for `eq_false` after InstSimplify-after-simplifycfg fn eq_false(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify-after-simplifycfg.diff similarity index 83% rename from tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff rename to tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify-after-simplifycfg.diff index a80133b0eb097..9a509ccfa67b1 100644 --- a/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `eq_true` before InstSimplify -+ // MIR for `eq_true` after InstSimplify +- // MIR for `eq_true` before InstSimplify-after-simplifycfg ++ // MIR for `eq_true` after InstSimplify-after-simplifycfg fn eq_true(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify-after-simplifycfg.diff similarity index 83% rename from tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff rename to tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify-after-simplifycfg.diff index 8235d5263bb1b..e4ec4c80579ed 100644 --- a/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `false_eq` before InstSimplify -+ // MIR for `false_eq` after InstSimplify +- // MIR for `false_eq` before InstSimplify-after-simplifycfg ++ // MIR for `false_eq` after InstSimplify-after-simplifycfg fn false_eq(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify-after-simplifycfg.diff similarity index 83% rename from tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff rename to tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify-after-simplifycfg.diff index 77d076c6c14e3..3aea55f4db4f2 100644 --- a/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `false_ne` before InstSimplify -+ // MIR for `false_ne` after InstSimplify +- // MIR for `false_ne` before InstSimplify-after-simplifycfg ++ // MIR for `false_ne` after InstSimplify-after-simplifycfg fn false_ne(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify-after-simplifycfg.diff similarity index 83% rename from tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff rename to tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify-after-simplifycfg.diff index 2362b11297ea6..b6e891088a1df 100644 --- a/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `ne_false` before InstSimplify -+ // MIR for `ne_false` after InstSimplify +- // MIR for `ne_false` before InstSimplify-after-simplifycfg ++ // MIR for `ne_false` after InstSimplify-after-simplifycfg fn ne_false(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify-after-simplifycfg.diff similarity index 83% rename from tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff rename to tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify-after-simplifycfg.diff index 6ccbd2fb7a1f0..974738bb3a9ee 100644 --- a/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `ne_true` before InstSimplify -+ // MIR for `ne_true` after InstSimplify +- // MIR for `ne_true` before InstSimplify-after-simplifycfg ++ // MIR for `ne_true` after InstSimplify-after-simplifycfg fn ne_true(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/bool_compare.rs b/tests/mir-opt/instsimplify/bool_compare.rs index d1d903f9ef2cf..3911f81fe5cdd 100644 --- a/tests/mir-opt/instsimplify/bool_compare.rs +++ b/tests/mir-opt/instsimplify/bool_compare.rs @@ -1,55 +1,55 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg -// EMIT_MIR bool_compare.eq_true.InstSimplify.diff +// EMIT_MIR bool_compare.eq_true.InstSimplify-after-simplifycfg.diff fn eq_true(x: bool) -> u32 { // CHECK-LABEL: fn eq_true( // CHECK-NOT: Eq( if x == true { 0 } else { 1 } } -// EMIT_MIR bool_compare.true_eq.InstSimplify.diff +// EMIT_MIR bool_compare.true_eq.InstSimplify-after-simplifycfg.diff fn true_eq(x: bool) -> u32 { // CHECK-LABEL: fn true_eq( // CHECK-NOT: Eq( if true == x { 0 } else { 1 } } -// EMIT_MIR bool_compare.ne_true.InstSimplify.diff +// EMIT_MIR bool_compare.ne_true.InstSimplify-after-simplifycfg.diff fn ne_true(x: bool) -> u32 { // CHECK-LABEL: fn ne_true( // CHECK: Not( if x != true { 0 } else { 1 } } -// EMIT_MIR bool_compare.true_ne.InstSimplify.diff +// EMIT_MIR bool_compare.true_ne.InstSimplify-after-simplifycfg.diff fn true_ne(x: bool) -> u32 { // CHECK-LABEL: fn true_ne( // CHECK: Not( if true != x { 0 } else { 1 } } -// EMIT_MIR bool_compare.eq_false.InstSimplify.diff +// EMIT_MIR bool_compare.eq_false.InstSimplify-after-simplifycfg.diff fn eq_false(x: bool) -> u32 { // CHECK-LABEL: fn eq_false( // CHECK: Not( if x == false { 0 } else { 1 } } -// EMIT_MIR bool_compare.false_eq.InstSimplify.diff +// EMIT_MIR bool_compare.false_eq.InstSimplify-after-simplifycfg.diff fn false_eq(x: bool) -> u32 { // CHECK-LABEL: fn false_eq( // CHECK: Not( if false == x { 0 } else { 1 } } -// EMIT_MIR bool_compare.ne_false.InstSimplify.diff +// EMIT_MIR bool_compare.ne_false.InstSimplify-after-simplifycfg.diff fn ne_false(x: bool) -> u32 { // CHECK-LABEL: fn ne_false( // CHECK-NOT: Ne( if x != false { 0 } else { 1 } } -// EMIT_MIR bool_compare.false_ne.InstSimplify.diff +// EMIT_MIR bool_compare.false_ne.InstSimplify-after-simplifycfg.diff fn false_ne(x: bool) -> u32 { // CHECK-LABEL: fn false_ne( // CHECK-NOT: Ne( diff --git a/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify-after-simplifycfg.diff similarity index 83% rename from tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff rename to tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify-after-simplifycfg.diff index 18675329a2eed..240835bf7f22a 100644 --- a/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `true_eq` before InstSimplify -+ // MIR for `true_eq` after InstSimplify +- // MIR for `true_eq` before InstSimplify-after-simplifycfg ++ // MIR for `true_eq` after InstSimplify-after-simplifycfg fn true_eq(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify-after-simplifycfg.diff similarity index 83% rename from tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff rename to tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify-after-simplifycfg.diff index dc91cf8a5c41e..1e2b2c27f5707 100644 --- a/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `true_ne` before InstSimplify -+ // MIR for `true_ne` after InstSimplify +- // MIR for `true_ne` before InstSimplify-after-simplifycfg ++ // MIR for `true_ne` after InstSimplify-after-simplifycfg fn true_ne(_1: bool) -> u32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff b/tests/mir-opt/instsimplify/casts.redundant.InstSimplify-after-simplifycfg.diff similarity index 85% rename from tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff rename to tests/mir-opt/instsimplify/casts.redundant.InstSimplify-after-simplifycfg.diff index e7451d55777e7..7001589d9e3c8 100644 --- a/tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/casts.redundant.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `redundant` before InstSimplify -+ // MIR for `redundant` after InstSimplify +- // MIR for `redundant` before InstSimplify-after-simplifycfg ++ // MIR for `redundant` after InstSimplify-after-simplifycfg fn redundant(_1: *const &u8) -> *const &u8 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff b/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify-after-simplifycfg.diff similarity index 82% rename from tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff rename to tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify-after-simplifycfg.diff index e87ac762dfeb2..e1045db973078 100644 --- a/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `roundtrip` before InstSimplify -+ // MIR for `roundtrip` after InstSimplify +- // MIR for `roundtrip` before InstSimplify-after-simplifycfg ++ // MIR for `roundtrip` after InstSimplify-after-simplifycfg fn roundtrip(_1: *const u8) -> *const u8 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/casts.rs b/tests/mir-opt/instsimplify/casts.rs index 15ceea7671363..24dbb67b42d1a 100644 --- a/tests/mir-opt/instsimplify/casts.rs +++ b/tests/mir-opt/instsimplify/casts.rs @@ -1,4 +1,4 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg //@ compile-flags: -Zinline-mir #![crate_type = "lib"] #![feature(core_intrinsics)] @@ -8,7 +8,7 @@ fn generic_cast(x: *const T) -> *const U { x as *const U } -// EMIT_MIR casts.redundant.InstSimplify.diff +// EMIT_MIR casts.redundant.InstSimplify-after-simplifycfg.diff pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 { // CHECK-LABEL: fn redundant( // CHECK: inlined generic_cast @@ -16,7 +16,7 @@ pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 { generic_cast::<&'a u8, &'b u8>(x) as *const &'a u8 } -// EMIT_MIR casts.roundtrip.InstSimplify.diff +// EMIT_MIR casts.roundtrip.InstSimplify-after-simplifycfg.diff pub fn roundtrip(x: *const u8) -> *const u8 { // CHECK-LABEL: fn roundtrip( // CHECK: _4 = _1; @@ -25,7 +25,7 @@ pub fn roundtrip(x: *const u8) -> *const u8 { x as *mut u8 as *const u8 } -// EMIT_MIR casts.roundtrip.InstSimplify.diff +// EMIT_MIR casts.roundtrip.InstSimplify-after-simplifycfg.diff pub fn cast_thin_via_aggregate(x: *const u8) -> *const () { // CHECK-LABEL: fn cast_thin_via_aggregate( // CHECK: _2 = _1; diff --git a/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-abort.diff similarity index 94% rename from tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff rename to tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-abort.diff index 3e7d0ce51e2eb..a7de09ca38682 100644 --- a/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff +++ b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `norm2` before InstSimplify -+ // MIR for `norm2` after InstSimplify +- // MIR for `norm2` before InstSimplify-after-simplifycfg ++ // MIR for `norm2` after InstSimplify-after-simplifycfg fn norm2(_1: [f32; 2]) -> f32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-unwind.diff similarity index 94% rename from tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff rename to tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-unwind.diff index 4833c1089e3c5..c15f7e47fe36f 100644 --- a/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff +++ b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `norm2` before InstSimplify -+ // MIR for `norm2` after InstSimplify +- // MIR for `norm2` before InstSimplify-after-simplifycfg ++ // MIR for `norm2` after InstSimplify-after-simplifycfg fn norm2(_1: [f32; 2]) -> f32 { debug x => _1; diff --git a/tests/mir-opt/instsimplify/combine_array_len.rs b/tests/mir-opt/instsimplify/combine_array_len.rs index f12284f648210..91f43f75689de 100644 --- a/tests/mir-opt/instsimplify/combine_array_len.rs +++ b/tests/mir-opt/instsimplify/combine_array_len.rs @@ -1,7 +1,7 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg -// EMIT_MIR combine_array_len.norm2.InstSimplify.diff +// EMIT_MIR combine_array_len.norm2.InstSimplify-after-simplifycfg.diff fn norm2(x: [f32; 2]) -> f32 { // CHECK-LABEL: fn norm2( // CHECK-NOT: Len( diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs b/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs index 7b1f3d14f4fd9..4f7288333d1a8 100644 --- a/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs @@ -1,7 +1,7 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff +// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.diff #[derive(Clone)] struct MyThing { v: T, diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff similarity index 94% rename from tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff rename to tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff index 48586f8b3349a..c6f858d89eb2c 100644 --- a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `::clone` before InstSimplify -+ // MIR for `::clone` after InstSimplify +- // MIR for `::clone` before InstSimplify-after-simplifycfg ++ // MIR for `::clone` after InstSimplify-after-simplifycfg fn ::clone(_1: &MyThing) -> MyThing { debug self => _1; diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff similarity index 94% rename from tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff rename to tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff index a57266e9c1226..691ab1f0e7fb7 100644 --- a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `::clone` before InstSimplify -+ // MIR for `::clone` after InstSimplify +- // MIR for `::clone` before InstSimplify-after-simplifycfg ++ // MIR for `::clone` after InstSimplify-after-simplifycfg fn ::clone(_1: &MyThing) -> MyThing { debug self => _1; diff --git a/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify-after-simplifycfg.diff similarity index 94% rename from tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff rename to tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify-after-simplifycfg.diff index 17730e66291c1..9844aa2a64e26 100644 --- a/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `adt_transmutes` before InstSimplify -+ // MIR for `adt_transmutes` after InstSimplify +- // MIR for `adt_transmutes` before InstSimplify-after-simplifycfg ++ // MIR for `adt_transmutes` after InstSimplify-after-simplifycfg fn adt_transmutes() -> () { let mut _0: (); diff --git a/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify-after-simplifycfg.diff similarity index 85% rename from tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff rename to tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify-after-simplifycfg.diff index 58ae5919071af..589f7159b9bd2 100644 --- a/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `identity_transmutes` before InstSimplify -+ // MIR for `identity_transmutes` after InstSimplify +- // MIR for `identity_transmutes` before InstSimplify-after-simplifycfg ++ // MIR for `identity_transmutes` after InstSimplify-after-simplifycfg fn identity_transmutes() -> () { let mut _0: (); diff --git a/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify-after-simplifycfg.diff similarity index 80% rename from tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff rename to tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify-after-simplifycfg.diff index 8eff802dd3c4b..b7baa89dc809d 100644 --- a/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `integer_transmutes` before InstSimplify -+ // MIR for `integer_transmutes` after InstSimplify +- // MIR for `integer_transmutes` before InstSimplify-after-simplifycfg ++ // MIR for `integer_transmutes` after InstSimplify-after-simplifycfg fn integer_transmutes() -> () { let mut _0: (); diff --git a/tests/mir-opt/instsimplify/combine_transmutes.rs b/tests/mir-opt/instsimplify/combine_transmutes.rs index c3622c20697a5..23f10b71f3c1b 100644 --- a/tests/mir-opt/instsimplify/combine_transmutes.rs +++ b/tests/mir-opt/instsimplify/combine_transmutes.rs @@ -1,4 +1,4 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg //@ compile-flags: -C panic=abort #![crate_type = "lib"] #![feature(core_intrinsics)] @@ -7,7 +7,7 @@ use std::intrinsics::mir::*; use std::mem::{transmute, ManuallyDrop, MaybeUninit}; -// EMIT_MIR combine_transmutes.identity_transmutes.InstSimplify.diff +// EMIT_MIR combine_transmutes.identity_transmutes.InstSimplify-after-simplifycfg.diff pub unsafe fn identity_transmutes() { // CHECK-LABEL: fn identity_transmutes( // CHECK-NOT: as i32 (Transmute); @@ -19,7 +19,7 @@ pub unsafe fn identity_transmutes() { } #[custom_mir(dialect = "runtime", phase = "initial")] -// EMIT_MIR combine_transmutes.integer_transmutes.InstSimplify.diff +// EMIT_MIR combine_transmutes.integer_transmutes.InstSimplify-after-simplifycfg.diff pub unsafe fn integer_transmutes() { // CHECK-LABEL: fn integer_transmutes( // CHECK-NOT: _i32 as u32 (Transmute); @@ -43,7 +43,7 @@ pub unsafe fn integer_transmutes() { } } -// EMIT_MIR combine_transmutes.adt_transmutes.InstSimplify.diff +// EMIT_MIR combine_transmutes.adt_transmutes.InstSimplify-after-simplifycfg.diff pub unsafe fn adt_transmutes() { // CHECK-LABEL: fn adt_transmutes( // CHECK: as u8 (Transmute); diff --git a/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff b/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify-after-simplifycfg.diff similarity index 70% rename from tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff rename to tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify-after-simplifycfg.diff index e2b45c882d6f3..7596aa203086e 100644 --- a/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `assert_zero` before InstSimplify -+ // MIR for `assert_zero` after InstSimplify +- // MIR for `assert_zero` before InstSimplify-after-simplifycfg ++ // MIR for `assert_zero` after InstSimplify-after-simplifycfg fn assert_zero(_1: u8) -> u8 { let mut _0: u8; diff --git a/tests/mir-opt/instsimplify/duplicate_switch_targets.rs b/tests/mir-opt/instsimplify/duplicate_switch_targets.rs index a47d9d5a71d7a..d610ba5f6904e 100644 --- a/tests/mir-opt/instsimplify/duplicate_switch_targets.rs +++ b/tests/mir-opt/instsimplify/duplicate_switch_targets.rs @@ -1,11 +1,11 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg #![feature(custom_mir, core_intrinsics)] #![crate_type = "lib"] use std::intrinsics::mir::*; -// EMIT_MIR duplicate_switch_targets.assert_zero.InstSimplify.diff +// EMIT_MIR duplicate_switch_targets.assert_zero.InstSimplify-after-simplifycfg.diff #[custom_mir(dialect = "runtime", phase = "post-cleanup")] pub unsafe fn assert_zero(x: u8) -> u8 { // CHECK-LABEL: fn assert_zero( diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify-after-simplifycfg.diff similarity index 84% rename from tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify.diff rename to tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify-after-simplifycfg.diff index 2ecacb5e39f47..d35844b21d160 100644 --- a/tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `generic` before InstSimplify -+ // MIR for `generic` after InstSimplify +- // MIR for `generic` before InstSimplify-after-simplifycfg ++ // MIR for `generic` after InstSimplify-after-simplifycfg fn generic() -> () { let mut _0: (); diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify-after-simplifycfg.diff similarity index 70% rename from tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff rename to tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify-after-simplifycfg.diff index d29af0945f7dc..6ddd8481ca733 100644 --- a/tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `generic_ref` before InstSimplify -+ // MIR for `generic_ref` after InstSimplify +- // MIR for `generic_ref` before InstSimplify-after-simplifycfg ++ // MIR for `generic_ref` after InstSimplify-after-simplifycfg fn generic_ref() -> () { let mut _0: (); diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify-after-simplifycfg.diff similarity index 87% rename from tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff rename to tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify-after-simplifycfg.diff index 1be386acfccab..1b7aa124c36e1 100644 --- a/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `panics` before InstSimplify -+ // MIR for `panics` after InstSimplify +- // MIR for `panics` before InstSimplify-after-simplifycfg ++ // MIR for `panics` after InstSimplify-after-simplifycfg fn panics() -> () { let mut _0: (); diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify-after-simplifycfg.diff similarity index 85% rename from tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff rename to tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify-after-simplifycfg.diff index f2e6978384205..20e046d8e194b 100644 --- a/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `removable` before InstSimplify -+ // MIR for `removable` after InstSimplify +- // MIR for `removable` before InstSimplify-after-simplifycfg ++ // MIR for `removable` after InstSimplify-after-simplifycfg fn removable() -> () { let mut _0: (); diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.rs b/tests/mir-opt/instsimplify/intrinsic_asserts.rs index c031c97816261..c71e08b9f1f75 100644 --- a/tests/mir-opt/instsimplify/intrinsic_asserts.rs +++ b/tests/mir-opt/instsimplify/intrinsic_asserts.rs @@ -1,10 +1,10 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg #![crate_type = "lib"] #![feature(core_intrinsics)] // All these assertions pass, so all the intrinsic calls should be deleted. -// EMIT_MIR intrinsic_asserts.removable.InstSimplify.diff +// EMIT_MIR intrinsic_asserts.removable.InstSimplify-after-simplifycfg.diff pub fn removable() { // CHECK-LABEL: fn removable( // CHECK-NOT: assert_inhabited @@ -18,7 +18,7 @@ pub fn removable() { enum Never {} // These assertions all diverge, so their target blocks should become None. -// EMIT_MIR intrinsic_asserts.panics.InstSimplify.diff +// EMIT_MIR intrinsic_asserts.panics.InstSimplify-after-simplifycfg.diff pub fn panics() { // CHECK-LABEL: fn panics( // CHECK: assert_inhabited::() -> unwind @@ -30,7 +30,7 @@ pub fn panics() { } // Whether or not these asserts pass isn't known, so they shouldn't be modified. -// EMIT_MIR intrinsic_asserts.generic.InstSimplify.diff +// EMIT_MIR intrinsic_asserts.generic.InstSimplify-after-simplifycfg.diff pub fn generic() { // CHECK-LABEL: fn generic( // CHECK: assert_inhabited::() -> [return: @@ -42,7 +42,7 @@ pub fn generic() { } // Whether or not these asserts pass isn't known, so they shouldn't be modified. -// EMIT_MIR intrinsic_asserts.generic_ref.InstSimplify.diff +// EMIT_MIR intrinsic_asserts.generic_ref.InstSimplify-after-simplifycfg.diff pub fn generic_ref() { // CHECK-LABEL: fn generic_ref( // CHECK: assert_mem_uninitialized_valid::<&T>() -> [return: diff --git a/tests/mir-opt/instsimplify/ref_of_deref.pointers.InstSimplify.diff b/tests/mir-opt/instsimplify/ref_of_deref.pointers.InstSimplify-after-simplifycfg.diff similarity index 92% rename from tests/mir-opt/instsimplify/ref_of_deref.pointers.InstSimplify.diff rename to tests/mir-opt/instsimplify/ref_of_deref.pointers.InstSimplify-after-simplifycfg.diff index 52b3d1e1d40b3..ca26f0240f9de 100644 --- a/tests/mir-opt/instsimplify/ref_of_deref.pointers.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/ref_of_deref.pointers.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `pointers` before InstSimplify -+ // MIR for `pointers` after InstSimplify +- // MIR for `pointers` before InstSimplify-after-simplifycfg ++ // MIR for `pointers` after InstSimplify-after-simplifycfg fn pointers(_1: *const [i32], _2: *mut i32) -> () { debug const_ptr => _1; diff --git a/tests/mir-opt/instsimplify/ref_of_deref.references.InstSimplify.diff b/tests/mir-opt/instsimplify/ref_of_deref.references.InstSimplify-after-simplifycfg.diff similarity index 91% rename from tests/mir-opt/instsimplify/ref_of_deref.references.InstSimplify.diff rename to tests/mir-opt/instsimplify/ref_of_deref.references.InstSimplify-after-simplifycfg.diff index ca0828a225a01..928ee3acaa028 100644 --- a/tests/mir-opt/instsimplify/ref_of_deref.references.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/ref_of_deref.references.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `references` before InstSimplify -+ // MIR for `references` after InstSimplify +- // MIR for `references` before InstSimplify-after-simplifycfg ++ // MIR for `references` after InstSimplify-after-simplifycfg fn references(_1: &i32, _2: &mut [i32]) -> () { debug const_ref => _1; diff --git a/tests/mir-opt/instsimplify/ref_of_deref.rs b/tests/mir-opt/instsimplify/ref_of_deref.rs index 37e164bc17f18..dc0f5f8198bc7 100644 --- a/tests/mir-opt/instsimplify/ref_of_deref.rs +++ b/tests/mir-opt/instsimplify/ref_of_deref.rs @@ -1,11 +1,11 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg #![crate_type = "lib"] #![feature(raw_ref_op)] // For each of these, only 2 of the 6 should simplify, // as the others have the wrong types. -// EMIT_MIR ref_of_deref.references.InstSimplify.diff +// EMIT_MIR ref_of_deref.references.InstSimplify-after-simplifycfg.diff // CHECK-LABEL: references pub fn references(const_ref: &i32, mut_ref: &mut [i32]) { // CHECK: _3 = _1; @@ -22,7 +22,7 @@ pub fn references(const_ref: &i32, mut_ref: &mut [i32]) { let _f = &raw mut *mut_ref; } -// EMIT_MIR ref_of_deref.pointers.InstSimplify.diff +// EMIT_MIR ref_of_deref.pointers.InstSimplify-after-simplifycfg.diff // CHECK-LABEL: pointers pub unsafe fn pointers(const_ptr: *const [i32], mut_ptr: *mut i32) { // CHECK: _3 = &(*_1); diff --git a/tests/mir-opt/instsimplify/ub_check.rs b/tests/mir-opt/instsimplify/ub_check.rs index 5f13f5ba059b5..ee72511c132de 100644 --- a/tests/mir-opt/instsimplify/ub_check.rs +++ b/tests/mir-opt/instsimplify/ub_check.rs @@ -1,7 +1,7 @@ -//@ test-mir-pass: InstSimplify +//@ test-mir-pass: InstSimplify-after-simplifycfg //@ compile-flags: -Cdebug-assertions=no -Zinline-mir -// EMIT_MIR ub_check.unwrap_unchecked.InstSimplify.diff +// EMIT_MIR ub_check.unwrap_unchecked.InstSimplify-after-simplifycfg.diff pub fn unwrap_unchecked(x: Option) -> i32 { // CHECK-LABEL: fn unwrap_unchecked( // CHECK-NOT: UbChecks() diff --git a/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify.diff b/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify-after-simplifycfg.diff similarity index 90% rename from tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify.diff rename to tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify-after-simplifycfg.diff index 4d8d658984235..7ef77e76d1297 100644 --- a/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify.diff +++ b/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `unwrap_unchecked` before InstSimplify -+ // MIR for `unwrap_unchecked` after InstSimplify +- // MIR for `unwrap_unchecked` before InstSimplify-after-simplifycfg ++ // MIR for `unwrap_unchecked` after InstSimplify-after-simplifycfg fn unwrap_unchecked(_1: Option) -> i32 { debug x => _1; 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 1f88339b5861b..861ee1d3d3d46 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 mut _3: &[T; 3]; + let _3: &[T; 3]; let _4: [T; 3]; let mut _5: usize; let mut _6: bool; @@ -23,12 +23,10 @@ } bb0: { - StorageLive(_3); StorageLive(_4); _4 = [_1, _1, _1]; _3 = &_4; - _2 = move _3 as &[T] (PointerCoercion(Unsize)); - StorageDead(_3); + _2 = _3 as &[T] (PointerCoercion(Unsize)); nop; nop; goto -> bb2; 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 19a581ba3f096..f27be95338479 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 mut _3: &[T; 3]; + let _3: &[T; 3]; let _4: [T; 3]; let mut _5: usize; let mut _6: bool; @@ -23,12 +23,10 @@ } bb0: { - StorageLive(_3); StorageLive(_4); _4 = [_1, _1, _1]; _3 = &_4; - _2 = move _3 as &[T] (PointerCoercion(Unsize)); - StorageDead(_3); + _2 = _3 as &[T] (PointerCoercion(Unsize)); nop; nop; goto -> bb2; diff --git a/tests/mir-opt/issue_78192.f.InstSimplify.diff b/tests/mir-opt/issue_78192.f.InstSimplify-after-simplifycfg.diff similarity index 79% rename from tests/mir-opt/issue_78192.f.InstSimplify.diff rename to tests/mir-opt/issue_78192.f.InstSimplify-after-simplifycfg.diff index 10e3dd2036202..53957bb3cb193 100644 --- a/tests/mir-opt/issue_78192.f.InstSimplify.diff +++ b/tests/mir-opt/issue_78192.f.InstSimplify-after-simplifycfg.diff @@ -1,5 +1,5 @@ -- // MIR for `f` before InstSimplify -+ // MIR for `f` after InstSimplify +- // MIR for `f` before InstSimplify-after-simplifycfg ++ // MIR for `f` after InstSimplify-after-simplifycfg fn f(_1: &T) -> *const T { debug a => _1; @@ -17,8 +17,7 @@ StorageLive(_4); _4 = &raw const (*_1); _3 = &_4; -- _2 = &(*_3); -+ _2 = _3; + _2 = _3; StorageDead(_3); _0 = (*_2); StorageDead(_4); diff --git a/tests/mir-opt/issue_78192.rs b/tests/mir-opt/issue_78192.rs index 857b1dec951e5..a82f0e3a6653a 100644 --- a/tests/mir-opt/issue_78192.rs +++ b/tests/mir-opt/issue_78192.rs @@ -9,4 +9,4 @@ fn main() { f(&2); } -// EMIT_MIR issue_78192.f.InstSimplify.diff +// EMIT_MIR issue_78192.f.InstSimplify-after-simplifycfg.diff 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 465cb1a9b1f41..959efa2a54870 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 _13: std::alloc::AllocError; let mut _14: !; let mut _15: &dyn std::fmt::Debug; - let mut _16: &std::alloc::AllocError; + let _16: &std::alloc::AllocError; scope 7 { } scope 8 { @@ -86,21 +86,21 @@ StorageDead(_8); StorageDead(_7); StorageLive(_12); + StorageLive(_16); _12 = discriminant(_6); switchInt(move _12) -> [0: bb6, 1: bb5, otherwise: bb1]; } bb5: { StorageLive(_15); - StorageLive(_16); _16 = &_13; - _15 = move _16 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); - StorageDead(_16); + _15 = _16 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); _14 = result::unwrap_failed(const "called `Result::unwrap()` on an `Err` value", move _15) -> unwind unreachable; } bb6: { _5 = move ((_6 as Ok).0: std::ptr::NonNull<[u8]>); + StorageDead(_16); StorageDead(_12); StorageDead(_6); - StorageLive(_17); 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 925d8997b8a55..97f5245a8c927 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 _13: std::alloc::AllocError; let mut _14: !; let mut _15: &dyn std::fmt::Debug; - let mut _16: &std::alloc::AllocError; + let _16: &std::alloc::AllocError; scope 7 { } scope 8 { @@ -86,21 +86,21 @@ StorageDead(_8); StorageDead(_7); StorageLive(_12); + StorageLive(_16); _12 = discriminant(_6); switchInt(move _12) -> [0: bb6, 1: bb5, otherwise: bb1]; } bb5: { StorageLive(_15); - StorageLive(_16); _16 = &_13; - _15 = move _16 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); - StorageDead(_16); + _15 = _16 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); _14 = result::unwrap_failed(const "called `Result::unwrap()` on an `Err` value", move _15) -> unwind unreachable; } bb6: { _5 = move ((_6 as Ok).0: std::ptr::NonNull<[u8]>); + StorageDead(_16); StorageDead(_12); StorageDead(_6); - StorageLive(_17); diff --git a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir index cb29473d7627f..e537dd6a28ef8 100644 --- a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir @@ -30,13 +30,11 @@ fn vec_move(_1: Vec) -> () { bb2: { StorageLive(_5); - StorageLive(_4); _4 = &mut _3; _5 = as Iterator>::next(move _4) -> [return: bb3, unwind: bb9]; } bb3: { - StorageDead(_4); _6 = discriminant(_5); switchInt(move _6) -> [0: bb4, 1: bb6, otherwise: bb8]; } diff --git a/tests/mir-opt/pre-codegen/no_inlined_clone.rs b/tests/mir-opt/pre-codegen/no_inlined_clone.rs new file mode 100644 index 0000000000000..475b230b46525 --- /dev/null +++ b/tests/mir-opt/pre-codegen/no_inlined_clone.rs @@ -0,0 +1,12 @@ +#![crate_type = "lib"] + +// EMIT_MIR no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir + +// CHECK-LABEL: ::clone( +// CHECK-NOT: inlined clone::impls::::clone +// CHECK: return; + +#[derive(Clone)] +struct Foo { + a: i32, +} diff --git a/tests/mir-opt/pre-codegen/no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir new file mode 100644 index 0000000000000..71898daa1bfa2 --- /dev/null +++ b/tests/mir-opt/pre-codegen/no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir @@ -0,0 +1,15 @@ +// MIR for `::clone` after PreCodegen + +fn ::clone(_1: &Foo) -> Foo { + debug self => _1; + let mut _0: Foo; + let mut _2: i32; + + bb0: { + StorageLive(_2); + _2 = ((*_1).0: i32); + _0 = Foo { a: move _2 }; + StorageDead(_2); + return; + } +} diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff index 802bfbbcdc5fa..c01a12eaa4f2c 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff @@ -37,7 +37,7 @@ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; StorageLive(_5); _5 = const 3_usize; - _6 = Len(_4); + _6 = const 6_usize; _7 = Lt(_5, _6); assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff index de94a55740318..64028e4437be3 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff @@ -37,7 +37,7 @@ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; StorageLive(_5); _5 = const 3_usize; - _6 = Len(_4); + _6 = const 6_usize; _7 = Lt(_5, _6); assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff index 802bfbbcdc5fa..c01a12eaa4f2c 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff @@ -37,7 +37,7 @@ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; StorageLive(_5); _5 = const 3_usize; - _6 = Len(_4); + _6 = const 6_usize; _7 = Lt(_5, _6); assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff index de94a55740318..64028e4437be3 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff @@ -37,7 +37,7 @@ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; StorageLive(_5); _5 = const 3_usize; - _6 = Len(_4); + _6 = const 6_usize; _7 = Lt(_5, _6); assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; } diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir index ce79a33013d95..a7fe52d8390e9 100644 --- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir @@ -36,13 +36,11 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb1: { StorageLive(_7); - StorageLive(_6); _6 = &mut _5; _7 = as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _6) -> [return: bb2, unwind unreachable]; } bb2: { - StorageDead(_6); _8 = discriminant(_7); switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb7]; } diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir index 602ecb7c9b835..3e2bbcd3c916f 100644 --- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir @@ -36,13 +36,11 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb1: { StorageLive(_7); - StorageLive(_6); _6 = &mut _5; _7 = as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _6) -> [return: bb2, unwind: bb8]; } bb2: { - StorageDead(_6); _8 = discriminant(_7); switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb7]; } diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir index dfa13230254c9..e382f744723eb 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir @@ -32,7 +32,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 debug other => _10; scope 3 (inlined std::cmp::impls::::le) { debug self => _4; - debug other => _9; + debug other => _6; let mut _11: usize; let mut _12: usize; } @@ -42,7 +42,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 debug other => _16; scope 5 (inlined std::cmp::impls::::le) { debug self => _7; - debug other => _15; + debug other => _5; let mut _17: usize; let mut _18: usize; } @@ -52,7 +52,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 debug other => _22; scope 7 (inlined std::cmp::impls::::le) { debug self => _6; - debug other => _21; + debug other => _4; } } scope 8 (inlined std::cmp::impls::::le) { @@ -60,7 +60,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 debug other => _26; scope 9 (inlined std::cmp::impls::::le) { debug self => _5; - debug other => _25; + debug other => _7; let mut _27: usize; let mut _28: usize; } @@ -77,7 +77,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 StorageLive(_8); _8 = &_4; StorageLive(_10); - _9 = &((*_3).2: usize); + StorageLive(_9); + _9 = _6; _10 = &_9; _11 = ((*_3).0: usize); _12 = ((*_3).2: usize); @@ -86,19 +87,22 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 } bb1: { + StorageDead(_9); StorageDead(_10); StorageDead(_8); goto -> bb4; } bb2: { + StorageDead(_9); StorageDead(_10); StorageDead(_8); StorageLive(_19); StorageLive(_14); _14 = &_7; StorageLive(_16); - _15 = &((*_3).1: usize); + StorageLive(_15); + _15 = _5; _16 = &_15; StorageLive(_17); _17 = ((*_3).3: usize); @@ -111,6 +115,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 } bb3: { + StorageDead(_15); StorageDead(_16); StorageDead(_14); goto -> bb4; @@ -121,13 +126,15 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 StorageLive(_20); _20 = &_6; StorageLive(_22); - _21 = &((*_3).0: usize); + StorageLive(_21); + _21 = _4; _22 = &_21; _23 = Le(_12, _11); switchInt(move _23) -> [0: bb5, otherwise: bb6]; } bb5: { + StorageDead(_21); StorageDead(_22); StorageDead(_20); _0 = const false; @@ -135,12 +142,14 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 } bb6: { + StorageDead(_21); StorageDead(_22); StorageDead(_20); StorageLive(_24); _24 = &_5; StorageLive(_26); - _25 = &((*_3).3: usize); + StorageLive(_25); + _25 = _7; _26 = &_25; StorageLive(_27); _27 = ((*_3).1: usize); @@ -149,6 +158,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 _0 = Le(move _27, move _28); StorageDead(_28); StorageDead(_27); + StorageDead(_25); StorageDead(_26); StorageDead(_24); goto -> bb7; @@ -160,6 +170,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 } bb8: { + StorageDead(_15); StorageDead(_16); StorageDead(_14); _0 = const true; diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir index d7f09fafeebe7..58e9b45a4a0f1 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir @@ -20,7 +20,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } bb0: { - StorageLive(_7); + StorageLive(_8); StorageLive(_4); StorageLive(_3); _3 = PtrMetadata(_1); @@ -36,7 +36,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { bb2: { StorageDead(_3); - StorageLive(_8); + StorageLive(_7); StorageLive(_5); _5 = &raw mut (*_1); StorageLive(_6); @@ -45,14 +45,14 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { StorageDead(_6); StorageDead(_5); _8 = &mut (*_7); - _0 = Option::<&mut u32>::Some(move _8); - StorageDead(_8); + _0 = Option::<&mut u32>::Some(_8); + StorageDead(_7); goto -> bb3; } bb3: { StorageDead(_4); - StorageDead(_7); + StorageDead(_8); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir index d7f09fafeebe7..58e9b45a4a0f1 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir @@ -20,7 +20,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } bb0: { - StorageLive(_7); + StorageLive(_8); StorageLive(_4); StorageLive(_3); _3 = PtrMetadata(_1); @@ -36,7 +36,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { bb2: { StorageDead(_3); - StorageLive(_8); + StorageLive(_7); StorageLive(_5); _5 = &raw mut (*_1); StorageLive(_6); @@ -45,14 +45,14 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { StorageDead(_6); StorageDead(_5); _8 = &mut (*_7); - _0 = Option::<&mut u32>::Some(move _8); - StorageDead(_8); + _0 = Option::<&mut u32>::Some(_8); + StorageDead(_7); goto -> bb3; } bb3: { StorageDead(_4); - StorageDead(_7); + StorageDead(_8); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir index 2f13cfa4dab62..ee80726a675c8 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir @@ -35,6 +35,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> bb0: { _3 = move (_2.0: usize); _4 = move (_2.1: usize); + StorageLive(_11); StorageLive(_5); _5 = &raw mut (*_1); StorageLive(_8); @@ -56,6 +57,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> StorageDead(_8); StorageDead(_5); _0 = &mut (*_11); + StorageDead(_11); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir index 2f13cfa4dab62..ee80726a675c8 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir @@ -35,6 +35,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> bb0: { _3 = move (_2.0: usize); _4 = move (_2.1: usize); + StorageLive(_11); StorageLive(_5); _5 = &raw mut (*_1); StorageLive(_8); @@ -56,6 +57,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> StorageDead(_8); StorageDead(_5); _0 = &mut (*_11); + StorageDead(_11); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir index d5fdb2e08cc16..4c766c6497a2e 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir @@ -108,13 +108,11 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb4: { StorageLive(_15); - StorageLive(_14); _14 = &mut _13; _15 = > as Iterator>::next(move _14) -> [return: bb5, unwind: bb11]; } bb5: { - StorageDead(_14); _16 = discriminant(_15); switchInt(move _16) -> [0: bb6, 1: bb8, otherwise: bb10]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir index cc2beac06f23c..03de9fd938ec4 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -98,13 +98,11 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb4: { StorageLive(_14); - StorageLive(_13); _13 = &mut _12; _14 = as Iterator>::next(move _13) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_13); _15 = discriminant(_14); switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir index d66edb28570fc..c7c722274f24e 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -98,13 +98,11 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb4: { StorageLive(_14); - StorageLive(_13); _13 = &mut _12; _14 = as Iterator>::next(move _13) -> [return: bb5, unwind: bb11]; } bb5: { - StorageDead(_13); _15 = discriminant(_14); switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10]; } diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir index 485dc9179cef0..c76e5315db9f6 100644 --- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir @@ -3,16 +3,14 @@ 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 mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 + let _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 } bb0: { - StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13 _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13 _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7 - StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14 return; // scope 0 at $DIR/spans.rs:12:2: 12:2 } } diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir index 485dc9179cef0..c76e5315db9f6 100644 --- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir @@ -3,16 +3,14 @@ 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 mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 + let _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 } bb0: { - StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13 _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13 _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7 - StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14 return; // scope 0 at $DIR/spans.rs:12:2: 12:2 } } diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir index 1c9ed25d7f2b2..14ad951a47662 100644 --- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir @@ -56,10 +56,12 @@ fn vec_deref_to_slice(_1: &Vec) -> &[u8] { StorageDead(_2); StorageLive(_5); _5 = ((*_1).1: usize); + StorageLive(_6); _6 = *const [u8] from (_4, _5); + _0 = &(*_6); + StorageDead(_6); StorageDead(_5); StorageDead(_4); - _0 = &(*_6); return; } } diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir index 1c9ed25d7f2b2..14ad951a47662 100644 --- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir @@ -56,10 +56,12 @@ fn vec_deref_to_slice(_1: &Vec) -> &[u8] { StorageDead(_2); StorageLive(_5); _5 = ((*_1).1: usize); + StorageLive(_6); _6 = *const [u8] from (_4, _5); + _0 = &(*_6); + StorageDead(_6); StorageDead(_5); StorageDead(_4); - _0 = &(*_6); return; } }