From 466812394508495935ff3eb57152ce231a3635eb Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 8 Jun 2023 09:34:53 +0200 Subject: [PATCH] bless mir-opt To reproduce the changes in this commit locally: - Run `./x test tidy` and remove all the output files not associated with a test file anymore, as reported by tidy. - Run `./x test tests/mir-opt --bless` to generate the new outputs. --- ...yCfg-elaborate-drops.after.panic-abort.mir | 64 +++++ ...fg-elaborate-drops.after.panic-unwind.mir} | 0 ...main.ElaborateDrops.before.panic-abort.mir | 80 ++++++ ...in.ElaborateDrops.before.panic-unwind.mir} | 0 ...ay_len.norm2.InstSimplify.panic-abort.diff | 77 +++++ ..._len.norm2.InstSimplify.panic-unwind.diff} | 0 ...mpl#0}-clone.InstSimplify.panic-abort.diff | 74 +++++ ...l#0}-clone.InstSimplify.panic-unwind.diff} | 0 ... aggregate.foo.ConstProp.panic-abort.diff} | 0 .../aggregate.foo.ConstProp.panic-unwind.diff | 55 ++++ ...gate.foo.PreCodegen.after.panic-abort.mir} | 0 ...gate.foo.PreCodegen.after.panic-unwind.mir | 49 ++++ .../aggregate.main.ConstProp.panic-abort.diff | 44 +++ ...ggregate.main.ConstProp.panic-unwind.diff} | 0 ...gate.main.PreCodegen.after.panic-abort.mir | 39 +++ ...te.main.PreCodegen.after.panic-unwind.mir} | 0 ...ndex.main.ConstProp.32bit.panic-abort.diff | 39 +++ ...ex.main.ConstProp.32bit.panic-unwind.diff} | 0 ...ndex.main.ConstProp.64bit.panic-abort.diff | 39 +++ ...ex.main.ConstProp.64bit.panic-unwind.diff} | 0 ...iv_by_zero.main.ConstProp.panic-abort.diff | 53 ++++ ..._by_zero.main.ConstProp.panic-unwind.diff} | 0 ...od_by_zero.main.ConstProp.panic-abort.diff | 53 ++++ ..._by_zero.main.ConstProp.panic-unwind.diff} | 0 ...ices.main.ConstProp.32bit.panic-abort.diff | 57 ++++ ...es.main.ConstProp.32bit.panic-unwind.diff} | 0 ...ices.main.ConstProp.64bit.panic-abort.diff | 57 ++++ ...es.main.ConstProp.64bit.panic-unwind.diff} | 0 .../boxes.main.ConstProp.panic-abort.diff | 56 ++++ ...=> boxes.main.ConstProp.panic-unwind.diff} | 0 ...hecked_add.main.ConstProp.panic-abort.diff | 28 ++ ...cked_add.main.ConstProp.panic-unwind.diff} | 0 ...gracefully.main.ConstProp.panic-abort.diff | 44 +++ ...acefully.main.ConstProp.panic-unwind.diff} | 0 ...ification.hello.ConstProp.panic-abort.diff | 31 ++ ...ication.hello.ConstProp.panic-unwind.diff} | 0 ...n.hello.PreCodegen.before.panic-abort.mir} | 0 ...n.hello.PreCodegen.before.panic-unwind.mir | 9 + .../indirect.main.ConstProp.panic-abort.diff | 33 +++ ...indirect.main.ConstProp.panic-unwind.diff} | 0 ...t_overflow.main.ConstProp.panic-abort.diff | 39 +++ ...overflow.main.ConstProp.panic-unwind.diff} | 0 ...ssue_66971.main.ConstProp.panic-abort.diff | 23 ++ ...ue_66971.main.ConstProp.panic-unwind.diff} | 0 ...ssue_67019.main.ConstProp.panic-abort.diff | 28 ++ ...ue_67019.main.ConstProp.panic-unwind.diff} | 0 ...ndex.main.ConstProp.32bit.panic-abort.diff | 39 +++ ...ex.main.ConstProp.32bit.panic-unwind.diff} | 0 ...ndex.main.ConstProp.64bit.panic-abort.diff | 39 +++ ...ex.main.ConstProp.64bit.panic-unwind.diff} | 0 ...rtial_read.main.ConstProp.panic-abort.diff | 35 +++ ...ial_read.main.ConstProp.panic-unwind.diff} | 0 ...rop_assign.main.ConstProp.panic-abort.diff | 53 ++++ ...p_assign.main.ConstProp.panic-unwind.diff} | 0 ...peat.main.ConstProp.32bit.panic-abort.diff | 44 +++ ...at.main.ConstProp.32bit.panic-unwind.diff} | 0 ...peat.main.ConstProp.64bit.panic-abort.diff | 44 +++ ...at.main.ConstProp.64bit.panic-unwind.diff} | 0 ...eturn_place.add.ConstProp.panic-abort.diff | 21 ++ ...urn_place.add.ConstProp.panic-unwind.diff} | 0 ...lace.add.PreCodegen.before.panic-abort.mir | 16 ++ ...ce.add.PreCodegen.before.panic-unwind.mir} | 0 ...ropagation.main.ConstProp.panic-abort.diff | 34 +++ ...pagation.main.ConstProp.panic-unwind.diff} | 0 ..._len.main.ConstProp.32bit.panic-abort.diff | 50 ++++ ...en.main.ConstProp.32bit.panic-unwind.diff} | 0 ..._len.main.ConstProp.64bit.panic-abort.diff | 50 ++++ ...en.main.ConstProp.64bit.panic-unwind.diff} | 0 ...switch_int.main.ConstProp.panic-abort.diff | 34 +++ ...itch_int.main.ConstProp.panic-unwind.diff} | 0 ...ondition-after-const-prop.panic-abort.diff | 34 +++ ...dition-after-const-prop.panic-unwind.diff} | 0 ...ropagation.main.ConstProp.panic-abort.diff | 35 +++ ...pagation.main.ConstProp.panic-unwind.diff} | 0 ...borrowed_local.f.CopyProp.panic-abort.diff | 33 +++ ...rrowed_local.f.CopyProp.panic-unwind.diff} | 0 .../branch.foo.CopyProp.panic-abort.diff | 65 +++++ ... => branch.foo.CopyProp.panic-unwind.diff} | 0 ...ion_arg.arg_src.CopyProp.panic-abort.diff} | 0 ...ion_arg.arg_src.CopyProp.panic-unwind.diff | 23 ++ ...pagation_arg.bar.CopyProp.panic-abort.diff | 28 ++ ...gation_arg.bar.CopyProp.panic-unwind.diff} | 0 ...agation_arg.baz.CopyProp.panic-abort.diff} | 0 ...agation_arg.baz.CopyProp.panic-unwind.diff | 18 ++ ...pagation_arg.foo.CopyProp.panic-abort.diff | 28 ++ ...gation_arg.foo.CopyProp.panic-unwind.diff} | 0 ...ustom_move_arg.f.CopyProp.panic-abort.diff | 31 ++ ...tom_move_arg.f.CopyProp.panic-unwind.diff} | 0 .../cycle.main.CopyProp.panic-abort.diff | 60 ++++ ... => cycle.main.CopyProp.panic-unwind.diff} | 0 ...res_79191.f.CopyProp.after.panic-abort.mir | 29 ++ ...s_79191.f.CopyProp.after.panic-unwind.mir} | 0 ...es_better.f.CopyProp.after.panic-abort.mir | 29 ++ ..._better.f.CopyProp.after.panic-unwind.mir} | 0 ...ssue_107511.main.CopyProp.panic-abort.diff | 138 +++++++++ ...ue_107511.main.CopyProp.panic-unwind.diff} | 0 .../move_arg.f.CopyProp.panic-abort.diff | 40 +++ ... => move_arg.f.CopyProp.panic-unwind.diff} | 0 ...ove_projection.f.CopyProp.panic-abort.diff | 31 ++ ...e_projection.f.CopyProp.panic-unwind.diff} | 0 ...reborrow.demiraw.CopyProp.panic-abort.diff | 56 ++++ ...borrow.demiraw.CopyProp.panic-unwind.diff} | 0 .../reborrow.miraw.CopyProp.panic-abort.diff | 52 ++++ ...reborrow.miraw.CopyProp.panic-unwind.diff} | 0 .../reborrow.remut.CopyProp.panic-abort.diff | 50 ++++ ...reborrow.remut.CopyProp.panic-unwind.diff} | 0 .../reborrow.reraw.CopyProp.panic-abort.diff | 50 ++++ ...reborrow.reraw.CopyProp.panic-unwind.diff} | 0 ...ed.main.DataflowConstProp.panic-abort.diff | 80 ++++++ ....main.DataflowConstProp.panic-unwind.diff} | 0 ...ow.main.DataflowConstProp.panic-abort.diff | 39 +++ ....main.DataflowConstProp.panic-unwind.diff} | 0 ...sb.main.DataflowConstProp.panic-abort.diff | 55 ++++ ....main.DataflowConstProp.panic-unwind.diff} | 0 ...tr.main.DataflowConstProp.panic-abort.diff | 54 ++++ ....main.DataflowConstProp.panic-unwind.diff} | 0 ...or.main.DataflowConstProp.panic-abort.diff | 40 +++ ....main.DataflowConstProp.panic-unwind.diff} | 0 ...ycle.DeadStoreElimination.panic-abort.diff | 76 +++++ ...le.DeadStoreElimination.panic-unwind.diff} | 0 ...mment_2.DeduplicateBlocks.panic-abort.diff | 100 +++++++ ...ent_2.DeduplicateBlocks.panic-unwind.diff} | 0 ...complex_case.main.Derefer.panic-abort.diff | 109 +++++++ ...mplex_case.main.Derefer.panic-unwind.diff} | 0 ..._inline_test.main.Derefer.panic-abort.diff | 45 +++ ...nline_test.main.Derefer.panic-unwind.diff} | 0 ...minator_test.main.Derefer.panic-abort.diff | 96 +++++++ ...nator_test.main.Derefer.panic-unwind.diff} | 0 ...oo.DestinationPropagation.panic-abort.diff | 75 +++++ ....DestinationPropagation.panic-unwind.diff} | 0 ...c.DestinationPropagation.panic-abort.diff} | 0 ...c.DestinationPropagation.panic-unwind.diff | 26 ++ ...ar.DestinationPropagation.panic-abort.diff | 32 +++ ....DestinationPropagation.panic-unwind.diff} | 0 ...z.DestinationPropagation.panic-abort.diff} | 0 ...z.DestinationPropagation.panic-unwind.diff | 22 ++ ...oo.DestinationPropagation.panic-abort.diff | 32 +++ ....DestinationPropagation.panic-unwind.diff} | 0 ...in.DestinationPropagation.panic-abort.diff | 77 +++++ ....DestinationPropagation.panic-unwind.diff} | 0 ...stinationPropagation.after.panic-abort.mir | 34 +++ ...inationPropagation.after.panic-unwind.mir} | 0 ...stinationPropagation.after.panic-abort.mir | 33 +++ ...inationPropagation.after.panic-unwind.mir} | 0 ...vo.DestinationPropagation.panic-abort.diff | 43 +++ ....DestinationPropagation.panic-unwind.diff} | 0 ...in.DestinationPropagation.panic-abort.diff | 35 +++ ....DestinationPropagation.panic-unwind.diff} | 0 ....f.DestinationPropagation.panic-abort.diff | 86 ++++++ ....DestinationPropagation.panic-unwind.diff} | 0 ...onential_common.ConstProp.panic-abort.diff | 129 +++++++++ ...ential_common.ConstProp.panic-unwind.diff} | 0 ...losure#0}.generator_drop.0.panic-abort.mir | 82 ++++++ ...sure#0}.generator_drop.0.panic-unwind.mir} | 0 ...e#0}.StateTransform.before.panic-abort.mir | 89 ++++++ ...0}.StateTransform.before.panic-unwind.mir} | 0 .../asm_unwind.main.Inline.panic-abort.diff | 37 +++ ... asm_unwind.main.Inline.panic-unwind.diff} | 0 ...rivial_bound.foo.Inline.panic-unwind.diff} | 0 .../inline/cycle.f.Inline.panic-abort.diff | 35 +++ ....diff => cycle.f.Inline.panic-unwind.diff} | 0 .../inline/cycle.g.Inline.panic-abort.diff | 50 ++++ ....diff => cycle.g.Inline.panic-unwind.diff} | 0 .../inline/cycle.main.Inline.panic-abort.diff | 63 ++++ ...ff => cycle.main.Inline.panic-unwind.diff} | 0 ...yn_trait.get_query.Inline.panic-abort.diff | 54 ++++ ..._trait.get_query.Inline.panic-unwind.diff} | 0 ...dyn_trait.mk_cycle.Inline.panic-abort.diff | 23 ++ ...n_trait.mk_cycle.Inline.panic-unwind.diff} | 0 ....try_execute_query.Inline.panic-abort.diff | 33 +++ ...ry_execute_query.Inline.panic-unwind.diff} | 0 ...ntial_runtime.main.Inline.panic-abort.diff | 175 +++++++++++ ...ial_runtime.main.Inline.panic-unwind.diff} | 0 ...nlined_no_sanitize.Inline.panic-abort.diff | 24 ++ ...ined_no_sanitize.Inline.panic-unwind.diff} | 4 +- ...ned_target_feature.Inline.panic-abort.diff | 24 ++ ...d_target_feature.Inline.panic-unwind.diff} | 4 +- ...inlined_c_variadic.Inline.panic-abort.diff | 25 ++ ...lined_c_variadic.Inline.panic-unwind.diff} | 2 +- ...nlined_no_sanitize.Inline.panic-abort.diff | 22 ++ ...ined_no_sanitize.Inline.panic-unwind.diff} | 2 +- ...ned_target_feature.Inline.panic-abort.diff | 22 ++ ...d_target_feature.Inline.panic-unwind.diff} | 2 +- .../inline_cycle.one.Inline.panic-abort.diff | 30 ++ ...inline_cycle.one.Inline.panic-unwind.diff} | 0 .../inline_cycle.two.Inline.panic-abort.diff | 55 ++++ ...inline_cycle.two.Inline.panic-unwind.diff} | 0 ...cycle_generic.main.Inline.panic-abort.diff | 31 ++ ...cle_generic.main.Inline.panic-unwind.diff} | 0 ...inline_diverging.f.Inline.panic-abort.diff | 24 ++ ...line_diverging.f.Inline.panic-unwind.diff} | 0 ...inline_diverging.g.Inline.panic-abort.diff | 49 ++++ ...line_diverging.g.Inline.panic-unwind.diff} | 0 ...inline_diverging.h.Inline.panic-abort.diff | 51 ++++ ...line_diverging.h.Inline.panic-unwind.diff} | 0 ...ine_generator.main.Inline.panic-abort.diff | 127 ++++++++ ...e_generator.main.Inline.panic-unwind.diff} | 0 ...nto_box_place.main.Inline.panic-abort.diff | 72 +++++ ...o_box_place.main.Inline.panic-unwind.diff} | 0 ..._options.main.Inline.after.panic-abort.mir | 55 ++++ ...ptions.main.Inline.after.panic-unwind.mir} | 0 ...inline_shims.clone.Inline.panic-abort.diff | 26 ++ ...line_shims.clone.Inline.panic-unwind.diff} | 0 .../inline_shims.drop.Inline.panic-abort.diff | 72 +++++ ...nline_shims.drop.Inline.panic-unwind.diff} | 0 ...pecialization.main.Inline.panic-abort.diff | 28 ++ ...cialization.main.Inline.panic-unwind.diff} | 0 ...t_method.test.Inline.after.panic-abort.mir | 21 ++ ...method.test.Inline.after.panic-unwind.mir} | 0 ...ethod_2.test2.Inline.after.panic-abort.mir | 28 ++ ...hod_2.test2.Inline.after.panic-unwind.mir} | 0 ...issue_106141.outer.Inline.panic-abort.diff | 55 ++++ ...sue_106141.outer.Inline.panic-unwind.diff} | 0 .../issue_78442.bar.Inline.panic-abort.diff | 53 ++++ ... issue_78442.bar.Inline.panic-unwind.diff} | 0 ...issue_78442.bar.RevealAll.panic-abort.diff | 49 ++++ ...sue_78442.bar.RevealAll.panic-unwind.diff} | 0 ...l_unsigned_smaller.Inline.panic-abort.diff | 144 ++++++++++ ...unsigned_smaller.Inline.panic-unwind.diff} | 0 ..._smaller.PreCodegen.after.panic-abort.mir} | 0 ..._smaller.PreCodegen.after.panic-unwind.mir | 130 +++++++++ ...shr_signed_smaller.Inline.panic-abort.diff | 144 ++++++++++ ...r_signed_smaller.Inline.panic-unwind.diff} | 0 ..._smaller.PreCodegen.after.panic-abort.mir} | 0 ..._smaller.PreCodegen.after.panic-unwind.mir | 130 +++++++++ ...d.unwrap_unchecked.Inline.panic-abort.diff | 51 ++++ ...unwrap_unchecked.Inline.panic-unwind.diff} | 0 ...nchecked.PreCodegen.after.panic-abort.mir} | 0 ...nchecked.PreCodegen.after.panic-unwind.mir | 41 +++ ...ue_101973.inner.ConstProp.panic-abort.diff | 85 ++++++ ..._101973.inner.ConstProp.panic-unwind.diff} | 0 ....AbortUnwindingCalls.after.panic-abort.mir | 25 ++ ...bortUnwindingCalls.after.panic-unwind.mir} | 0 ...1110.main.ElaborateDrops.panic-abort.diff} | 0 ...1110.main.ElaborateDrops.panic-unwind.diff | 75 +++++ ...41110.test.ElaborateDrops.panic-abort.diff | 105 +++++++ ...110.test.ElaborateDrops.panic-unwind.diff} | 0 ...41888.main.ElaborateDrops.panic-abort.diff | 151 ++++++++++ ...888.main.ElaborateDrops.panic-unwind.diff} | 0 ...test.ElaborateDrops.before.panic-abort.mir | 122 ++++++++ ...st.ElaborateDrops.before.panic-unwind.mir} | 0 ...implifyComparisonIntegral.panic-abort.diff | 60 ++++ ...plifyComparisonIntegral.panic-unwind.diff} | 0 ..._to_digit.PreCodegen.after.panic-abort.mir | 84 ++++++ ...o_digit.PreCodegen.after.panic-unwind.mir} | 0 ...y_bound.NormalizeArrayLen.panic-abort.diff | 64 +++++ ...bound.NormalizeArrayLen.panic-unwind.diff} | 0 ...und_mut.NormalizeArrayLen.panic-abort.diff | 77 +++++ ...d_mut.NormalizeArrayLen.panic-unwind.diff} | 0 ...ay_len.NormalizeArrayLen.panic-abort.diff} | 0 ...ay_len.NormalizeArrayLen.panic-unwind.diff | 26 ++ ..._value.NormalizeArrayLen.panic-abort.diff} | 0 ..._value.NormalizeArrayLen.panic-unwind.diff | 26 ++ ...en_raw.NormalizeArrayLen.panic-abort.diff} | 0 ...en_raw.NormalizeArrayLen.panic-unwind.diff | 50 ++++ ...borrow.NormalizeArrayLen.panic-abort.diff} | 0 ...borrow.NormalizeArrayLen.panic-unwind.diff | 44 +++ ...align_of.LowerIntrinsics.panic-abort.diff} | 0 ...align_of.LowerIntrinsics.panic-unwind.diff | 20 ++ ...s.assume.LowerIntrinsics.panic-abort.diff} | 0 ...s.assume.LowerIntrinsics.panic-unwind.diff | 26 ++ ...criminant.LowerIntrinsics.panic-abort.diff | 115 ++++++++ ...iminant.LowerIntrinsics.panic-unwind.diff} | 0 ...rlapping.LowerIntrinsics.panic-abort.diff} | 0 ...rlapping.LowerIntrinsics.panic-unwind.diff | 72 +++++ ...s.forget.LowerIntrinsics.panic-abort.diff} | 0 ...s.forget.LowerIntrinsics.panic-unwind.diff | 29 ++ ...on_const.LowerIntrinsics.panic-abort.diff} | 0 ...on_const.LowerIntrinsics.panic-unwind.diff | 31 ++ ..._payload.LowerIntrinsics.panic-abort.diff} | 0 ..._payload.LowerIntrinsics.panic-unwind.diff | 54 ++++ ...r_offset.LowerIntrinsics.panic-abort.diff} | 0 ...r_offset.LowerIntrinsics.panic-unwind.diff | 30 ++ ...rimitive.LowerIntrinsics.panic-abort.diff} | 0 ...rimitive.LowerIntrinsics.panic-unwind.diff | 27 ++ ...nhabited.LowerIntrinsics.panic-abort.diff} | 0 ...nhabited.LowerIntrinsics.panic-unwind.diff | 21 ++ ....size_of.LowerIntrinsics.panic-abort.diff} | 0 ....size_of.LowerIntrinsics.panic-unwind.diff | 20 ++ ...nhabited.LowerIntrinsics.panic-abort.diff} | 0 ...nhabited.LowerIntrinsics.panic-unwind.diff | 27 ++ ..._ref_dst.LowerIntrinsics.panic-abort.diff} | 0 ..._ref_dst.LowerIntrinsics.panic-unwind.diff | 27 ++ ...nhabited.LowerIntrinsics.panic-abort.diff} | 0 ...nhabited.LowerIntrinsics.panic-unwind.diff | 25 ++ ...nhabited.LowerIntrinsics.panic-abort.diff} | 0 ...nhabited.LowerIntrinsics.panic-unwind.diff | 25 ++ ...nhabited.LowerIntrinsics.panic-abort.diff} | 0 ...nhabited.LowerIntrinsics.panic-unwind.diff | 25 ++ ...nhabited.LowerIntrinsics.panic-abort.diff} | 0 ...nhabited.LowerIntrinsics.panic-unwind.diff | 22 ++ ...nchecked.LowerIntrinsics.panic-abort.diff} | 0 ...nchecked.LowerIntrinsics.panic-unwind.diff | 60 ++++ ...eachable.LowerIntrinsics.panic-abort.diff} | 0 ...eachable.LowerIntrinsics.panic-unwind.diff | 21 ++ ...overflow.LowerIntrinsics.panic-abort.diff} | 0 ...overflow.LowerIntrinsics.panic-unwind.diff | 83 ++++++ ...wrapping.LowerIntrinsics.panic-abort.diff} | 0 ...wrapping.LowerIntrinsics.panic-unwind.diff | 83 ++++++ ...e_string.LowerIntrinsics.panic-abort.diff} | 0 ...e_string.LowerIntrinsics.panic-unwind.diff | 36 +++ ....bound.LowerSliceLenCalls.panic-abort.diff | 63 ++++ ...ound.LowerSliceLenCalls.panic-unwind.diff} | 0 ...g-initial.after-ElaborateDrops.after.diff} | 0 ...fg-initial.after-ElaborateDrops.after.diff | 272 ++++++++++++++++++ ...yCfg-elaborate-drops.after.panic-abort.mir | 44 +++ ...fg-elaborate-drops.after.panic-unwind.mir} | 0 ...main.ElaborateDrops.before.panic-abort.mir | 49 ++++ ...in.ElaborateDrops.before.panic-unwind.mir} | 0 ...le.nrvo.RenameReturnPlace.panic-abort.diff | 43 +++ ....nrvo.RenameReturnPlace.panic-unwind.diff} | 0 ...yCfg-elaborate-drops.after.panic-abort.mir | 46 +++ ...fg-elaborate-drops.after.panic-unwind.mir} | 0 ...able.main.ConstProp.32bit.panic-abort.diff | 59 ++++ ...le.main.ConstProp.32bit.panic-unwind.diff} | 0 ...able.main.ConstProp.64bit.panic-abort.diff | 59 ++++ ...le.main.ConstProp.64bit.panic-unwind.diff} | 0 ...in.PreCodegen.after.32bit.panic-abort.mir} | 0 ...n.PreCodegen.after.32bit.panic-unwind.mir} | 0 ...ain.PreCodegen.after.64bit.panic-abort.mir | 18 ++ ...in.PreCodegen.after.64bit.panic-unwind.mir | 18 ++ ...acementOfAggregates.32bit.panic-abort.diff | 71 +++++ ...ementOfAggregates.32bit.panic-unwind.diff} | 0 ...acementOfAggregates.64bit.panic-abort.diff | 71 +++++ ...ementOfAggregates.64bit.panic-unwind.diff} | 0 ...yLocals-final.after.32bit.panic-abort.mir} | 0 ...Locals-final.after.32bit.panic-unwind.mir} | 0 ...fyLocals-final.after.64bit.panic-abort.mir | 18 ++ ...yLocals-final.after.64bit.panic-unwind.mir | 18 ++ ...ward_loop.PreCodegen.after.panic-abort.mir | 137 +++++++++ ...rd_loop.PreCodegen.after.panic-unwind.mir} | 6 +- ...sive_loop.PreCodegen.after.panic-abort.mir | 87 ++++++ ...ve_loop.PreCodegen.after.panic-unwind.mir} | 8 +- ...iter_next.PreCodegen.after.panic-abort.mir | 20 ++ ...er_next.PreCodegen.after.panic-unwind.mir} | 2 +- ...iter_next.PreCodegen.after.panic-abort.mir | 74 +++++ ...er_next.PreCodegen.after.panic-unwind.mir} | 2 +- ...ut_usize.PreCodegen.after.panic-abort.mir} | 2 +- ...ut_usize.PreCodegen.after.panic-unwind.mir | 99 +++++++ ...ut_range.PreCodegen.after.panic-abort.mir} | 2 +- ...ut_range.PreCodegen.after.panic-unwind.mir | 123 ++++++++ ...dex_range.PreCodegen.after.panic-abort.mir | 26 ++ ...x_range.PreCodegen.after.panic-unwind.mir} | 2 +- ...dex_usize.PreCodegen.after.panic-abort.mir | 20 ++ ...x_usize.PreCodegen.after.panic-unwind.mir} | 0 ...ated_loop.PreCodegen.after.panic-abort.mir | 205 +++++++++++++ ...ed_loop.PreCodegen.after.panic-unwind.mir} | 10 +- ...ward_loop.PreCodegen.after.panic-abort.mir | 192 +++++++++++++ ...rd_loop.PreCodegen.after.panic-unwind.mir} | 8 +- ...ange_loop.PreCodegen.after.panic-abort.mir | 153 ++++++++++ ...ge_loop.PreCodegen.after.panic-unwind.mir} | 6 +- ...erse_loop.PreCodegen.after.panic-abort.mir | 209 ++++++++++++++ ...se_loop.PreCodegen.after.panic-unwind.mir} | 10 +- ...next_back.PreCodegen.after.panic-abort.mir | 17 ++ ...xt_back.PreCodegen.after.panic-unwind.mir} | 2 +- ...iter_next.PreCodegen.after.panic-abort.mir | 17 ++ ...er_next.PreCodegen.after.panic-unwind.mir} | 2 +- ...uard.CleanupPostBorrowck.panic-abort.diff} | 0 ...uard.CleanupPostBorrowck.panic-unwind.diff | 74 +++++ ...main.RemoveStorageMarkers.panic-abort.diff | 98 +++++++ ...in.RemoveStorageMarkers.panic-unwind.diff} | 0 ...neric.RemoveUnneededDrops.panic-abort.diff | 27 ++ ...ric.RemoveUnneededDrops.panic-unwind.diff} | 0 ...t_opt.RemoveUnneededDrops.panic-abort.diff | 27 ++ ...opt.RemoveUnneededDrops.panic-unwind.diff} | 0 ...s.opt.RemoveUnneededDrops.panic-abort.diff | 27 ++ ...opt.RemoveUnneededDrops.panic-unwind.diff} | 0 ..._copy.RemoveUnneededDrops.panic-abort.diff | 27 ++ ...opy.RemoveUnneededDrops.panic-unwind.diff} | 0 ...yCfg-elaborate-drops.after.panic-abort.mir | 188 ++++++++++++ ...fg-elaborate-drops.after.panic-unwind.mir} | 0 ...implifyCfg-make_shim.after.panic-abort.mir | 26 ++ ...plifyCfg-make_shim.after.panic-unwind.mir} | 0 ...Cfg-elaborate-drops.after.panic-abort.mir} | 0 ...Cfg-elaborate-drops.after.panic-unwind.mir | 21 ++ ...yCfg-elaborate-drops.after.panic-abort.mir | 187 ++++++++++++ ...fg-elaborate-drops.after.panic-unwind.mir} | 0 ...Cfg-elaborate-drops.after.panic-abort.mir} | 0 ...Cfg-elaborate-drops.after.panic-unwind.mir | 18 ++ ...Cfg-elaborate-drops.after.panic-abort.mir} | 0 ...Cfg-elaborate-drops.after.panic-unwind.mir | 15 + ...ondition-after-const-prop.panic-abort.diff | 36 +++ ...dition-after-const-prop.panic-unwind.diff} | 0 ....foo.SimplifyLocals-final.panic-abort.diff | 50 ++++ ...oo.SimplifyLocals-final.panic-unwind.diff} | 0 ...yLocals-before-const-prop.panic-abort.diff | 101 +++++++ ...ocals-before-const-prop.panic-unwind.diff} | 0 ...lify_match.main.ConstProp.panic-abort.diff | 33 +++ ...fy_match.main.ConstProp.panic-unwind.diff} | 0 ...in.UnreachablePropagation.panic-abort.diff | 70 +++++ ....UnreachablePropagation.panic-unwind.diff} | 0 ...in.UnreachablePropagation.panic-abort.diff | 71 +++++ ....UnreachablePropagation.panic-unwind.diff} | 0 ...hile_loop.PreCodegen.after.panic-abort.mir | 52 ++++ ...le_loop.PreCodegen.after.panic-unwind.mir} | 0 395 files changed, 11189 insertions(+), 38 deletions(-) create mode 100644 tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir rename tests/mir-opt/{array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir => array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir rename tests/mir-opt/{box_expr.main.ElaborateDrops.before.mir => box_expr.main.ElaborateDrops.before.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-abort.diff rename tests/mir-opt/{combine_array_len.norm2.InstSimplify.diff => combine_array_len.norm2.InstSimplify.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff rename tests/mir-opt/{combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff => combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff} (100%) rename tests/mir-opt/const_prop/{aggregate.foo.ConstProp.diff => aggregate.foo.ConstProp.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-unwind.diff rename tests/mir-opt/const_prop/{aggregate.foo.PreCodegen.after.mir => aggregate.foo.PreCodegen.after.panic-abort.mir} (100%) create mode 100644 tests/mir-opt/const_prop/aggregate.foo.PreCodegen.after.panic-unwind.mir create mode 100644 tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{aggregate.main.ConstProp.diff => aggregate.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-abort.mir rename tests/mir-opt/const_prop/{aggregate.main.PreCodegen.after.mir => aggregate.main.PreCodegen.after.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff rename tests/mir-opt/const_prop/{array_index.main.ConstProp.32bit.diff => array_index.main.ConstProp.32bit.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff rename tests/mir-opt/const_prop/{array_index.main.ConstProp.64bit.diff => array_index.main.ConstProp.64bit.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{bad_op_div_by_zero.main.ConstProp.diff => bad_op_div_by_zero.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{bad_op_mod_by_zero.main.ConstProp.diff => bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff rename tests/mir-opt/const_prop/{bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff => bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff rename tests/mir-opt/const_prop/{bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff => bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{boxes.main.ConstProp.diff => boxes.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{checked_add.main.ConstProp.diff => checked_add.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{const_prop_fails_gracefully.main.ConstProp.diff => const_prop_fails_gracefully.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{control_flow_simplification.hello.ConstProp.diff => control_flow_simplification.hello.ConstProp.panic-unwind.diff} (100%) rename tests/mir-opt/const_prop/{control_flow_simplification.hello.PreCodegen.before.mir => control_flow_simplification.hello.PreCodegen.before.panic-abort.mir} (100%) create mode 100644 tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.panic-unwind.mir create mode 100644 tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{indirect.main.ConstProp.diff => indirect.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{inherit_overflow.main.ConstProp.diff => inherit_overflow.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{issue_66971.main.ConstProp.diff => issue_66971.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{issue_67019.main.ConstProp.diff => issue_67019.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff rename tests/mir-opt/const_prop/{large_array_index.main.ConstProp.32bit.diff => large_array_index.main.ConstProp.32bit.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff rename tests/mir-opt/const_prop/{large_array_index.main.ConstProp.64bit.diff => large_array_index.main.ConstProp.64bit.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{mutable_variable_aggregate_partial_read.main.ConstProp.diff => mutable_variable_aggregate_partial_read.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{mutable_variable_unprop_assign.main.ConstProp.diff => mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff rename tests/mir-opt/const_prop/{repeat.main.ConstProp.32bit.diff => repeat.main.ConstProp.32bit.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff rename tests/mir-opt/const_prop/{repeat.main.ConstProp.64bit.diff => repeat.main.ConstProp.64bit.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{return_place.add.ConstProp.diff => return_place.add.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir rename tests/mir-opt/const_prop/{return_place.add.PreCodegen.before.mir => return_place.add.PreCodegen.before.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{scalar_literal_propagation.main.ConstProp.diff => scalar_literal_propagation.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff rename tests/mir-opt/const_prop/{slice_len.main.ConstProp.32bit.diff => slice_len.main.ConstProp.32bit.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff rename tests/mir-opt/const_prop/{slice_len.main.ConstProp.64bit.diff => slice_len.main.ConstProp.64bit.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{switch_int.main.ConstProp.diff => switch_int.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-abort.diff rename tests/mir-opt/const_prop/{switch_int.main.SimplifyConstCondition-after-const-prop.diff => switch_int.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff rename tests/mir-opt/const_prop/{tuple_literal_propagation.main.ConstProp.diff => tuple_literal_propagation.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-abort.diff rename tests/mir-opt/copy-prop/{borrowed_local.f.CopyProp.diff => borrowed_local.f.CopyProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-abort.diff rename tests/mir-opt/copy-prop/{branch.foo.CopyProp.diff => branch.foo.CopyProp.panic-unwind.diff} (100%) rename tests/mir-opt/copy-prop/{copy_propagation_arg.arg_src.CopyProp.diff => copy_propagation_arg.arg_src.CopyProp.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-unwind.diff create mode 100644 tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-abort.diff rename tests/mir-opt/copy-prop/{copy_propagation_arg.bar.CopyProp.diff => copy_propagation_arg.bar.CopyProp.panic-unwind.diff} (100%) rename tests/mir-opt/copy-prop/{copy_propagation_arg.baz.CopyProp.diff => copy_propagation_arg.baz.CopyProp.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-unwind.diff create mode 100644 tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-abort.diff rename tests/mir-opt/copy-prop/{copy_propagation_arg.foo.CopyProp.diff => copy_propagation_arg.foo.CopyProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-abort.diff rename tests/mir-opt/copy-prop/{custom_move_arg.f.CopyProp.diff => custom_move_arg.f.CopyProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-abort.diff rename tests/mir-opt/copy-prop/{cycle.main.CopyProp.diff => cycle.main.CopyProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-abort.mir rename tests/mir-opt/copy-prop/{dead_stores_79191.f.CopyProp.after.mir => dead_stores_79191.f.CopyProp.after.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-abort.mir rename tests/mir-opt/copy-prop/{dead_stores_better.f.CopyProp.after.mir => dead_stores_better.f.CopyProp.after.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff rename tests/mir-opt/copy-prop/{issue_107511.main.CopyProp.diff => issue_107511.main.CopyProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-abort.diff rename tests/mir-opt/copy-prop/{move_arg.f.CopyProp.diff => move_arg.f.CopyProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-abort.diff rename tests/mir-opt/copy-prop/{move_projection.f.CopyProp.diff => move_projection.f.CopyProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff rename tests/mir-opt/copy-prop/{reborrow.demiraw.CopyProp.diff => reborrow.demiraw.CopyProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff rename tests/mir-opt/copy-prop/{reborrow.miraw.CopyProp.diff => reborrow.miraw.CopyProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-abort.diff rename tests/mir-opt/copy-prop/{reborrow.remut.CopyProp.diff => reborrow.remut.CopyProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-abort.diff rename tests/mir-opt/copy-prop/{reborrow.reraw.CopyProp.diff => reborrow.reraw.CopyProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff rename tests/mir-opt/dataflow-const-prop/{checked.main.DataflowConstProp.diff => checked.main.DataflowConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff rename tests/mir-opt/dataflow-const-prop/{inherit_overflow.main.DataflowConstProp.diff => inherit_overflow.main.DataflowConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff rename tests/mir-opt/dataflow-const-prop/{ref_without_sb.main.DataflowConstProp.diff => ref_without_sb.main.DataflowConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff rename tests/mir-opt/dataflow-const-prop/{sibling_ptr.main.DataflowConstProp.diff => sibling_ptr.main.DataflowConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff rename tests/mir-opt/dataflow-const-prop/{terminator.main.DataflowConstProp.diff => terminator.main.DataflowConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff rename tests/mir-opt/dead-store-elimination/{cycle.cycle.DeadStoreElimination.diff => cycle.cycle.DeadStoreElimination.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff rename tests/mir-opt/{deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff => deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff rename tests/mir-opt/{derefer_complex_case.main.Derefer.diff => derefer_complex_case.main.Derefer.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff rename tests/mir-opt/{derefer_inline_test.main.Derefer.diff => derefer_inline_test.main.Derefer.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff rename tests/mir-opt/{derefer_terminator_test.main.Derefer.diff => derefer_terminator_test.main.Derefer.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff rename tests/mir-opt/dest-prop/{branch.foo.DestinationPropagation.diff => branch.foo.DestinationPropagation.panic-unwind.diff} (100%) rename tests/mir-opt/dest-prop/{copy_propagation_arg.arg_src.DestinationPropagation.diff => copy_propagation_arg.arg_src.DestinationPropagation.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.diff create mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff rename tests/mir-opt/dest-prop/{copy_propagation_arg.bar.DestinationPropagation.diff => copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff} (100%) rename tests/mir-opt/dest-prop/{copy_propagation_arg.baz.DestinationPropagation.diff => copy_propagation_arg.baz.DestinationPropagation.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff create mode 100644 tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff rename tests/mir-opt/dest-prop/{copy_propagation_arg.foo.DestinationPropagation.diff => copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff rename tests/mir-opt/dest-prop/{cycle.main.DestinationPropagation.diff => cycle.main.DestinationPropagation.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir rename tests/mir-opt/dest-prop/{dead_stores_79191.f.DestinationPropagation.after.mir => dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir rename tests/mir-opt/dest-prop/{dead_stores_better.f.DestinationPropagation.after.mir => dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff rename tests/mir-opt/dest-prop/{simple.nrvo.DestinationPropagation.diff => simple.nrvo.DestinationPropagation.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff rename tests/mir-opt/dest-prop/{union.main.DestinationPropagation.diff => union.main.DestinationPropagation.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff rename tests/mir-opt/dest-prop/{unreachable.f.DestinationPropagation.diff => unreachable.f.DestinationPropagation.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff rename tests/mir-opt/{funky_arms.float_to_exponential_common.ConstProp.diff => funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir rename tests/mir-opt/{generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir => generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir rename tests/mir-opt/{generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir => generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff rename tests/mir-opt/inline/{asm_unwind.main.Inline.diff => asm_unwind.main.Inline.panic-unwind.diff} (100%) rename tests/mir-opt/inline/{caller_with_trivial_bound.foo.Inline.diff => caller_with_trivial_bound.foo.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/cycle.f.Inline.panic-abort.diff rename tests/mir-opt/inline/{cycle.f.Inline.diff => cycle.f.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/cycle.g.Inline.panic-abort.diff rename tests/mir-opt/inline/{cycle.g.Inline.diff => cycle.g.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/cycle.main.Inline.panic-abort.diff rename tests/mir-opt/inline/{cycle.main.Inline.diff => cycle.main.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff rename tests/mir-opt/inline/{dyn_trait.get_query.Inline.diff => dyn_trait.get_query.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff rename tests/mir-opt/inline/{dyn_trait.mk_cycle.Inline.diff => dyn_trait.mk_cycle.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff rename tests/mir-opt/inline/{dyn_trait.try_execute_query.Inline.diff => dyn_trait.try_execute_query.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/exponential_runtime.main.Inline.panic-abort.diff rename tests/mir-opt/inline/{exponential_runtime.main.Inline.diff => exponential_runtime.main.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_compatibility.inlined_no_sanitize.Inline.diff => inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff} (95%) create mode 100644 tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_compatibility.inlined_target_feature.Inline.diff => inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff} (95%) create mode 100644 tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_compatibility.not_inlined_c_variadic.Inline.diff => inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff} (97%) create mode 100644 tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_compatibility.not_inlined_no_sanitize.Inline.diff => inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff} (97%) create mode 100644 tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_compatibility.not_inlined_target_feature.Inline.diff => inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff} (97%) create mode 100644 tests/mir-opt/inline/inline_cycle.one.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_cycle.one.Inline.diff => inline_cycle.one.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_cycle.two.Inline.diff => inline_cycle.two.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_cycle_generic.main.Inline.diff => inline_cycle_generic.main.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/inline_diverging.f.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_diverging.f.Inline.diff => inline_diverging.f.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_diverging.g.Inline.diff => inline_diverging.g.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_diverging.h.Inline.diff => inline_diverging.h.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_generator.main.Inline.diff => inline_generator.main.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_into_box_place.main.Inline.diff => inline_into_box_place.main.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/inline_options.main.Inline.after.panic-abort.mir rename tests/mir-opt/inline/{inline_options.main.Inline.after.mir => inline_options.main.Inline.after.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/inline/inline_shims.clone.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_shims.clone.Inline.diff => inline_shims.clone.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_shims.drop.Inline.diff => inline_shims.drop.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/inline_specialization.main.Inline.panic-abort.diff rename tests/mir-opt/inline/{inline_specialization.main.Inline.diff => inline_specialization.main.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir rename tests/mir-opt/inline/{inline_trait_method.test.Inline.after.mir => inline_trait_method.test.Inline.after.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir rename tests/mir-opt/inline/{inline_trait_method_2.test2.Inline.after.mir => inline_trait_method_2.test2.Inline.after.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff rename tests/mir-opt/inline/{issue_106141.outer.Inline.diff => issue_106141.outer.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff rename tests/mir-opt/inline/{issue_78442.bar.Inline.diff => issue_78442.bar.Inline.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff rename tests/mir-opt/inline/{issue_78442.bar.RevealAll.diff => issue_78442.bar.RevealAll.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff rename tests/mir-opt/inline/{unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff => unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff} (100%) rename tests/mir-opt/inline/{unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir => unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir} (100%) create mode 100644 tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir create mode 100644 tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff rename tests/mir-opt/inline/{unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff => unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff} (100%) rename tests/mir-opt/inline/{unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir => unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir} (100%) create mode 100644 tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir create mode 100644 tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff rename tests/mir-opt/inline/{unwrap_unchecked.unwrap_unchecked.Inline.diff => unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff} (100%) rename tests/mir-opt/inline/{unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir => unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir} (100%) create mode 100644 tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir create mode 100644 tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff rename tests/mir-opt/{issue_101973.inner.ConstProp.diff => issue_101973.inner.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-abort.mir rename tests/mir-opt/{issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.mir => issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-unwind.mir} (100%) rename tests/mir-opt/{issue_41110.main.ElaborateDrops.diff => issue_41110.main.ElaborateDrops.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff create mode 100644 tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff rename tests/mir-opt/{issue_41110.test.ElaborateDrops.diff => issue_41110.test.ElaborateDrops.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff rename tests/mir-opt/{issue_41888.main.ElaborateDrops.diff => issue_41888.main.ElaborateDrops.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir rename tests/mir-opt/{issue_62289.test.ElaborateDrops.before.mir => issue_62289.test.ElaborateDrops.before.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff rename tests/mir-opt/{issue_76432.test.SimplifyComparisonIntegral.diff => issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir rename tests/mir-opt/issues/{issue_59352.num_to_digit.PreCodegen.after.mir => issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff rename tests/mir-opt/{lower_array_len.array_bound.NormalizeArrayLen.diff => lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff rename tests/mir-opt/{lower_array_len.array_bound_mut.NormalizeArrayLen.diff => lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff} (100%) rename tests/mir-opt/{lower_array_len.array_len.NormalizeArrayLen.diff => lower_array_len.array_len.NormalizeArrayLen.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-unwind.diff rename tests/mir-opt/{lower_array_len.array_len_by_value.NormalizeArrayLen.diff => lower_array_len.array_len_by_value.NormalizeArrayLen.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.panic-unwind.diff rename tests/mir-opt/{lower_array_len.array_len_raw.NormalizeArrayLen.diff => lower_array_len.array_len_raw.NormalizeArrayLen.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-unwind.diff rename tests/mir-opt/{lower_array_len.array_len_reborrow.NormalizeArrayLen.diff => lower_array_len.array_len_reborrow.NormalizeArrayLen.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.align_of.LowerIntrinsics.diff => lower_intrinsics.align_of.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.assume.LowerIntrinsics.diff => lower_intrinsics.assume.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-unwind.diff create mode 100644 tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-abort.diff rename tests/mir-opt/{lower_intrinsics.discriminant.LowerIntrinsics.diff => lower_intrinsics.discriminant.LowerIntrinsics.panic-unwind.diff} (100%) rename tests/mir-opt/{lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff => lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.forget.LowerIntrinsics.diff => lower_intrinsics.forget.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.non_const.LowerIntrinsics.diff => lower_intrinsics.non_const.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.option_payload.LowerIntrinsics.diff => lower_intrinsics.option_payload.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.ptr_offset.LowerIntrinsics.diff => lower_intrinsics.ptr_offset.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff => lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff => lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.size_of.LowerIntrinsics.diff => lower_intrinsics.size_of.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff => lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff => lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff => lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff => lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff => lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff => lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.unchecked.LowerIntrinsics.diff => lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.unreachable.LowerIntrinsics.diff => lower_intrinsics.unreachable.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.with_overflow.LowerIntrinsics.diff => lower_intrinsics.with_overflow.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.wrapping.LowerIntrinsics.diff => lower_intrinsics.wrapping.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-unwind.diff rename tests/mir-opt/{lower_intrinsics.write_via_move_string.LowerIntrinsics.diff => lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-unwind.diff create mode 100644 tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff rename tests/mir-opt/{lower_slice_len.bound.LowerSliceLenCalls.diff => lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff} (100%) rename tests/mir-opt/{match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff => match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff} (100%) create mode 100644 tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff create mode 100644 tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-abort.mir rename tests/mir-opt/{no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir => no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir rename tests/mir-opt/{no_spurious_drop_after_call.main.ElaborateDrops.before.mir => no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-abort.diff rename tests/mir-opt/{nrvo_simple.nrvo.RenameReturnPlace.diff => nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir rename tests/mir-opt/{packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir => packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff rename tests/mir-opt/pre-codegen/{optimizes_into_variable.main.ConstProp.32bit.diff => optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff rename tests/mir-opt/pre-codegen/{optimizes_into_variable.main.ConstProp.64bit.diff => optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff} (100%) rename tests/mir-opt/pre-codegen/{optimizes_into_variable.main.PreCodegen.after.32bit.mir => optimizes_into_variable.main.PreCodegen.after.32bit.panic-abort.mir} (100%) rename tests/mir-opt/pre-codegen/{optimizes_into_variable.main.PreCodegen.after.64bit.mir => optimizes_into_variable.main.PreCodegen.after.32bit.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-abort.mir create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-unwind.mir create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff rename tests/mir-opt/pre-codegen/{optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff => optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff rename tests/mir-opt/pre-codegen/{optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff => optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff} (100%) rename tests/mir-opt/pre-codegen/{optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir => optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-abort.mir} (100%) rename tests/mir-opt/pre-codegen/{optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir => optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-abort.mir create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-unwind.mir create mode 100644 tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir rename tests/mir-opt/pre-codegen/{range_iter.forward_loop.PreCodegen.after.mir => range_iter.forward_loop.PreCodegen.after.panic-unwind.mir} (98%) create mode 100644 tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir rename tests/mir-opt/pre-codegen/{range_iter.inclusive_loop.PreCodegen.after.mir => range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir} (97%) create mode 100644 tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir rename tests/mir-opt/pre-codegen/{range_iter.range_inclusive_iter_next.PreCodegen.after.mir => range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir} (95%) create mode 100644 tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir rename tests/mir-opt/pre-codegen/{range_iter.range_iter_next.PreCodegen.after.mir => range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir} (98%) rename tests/mir-opt/pre-codegen/{slice_index.slice_get_mut_usize.PreCodegen.after.mir => slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir} (99%) create mode 100644 tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir rename tests/mir-opt/pre-codegen/{slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir => slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir} (99%) create mode 100644 tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir create mode 100644 tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir rename tests/mir-opt/pre-codegen/{slice_index.slice_index_range.PreCodegen.after.mir => slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir} (98%) create mode 100644 tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir rename tests/mir-opt/pre-codegen/{slice_index.slice_index_usize.PreCodegen.after.mir => slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir rename tests/mir-opt/pre-codegen/{slice_iter.enumerated_loop.PreCodegen.after.mir => slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir} (98%) create mode 100644 tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir rename tests/mir-opt/pre-codegen/{slice_iter.forward_loop.PreCodegen.after.mir => slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir} (99%) create mode 100644 tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir rename tests/mir-opt/pre-codegen/{slice_iter.range_loop.PreCodegen.after.mir => slice_iter.range_loop.PreCodegen.after.panic-unwind.mir} (98%) create mode 100644 tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir rename tests/mir-opt/pre-codegen/{slice_iter.reverse_loop.PreCodegen.after.mir => slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir} (98%) create mode 100644 tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir rename tests/mir-opt/pre-codegen/{slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir => slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir} (98%) create mode 100644 tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir rename tests/mir-opt/pre-codegen/{slice_iter.slice_iter_next.PreCodegen.after.mir => slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir} (97%) rename tests/mir-opt/{remove_fake_borrows.match_guard.CleanupPostBorrowck.diff => remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff} (100%) create mode 100644 tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff create mode 100644 tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff rename tests/mir-opt/{remove_storage_markers.main.RemoveStorageMarkers.diff => remove_storage_markers.main.RemoveStorageMarkers.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-abort.diff rename tests/mir-opt/{remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff => remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-abort.diff rename tests/mir-opt/{remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff => remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-abort.diff rename tests/mir-opt/{remove_unneeded_drops.opt.RemoveUnneededDrops.diff => remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-abort.diff rename tests/mir-opt/{remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff => remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-abort.mir rename tests/mir-opt/{retag.array_casts.SimplifyCfg-elaborate-drops.after.mir => retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir} (100%) create mode 100644 tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-abort.mir rename tests/mir-opt/{retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir => retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-unwind.mir} (100%) rename tests/mir-opt/{retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.mir => retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir} (100%) create mode 100644 tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-unwind.mir create mode 100644 tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir rename tests/mir-opt/{retag.main.SimplifyCfg-elaborate-drops.after.mir => retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir} (100%) rename tests/mir-opt/{retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir => retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir} (100%) create mode 100644 tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir rename tests/mir-opt/{retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.mir => retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir} (100%) create mode 100644 tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir create mode 100644 tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff rename tests/mir-opt/{simplify_if.main.SimplifyConstCondition-after-const-prop.diff => simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-abort.diff rename tests/mir-opt/{simplify_locals_fixedpoint.foo.SimplifyLocals-final.diff => simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-abort.diff rename tests/mir-opt/{simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.diff => simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff rename tests/mir-opt/{simplify_match.main.ConstProp.diff => simplify_match.main.ConstProp.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/unreachable.main.UnreachablePropagation.panic-abort.diff rename tests/mir-opt/{unreachable.main.UnreachablePropagation.diff => unreachable.main.UnreachablePropagation.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff rename tests/mir-opt/{unreachable_diverging.main.UnreachablePropagation.diff => unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-abort.mir rename tests/mir-opt/{while_storage.while_loop.PreCodegen.after.mir => while_storage.while_loop.PreCodegen.after.panic-unwind.mir} (100%) diff --git a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir new file mode 100644 index 00000000000..6351d58f7d2 --- /dev/null +++ b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir @@ -0,0 +1,64 @@ +// MIR for `main` after SimplifyCfg-elaborate-drops + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/array_index_is_temporary.rs:+0:11: +0:11 + let mut _1: [u32; 3]; // in scope 0 at $DIR/array_index_is_temporary.rs:+1:9: +1:14 + let mut _4: &mut usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+3:25: +3:31 + let mut _5: u32; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:12: +4:29 + let mut _6: *mut usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:25: +4:26 + let _7: usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:7: +4:8 + let mut _8: usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:5: +4:9 + let mut _9: bool; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:5: +4:9 + scope 1 { + debug x => _1; // in scope 1 at $DIR/array_index_is_temporary.rs:+1:9: +1:14 + let mut _2: usize; // in scope 1 at $DIR/array_index_is_temporary.rs:+2:9: +2:14 + scope 2 { + debug y => _2; // in scope 2 at $DIR/array_index_is_temporary.rs:+2:9: +2:14 + let _3: *mut usize; // in scope 2 at $DIR/array_index_is_temporary.rs:+3:9: +3:10 + scope 3 { + debug z => _3; // in scope 3 at $DIR/array_index_is_temporary.rs:+3:9: +3:10 + scope 4 { + } + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/array_index_is_temporary.rs:+1:9: +1:14 + _1 = [const 42_u32, const 43_u32, const 44_u32]; // scope 0 at $DIR/array_index_is_temporary.rs:+1:17: +1:29 + StorageLive(_2); // scope 1 at $DIR/array_index_is_temporary.rs:+2:9: +2:14 + _2 = const 1_usize; // scope 1 at $DIR/array_index_is_temporary.rs:+2:17: +2:18 + StorageLive(_3); // scope 2 at $DIR/array_index_is_temporary.rs:+3:9: +3:10 + StorageLive(_4); // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31 + _4 = &mut _2; // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31 + _3 = &raw mut (*_4); // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31 + StorageDead(_4); // scope 2 at $DIR/array_index_is_temporary.rs:+3:31: +3:32 + StorageLive(_5); // scope 3 at $DIR/array_index_is_temporary.rs:+4:12: +4:29 + StorageLive(_6); // scope 4 at $DIR/array_index_is_temporary.rs:+4:25: +4:26 + _6 = _3; // scope 4 at $DIR/array_index_is_temporary.rs:+4:25: +4:26 + _5 = foo(move _6) -> [return: bb1, unwind unreachable]; // scope 4 at $DIR/array_index_is_temporary.rs:+4:21: +4:27 + // mir::Constant + // + span: $DIR/array_index_is_temporary.rs:17:21: 17:24 + // + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value() } + } + + bb1: { + StorageDead(_6); // scope 4 at $DIR/array_index_is_temporary.rs:+4:26: +4:27 + StorageLive(_7); // scope 3 at $DIR/array_index_is_temporary.rs:+4:7: +4:8 + _7 = _2; // scope 3 at $DIR/array_index_is_temporary.rs:+4:7: +4:8 + _8 = Len(_1); // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9 + _9 = Lt(_7, _8); // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9 + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind unreachable]; // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9 + } + + bb2: { + _1[_7] = move _5; // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:29 + StorageDead(_5); // scope 3 at $DIR/array_index_is_temporary.rs:+4:28: +4:29 + StorageDead(_7); // scope 3 at $DIR/array_index_is_temporary.rs:+4:29: +4:30 + _0 = const (); // scope 0 at $DIR/array_index_is_temporary.rs:+0:11: +5:2 + StorageDead(_3); // scope 2 at $DIR/array_index_is_temporary.rs:+5:1: +5:2 + StorageDead(_2); // scope 1 at $DIR/array_index_is_temporary.rs:+5:1: +5:2 + StorageDead(_1); // scope 0 at $DIR/array_index_is_temporary.rs:+5:1: +5:2 + return; // scope 0 at $DIR/array_index_is_temporary.rs:+5:2: +5:2 + } +} diff --git a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir rename to tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir new file mode 100644 index 00000000000..2c0a3af7302 --- /dev/null +++ b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir @@ -0,0 +1,80 @@ +// MIR for `main` before ElaborateDrops + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/box_expr.rs:+0:11: +0:11 + let _1: std::boxed::Box; // in scope 0 at $DIR/box_expr.rs:+1:9: +1:10 + let mut _2: usize; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23 + let mut _3: usize; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23 + let mut _4: *mut u8; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23 + let mut _5: std::boxed::Box; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23 + let _6: (); // in scope 0 at $DIR/box_expr.rs:+3:5: +3:12 + let mut _7: std::boxed::Box; // in scope 0 at $DIR/box_expr.rs:+3:10: +3:11 + scope 1 { + debug x => _1; // in scope 1 at $DIR/box_expr.rs:+1:9: +1:10 + } + scope 2 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/box_expr.rs:+1:9: +1:10 + _2 = SizeOf(S); // scope 2 at $DIR/box_expr.rs:+2:5: +2:23 + _3 = AlignOf(S); // scope 2 at $DIR/box_expr.rs:+2:5: +2:23 + _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind: bb9]; // scope 2 at $DIR/box_expr.rs:+2:5: +2:23 + // mir::Constant + // + span: $DIR/box_expr.rs:8:5: 8:23 + // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } + } + + bb1: { + StorageLive(_5); // scope 0 at $DIR/box_expr.rs:+2:5: +2:23 + _5 = ShallowInitBox(move _4, S); // scope 0 at $DIR/box_expr.rs:+2:5: +2:23 + (*_5) = S::new() -> [return: bb2, unwind: bb8]; // scope 0 at $DIR/box_expr.rs:+2:14: +2:22 + // mir::Constant + // + span: $DIR/box_expr.rs:8:14: 8:20 + // + literal: Const { ty: fn() -> S {S::new}, val: Value() } + } + + bb2: { + _1 = move _5; // scope 0 at $DIR/box_expr.rs:+2:5: +2:23 + drop(_5) -> [return: bb3, unwind: bb9]; // scope 0 at $DIR/box_expr.rs:+2:22: +2:23 + } + + bb3: { + StorageDead(_5); // scope 0 at $DIR/box_expr.rs:+2:22: +2:23 + StorageLive(_6); // scope 1 at $DIR/box_expr.rs:+3:5: +3:12 + StorageLive(_7); // scope 1 at $DIR/box_expr.rs:+3:10: +3:11 + _7 = move _1; // scope 1 at $DIR/box_expr.rs:+3:10: +3:11 + _6 = std::mem::drop::>(move _7) -> [return: bb4, unwind: bb6]; // scope 1 at $DIR/box_expr.rs:+3:5: +3:12 + // mir::Constant + // + span: $DIR/box_expr.rs:9:5: 9:9 + // + literal: Const { ty: fn(Box) {std::mem::drop::>}, val: Value() } + } + + bb4: { + StorageDead(_7); // scope 1 at $DIR/box_expr.rs:+3:11: +3:12 + StorageDead(_6); // scope 1 at $DIR/box_expr.rs:+3:12: +3:13 + _0 = const (); // scope 0 at $DIR/box_expr.rs:+0:11: +4:2 + drop(_1) -> [return: bb5, unwind: bb9]; // scope 0 at $DIR/box_expr.rs:+4:1: +4:2 + } + + bb5: { + StorageDead(_1); // scope 0 at $DIR/box_expr.rs:+4:1: +4:2 + return; // scope 0 at $DIR/box_expr.rs:+4:2: +4:2 + } + + bb6 (cleanup): { + drop(_7) -> [return: bb7, unwind terminate]; // scope 1 at $DIR/box_expr.rs:+3:11: +3:12 + } + + bb7 (cleanup): { + drop(_1) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/box_expr.rs:+4:1: +4:2 + } + + bb8 (cleanup): { + drop(_5) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/box_expr.rs:+2:22: +2:23 + } + + bb9 (cleanup): { + resume; // scope 0 at $DIR/box_expr.rs:+0:1: +4:2 + } +} diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.before.mir b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir similarity index 100% rename from tests/mir-opt/box_expr.main.ElaborateDrops.before.mir rename to tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir diff --git a/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-abort.diff b/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-abort.diff new file mode 100644 index 00000000000..33dd4a90265 --- /dev/null +++ b/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-abort.diff @@ -0,0 +1,77 @@ +- // MIR for `norm2` before InstSimplify ++ // MIR for `norm2` after InstSimplify + + fn norm2(_1: [f32; 2]) -> f32 { + debug x => _1; // in scope 0 at $DIR/combine_array_len.rs:+0:10: +0:11 + let mut _0: f32; // return place in scope 0 at $DIR/combine_array_len.rs:+0:26: +0:29 + let _2: f32; // in scope 0 at $DIR/combine_array_len.rs:+1:9: +1:10 + let _3: usize; // in scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16 + let mut _4: usize; // in scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 + let mut _5: bool; // in scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 + let _7: usize; // in scope 0 at $DIR/combine_array_len.rs:+2:15: +2:16 + let mut _8: usize; // in scope 0 at $DIR/combine_array_len.rs:+2:13: +2:17 + let mut _9: bool; // in scope 0 at $DIR/combine_array_len.rs:+2:13: +2:17 + let mut _10: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:5: +3:8 + let mut _11: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:5: +3:6 + let mut _12: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:7: +3:8 + let mut _13: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:11: +3:14 + let mut _14: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:11: +3:12 + let mut _15: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:13: +3:14 + scope 1 { + debug a => _2; // in scope 1 at $DIR/combine_array_len.rs:+1:9: +1:10 + let _6: f32; // in scope 1 at $DIR/combine_array_len.rs:+2:9: +2:10 + scope 2 { + debug b => _6; // in scope 2 at $DIR/combine_array_len.rs:+2:9: +2:10 + } + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/combine_array_len.rs:+1:9: +1:10 + StorageLive(_3); // scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16 + _3 = const 0_usize; // scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16 +- _4 = Len(_1); // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 ++ _4 = const 2_usize; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 + _5 = Lt(_3, _4); // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 + assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 + } + + bb1: { + _2 = _1[_3]; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 + StorageDead(_3); // scope 0 at $DIR/combine_array_len.rs:+1:17: +1:18 + StorageLive(_6); // scope 1 at $DIR/combine_array_len.rs:+2:9: +2:10 + StorageLive(_7); // scope 1 at $DIR/combine_array_len.rs:+2:15: +2:16 + _7 = const 1_usize; // scope 1 at $DIR/combine_array_len.rs:+2:15: +2:16 +- _8 = Len(_1); // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17 ++ _8 = const 2_usize; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17 + _9 = Lt(_7, _8); // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17 + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17 + } + + bb2: { + _6 = _1[_7]; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17 + StorageDead(_7); // scope 1 at $DIR/combine_array_len.rs:+2:17: +2:18 + StorageLive(_10); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:8 + StorageLive(_11); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:6 + _11 = _2; // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:6 + StorageLive(_12); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8 + _12 = _2; // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8 + _10 = Mul(move _11, move _12); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:8 + StorageDead(_12); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8 + StorageDead(_11); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8 + StorageLive(_13); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:14 + StorageLive(_14); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:12 + _14 = _6; // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:12 + StorageLive(_15); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 + _15 = _6; // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 + _13 = Mul(move _14, move _15); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:14 + StorageDead(_15); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 + StorageDead(_14); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 + _0 = Add(move _10, move _13); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:14 + StorageDead(_13); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 + StorageDead(_10); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 + StorageDead(_6); // scope 1 at $DIR/combine_array_len.rs:+4:1: +4:2 + StorageDead(_2); // scope 0 at $DIR/combine_array_len.rs:+4:1: +4:2 + return; // scope 0 at $DIR/combine_array_len.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/combine_array_len.norm2.InstSimplify.diff b/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-unwind.diff similarity index 100% rename from tests/mir-opt/combine_array_len.norm2.InstSimplify.diff rename to tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-unwind.diff diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff new file mode 100644 index 00000000000..6ca960935ba --- /dev/null +++ b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff @@ -0,0 +1,74 @@ +- // MIR for `::clone` before InstSimplify ++ // MIR for `::clone` after InstSimplify + + fn ::clone(_1: &MyThing) -> MyThing { + debug self => _1; // in scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15 + let mut _0: MyThing; // return place in scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15 + let mut _2: T; // in scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + let mut _3: &T; // in scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + let _4: &T; // in scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + let mut _5: u64; // in scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 + let mut _6: &u64; // in scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 + let _7: &u64; // in scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 + let mut _8: [f32; 3]; // in scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 + let mut _9: &[f32; 3]; // in scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 + let _10: &[f32; 3]; // in scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + StorageLive(_3); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + StorageLive(_4); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + _4 = &((*_1).0: T); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 +- _3 = &(*_4); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 ++ _3 = _4; // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + _2 = ::clone(move _3) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + // mir::Constant + // + span: $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + // + literal: Const { ty: for<'a> fn(&'a T) -> T {::clone}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:8: 8:9 + StorageLive(_5); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 + StorageLive(_6); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 + StorageLive(_7); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 + _7 = &((*_1).1: u64); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 +- _6 = &(*_7); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 +- _5 = ::clone(move _6) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 +- // mir::Constant +- // + span: $DIR/combine_clone_of_primitives.rs:9:5: 9:11 +- // + literal: Const { ty: for<'a> fn(&'a u64) -> u64 {::clone}, val: Value() } ++ _6 = _7; // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 ++ _5 = (*_6); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 ++ goto -> bb2; // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 + } + + bb2: { + StorageDead(_6); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:10: 9:11 + StorageLive(_8); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 + StorageLive(_9); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 + StorageLive(_10); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 + _10 = &((*_1).2: [f32; 3]); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 +- _9 = &(*_10); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 +- _8 = <[f32; 3] as Clone>::clone(move _9) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 +- // mir::Constant +- // + span: $DIR/combine_clone_of_primitives.rs:10:5: 10:16 +- // + literal: Const { ty: for<'a> fn(&'a [f32; 3]) -> [f32; 3] {<[f32; 3] as Clone>::clone}, val: Value() } ++ _9 = _10; // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 ++ _8 = (*_9); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 ++ goto -> bb3; // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 + } + + bb3: { + StorageDead(_9); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:15: 10:16 + _0 = MyThing:: { v: move _2, i: move _5, a: move _8 }; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15 + StorageDead(_8); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 + StorageDead(_5); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 + StorageDead(_2); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 + StorageDead(_10); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 + StorageDead(_7); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 + StorageDead(_4); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 + return; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:15: +0:15 + } + } + diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff similarity index 100% rename from tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff rename to tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/aggregate.foo.ConstProp.diff b/tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-abort.diff similarity index 100% rename from tests/mir-opt/const_prop/aggregate.foo.ConstProp.diff rename to tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-abort.diff diff --git a/tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-unwind.diff new file mode 100644 index 00000000000..6ac460db86f --- /dev/null +++ b/tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-unwind.diff @@ -0,0 +1,55 @@ +- // MIR for `foo` before ConstProp ++ // MIR for `foo` after ConstProp + + fn foo(_1: u8) -> () { + debug x => _1; // in scope 0 at $DIR/aggregate.rs:+0:8: +0:9 + let mut _0: (); // return place in scope 0 at $DIR/aggregate.rs:+0:15: +0:15 + let _2: i32; // in scope 0 at $DIR/aggregate.rs:+2:9: +2:14 + let mut _3: i32; // in scope 0 at $DIR/aggregate.rs:+2:17: +2:25 + let mut _4: (i32, u8); // in scope 0 at $DIR/aggregate.rs:+2:17: +2:23 + let mut _5: u8; // in scope 0 at $DIR/aggregate.rs:+2:21: +2:22 + let mut _7: i32; // in scope 0 at $DIR/aggregate.rs:+3:18: +3:26 + let mut _8: (u8, i32); // in scope 0 at $DIR/aggregate.rs:+3:18: +3:24 + let mut _9: u8; // in scope 0 at $DIR/aggregate.rs:+3:19: +3:20 + scope 1 { + debug first => _2; // in scope 1 at $DIR/aggregate.rs:+2:9: +2:14 + let _6: i32; // in scope 1 at $DIR/aggregate.rs:+3:9: +3:15 + scope 2 { + debug second => _6; // in scope 2 at $DIR/aggregate.rs:+3:9: +3:15 + } + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/aggregate.rs:+2:9: +2:14 + StorageLive(_3); // scope 0 at $DIR/aggregate.rs:+2:17: +2:25 + StorageLive(_4); // scope 0 at $DIR/aggregate.rs:+2:17: +2:23 + StorageLive(_5); // scope 0 at $DIR/aggregate.rs:+2:21: +2:22 + _5 = _1; // scope 0 at $DIR/aggregate.rs:+2:21: +2:22 + _4 = (const 0_i32, move _5); // scope 0 at $DIR/aggregate.rs:+2:17: +2:23 + StorageDead(_5); // scope 0 at $DIR/aggregate.rs:+2:22: +2:23 +- _3 = (_4.0: i32); // scope 0 at $DIR/aggregate.rs:+2:17: +2:25 +- _2 = Add(move _3, const 1_i32); // scope 0 at $DIR/aggregate.rs:+2:17: +2:29 ++ _3 = const 0_i32; // scope 0 at $DIR/aggregate.rs:+2:17: +2:25 ++ _2 = const 1_i32; // scope 0 at $DIR/aggregate.rs:+2:17: +2:29 + StorageDead(_3); // scope 0 at $DIR/aggregate.rs:+2:28: +2:29 + StorageDead(_4); // scope 0 at $DIR/aggregate.rs:+2:29: +2:30 + StorageLive(_6); // scope 1 at $DIR/aggregate.rs:+3:9: +3:15 + StorageLive(_7); // scope 1 at $DIR/aggregate.rs:+3:18: +3:26 + StorageLive(_8); // scope 1 at $DIR/aggregate.rs:+3:18: +3:24 + StorageLive(_9); // scope 1 at $DIR/aggregate.rs:+3:19: +3:20 + _9 = _1; // scope 1 at $DIR/aggregate.rs:+3:19: +3:20 + _8 = (move _9, const 1_i32); // scope 1 at $DIR/aggregate.rs:+3:18: +3:24 + StorageDead(_9); // scope 1 at $DIR/aggregate.rs:+3:23: +3:24 +- _7 = (_8.1: i32); // scope 1 at $DIR/aggregate.rs:+3:18: +3:26 +- _6 = Add(move _7, const 2_i32); // scope 1 at $DIR/aggregate.rs:+3:18: +3:30 ++ _7 = const 1_i32; // scope 1 at $DIR/aggregate.rs:+3:18: +3:26 ++ _6 = const 3_i32; // scope 1 at $DIR/aggregate.rs:+3:18: +3:30 + StorageDead(_7); // scope 1 at $DIR/aggregate.rs:+3:29: +3:30 + StorageDead(_8); // scope 1 at $DIR/aggregate.rs:+3:30: +3:31 + _0 = const (); // scope 0 at $DIR/aggregate.rs:+0:15: +4:2 + StorageDead(_6); // scope 1 at $DIR/aggregate.rs:+4:1: +4:2 + StorageDead(_2); // scope 0 at $DIR/aggregate.rs:+4:1: +4:2 + return; // scope 0 at $DIR/aggregate.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/const_prop/aggregate.foo.PreCodegen.after.mir b/tests/mir-opt/const_prop/aggregate.foo.PreCodegen.after.panic-abort.mir similarity index 100% rename from tests/mir-opt/const_prop/aggregate.foo.PreCodegen.after.mir rename to tests/mir-opt/const_prop/aggregate.foo.PreCodegen.after.panic-abort.mir diff --git a/tests/mir-opt/const_prop/aggregate.foo.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/const_prop/aggregate.foo.PreCodegen.after.panic-unwind.mir new file mode 100644 index 00000000000..2ef6d74e528 --- /dev/null +++ b/tests/mir-opt/const_prop/aggregate.foo.PreCodegen.after.panic-unwind.mir @@ -0,0 +1,49 @@ +// MIR for `foo` after PreCodegen + +fn foo(_1: u8) -> () { + debug x => _1; // in scope 0 at $DIR/aggregate.rs:+0:8: +0:9 + let mut _0: (); // return place in scope 0 at $DIR/aggregate.rs:+0:15: +0:15 + let _2: i32; // in scope 0 at $DIR/aggregate.rs:+2:9: +2:14 + let mut _3: i32; // in scope 0 at $DIR/aggregate.rs:+2:17: +2:25 + let mut _4: (i32, u8); // in scope 0 at $DIR/aggregate.rs:+2:17: +2:23 + let mut _5: u8; // in scope 0 at $DIR/aggregate.rs:+2:21: +2:22 + let mut _7: i32; // in scope 0 at $DIR/aggregate.rs:+3:18: +3:26 + let mut _8: (u8, i32); // in scope 0 at $DIR/aggregate.rs:+3:18: +3:24 + let mut _9: u8; // in scope 0 at $DIR/aggregate.rs:+3:19: +3:20 + scope 1 { + debug first => _2; // in scope 1 at $DIR/aggregate.rs:+2:9: +2:14 + let _6: i32; // in scope 1 at $DIR/aggregate.rs:+3:9: +3:15 + scope 2 { + debug second => _6; // in scope 2 at $DIR/aggregate.rs:+3:9: +3:15 + } + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/aggregate.rs:+2:9: +2:14 + StorageLive(_3); // scope 0 at $DIR/aggregate.rs:+2:17: +2:25 + StorageLive(_4); // scope 0 at $DIR/aggregate.rs:+2:17: +2:23 + StorageLive(_5); // scope 0 at $DIR/aggregate.rs:+2:21: +2:22 + _5 = _1; // scope 0 at $DIR/aggregate.rs:+2:21: +2:22 + _4 = (const 0_i32, move _5); // scope 0 at $DIR/aggregate.rs:+2:17: +2:23 + StorageDead(_5); // scope 0 at $DIR/aggregate.rs:+2:22: +2:23 + _3 = const 0_i32; // scope 0 at $DIR/aggregate.rs:+2:17: +2:25 + _2 = const 1_i32; // scope 0 at $DIR/aggregate.rs:+2:17: +2:29 + StorageDead(_3); // scope 0 at $DIR/aggregate.rs:+2:28: +2:29 + StorageDead(_4); // scope 0 at $DIR/aggregate.rs:+2:29: +2:30 + StorageLive(_6); // scope 1 at $DIR/aggregate.rs:+3:9: +3:15 + StorageLive(_7); // scope 1 at $DIR/aggregate.rs:+3:18: +3:26 + StorageLive(_8); // scope 1 at $DIR/aggregate.rs:+3:18: +3:24 + StorageLive(_9); // scope 1 at $DIR/aggregate.rs:+3:19: +3:20 + _9 = _1; // scope 1 at $DIR/aggregate.rs:+3:19: +3:20 + _8 = (move _9, const 1_i32); // scope 1 at $DIR/aggregate.rs:+3:18: +3:24 + StorageDead(_9); // scope 1 at $DIR/aggregate.rs:+3:23: +3:24 + _7 = const 1_i32; // scope 1 at $DIR/aggregate.rs:+3:18: +3:26 + _6 = const 3_i32; // scope 1 at $DIR/aggregate.rs:+3:18: +3:30 + StorageDead(_7); // scope 1 at $DIR/aggregate.rs:+3:29: +3:30 + StorageDead(_8); // scope 1 at $DIR/aggregate.rs:+3:30: +3:31 + _0 = const (); // scope 0 at $DIR/aggregate.rs:+0:15: +4:2 + StorageDead(_6); // scope 1 at $DIR/aggregate.rs:+4:1: +4:2 + StorageDead(_2); // scope 0 at $DIR/aggregate.rs:+4:1: +4:2 + return; // scope 0 at $DIR/aggregate.rs:+4:2: +4:2 + } +} diff --git a/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..130c0a8d38c --- /dev/null +++ b/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff @@ -0,0 +1,44 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/aggregate.rs:+0:11: +0:11 + let _1: u8; // in scope 0 at $DIR/aggregate.rs:+1:9: +1:10 + let mut _2: u8; // in scope 0 at $DIR/aggregate.rs:+1:13: +1:24 + let mut _3: (i32, u8, i32); // in scope 0 at $DIR/aggregate.rs:+1:13: +1:22 + let _4: (); // in scope 0 at $DIR/aggregate.rs:+2:5: +2:11 + let mut _5: u8; // in scope 0 at $DIR/aggregate.rs:+2:9: +2:10 + scope 1 { + debug x => _1; // in scope 1 at $DIR/aggregate.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/aggregate.rs:+1:9: +1:10 + StorageLive(_2); // scope 0 at $DIR/aggregate.rs:+1:13: +1:24 + StorageLive(_3); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22 + _3 = (const 0_i32, const 1_u8, const 2_i32); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22 +- _2 = (_3.1: u8); // scope 0 at $DIR/aggregate.rs:+1:13: +1:24 +- _1 = Add(move _2, const 0_u8); // scope 0 at $DIR/aggregate.rs:+1:13: +1:28 ++ _2 = const 1_u8; // scope 0 at $DIR/aggregate.rs:+1:13: +1:24 ++ _1 = const 1_u8; // scope 0 at $DIR/aggregate.rs:+1:13: +1:28 + StorageDead(_2); // scope 0 at $DIR/aggregate.rs:+1:27: +1:28 + StorageDead(_3); // scope 0 at $DIR/aggregate.rs:+1:28: +1:29 + StorageLive(_4); // scope 1 at $DIR/aggregate.rs:+2:5: +2:11 + StorageLive(_5); // scope 1 at $DIR/aggregate.rs:+2:9: +2:10 +- _5 = _1; // scope 1 at $DIR/aggregate.rs:+2:9: +2:10 ++ _5 = const 1_u8; // scope 1 at $DIR/aggregate.rs:+2:9: +2:10 + _4 = foo(move _5) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/aggregate.rs:+2:5: +2:11 + // mir::Constant + // + span: $DIR/aggregate.rs:9:5: 9:8 + // + literal: Const { ty: fn(u8) {foo}, val: Value() } + } + + bb1: { + StorageDead(_5); // scope 1 at $DIR/aggregate.rs:+2:10: +2:11 + StorageDead(_4); // scope 1 at $DIR/aggregate.rs:+2:11: +2:12 + _0 = const (); // scope 0 at $DIR/aggregate.rs:+0:11: +3:2 + StorageDead(_1); // scope 0 at $DIR/aggregate.rs:+3:1: +3:2 + return; // scope 0 at $DIR/aggregate.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/const_prop/aggregate.main.ConstProp.diff b/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/aggregate.main.ConstProp.diff rename to tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-abort.mir b/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..06243db8b7e --- /dev/null +++ b/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-abort.mir @@ -0,0 +1,39 @@ +// MIR for `main` after PreCodegen + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/aggregate.rs:+0:11: +0:11 + let _1: u8; // in scope 0 at $DIR/aggregate.rs:+1:9: +1:10 + let mut _2: u8; // in scope 0 at $DIR/aggregate.rs:+1:13: +1:24 + let mut _3: (i32, u8, i32); // in scope 0 at $DIR/aggregate.rs:+1:13: +1:22 + let _4: (); // in scope 0 at $DIR/aggregate.rs:+2:5: +2:11 + let mut _5: u8; // in scope 0 at $DIR/aggregate.rs:+2:9: +2:10 + scope 1 { + debug x => _1; // in scope 1 at $DIR/aggregate.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/aggregate.rs:+1:9: +1:10 + StorageLive(_2); // scope 0 at $DIR/aggregate.rs:+1:13: +1:24 + StorageLive(_3); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22 + _3 = (const 0_i32, const 1_u8, const 2_i32); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22 + _2 = const 1_u8; // scope 0 at $DIR/aggregate.rs:+1:13: +1:24 + _1 = const 1_u8; // scope 0 at $DIR/aggregate.rs:+1:13: +1:28 + StorageDead(_2); // scope 0 at $DIR/aggregate.rs:+1:27: +1:28 + StorageDead(_3); // scope 0 at $DIR/aggregate.rs:+1:28: +1:29 + StorageLive(_4); // scope 1 at $DIR/aggregate.rs:+2:5: +2:11 + StorageLive(_5); // scope 1 at $DIR/aggregate.rs:+2:9: +2:10 + _5 = const 1_u8; // scope 1 at $DIR/aggregate.rs:+2:9: +2:10 + _4 = foo(move _5) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/aggregate.rs:+2:5: +2:11 + // mir::Constant + // + span: $DIR/aggregate.rs:9:5: 9:8 + // + literal: Const { ty: fn(u8) {foo}, val: Value() } + } + + bb1: { + StorageDead(_5); // scope 1 at $DIR/aggregate.rs:+2:10: +2:11 + StorageDead(_4); // scope 1 at $DIR/aggregate.rs:+2:11: +2:12 + _0 = const (); // scope 0 at $DIR/aggregate.rs:+0:11: +3:2 + StorageDead(_1); // scope 0 at $DIR/aggregate.rs:+3:1: +3:2 + return; // scope 0 at $DIR/aggregate.rs:+3:2: +3:2 + } +} diff --git a/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir b/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir rename to tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-unwind.mir diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff new file mode 100644 index 00000000000..0859a1671da --- /dev/null +++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff @@ -0,0 +1,39 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:+0:11: +0:11 + let _1: u32; // in scope 0 at $DIR/array_index.rs:+1:9: +1:10 + let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:+1:18: +1:30 + let _3: usize; // in scope 0 at $DIR/array_index.rs:+1:31: +1:32 + let mut _4: usize; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33 + let mut _5: bool; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33 + scope 1 { + debug x => _1; // in scope 1 at $DIR/array_index.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/array_index.rs:+1:9: +1:10 + StorageLive(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:30 + _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; // scope 0 at $DIR/array_index.rs:+1:18: +1:30 + StorageLive(_3); // scope 0 at $DIR/array_index.rs:+1:31: +1:32 + _3 = const 2_usize; // scope 0 at $DIR/array_index.rs:+1:31: +1:32 +- _4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33 +- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33 +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 ++ _4 = const 4_usize; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 ++ _5 = const true; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 + } + + bb1: { +- _1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 ++ _1 = const 2_u32; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 + StorageDead(_3); // scope 0 at $DIR/array_index.rs:+1:33: +1:34 + StorageDead(_2); // scope 0 at $DIR/array_index.rs:+1:33: +1:34 + _0 = const (); // scope 0 at $DIR/array_index.rs:+0:11: +2:2 + StorageDead(_1); // scope 0 at $DIR/array_index.rs:+2:1: +2:2 + return; // scope 0 at $DIR/array_index.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.diff rename to tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff new file mode 100644 index 00000000000..0859a1671da --- /dev/null +++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff @@ -0,0 +1,39 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:+0:11: +0:11 + let _1: u32; // in scope 0 at $DIR/array_index.rs:+1:9: +1:10 + let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:+1:18: +1:30 + let _3: usize; // in scope 0 at $DIR/array_index.rs:+1:31: +1:32 + let mut _4: usize; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33 + let mut _5: bool; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33 + scope 1 { + debug x => _1; // in scope 1 at $DIR/array_index.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/array_index.rs:+1:9: +1:10 + StorageLive(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:30 + _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; // scope 0 at $DIR/array_index.rs:+1:18: +1:30 + StorageLive(_3); // scope 0 at $DIR/array_index.rs:+1:31: +1:32 + _3 = const 2_usize; // scope 0 at $DIR/array_index.rs:+1:31: +1:32 +- _4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33 +- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33 +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 ++ _4 = const 4_usize; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 ++ _5 = const true; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 + } + + bb1: { +- _1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 ++ _1 = const 2_u32; // scope 0 at $DIR/array_index.rs:+1:18: +1:33 + StorageDead(_3); // scope 0 at $DIR/array_index.rs:+1:33: +1:34 + StorageDead(_2); // scope 0 at $DIR/array_index.rs:+1:33: +1:34 + _0 = const (); // scope 0 at $DIR/array_index.rs:+0:11: +2:2 + StorageDead(_1); // scope 0 at $DIR/array_index.rs:+2:1: +2:2 + return; // scope 0 at $DIR/array_index.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.diff rename to tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..5ec96b440b9 --- /dev/null +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff @@ -0,0 +1,53 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/bad_op_div_by_zero.rs:+0:11: +0:11 + let _1: i32; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+1:9: +1:10 + let mut _3: i32; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19 + let mut _4: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 + let mut _5: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 + let mut _6: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 + let mut _7: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 + scope 1 { + debug y => _1; // in scope 1 at $DIR/bad_op_div_by_zero.rs:+1:9: +1:10 + let _2: i32; // in scope 1 at $DIR/bad_op_div_by_zero.rs:+2:9: +2:11 + scope 2 { + debug _z => _2; // in scope 2 at $DIR/bad_op_div_by_zero.rs:+2:9: +2:11 + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/bad_op_div_by_zero.rs:+1:9: +1:10 + _1 = const 0_i32; // scope 0 at $DIR/bad_op_div_by_zero.rs:+1:13: +1:14 + StorageLive(_2); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:9: +2:11 + StorageLive(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19 +- _3 = _1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19 +- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 +- assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind unreachable]; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 ++ _3 = const 0_i32; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19 ++ _4 = const true; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 ++ assert(!const true, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind unreachable]; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 + } + + bb1: { +- _5 = Eq(_3, const -1_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 +- _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 +- _7 = BitAnd(move _5, move _6); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 +- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 ++ _5 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 ++ _6 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 ++ _7 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 ++ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 + } + + bb2: { + _2 = Div(const 1_i32, move _3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19 + StorageDead(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19 + _0 = const (); // scope 0 at $DIR/bad_op_div_by_zero.rs:+0:11: +3:2 + StorageDead(_2); // scope 1 at $DIR/bad_op_div_by_zero.rs:+3:1: +3:2 + StorageDead(_1); // scope 0 at $DIR/bad_op_div_by_zero.rs:+3:1: +3:2 + return; // scope 0 at $DIR/bad_op_div_by_zero.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.diff rename to tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..fa9a2a09ba3 --- /dev/null +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff @@ -0,0 +1,53 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/bad_op_mod_by_zero.rs:+0:11: +0:11 + let _1: i32; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10 + let mut _3: i32; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19 + let mut _4: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 + let mut _5: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 + let mut _6: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 + let mut _7: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 + scope 1 { + debug y => _1; // in scope 1 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10 + let _2: i32; // in scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11 + scope 2 { + debug _z => _2; // in scope 2 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11 + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10 + _1 = const 0_i32; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:13: +1:14 + StorageLive(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11 + StorageLive(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19 +- _3 = _1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19 +- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 +- assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> [success: bb1, unwind unreachable]; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 ++ _3 = const 0_i32; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19 ++ _4 = const true; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 ++ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> [success: bb1, unwind unreachable]; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 + } + + bb1: { +- _5 = Eq(_3, const -1_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 +- _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 +- _7 = BitAnd(move _5, move _6); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 +- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 ++ _5 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 ++ _6 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 ++ _7 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 ++ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 + } + + bb2: { + _2 = Rem(const 1_i32, move _3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 + StorageDead(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19 + _0 = const (); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+0:11: +3:2 + StorageDead(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+3:1: +3:2 + StorageDead(_1); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+3:1: +3:2 + return; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff rename to tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff new file mode 100644 index 00000000000..ebe38a8f294 --- /dev/null +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff @@ -0,0 +1,57 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+0:11: +0:11 + let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 + let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:26: +1:35 + let _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + let mut _7: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + let mut _8: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + let mut _9: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + scope 1 { + debug a => _1; // in scope 1 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 + scope 2 { + let _5: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + scope 3 { + debug _b => _5; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 + StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + _9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + // mir::Constant + // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:9:25: 9:35 + // + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) } + _3 = &(*_9); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + _2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + _1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + StorageDead(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:34: +1:35 + StorageDead(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:35: +1:36 + StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + _6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + _7 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 +- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ _8 = const false; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + } + + bb1: { +- _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ _5 = (*_1)[3 of 4]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26 + _0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6 + StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6 + StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:1: +5:2 + return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff rename to tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff new file mode 100644 index 00000000000..ebe38a8f294 --- /dev/null +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff @@ -0,0 +1,57 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+0:11: +0:11 + let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 + let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:26: +1:35 + let _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + let mut _7: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + let mut _8: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + let mut _9: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + scope 1 { + debug a => _1; // in scope 1 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 + scope 2 { + let _5: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + scope 3 { + debug _b => _5; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 + StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + _9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + // mir::Constant + // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:9:25: 9:35 + // + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) } + _3 = &(*_9); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + _2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + _1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + StorageDead(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:34: +1:35 + StorageDead(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:35: +1:36 + StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + _6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + _7 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 +- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ _8 = const false; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + } + + bb1: { +- _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ _5 = (*_1)[3 of 4]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26 + _0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6 + StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6 + StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:1: +5:2 + return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff rename to tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..2cc0b98acfd --- /dev/null +++ b/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff @@ -0,0 +1,56 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/boxes.rs:+0:11: +0:11 + let _1: i32; // in scope 0 at $DIR/boxes.rs:+1:9: +1:10 + let mut _2: i32; // in scope 0 at $DIR/boxes.rs:+1:13: +2:18 + let mut _3: std::boxed::Box; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18 + let mut _4: usize; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18 + let mut _5: usize; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18 + let mut _6: *mut u8; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18 + let mut _7: std::boxed::Box; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18 + let mut _8: *const i32; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18 + let mut _9: *const i32; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18 + scope 1 { + debug x => _1; // in scope 1 at $DIR/boxes.rs:+1:9: +1:10 + } + scope 2 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/boxes.rs:+1:9: +1:10 + StorageLive(_2); // scope 0 at $DIR/boxes.rs:+1:13: +2:18 + StorageLive(_3); // scope 0 at $DIR/boxes.rs:+1:14: +2:18 +- _4 = SizeOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +2:18 +- _5 = AlignOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +2:18 ++ _4 = const 4_usize; // scope 2 at $DIR/boxes.rs:+1:14: +2:18 ++ _5 = const 4_usize; // scope 2 at $DIR/boxes.rs:+1:14: +2:18 + _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 2 at $DIR/boxes.rs:+1:14: +2:18 + // mir::Constant + // + span: $DIR/boxes.rs:13:14: 14:18 + // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } + } + + bb1: { + StorageLive(_7); // scope 0 at $DIR/boxes.rs:+1:14: +2:18 + _7 = ShallowInitBox(move _6, i32); // scope 0 at $DIR/boxes.rs:+1:14: +2:18 + _8 = (((_7.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const i32); // scope 0 at $DIR/boxes.rs:+2:14: +2:16 + (*_8) = const 42_i32; // scope 0 at $DIR/boxes.rs:+2:14: +2:16 + _3 = move _7; // scope 0 at $DIR/boxes.rs:+1:14: +2:18 + StorageDead(_7); // scope 0 at $DIR/boxes.rs:+2:17: +2:18 + _9 = (((_3.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const i32); // scope 0 at $DIR/boxes.rs:+1:13: +2:18 + _2 = (*_9); // scope 0 at $DIR/boxes.rs:+1:13: +2:18 + _1 = Add(move _2, const 0_i32); // scope 0 at $DIR/boxes.rs:+1:13: +3:12 + StorageDead(_2); // scope 0 at $DIR/boxes.rs:+3:11: +3:12 + drop(_3) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/boxes.rs:+3:12: +3:13 + } + + bb2: { + StorageDead(_3); // scope 0 at $DIR/boxes.rs:+3:12: +3:13 + _0 = const (); // scope 0 at $DIR/boxes.rs:+0:11: +4:2 + StorageDead(_1); // scope 0 at $DIR/boxes.rs:+4:1: +4:2 + return; // scope 0 at $DIR/boxes.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/const_prop/boxes.main.ConstProp.diff b/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/boxes.main.ConstProp.diff rename to tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..ba318d8eb35 --- /dev/null +++ b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff @@ -0,0 +1,28 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/checked_add.rs:+0:11: +0:11 + let _1: u32; // in scope 0 at $DIR/checked_add.rs:+1:9: +1:10 + let mut _2: (u32, bool); // in scope 0 at $DIR/checked_add.rs:+1:18: +1:23 + scope 1 { + debug x => _1; // in scope 1 at $DIR/checked_add.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/checked_add.rs:+1:9: +1:10 +- _2 = CheckedAdd(const 1_u32, const 1_u32); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23 +- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23 ++ _2 = const (2_u32, false); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23 ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23 + } + + bb1: { +- _1 = move (_2.0: u32); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23 ++ _1 = const 2_u32; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23 + _0 = const (); // scope 0 at $DIR/checked_add.rs:+0:11: +2:2 + StorageDead(_1); // scope 0 at $DIR/checked_add.rs:+2:1: +2:2 + return; // scope 0 at $DIR/checked_add.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/checked_add.main.ConstProp.diff b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/checked_add.main.ConstProp.diff rename to tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..1999a128c63 --- /dev/null +++ b/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.panic-abort.diff @@ -0,0 +1,44 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/const_prop_fails_gracefully.rs:+0:11: +0:11 + let _1: usize; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:9: +2:10 + let mut _2: *const i32; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:30 + let _3: &i32; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16 + let _4: (); // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12 + let mut _5: usize; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11 + scope 1 { + debug x => _1; // in scope 1 at $DIR/const_prop_fails_gracefully.rs:+2:9: +2:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:9: +2:10 + StorageLive(_2); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:30 + StorageLive(_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16 + _3 = const _; // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16 + // mir::Constant + // + span: $DIR/const_prop_fails_gracefully.rs:9:13: 9:16 + // + literal: Const { ty: &i32, val: Unevaluated(FOO, [], None) } + _2 = &raw const (*_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16 + _1 = move _2 as usize (PointerExposeAddress); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:39 + StorageDead(_2); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:38: +2:39 + StorageDead(_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:39: +2:40 + StorageLive(_4); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12 + StorageLive(_5); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11 + _5 = _1; // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11 + _4 = read(move _5) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12 + // mir::Constant + // + span: $DIR/const_prop_fails_gracefully.rs:10:5: 10:9 + // + literal: Const { ty: fn(usize) {read}, val: Value() } + } + + bb1: { + StorageDead(_5); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:11: +3:12 + StorageDead(_4); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:12: +3:13 + _0 = const (); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+0:11: +4:2 + StorageDead(_1); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+4:1: +4:2 + return; // scope 0 at $DIR/const_prop_fails_gracefully.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff b/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff rename to tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..0ed29267433 --- /dev/null +++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff @@ -0,0 +1,31 @@ +- // MIR for `hello` before ConstProp ++ // MIR for `hello` after ConstProp + + fn hello() -> () { + let mut _0: (); // return place in scope 0 at $DIR/control_flow_simplification.rs:+0:14: +0:14 + let mut _1: bool; // in scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21 + let mut _2: !; // in scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL + + bb0: { + StorageLive(_1); // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21 + _1 = const _; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21 +- switchInt(move _1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21 ++ switchInt(const false) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21 + } + + bb1: { + _2 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable; // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/std/src/panic.rs:LL:COL + // + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value() } + // mir::Constant + // + span: $SRC_DIR/std/src/panic.rs:LL:COL + // + literal: Const { ty: &str, val: Value(Slice(..)) } + } + + bb2: { + StorageDead(_1); // scope 0 at $DIR/control_flow_simplification.rs:+3:5: +3:6 + return; // scope 0 at $DIR/control_flow_simplification.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff rename to tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir b/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.panic-abort.mir similarity index 100% rename from tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir rename to tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.panic-abort.mir diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.panic-unwind.mir b/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.panic-unwind.mir new file mode 100644 index 00000000000..9f7528f0ce1 --- /dev/null +++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.panic-unwind.mir @@ -0,0 +1,9 @@ +// MIR for `hello` before PreCodegen + +fn hello() -> () { + let mut _0: (); // return place in scope 0 at $DIR/control_flow_simplification.rs:+0:14: +0:14 + + bb0: { + return; // scope 0 at $DIR/control_flow_simplification.rs:+4:2: +4:2 + } +} diff --git a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..a58d29d2fe1 --- /dev/null +++ b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff @@ -0,0 +1,33 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/indirect.rs:+0:11: +0:11 + let _1: u8; // in scope 0 at $DIR/indirect.rs:+1:9: +1:10 + let mut _2: u8; // in scope 0 at $DIR/indirect.rs:+1:13: +1:25 + let mut _3: (u8, bool); // in scope 0 at $DIR/indirect.rs:+1:13: +1:29 + scope 1 { + debug x => _1; // in scope 1 at $DIR/indirect.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/indirect.rs:+1:9: +1:10 + StorageLive(_2); // scope 0 at $DIR/indirect.rs:+1:13: +1:25 +- _2 = const 2_u32 as u8 (IntToInt); // scope 0 at $DIR/indirect.rs:+1:13: +1:25 +- _3 = CheckedAdd(_2, const 1_u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29 +- assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/indirect.rs:+1:13: +1:29 ++ _2 = const 2_u8; // scope 0 at $DIR/indirect.rs:+1:13: +1:25 ++ _3 = const (3_u8, false); // scope 0 at $DIR/indirect.rs:+1:13: +1:29 ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/indirect.rs:+1:13: +1:29 + } + + bb1: { +- _1 = move (_3.0: u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29 ++ _1 = const 3_u8; // scope 0 at $DIR/indirect.rs:+1:13: +1:29 + StorageDead(_2); // scope 0 at $DIR/indirect.rs:+1:28: +1:29 + _0 = const (); // scope 0 at $DIR/indirect.rs:+0:11: +2:2 + StorageDead(_1); // scope 0 at $DIR/indirect.rs:+2:1: +2:2 + return; // scope 0 at $DIR/indirect.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/indirect.main.ConstProp.diff b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/indirect.main.ConstProp.diff rename to tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..951de4c3e33 --- /dev/null +++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff @@ -0,0 +1,39 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inherit_overflow.rs:+0:11: +0:11 + let mut _1: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + let mut _2: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + let mut _3: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + scope 1 { + } + scope 2 (inlined ::add) { // at $DIR/inherit_overflow.rs:9:13: 9:47 + debug self => _2; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL + debug other => _3; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL + let mut _4: (u8, bool); // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + StorageLive(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + _2 = const u8::MAX; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + StorageLive(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + _3 = const 1_u8; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 +- _4 = CheckedAdd(_2, _3); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL +- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL ++ _4 = const (0_u8, true); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL ++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL + } + + bb1: { +- _1 = move (_4.0: u8); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL ++ _1 = const 0_u8; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL + StorageDead(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + StorageDead(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + StorageDead(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:47: +3:48 + _0 = const (); // scope 0 at $DIR/inherit_overflow.rs:+0:11: +4:2 + return; // scope 0 at $DIR/inherit_overflow.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.diff rename to tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..061fd39e8b0 --- /dev/null +++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff @@ -0,0 +1,23 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/issue_66971.rs:+0:11: +0:11 + let _1: (); // in scope 0 at $DIR/issue_66971.rs:+1:5: +1:23 + let mut _2: ((), u8, u8); // in scope 0 at $DIR/issue_66971.rs:+1:12: +1:22 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/issue_66971.rs:+1:12: +1:22 + _2 = (const (), const 0_u8, const 0_u8); // scope 0 at $DIR/issue_66971.rs:+1:12: +1:22 + _1 = encode(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/issue_66971.rs:+1:5: +1:23 + // mir::Constant + // + span: $DIR/issue_66971.rs:18:5: 18:11 + // + literal: Const { ty: fn(((), u8, u8)) {encode}, val: Value() } + } + + bb1: { + StorageDead(_2); // scope 0 at $DIR/issue_66971.rs:+1:22: +1:23 + return; // scope 0 at $DIR/issue_66971.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/issue_66971.main.ConstProp.diff rename to tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..99844045bb5 --- /dev/null +++ b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff @@ -0,0 +1,28 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/issue_67019.rs:+0:11: +0:11 + let _1: (); // in scope 0 at $DIR/issue_67019.rs:+1:5: +1:20 + let mut _2: ((u8, u8),); // in scope 0 at $DIR/issue_67019.rs:+1:10: +1:19 + let mut _3: (u8, u8); // in scope 0 at $DIR/issue_67019.rs:+1:11: +1:17 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/issue_67019.rs:+1:10: +1:19 + StorageLive(_3); // scope 0 at $DIR/issue_67019.rs:+1:11: +1:17 +- _3 = (const 1_u8, const 2_u8); // scope 0 at $DIR/issue_67019.rs:+1:11: +1:17 ++ _3 = const (1_u8, 2_u8); // scope 0 at $DIR/issue_67019.rs:+1:11: +1:17 + _2 = (move _3,); // scope 0 at $DIR/issue_67019.rs:+1:10: +1:19 + StorageDead(_3); // scope 0 at $DIR/issue_67019.rs:+1:18: +1:19 + _1 = test(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/issue_67019.rs:+1:5: +1:20 + // mir::Constant + // + span: $DIR/issue_67019.rs:13:5: 13:9 + // + literal: Const { ty: fn(((u8, u8),)) {test}, val: Value() } + } + + bb1: { + StorageDead(_2); // scope 0 at $DIR/issue_67019.rs:+1:19: +1:20 + return; // scope 0 at $DIR/issue_67019.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.diff b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/issue_67019.main.ConstProp.diff rename to tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff new file mode 100644 index 00000000000..6794cfd81df --- /dev/null +++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff @@ -0,0 +1,39 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/large_array_index.rs:+0:11: +0:11 + let _1: u8; // in scope 0 at $DIR/large_array_index.rs:+2:9: +2:10 + let mut _2: [u8; 5000]; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:29 + let _3: usize; // in scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 + let mut _4: usize; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 + let mut _5: bool; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 + scope 1 { + debug x => _1; // in scope 1 at $DIR/large_array_index.rs:+2:9: +2:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/large_array_index.rs:+2:9: +2:10 + StorageLive(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29 + _2 = [const 0_u8; 5000]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29 + StorageLive(_3); // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 + _3 = const 2_usize; // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 +- _4 = Len(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 +- _5 = Lt(_3, _4); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ _5 = const true; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 + } + + bb1: { +- _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ _1 = _2[2 of 3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 + StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 + StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 + _0 = const (); // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2 + StorageDead(_1); // scope 0 at $DIR/large_array_index.rs:+3:1: +3:2 + return; // scope 0 at $DIR/large_array_index.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff rename to tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff new file mode 100644 index 00000000000..6794cfd81df --- /dev/null +++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff @@ -0,0 +1,39 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/large_array_index.rs:+0:11: +0:11 + let _1: u8; // in scope 0 at $DIR/large_array_index.rs:+2:9: +2:10 + let mut _2: [u8; 5000]; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:29 + let _3: usize; // in scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 + let mut _4: usize; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 + let mut _5: bool; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 + scope 1 { + debug x => _1; // in scope 1 at $DIR/large_array_index.rs:+2:9: +2:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/large_array_index.rs:+2:9: +2:10 + StorageLive(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29 + _2 = [const 0_u8; 5000]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29 + StorageLive(_3); // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 + _3 = const 2_usize; // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 +- _4 = Len(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 +- _5 = Lt(_3, _4); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ _5 = const true; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 + } + + bb1: { +- _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ _1 = _2[2 of 3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 + StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 + StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 + _0 = const (); // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2 + StorageDead(_1); // scope 0 at $DIR/large_array_index.rs:+3:1: +3:2 + return; // scope 0 at $DIR/large_array_index.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff rename to tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..b9da74e30b0 --- /dev/null +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-abort.diff @@ -0,0 +1,35 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+0:11: +0:11 + let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14 + scope 1 { + debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14 + let _2: i32; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10 + scope 2 { + debug y => _2; // in scope 2 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10 + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14 + _1 = foo() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:29: +1:34 + // mir::Constant + // + span: $DIR/mutable_variable_aggregate_partial_read.rs:6:29: 6:32 + // + literal: Const { ty: fn() -> (i32, i32) {foo}, val: Value() } + } + + bb1: { + (_1.1: i32) = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+2:5: +2:13 + (_1.0: i32) = const 42_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+3:5: +3:13 + StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10 +- _2 = (_1.1: i32); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16 ++ _2 = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16 + _0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+0:11: +5:2 + StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2 + StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2 + return; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff rename to tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..b090dfc92b6 --- /dev/null +++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff @@ -0,0 +1,53 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+0:11: +0:11 + let _1: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10 + let mut _3: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 + scope 1 { + debug a => _1; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10 + let mut _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 + scope 2 { + debug x => _2; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 + let _4: i32; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10 + scope 3 { + debug y => _4; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10 + let _5: i32; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10 + scope 4 { + debug z => _5; // in scope 4 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10 + } + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10 + _1 = foo() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:13: +1:18 + // mir::Constant + // + span: $DIR/mutable_variable_unprop_assign.rs:6:13: 6:16 + // + literal: Const { ty: fn() -> i32 {foo}, val: Value() } + } + + bb1: { + StorageLive(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 +- _2 = (const 1_i32, const 2_i32); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35 ++ _2 = const (1_i32, 2_i32); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35 + StorageLive(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 + _3 = _1; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 + (_2.1: i32) = move _3; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:5: +3:12 + StorageDead(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 + StorageLive(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10 + _4 = (_2.1: i32); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:13: +4:16 + StorageLive(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10 +- _5 = (_2.0: i32); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16 ++ _5 = const 1_i32; // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16 + _0 = const (); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+0:11: +6:2 + StorageDead(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 + StorageDead(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 + StorageDead(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 + StorageDead(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 + return; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+6:2: +6:2 + } + } + diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff rename to tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff new file mode 100644 index 00000000000..24c78ab992f --- /dev/null +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff @@ -0,0 +1,44 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:+0:11: +0:11 + let _1: u32; // in scope 0 at $DIR/repeat.rs:+1:9: +1:10 + let mut _2: u32; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28 + let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:+1:18: +1:25 + let _4: usize; // in scope 0 at $DIR/repeat.rs:+1:26: +1:27 + let mut _5: usize; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28 + let mut _6: bool; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28 + scope 1 { + debug x => _1; // in scope 1 at $DIR/repeat.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/repeat.rs:+1:9: +1:10 + StorageLive(_2); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 + StorageLive(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:25 + _3 = [const 42_u32; 8]; // scope 0 at $DIR/repeat.rs:+1:18: +1:25 + StorageLive(_4); // scope 0 at $DIR/repeat.rs:+1:26: +1:27 + _4 = const 2_usize; // scope 0 at $DIR/repeat.rs:+1:26: +1:27 +- _5 = Len(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 +- _6 = Lt(_4, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 +- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 ++ _5 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 ++ _6 = const true; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 + } + + bb1: { +- _2 = _3[_4]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 +- _1 = Add(move _2, const 0_u32); // scope 0 at $DIR/repeat.rs:+1:18: +1:32 ++ _2 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 ++ _1 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:32 + StorageDead(_2); // scope 0 at $DIR/repeat.rs:+1:31: +1:32 + StorageDead(_4); // scope 0 at $DIR/repeat.rs:+1:32: +1:33 + StorageDead(_3); // scope 0 at $DIR/repeat.rs:+1:32: +1:33 + _0 = const (); // scope 0 at $DIR/repeat.rs:+0:11: +2:2 + StorageDead(_1); // scope 0 at $DIR/repeat.rs:+2:1: +2:2 + return; // scope 0 at $DIR/repeat.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff rename to tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff new file mode 100644 index 00000000000..24c78ab992f --- /dev/null +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff @@ -0,0 +1,44 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:+0:11: +0:11 + let _1: u32; // in scope 0 at $DIR/repeat.rs:+1:9: +1:10 + let mut _2: u32; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28 + let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:+1:18: +1:25 + let _4: usize; // in scope 0 at $DIR/repeat.rs:+1:26: +1:27 + let mut _5: usize; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28 + let mut _6: bool; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28 + scope 1 { + debug x => _1; // in scope 1 at $DIR/repeat.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/repeat.rs:+1:9: +1:10 + StorageLive(_2); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 + StorageLive(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:25 + _3 = [const 42_u32; 8]; // scope 0 at $DIR/repeat.rs:+1:18: +1:25 + StorageLive(_4); // scope 0 at $DIR/repeat.rs:+1:26: +1:27 + _4 = const 2_usize; // scope 0 at $DIR/repeat.rs:+1:26: +1:27 +- _5 = Len(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 +- _6 = Lt(_4, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 +- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 ++ _5 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 ++ _6 = const true; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 + } + + bb1: { +- _2 = _3[_4]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 +- _1 = Add(move _2, const 0_u32); // scope 0 at $DIR/repeat.rs:+1:18: +1:32 ++ _2 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 ++ _1 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:32 + StorageDead(_2); // scope 0 at $DIR/repeat.rs:+1:31: +1:32 + StorageDead(_4); // scope 0 at $DIR/repeat.rs:+1:32: +1:33 + StorageDead(_3); // scope 0 at $DIR/repeat.rs:+1:32: +1:33 + _0 = const (); // scope 0 at $DIR/repeat.rs:+0:11: +2:2 + StorageDead(_1); // scope 0 at $DIR/repeat.rs:+2:1: +2:2 + return; // scope 0 at $DIR/repeat.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff rename to tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..e0daf107522 --- /dev/null +++ b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff @@ -0,0 +1,21 @@ +- // MIR for `add` before ConstProp ++ // MIR for `add` after ConstProp + + fn add() -> u32 { + let mut _0: u32; // return place in scope 0 at $DIR/return_place.rs:+0:13: +0:16 + let mut _1: (u32, bool); // in scope 0 at $DIR/return_place.rs:+1:5: +1:10 + + bb0: { +- _1 = CheckedAdd(const 2_u32, const 2_u32); // scope 0 at $DIR/return_place.rs:+1:5: +1:10 +- assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/return_place.rs:+1:5: +1:10 ++ _1 = const (4_u32, false); // scope 0 at $DIR/return_place.rs:+1:5: +1:10 ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/return_place.rs:+1:5: +1:10 + } + + bb1: { +- _0 = move (_1.0: u32); // scope 0 at $DIR/return_place.rs:+1:5: +1:10 ++ _0 = const 4_u32; // scope 0 at $DIR/return_place.rs:+1:5: +1:10 + return; // scope 0 at $DIR/return_place.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/return_place.add.ConstProp.diff b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/return_place.add.ConstProp.diff rename to tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir new file mode 100644 index 00000000000..58b2acfbad2 --- /dev/null +++ b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir @@ -0,0 +1,16 @@ +// MIR for `add` before PreCodegen + +fn add() -> u32 { + let mut _0: u32; // return place in scope 0 at $DIR/return_place.rs:+0:13: +0:16 + let mut _1: (u32, bool); // in scope 0 at $DIR/return_place.rs:+1:5: +1:10 + + bb0: { + _1 = const (4_u32, false); // scope 0 at $DIR/return_place.rs:+1:5: +1:10 + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/return_place.rs:+1:5: +1:10 + } + + bb1: { + _0 = const 4_u32; // scope 0 at $DIR/return_place.rs:+1:5: +1:10 + return; // scope 0 at $DIR/return_place.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir similarity index 100% rename from tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir rename to tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..11bbe9da10f --- /dev/null +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-abort.diff @@ -0,0 +1,34 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/scalar_literal_propagation.rs:+0:11: +0:11 + let _1: u32; // in scope 0 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10 + let _2: (); // in scope 0 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15 + let mut _3: u32; // in scope 0 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14 + scope 1 { + debug x => _1; // in scope 1 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10 + _1 = const 1_u32; // scope 0 at $DIR/scalar_literal_propagation.rs:+1:13: +1:14 + StorageLive(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15 + StorageLive(_3); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14 +- _3 = _1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14 ++ _3 = const 1_u32; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14 + _2 = consume(move _3) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15 + // mir::Constant + // + span: $DIR/scalar_literal_propagation.rs:6:5: 6:12 + // + literal: Const { ty: fn(u32) {consume}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:14: +2:15 + StorageDead(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:15: +2:16 + _0 = const (); // scope 0 at $DIR/scalar_literal_propagation.rs:+0:11: +3:2 + StorageDead(_1); // scope 0 at $DIR/scalar_literal_propagation.rs:+3:1: +3:2 + return; // scope 0 at $DIR/scalar_literal_propagation.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff rename to tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff new file mode 100644 index 00000000000..cd8ee121a25 --- /dev/null +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff @@ -0,0 +1,50 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/slice_len.rs:+0:11: +0:11 + let _1: u32; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + let mut _2: &[u32]; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:30 + let mut _3: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + let _4: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + let _5: [u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:7: +1:19 + let _6: usize; // in scope 0 at $DIR/slice_len.rs:+1:31: +1:32 + let mut _7: usize; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + let mut _8: bool; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + let mut _9: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + + bb0: { + StorageLive(_1); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + StorageLive(_2); // scope 0 at $DIR/slice_len.rs:+1:5: +1:30 + StorageLive(_3); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + StorageLive(_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + _9 = const _; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + // mir::Constant + // + span: $DIR/slice_len.rs:8:6: 8:19 + // + literal: Const { ty: &[u32; 3], val: Unevaluated(main, [], Some(promoted[0])) } + _4 = _9; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + _3 = _4; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + _2 = move _3 as &[u32] (Pointer(Unsize)); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + StorageDead(_3); // scope 0 at $DIR/slice_len.rs:+1:18: +1:19 + StorageLive(_6); // scope 0 at $DIR/slice_len.rs:+1:31: +1:32 + _6 = const 1_usize; // scope 0 at $DIR/slice_len.rs:+1:31: +1:32 +- _7 = Len((*_2)); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 +- _8 = Lt(_6, _7); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 ++ _7 = const 3_usize; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 ++ _8 = const true; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + } + + bb1: { +- _1 = (*_2)[_6]; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 ++ _1 = const 2_u32; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + StorageDead(_6); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 + StorageDead(_4); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 + StorageDead(_2); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 + StorageDead(_1); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 + _0 = const (); // scope 0 at $DIR/slice_len.rs:+0:11: +2:2 + return; // scope 0 at $DIR/slice_len.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff rename to tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff new file mode 100644 index 00000000000..cd8ee121a25 --- /dev/null +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff @@ -0,0 +1,50 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/slice_len.rs:+0:11: +0:11 + let _1: u32; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + let mut _2: &[u32]; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:30 + let mut _3: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + let _4: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + let _5: [u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:7: +1:19 + let _6: usize; // in scope 0 at $DIR/slice_len.rs:+1:31: +1:32 + let mut _7: usize; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + let mut _8: bool; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + let mut _9: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + + bb0: { + StorageLive(_1); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + StorageLive(_2); // scope 0 at $DIR/slice_len.rs:+1:5: +1:30 + StorageLive(_3); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + StorageLive(_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + _9 = const _; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + // mir::Constant + // + span: $DIR/slice_len.rs:8:6: 8:19 + // + literal: Const { ty: &[u32; 3], val: Unevaluated(main, [], Some(promoted[0])) } + _4 = _9; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + _3 = _4; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + _2 = move _3 as &[u32] (Pointer(Unsize)); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19 + StorageDead(_3); // scope 0 at $DIR/slice_len.rs:+1:18: +1:19 + StorageLive(_6); // scope 0 at $DIR/slice_len.rs:+1:31: +1:32 + _6 = const 1_usize; // scope 0 at $DIR/slice_len.rs:+1:31: +1:32 +- _7 = Len((*_2)); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 +- _8 = Lt(_6, _7); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 ++ _7 = const 3_usize; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 ++ _8 = const true; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + } + + bb1: { +- _1 = (*_2)[_6]; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 ++ _1 = const 2_u32; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33 + StorageDead(_6); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 + StorageDead(_4); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 + StorageDead(_2); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 + StorageDead(_1); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34 + _0 = const (); // scope 0 at $DIR/slice_len.rs:+0:11: +2:2 + return; // scope 0 at $DIR/slice_len.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff rename to tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..e334faa15cb --- /dev/null +++ b/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-abort.diff @@ -0,0 +1,34 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/switch_int.rs:+0:11: +0:11 + let mut _1: i32; // in scope 0 at $DIR/switch_int.rs:+1:11: +1:12 + + bb0: { + StorageLive(_1); // scope 0 at $DIR/switch_int.rs:+1:11: +1:12 + _1 = const 1_i32; // scope 0 at $DIR/switch_int.rs:+1:11: +1:12 +- switchInt(_1) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 ++ switchInt(const 1_i32) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 + } + + bb1: { + _0 = foo(const -1_i32) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/switch_int.rs:+3:14: +3:21 + // mir::Constant + // + span: $DIR/switch_int.rs:12:14: 12:17 + // + literal: Const { ty: fn(i32) {foo}, val: Value() } + } + + bb2: { + _0 = foo(const 0_i32) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/switch_int.rs:+2:14: +2:20 + // mir::Constant + // + span: $DIR/switch_int.rs:11:14: 11:17 + // + literal: Const { ty: fn(i32) {foo}, val: Value() } + } + + bb3: { + StorageDead(_1); // scope 0 at $DIR/switch_int.rs:+5:1: +5:2 + return; // scope 0 at $DIR/switch_int.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/const_prop/switch_int.main.ConstProp.diff b/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/switch_int.main.ConstProp.diff rename to tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-abort.diff b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-abort.diff new file mode 100644 index 00000000000..865dd488f00 --- /dev/null +++ b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-abort.diff @@ -0,0 +1,34 @@ +- // MIR for `main` before SimplifyConstCondition-after-const-prop ++ // MIR for `main` after SimplifyConstCondition-after-const-prop + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/switch_int.rs:+0:11: +0:11 + let mut _1: i32; // in scope 0 at $DIR/switch_int.rs:+1:11: +1:12 + + bb0: { + StorageLive(_1); // scope 0 at $DIR/switch_int.rs:+1:11: +1:12 + _1 = const 1_i32; // scope 0 at $DIR/switch_int.rs:+1:11: +1:12 +- switchInt(const 1_i32) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 ++ goto -> bb2; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 + } + + bb1: { + _0 = foo(const -1_i32) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/switch_int.rs:+3:14: +3:21 + // mir::Constant + // + span: $DIR/switch_int.rs:12:14: 12:17 + // + literal: Const { ty: fn(i32) {foo}, val: Value() } + } + + bb2: { + _0 = foo(const 0_i32) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/switch_int.rs:+2:14: +2:20 + // mir::Constant + // + span: $DIR/switch_int.rs:11:14: 11:17 + // + literal: Const { ty: fn(i32) {foo}, val: Value() } + } + + bb3: { + StorageDead(_1); // scope 0 at $DIR/switch_int.rs:+5:1: +5:2 + return; // scope 0 at $DIR/switch_int.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff rename to tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..f9ae4da800b --- /dev/null +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff @@ -0,0 +1,35 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/tuple_literal_propagation.rs:+0:11: +0:11 + let _1: (u32, u32); // in scope 0 at $DIR/tuple_literal_propagation.rs:+1:9: +1:10 + let _2: (); // in scope 0 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15 + let mut _3: (u32, u32); // in scope 0 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14 + scope 1 { + debug x => _1; // in scope 1 at $DIR/tuple_literal_propagation.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:9: +1:10 +- _1 = (const 1_u32, const 2_u32); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:13: +1:19 ++ _1 = const (1_u32, 2_u32); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:13: +1:19 + StorageLive(_2); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15 + StorageLive(_3); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14 +- _3 = _1; // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14 ++ _3 = const (1_u32, 2_u32); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14 + _2 = consume(move _3) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15 + // mir::Constant + // + span: $DIR/tuple_literal_propagation.rs:7:5: 7:12 + // + literal: Const { ty: fn((u32, u32)) {consume}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:14: +3:15 + StorageDead(_2); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:15: +3:16 + _0 = const (); // scope 0 at $DIR/tuple_literal_propagation.rs:+0:11: +4:2 + StorageDead(_1); // scope 0 at $DIR/tuple_literal_propagation.rs:+4:1: +4:2 + return; // scope 0 at $DIR/tuple_literal_propagation.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff rename to tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-abort.diff new file mode 100644 index 00000000000..00d22c9313e --- /dev/null +++ b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-abort.diff @@ -0,0 +1,33 @@ +- // MIR for `f` before CopyProp ++ // MIR for `f` after CopyProp + + fn f() -> bool { + let mut _0: bool; // return place in scope 0 at $DIR/borrowed_local.rs:+0:11: +0:15 + let mut _1: u8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _2: &u8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _3: u8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _4: &u8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { + _1 = const 5_u8; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _2 = &_1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _3 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _4 = &_3; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _0 = cmp_ref(_2, _4) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/borrowed_local.rs:+8:13: +8:45 + // mir::Constant + // + span: $DIR/borrowed_local.rs:24:29: 24:36 + // + literal: Const { ty: for<'a, 'b> fn(&'a u8, &'b u8) -> bool {cmp_ref}, val: Value() } + } + + bb1: { + _0 = opaque::(_3) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/borrowed_local.rs:+12:13: +12:38 + // mir::Constant + // + span: $DIR/borrowed_local.rs:28:28: 28:34 + // + literal: Const { ty: fn(u8) -> bool {opaque::}, val: Value() } + } + + bb2: { + return; // scope 0 at $DIR/borrowed_local.rs:+15:13: +15:21 + } + } + diff --git a/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff rename to tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-unwind.diff diff --git a/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-abort.diff new file mode 100644 index 00000000000..e52005cd457 --- /dev/null +++ b/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-abort.diff @@ -0,0 +1,65 @@ +- // MIR for `foo` before CopyProp ++ // MIR for `foo` after CopyProp + + fn foo() -> i32 { + let mut _0: i32; // return place in scope 0 at $DIR/branch.rs:+0:13: +0:16 + let _1: i32; // in scope 0 at $DIR/branch.rs:+1:9: +1:10 + let mut _3: bool; // in scope 0 at $DIR/branch.rs:+3:16: +3:22 + let _4: i32; // in scope 0 at $DIR/branch.rs:+6:9: +6:14 + scope 1 { + debug x => _1; // in scope 1 at $DIR/branch.rs:+1:9: +1:10 + let _2: i32; // in scope 1 at $DIR/branch.rs:+3:9: +3:10 + scope 2 { + debug y => _2; // in scope 2 at $DIR/branch.rs:+3:9: +3:10 + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/branch.rs:+1:9: +1:10 + _1 = val() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/branch.rs:+1:13: +1:18 + // mir::Constant + // + span: $DIR/branch.rs:14:13: 14:16 + // + literal: Const { ty: fn() -> i32 {val}, val: Value() } + } + + bb1: { + StorageLive(_2); // scope 1 at $DIR/branch.rs:+3:9: +3:10 + StorageLive(_3); // scope 1 at $DIR/branch.rs:+3:16: +3:22 + _3 = cond() -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/branch.rs:+3:16: +3:22 + // mir::Constant + // + span: $DIR/branch.rs:16:16: 16:20 + // + literal: Const { ty: fn() -> bool {cond}, val: Value() } + } + + bb2: { + switchInt(move _3) -> [0: bb4, otherwise: bb3]; // scope 1 at $DIR/branch.rs:+3:16: +3:22 + } + + bb3: { + _2 = _1; // scope 1 at $DIR/branch.rs:+4:9: +4:10 + goto -> bb6; // scope 1 at $DIR/branch.rs:+3:13: +8:6 + } + + bb4: { + StorageLive(_4); // scope 1 at $DIR/branch.rs:+6:9: +6:14 + _4 = val() -> [return: bb5, unwind unreachable]; // scope 1 at $DIR/branch.rs:+6:9: +6:14 + // mir::Constant + // + span: $DIR/branch.rs:19:9: 19:12 + // + literal: Const { ty: fn() -> i32 {val}, val: Value() } + } + + bb5: { + StorageDead(_4); // scope 1 at $DIR/branch.rs:+6:14: +6:15 + _2 = _1; // scope 1 at $DIR/branch.rs:+7:9: +7:10 + goto -> bb6; // scope 1 at $DIR/branch.rs:+3:13: +8:6 + } + + bb6: { + StorageDead(_3); // scope 1 at $DIR/branch.rs:+8:5: +8:6 + _0 = _2; // scope 2 at $DIR/branch.rs:+10:5: +10:6 + StorageDead(_2); // scope 1 at $DIR/branch.rs:+11:1: +11:2 + StorageDead(_1); // scope 0 at $DIR/branch.rs:+11:1: +11:2 + return; // scope 0 at $DIR/branch.rs:+11:2: +11:2 + } + } + diff --git a/tests/mir-opt/copy-prop/branch.foo.CopyProp.diff b/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/copy-prop/branch.foo.CopyProp.diff rename to tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-unwind.diff diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-abort.diff similarity index 100% rename from tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.diff rename to tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-abort.diff diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-unwind.diff new file mode 100644 index 00000000000..1c7b6494d6d --- /dev/null +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-unwind.diff @@ -0,0 +1,23 @@ +- // MIR for `arg_src` before CopyProp ++ // MIR for `arg_src` after CopyProp + + fn arg_src(_1: i32) -> i32 { + debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:12: +0:17 + let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:27: +0:30 + let _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 + scope 1 { +- debug y => _2; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 ++ debug y => _0; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 +- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14 ++ _0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14 + _1 = const 123_i32; // scope 1 at $DIR/copy_propagation_arg.rs:+2:5: +2:12 +- _0 = _2; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6 +- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+4:1: +4:2 + return; // scope 0 at $DIR/copy_propagation_arg.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-abort.diff new file mode 100644 index 00000000000..3c494af01c0 --- /dev/null +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-abort.diff @@ -0,0 +1,28 @@ +- // MIR for `bar` before CopyProp ++ // MIR for `bar` after CopyProp + + fn bar(_1: u8) -> () { + debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13 + let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +0:19 + let _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 + let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 + StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 + _3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 + _2 = dummy(move _3) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 + // mir::Constant + // + span: $DIR/copy_propagation_arg.rs:17:5: 17:10 + // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+1:12: +1:13 + StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14 + _1 = const 5_u8; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10 + _0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +3:2 + return; // scope 0 at $DIR/copy_propagation_arg.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.diff rename to tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-unwind.diff diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-abort.diff similarity index 100% rename from tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.diff rename to tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-abort.diff diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-unwind.diff new file mode 100644 index 00000000000..7ab6ebb7d53 --- /dev/null +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-unwind.diff @@ -0,0 +1,18 @@ +- // MIR for `baz` before CopyProp ++ // MIR for `baz` after CopyProp + + fn baz(_1: i32) -> i32 { + debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13 + let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:23: +0:26 + let mut _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 + _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 + _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10 + StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 + _0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+3:5: +3:6 + return; // scope 0 at $DIR/copy_propagation_arg.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-abort.diff new file mode 100644 index 00000000000..5845be331a5 --- /dev/null +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-abort.diff @@ -0,0 +1,28 @@ +- // MIR for `foo` before CopyProp ++ // MIR for `foo` after CopyProp + + fn foo(_1: u8) -> () { + debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13 + let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +0:19 + let mut _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 + let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 + StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16 + _3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16 + _2 = dummy(move _3) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 + // mir::Constant + // + span: $DIR/copy_propagation_arg.rs:12:9: 12:14 + // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17 + _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:17 + StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17 + _0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +3:2 + return; // scope 0 at $DIR/copy_propagation_arg.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.diff rename to tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-unwind.diff diff --git a/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-abort.diff new file mode 100644 index 00000000000..ab136769085 --- /dev/null +++ b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-abort.diff @@ -0,0 +1,31 @@ +- // MIR for `f` before CopyProp ++ // MIR for `f` after CopyProp + + fn f(_1: NotCopy) -> () { + let mut _0: (); // return place in scope 0 at $DIR/custom_move_arg.rs:+0:19: +0:19 + let mut _2: NotCopy; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _3: NotCopy; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { +- _2 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL +- _0 = opaque::(move _1) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/custom_move_arg.rs:+3:9: +3:41 ++ _0 = opaque::(_1) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/custom_move_arg.rs:+3:9: +3:41 + // mir::Constant + // + span: $DIR/custom_move_arg.rs:16:24: 16:30 + // + literal: Const { ty: fn(NotCopy) {opaque::}, val: Value() } + } + + bb1: { +- _3 = move _2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL +- _0 = opaque::(_3) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/custom_move_arg.rs:+7:9: +7:35 ++ _0 = opaque::(_1) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/custom_move_arg.rs:+7:9: +7:35 + // mir::Constant + // + span: $DIR/custom_move_arg.rs:20:24: 20:30 + // + literal: Const { ty: fn(NotCopy) {opaque::}, val: Value() } + } + + bb2: { + return; // scope 0 at $DIR/custom_move_arg.rs:+10:9: +10:17 + } + } + diff --git a/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.diff b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.diff rename to tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-unwind.diff diff --git a/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-abort.diff new file mode 100644 index 00000000000..37158af7648 --- /dev/null +++ b/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-abort.diff @@ -0,0 +1,60 @@ +- // MIR for `main` before CopyProp ++ // MIR for `main` after CopyProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:11: +0:11 + let mut _1: i32; // in scope 0 at $DIR/cycle.rs:+1:9: +1:14 + let mut _4: i32; // in scope 0 at $DIR/cycle.rs:+4:9: +4:10 + let _5: (); // in scope 0 at $DIR/cycle.rs:+6:5: +6:12 + let mut _6: i32; // in scope 0 at $DIR/cycle.rs:+6:10: +6:11 + scope 1 { + debug x => _1; // in scope 1 at $DIR/cycle.rs:+1:9: +1:14 + let _2: i32; // in scope 1 at $DIR/cycle.rs:+2:9: +2:10 + scope 2 { + debug y => _2; // in scope 2 at $DIR/cycle.rs:+2:9: +2:10 + let _3: i32; // in scope 2 at $DIR/cycle.rs:+3:9: +3:10 + scope 3 { +- debug z => _3; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10 ++ debug z => _2; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10 + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/cycle.rs:+1:9: +1:14 + _1 = val() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/cycle.rs:+1:17: +1:22 + // mir::Constant + // + span: $DIR/cycle.rs:10:17: 10:20 + // + literal: Const { ty: fn() -> i32 {val}, val: Value() } + } + + bb1: { +- StorageLive(_2); // scope 1 at $DIR/cycle.rs:+2:9: +2:10 + _2 = _1; // scope 1 at $DIR/cycle.rs:+2:13: +2:14 +- StorageLive(_3); // scope 2 at $DIR/cycle.rs:+3:9: +3:10 +- _3 = _2; // scope 2 at $DIR/cycle.rs:+3:13: +3:14 +- StorageLive(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10 +- _4 = _3; // scope 3 at $DIR/cycle.rs:+4:9: +4:10 +- _1 = move _4; // scope 3 at $DIR/cycle.rs:+4:5: +4:10 +- StorageDead(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10 ++ _1 = _2; // scope 3 at $DIR/cycle.rs:+4:5: +4:10 + StorageLive(_5); // scope 3 at $DIR/cycle.rs:+6:5: +6:12 + StorageLive(_6); // scope 3 at $DIR/cycle.rs:+6:10: +6:11 + _6 = _1; // scope 3 at $DIR/cycle.rs:+6:10: +6:11 + _5 = std::mem::drop::(move _6) -> [return: bb2, unwind unreachable]; // scope 3 at $DIR/cycle.rs:+6:5: +6:12 + // mir::Constant + // + span: $DIR/cycle.rs:15:5: 15:9 + // + literal: Const { ty: fn(i32) {std::mem::drop::}, val: Value() } + } + + bb2: { + StorageDead(_6); // scope 3 at $DIR/cycle.rs:+6:11: +6:12 + StorageDead(_5); // scope 3 at $DIR/cycle.rs:+6:12: +6:13 + _0 = const (); // scope 0 at $DIR/cycle.rs:+0:11: +7:2 +- StorageDead(_3); // scope 2 at $DIR/cycle.rs:+7:1: +7:2 +- StorageDead(_2); // scope 1 at $DIR/cycle.rs:+7:1: +7:2 + StorageDead(_1); // scope 0 at $DIR/cycle.rs:+7:1: +7:2 + return; // scope 0 at $DIR/cycle.rs:+7:2: +7:2 + } + } + diff --git a/tests/mir-opt/copy-prop/cycle.main.CopyProp.diff b/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/copy-prop/cycle.main.CopyProp.diff rename to tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-unwind.diff diff --git a/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-abort.mir b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-abort.mir new file mode 100644 index 00000000000..8de0a56c58c --- /dev/null +++ b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-abort.mir @@ -0,0 +1,29 @@ +// MIR for `f` after CopyProp + +fn f(_1: usize) -> usize { + debug a => _1; // in scope 0 at $DIR/dead_stores_79191.rs:+0:6: +0:11 + let mut _0: usize; // return place in scope 0 at $DIR/dead_stores_79191.rs:+0:23: +0:28 + let _2: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+1:9: +1:10 + let mut _3: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+3:9: +3:10 + let mut _4: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+4:8: +4:9 + scope 1 { + debug b => _2; // in scope 1 at $DIR/dead_stores_79191.rs:+1:9: +1:10 + } + + bb0: { + _2 = _1; // scope 0 at $DIR/dead_stores_79191.rs:+1:13: +1:14 + _1 = const 5_usize; // scope 1 at $DIR/dead_stores_79191.rs:+2:5: +2:10 + _1 = _2; // scope 1 at $DIR/dead_stores_79191.rs:+3:5: +3:10 + StorageLive(_4); // scope 1 at $DIR/dead_stores_79191.rs:+4:8: +4:9 + _4 = _1; // scope 1 at $DIR/dead_stores_79191.rs:+4:8: +4:9 + _0 = id::(move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/dead_stores_79191.rs:+4:5: +4:10 + // mir::Constant + // + span: $DIR/dead_stores_79191.rs:13:5: 13:7 + // + literal: Const { ty: fn(usize) -> usize {id::}, val: Value() } + } + + bb1: { + StorageDead(_4); // scope 1 at $DIR/dead_stores_79191.rs:+4:9: +4:10 + return; // scope 0 at $DIR/dead_stores_79191.rs:+5:2: +5:2 + } +} diff --git a/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.mir b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.mir rename to tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-unwind.mir diff --git a/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-abort.mir b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-abort.mir new file mode 100644 index 00000000000..606b94f3e70 --- /dev/null +++ b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-abort.mir @@ -0,0 +1,29 @@ +// MIR for `f` after CopyProp + +fn f(_1: usize) -> usize { + debug a => _1; // in scope 0 at $DIR/dead_stores_better.rs:+0:10: +0:15 + let mut _0: usize; // return place in scope 0 at $DIR/dead_stores_better.rs:+0:27: +0:32 + let _2: usize; // in scope 0 at $DIR/dead_stores_better.rs:+1:9: +1:10 + let mut _3: usize; // in scope 0 at $DIR/dead_stores_better.rs:+3:9: +3:10 + let mut _4: usize; // in scope 0 at $DIR/dead_stores_better.rs:+4:8: +4:9 + scope 1 { + debug b => _2; // in scope 1 at $DIR/dead_stores_better.rs:+1:9: +1:10 + } + + bb0: { + _2 = _1; // scope 0 at $DIR/dead_stores_better.rs:+1:13: +1:14 + _1 = const 5_usize; // scope 1 at $DIR/dead_stores_better.rs:+2:5: +2:10 + _1 = _2; // scope 1 at $DIR/dead_stores_better.rs:+3:5: +3:10 + StorageLive(_4); // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9 + _4 = _1; // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9 + _0 = id::(move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/dead_stores_better.rs:+4:5: +4:10 + // mir::Constant + // + span: $DIR/dead_stores_better.rs:17:5: 17:7 + // + literal: Const { ty: fn(usize) -> usize {id::}, val: Value() } + } + + bb1: { + StorageDead(_4); // scope 1 at $DIR/dead_stores_better.rs:+4:9: +4:10 + return; // scope 0 at $DIR/dead_stores_better.rs:+5:2: +5:2 + } +} diff --git a/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.mir b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.mir rename to tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-unwind.mir diff --git a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff new file mode 100644 index 00000000000..701cdda0fce --- /dev/null +++ b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff @@ -0,0 +1,138 @@ +- // MIR for `main` before CopyProp ++ // MIR for `main` after CopyProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/issue_107511.rs:+0:11: +0:11 + let mut _1: i32; // in scope 0 at $DIR/issue_107511.rs:+1:9: +1:16 + let mut _3: std::ops::Range; // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24 + let mut _4: std::ops::Range; // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24 + let mut _5: usize; // in scope 0 at $DIR/issue_107511.rs:+6:17: +6:24 + let mut _6: &[i32]; // in scope 0 at $DIR/issue_107511.rs:+6:17: +6:24 + let mut _7: &[i32; 4]; // in scope 0 at $DIR/issue_107511.rs:+6:17: +6:24 + let mut _9: (); // in scope 0 at $DIR/issue_107511.rs:+0:1: +9:2 + let _10: (); // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24 + let mut _11: std::option::Option; // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24 + let mut _12: &mut std::ops::Range; // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24 + let mut _13: &mut std::ops::Range; // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24 + let mut _14: isize; // in scope 0 at $DIR/issue_107511.rs:+6:5: +8:6 + let mut _15: !; // in scope 0 at $DIR/issue_107511.rs:+6:5: +8:6 + let mut _17: i32; // in scope 0 at $DIR/issue_107511.rs:+7:16: +7:20 + let _18: usize; // in scope 0 at $DIR/issue_107511.rs:+7:18: +7:19 + let mut _19: usize; // in scope 0 at $DIR/issue_107511.rs:+7:16: +7:20 + let mut _20: bool; // in scope 0 at $DIR/issue_107511.rs:+7:16: +7:20 + scope 1 { + debug sum => _1; // in scope 1 at $DIR/issue_107511.rs:+1:9: +1:16 + let _2: [i32; 4]; // in scope 1 at $DIR/issue_107511.rs:+2:9: +2:10 + scope 2 { + debug a => _2; // in scope 2 at $DIR/issue_107511.rs:+2:9: +2:10 + let mut _8: std::ops::Range; // in scope 2 at $DIR/issue_107511.rs:+6:14: +6:24 + scope 3 { + debug iter => _8; // in scope 3 at $DIR/issue_107511.rs:+6:14: +6:24 + let _16: usize; // in scope 3 at $DIR/issue_107511.rs:+6:9: +6:10 + scope 4 { + debug i => _16; // in scope 4 at $DIR/issue_107511.rs:+6:9: +6:10 + } + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/issue_107511.rs:+1:9: +1:16 + _1 = const 0_i32; // scope 0 at $DIR/issue_107511.rs:+1:19: +1:20 + StorageLive(_2); // scope 1 at $DIR/issue_107511.rs:+2:9: +2:10 + _2 = [const 0_i32, const 10_i32, const 20_i32, const 30_i32]; // scope 1 at $DIR/issue_107511.rs:+2:13: +2:28 + StorageLive(_3); // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24 + StorageLive(_4); // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24 + StorageLive(_5); // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24 + StorageLive(_6); // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24 + StorageLive(_7); // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24 + _7 = &_2; // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24 + _6 = move _7 as &[i32] (Pointer(Unsize)); // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24 + StorageDead(_7); // scope 2 at $DIR/issue_107511.rs:+6:17: +6:18 + _5 = core::slice::::len(move _6) -> [return: bb1, unwind unreachable]; // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24 + // mir::Constant + // + span: $DIR/issue_107511.rs:11:19: 11:22 + // + literal: Const { ty: for<'a> fn(&'a [i32]) -> usize {core::slice::::len}, val: Value() } + } + + bb1: { + StorageDead(_6); // scope 2 at $DIR/issue_107511.rs:+6:23: +6:24 + _4 = std::ops::Range:: { start: const 0_usize, end: move _5 }; // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24 + StorageDead(_5); // scope 2 at $DIR/issue_107511.rs:+6:23: +6:24 + _3 = as IntoIterator>::into_iter(move _4) -> [return: bb2, unwind unreachable]; // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24 + // mir::Constant + // + span: $DIR/issue_107511.rs:11:14: 11:24 + // + literal: Const { ty: fn(std::ops::Range) -> as IntoIterator>::IntoIter { as IntoIterator>::into_iter}, val: Value() } + } + + bb2: { + StorageDead(_4); // scope 2 at $DIR/issue_107511.rs:+6:23: +6:24 + StorageLive(_8); // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24 + _8 = move _3; // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24 + goto -> bb3; // scope 3 at $DIR/issue_107511.rs:+6:5: +8:6 + } + + bb3: { +- StorageLive(_10); // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24 + StorageLive(_11); // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24 + StorageLive(_12); // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24 + StorageLive(_13); // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24 + _13 = &mut _8; // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24 + _12 = &mut (*_13); // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24 + _11 = as Iterator>::next(move _12) -> [return: bb4, unwind unreachable]; // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24 + // mir::Constant + // + span: $DIR/issue_107511.rs:11:14: 11:24 + // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } + } + + bb4: { + StorageDead(_12); // scope 3 at $DIR/issue_107511.rs:+6:23: +6:24 + _14 = discriminant(_11); // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24 + switchInt(move _14) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24 + } + + bb5: { +- StorageLive(_16); // scope 3 at $DIR/issue_107511.rs:+6:9: +6:10 + _16 = ((_11 as Some).0: usize); // scope 3 at $DIR/issue_107511.rs:+6:9: +6:10 + StorageLive(_17); // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20 +- StorageLive(_18); // scope 4 at $DIR/issue_107511.rs:+7:18: +7:19 +- _18 = _16; // scope 4 at $DIR/issue_107511.rs:+7:18: +7:19 + _19 = Len(_2); // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20 +- _20 = Lt(_18, _19); // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20 +- assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _18) -> [success: bb8, unwind unreachable]; // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20 ++ _20 = Lt(_16, _19); // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20 ++ assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> [success: bb8, unwind unreachable]; // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20 + } + + bb6: { + unreachable; // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24 + } + + bb7: { + _0 = const (); // scope 3 at $DIR/issue_107511.rs:+6:5: +8:6 + StorageDead(_13); // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6 + StorageDead(_11); // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6 +- StorageDead(_10); // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6 + StorageDead(_8); // scope 2 at $DIR/issue_107511.rs:+8:5: +8:6 + StorageDead(_3); // scope 2 at $DIR/issue_107511.rs:+8:5: +8:6 + StorageDead(_2); // scope 1 at $DIR/issue_107511.rs:+9:1: +9:2 + StorageDead(_1); // scope 0 at $DIR/issue_107511.rs:+9:1: +9:2 + return; // scope 0 at $DIR/issue_107511.rs:+9:2: +9:2 + } + + bb8: { +- _17 = _2[_18]; // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20 ++ _17 = _2[_16]; // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20 + _1 = Add(_1, move _17); // scope 4 at $DIR/issue_107511.rs:+7:9: +7:20 + StorageDead(_17); // scope 4 at $DIR/issue_107511.rs:+7:19: +7:20 +- StorageDead(_18); // scope 4 at $DIR/issue_107511.rs:+7:20: +7:21 +- _10 = const (); // scope 4 at $DIR/issue_107511.rs:+6:25: +8:6 +- StorageDead(_16); // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6 + StorageDead(_13); // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6 + StorageDead(_11); // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6 +- StorageDead(_10); // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6 +- _9 = const (); // scope 3 at $DIR/issue_107511.rs:+6:5: +8:6 + goto -> bb3; // scope 3 at $DIR/issue_107511.rs:+6:5: +8:6 + } + } + diff --git a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.diff b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/copy-prop/issue_107511.main.CopyProp.diff rename to tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-unwind.diff diff --git a/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-abort.diff new file mode 100644 index 00000000000..b1ab5b54206 --- /dev/null +++ b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-abort.diff @@ -0,0 +1,40 @@ +- // MIR for `f` before CopyProp ++ // MIR for `f` after CopyProp + + fn f(_1: T) -> () { + debug a => _1; // in scope 0 at $DIR/move_arg.rs:+0:19: +0:20 + let mut _0: (); // return place in scope 0 at $DIR/move_arg.rs:+0:25: +0:25 + let _2: T; // in scope 0 at $DIR/move_arg.rs:+1:9: +1:10 + let _3: (); // in scope 0 at $DIR/move_arg.rs:+2:5: +2:12 + let mut _4: T; // in scope 0 at $DIR/move_arg.rs:+2:7: +2:8 + let mut _5: T; // in scope 0 at $DIR/move_arg.rs:+2:10: +2:11 + scope 1 { +- debug b => _2; // in scope 1 at $DIR/move_arg.rs:+1:9: +1:10 ++ debug b => _1; // in scope 1 at $DIR/move_arg.rs:+1:9: +1:10 + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/move_arg.rs:+1:9: +1:10 +- _2 = _1; // scope 0 at $DIR/move_arg.rs:+1:13: +1:14 + StorageLive(_3); // scope 1 at $DIR/move_arg.rs:+2:5: +2:12 +- StorageLive(_4); // scope 1 at $DIR/move_arg.rs:+2:7: +2:8 +- _4 = _1; // scope 1 at $DIR/move_arg.rs:+2:7: +2:8 +- StorageLive(_5); // scope 1 at $DIR/move_arg.rs:+2:10: +2:11 +- _5 = _2; // scope 1 at $DIR/move_arg.rs:+2:10: +2:11 +- _3 = g::(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/move_arg.rs:+2:5: +2:12 ++ _3 = g::(_1, _1) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/move_arg.rs:+2:5: +2:12 + // mir::Constant + // + span: $DIR/move_arg.rs:8:5: 8:6 + // + literal: Const { ty: fn(T, T) {g::}, val: Value() } + } + + bb1: { +- StorageDead(_5); // scope 1 at $DIR/move_arg.rs:+2:11: +2:12 +- StorageDead(_4); // scope 1 at $DIR/move_arg.rs:+2:11: +2:12 + StorageDead(_3); // scope 1 at $DIR/move_arg.rs:+2:12: +2:13 + _0 = const (); // scope 0 at $DIR/move_arg.rs:+0:25: +3:2 +- StorageDead(_2); // scope 0 at $DIR/move_arg.rs:+3:1: +3:2 + return; // scope 0 at $DIR/move_arg.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/copy-prop/move_arg.f.CopyProp.diff b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/copy-prop/move_arg.f.CopyProp.diff rename to tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-unwind.diff diff --git a/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-abort.diff new file mode 100644 index 00000000000..0871f64efed --- /dev/null +++ b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-abort.diff @@ -0,0 +1,31 @@ +- // MIR for `f` before CopyProp ++ // MIR for `f` after CopyProp + + fn f(_1: Foo) -> bool { + let mut _0: bool; // return place in scope 0 at $DIR/move_projection.rs:+0:17: +0:21 + let mut _2: Foo; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _3: u8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { +- _2 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL +- _3 = move (_2.0: u8); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL +- _0 = opaque::(move _1) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/move_projection.rs:+6:13: +6:44 ++ _3 = (_1.0: u8); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL ++ _0 = opaque::(_1) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/move_projection.rs:+6:13: +6:44 + // mir::Constant + // + span: $DIR/move_projection.rs:20:28: 20:34 + // + literal: Const { ty: fn(Foo) -> bool {opaque::}, val: Value() } + } + + bb1: { + _0 = opaque::(move _3) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/move_projection.rs:+9:13: +9:44 + // mir::Constant + // + span: $DIR/move_projection.rs:23:28: 23:34 + // + literal: Const { ty: fn(u8) -> bool {opaque::}, val: Value() } + } + + bb2: { + return; // scope 0 at $DIR/move_projection.rs:+12:13: +12:21 + } + } + diff --git a/tests/mir-opt/copy-prop/move_projection.f.CopyProp.diff b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/copy-prop/move_projection.f.CopyProp.diff rename to tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-unwind.diff diff --git a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff new file mode 100644 index 00000000000..f4d8e4ed67d --- /dev/null +++ b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff @@ -0,0 +1,56 @@ +- // MIR for `demiraw` before CopyProp ++ // MIR for `demiraw` after CopyProp + + fn demiraw(_1: u8) -> () { + debug x => _1; // in scope 0 at $DIR/reborrow.rs:+0:12: +0:17 + let mut _0: (); // return place in scope 0 at $DIR/reborrow.rs:+0:23: +0:23 + let _2: *mut u8; // in scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + let mut _4: &mut u8; // in scope 0 at $DIR/reborrow.rs:+2:22: +2:29 + let _6: (); // in scope 0 at $DIR/reborrow.rs:+4:5: +4:14 + let mut _7: *mut u8; // in scope 0 at $DIR/reborrow.rs:+4:12: +4:13 + scope 1 { + debug a => _2; // in scope 1 at $DIR/reborrow.rs:+1:9: +1:10 + let _3: &mut u8; // in scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + scope 2 { + debug b => _3; // in scope 2 at $DIR/reborrow.rs:+2:9: +2:10 + let _5: *mut u8; // in scope 2 at $DIR/reborrow.rs:+3:9: +3:10 + scope 4 { +- debug c => _5; // in scope 4 at $DIR/reborrow.rs:+3:9: +3:10 ++ debug c => _2; // in scope 4 at $DIR/reborrow.rs:+3:9: +3:10 + } + } + scope 3 { + } + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + _2 = &raw mut _1; // scope 0 at $DIR/reborrow.rs:+1:13: +1:23 + StorageLive(_3); // scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + StorageLive(_4); // scope 1 at $DIR/reborrow.rs:+2:22: +2:29 + _4 = &mut (*_2); // scope 3 at $DIR/reborrow.rs:+2:22: +2:29 + _3 = &mut (*_4); // scope 1 at $DIR/reborrow.rs:+2:22: +2:29 + StorageDead(_4); // scope 1 at $DIR/reborrow.rs:+2:31: +2:32 +- StorageLive(_5); // scope 2 at $DIR/reborrow.rs:+3:9: +3:10 +- _5 = _2; // scope 2 at $DIR/reborrow.rs:+3:13: +3:14 + StorageLive(_6); // scope 4 at $DIR/reborrow.rs:+4:5: +4:14 +- StorageLive(_7); // scope 4 at $DIR/reborrow.rs:+4:12: +4:13 +- _7 = _5; // scope 4 at $DIR/reborrow.rs:+4:12: +4:13 +- _6 = opaque::<*mut u8>(move _7) -> [return: bb1, unwind unreachable]; // scope 4 at $DIR/reborrow.rs:+4:5: +4:14 ++ _6 = opaque::<*mut u8>(_2) -> [return: bb1, unwind unreachable]; // scope 4 at $DIR/reborrow.rs:+4:5: +4:14 + // mir::Constant + // + span: $DIR/reborrow.rs:39:5: 39:11 + // + literal: Const { ty: fn(*mut u8) {opaque::<*mut u8>}, val: Value() } + } + + bb1: { +- StorageDead(_7); // scope 4 at $DIR/reborrow.rs:+4:13: +4:14 + StorageDead(_6); // scope 4 at $DIR/reborrow.rs:+4:14: +4:15 + _0 = const (); // scope 0 at $DIR/reborrow.rs:+0:23: +5:2 +- StorageDead(_5); // scope 2 at $DIR/reborrow.rs:+5:1: +5:2 + StorageDead(_3); // scope 1 at $DIR/reborrow.rs:+5:1: +5:2 +- StorageDead(_2); // scope 0 at $DIR/reborrow.rs:+5:1: +5:2 + return; // scope 0 at $DIR/reborrow.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.diff b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.diff rename to tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff diff --git a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff new file mode 100644 index 00000000000..3f34ec1600d --- /dev/null +++ b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff @@ -0,0 +1,52 @@ +- // MIR for `miraw` before CopyProp ++ // MIR for `miraw` after CopyProp + + fn miraw(_1: u8) -> () { + debug x => _1; // in scope 0 at $DIR/reborrow.rs:+0:10: +0:15 + let mut _0: (); // return place in scope 0 at $DIR/reborrow.rs:+0:21: +0:21 + let _2: *mut u8; // in scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + let _5: (); // in scope 0 at $DIR/reborrow.rs:+4:5: +4:14 + let mut _6: *mut u8; // in scope 0 at $DIR/reborrow.rs:+4:12: +4:13 + scope 1 { + debug a => _2; // in scope 1 at $DIR/reborrow.rs:+1:9: +1:10 + let _3: *mut u8; // in scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + scope 2 { + debug b => _3; // in scope 2 at $DIR/reborrow.rs:+2:9: +2:10 + let _4: *mut u8; // in scope 2 at $DIR/reborrow.rs:+3:9: +3:10 + scope 4 { +- debug c => _4; // in scope 4 at $DIR/reborrow.rs:+3:9: +3:10 ++ debug c => _2; // in scope 4 at $DIR/reborrow.rs:+3:9: +3:10 + } + } + scope 3 { + } + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + _2 = &raw mut _1; // scope 0 at $DIR/reborrow.rs:+1:13: +1:23 + StorageLive(_3); // scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + _3 = &raw mut (*_2); // scope 3 at $DIR/reborrow.rs:+2:22: +2:33 +- StorageLive(_4); // scope 2 at $DIR/reborrow.rs:+3:9: +3:10 +- _4 = _2; // scope 2 at $DIR/reborrow.rs:+3:13: +3:14 + StorageLive(_5); // scope 4 at $DIR/reborrow.rs:+4:5: +4:14 +- StorageLive(_6); // scope 4 at $DIR/reborrow.rs:+4:12: +4:13 +- _6 = _4; // scope 4 at $DIR/reborrow.rs:+4:12: +4:13 +- _5 = opaque::<*mut u8>(move _6) -> [return: bb1, unwind unreachable]; // scope 4 at $DIR/reborrow.rs:+4:5: +4:14 ++ _5 = opaque::<*mut u8>(_2) -> [return: bb1, unwind unreachable]; // scope 4 at $DIR/reborrow.rs:+4:5: +4:14 + // mir::Constant + // + span: $DIR/reborrow.rs:31:5: 31:11 + // + literal: Const { ty: fn(*mut u8) {opaque::<*mut u8>}, val: Value() } + } + + bb1: { +- StorageDead(_6); // scope 4 at $DIR/reborrow.rs:+4:13: +4:14 + StorageDead(_5); // scope 4 at $DIR/reborrow.rs:+4:14: +4:15 + _0 = const (); // scope 0 at $DIR/reborrow.rs:+0:21: +5:2 +- StorageDead(_4); // scope 2 at $DIR/reborrow.rs:+5:1: +5:2 + StorageDead(_3); // scope 1 at $DIR/reborrow.rs:+5:1: +5:2 +- StorageDead(_2); // scope 0 at $DIR/reborrow.rs:+5:1: +5:2 + return; // scope 0 at $DIR/reborrow.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.diff b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.diff rename to tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff diff --git a/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-abort.diff new file mode 100644 index 00000000000..59f87b5b911 --- /dev/null +++ b/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-abort.diff @@ -0,0 +1,50 @@ +- // MIR for `remut` before CopyProp ++ // MIR for `remut` after CopyProp + + fn remut(_1: u8) -> () { + debug x => _1; // in scope 0 at $DIR/reborrow.rs:+0:10: +0:15 + let mut _0: (); // return place in scope 0 at $DIR/reborrow.rs:+0:21: +0:21 + let _2: &mut u8; // in scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + let _5: (); // in scope 0 at $DIR/reborrow.rs:+4:5: +4:14 + let mut _6: &mut u8; // in scope 0 at $DIR/reborrow.rs:+4:12: +4:13 + scope 1 { + debug a => _2; // in scope 1 at $DIR/reborrow.rs:+1:9: +1:10 + let _3: &mut u8; // in scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + scope 2 { + debug b => _3; // in scope 2 at $DIR/reborrow.rs:+2:9: +2:10 + let _4: &mut u8; // in scope 2 at $DIR/reborrow.rs:+3:9: +3:10 + scope 3 { +- debug c => _4; // in scope 3 at $DIR/reborrow.rs:+3:9: +3:10 ++ debug c => _2; // in scope 3 at $DIR/reborrow.rs:+3:9: +3:10 + } + } + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + _2 = &mut _1; // scope 0 at $DIR/reborrow.rs:+1:13: +1:19 + StorageLive(_3); // scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + _3 = &mut (*_2); // scope 1 at $DIR/reborrow.rs:+2:13: +2:20 +- StorageLive(_4); // scope 2 at $DIR/reborrow.rs:+3:9: +3:10 +- _4 = move _2; // scope 2 at $DIR/reborrow.rs:+3:13: +3:14 + StorageLive(_5); // scope 3 at $DIR/reborrow.rs:+4:5: +4:14 +- StorageLive(_6); // scope 3 at $DIR/reborrow.rs:+4:12: +4:13 +- _6 = move _4; // scope 3 at $DIR/reborrow.rs:+4:12: +4:13 +- _5 = opaque::<&mut u8>(move _6) -> [return: bb1, unwind unreachable]; // scope 3 at $DIR/reborrow.rs:+4:5: +4:14 ++ _5 = opaque::<&mut u8>(move _2) -> [return: bb1, unwind unreachable]; // scope 3 at $DIR/reborrow.rs:+4:5: +4:14 + // mir::Constant + // + span: $DIR/reborrow.rs:15:5: 15:11 + // + literal: Const { ty: fn(&mut u8) {opaque::<&mut u8>}, val: Value() } + } + + bb1: { +- StorageDead(_6); // scope 3 at $DIR/reborrow.rs:+4:13: +4:14 + StorageDead(_5); // scope 3 at $DIR/reborrow.rs:+4:14: +4:15 + _0 = const (); // scope 0 at $DIR/reborrow.rs:+0:21: +5:2 +- StorageDead(_4); // scope 2 at $DIR/reborrow.rs:+5:1: +5:2 + StorageDead(_3); // scope 1 at $DIR/reborrow.rs:+5:1: +5:2 +- StorageDead(_2); // scope 0 at $DIR/reborrow.rs:+5:1: +5:2 + return; // scope 0 at $DIR/reborrow.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.diff b/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/copy-prop/reborrow.remut.CopyProp.diff rename to tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-unwind.diff diff --git a/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-abort.diff new file mode 100644 index 00000000000..08bb6d8b22b --- /dev/null +++ b/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-abort.diff @@ -0,0 +1,50 @@ +- // MIR for `reraw` before CopyProp ++ // MIR for `reraw` after CopyProp + + fn reraw(_1: u8) -> () { + debug x => _1; // in scope 0 at $DIR/reborrow.rs:+0:10: +0:15 + let mut _0: (); // return place in scope 0 at $DIR/reborrow.rs:+0:21: +0:21 + let _2: &mut u8; // in scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + let _5: (); // in scope 0 at $DIR/reborrow.rs:+4:5: +4:14 + let mut _6: &mut u8; // in scope 0 at $DIR/reborrow.rs:+4:12: +4:13 + scope 1 { + debug a => _2; // in scope 1 at $DIR/reborrow.rs:+1:9: +1:10 + let _3: *mut u8; // in scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + scope 2 { + debug b => _3; // in scope 2 at $DIR/reborrow.rs:+2:9: +2:10 + let _4: &mut u8; // in scope 2 at $DIR/reborrow.rs:+3:9: +3:10 + scope 3 { +- debug c => _4; // in scope 3 at $DIR/reborrow.rs:+3:9: +3:10 ++ debug c => _2; // in scope 3 at $DIR/reborrow.rs:+3:9: +3:10 + } + } + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/reborrow.rs:+1:9: +1:10 + _2 = &mut _1; // scope 0 at $DIR/reborrow.rs:+1:13: +1:19 + StorageLive(_3); // scope 1 at $DIR/reborrow.rs:+2:9: +2:10 + _3 = &raw mut (*_2); // scope 1 at $DIR/reborrow.rs:+2:13: +2:24 +- StorageLive(_4); // scope 2 at $DIR/reborrow.rs:+3:9: +3:10 +- _4 = move _2; // scope 2 at $DIR/reborrow.rs:+3:13: +3:14 + StorageLive(_5); // scope 3 at $DIR/reborrow.rs:+4:5: +4:14 +- StorageLive(_6); // scope 3 at $DIR/reborrow.rs:+4:12: +4:13 +- _6 = move _4; // scope 3 at $DIR/reborrow.rs:+4:12: +4:13 +- _5 = opaque::<&mut u8>(move _6) -> [return: bb1, unwind unreachable]; // scope 3 at $DIR/reborrow.rs:+4:5: +4:14 ++ _5 = opaque::<&mut u8>(move _2) -> [return: bb1, unwind unreachable]; // scope 3 at $DIR/reborrow.rs:+4:5: +4:14 + // mir::Constant + // + span: $DIR/reborrow.rs:23:5: 23:11 + // + literal: Const { ty: fn(&mut u8) {opaque::<&mut u8>}, val: Value() } + } + + bb1: { +- StorageDead(_6); // scope 3 at $DIR/reborrow.rs:+4:13: +4:14 + StorageDead(_5); // scope 3 at $DIR/reborrow.rs:+4:14: +4:15 + _0 = const (); // scope 0 at $DIR/reborrow.rs:+0:21: +5:2 +- StorageDead(_4); // scope 2 at $DIR/reborrow.rs:+5:1: +5:2 + StorageDead(_3); // scope 1 at $DIR/reborrow.rs:+5:1: +5:2 +- StorageDead(_2); // scope 0 at $DIR/reborrow.rs:+5:1: +5:2 + return; // scope 0 at $DIR/reborrow.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.diff b/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.diff rename to tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-unwind.diff diff --git a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff new file mode 100644 index 00000000000..be96743c362 --- /dev/null +++ b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff @@ -0,0 +1,80 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/checked.rs:+0:11: +0:11 + let _1: i32; // in scope 0 at $DIR/checked.rs:+1:9: +1:10 + let mut _4: i32; // in scope 0 at $DIR/checked.rs:+3:13: +3:14 + let mut _5: i32; // in scope 0 at $DIR/checked.rs:+3:17: +3:18 + let mut _6: (i32, bool); // in scope 0 at $DIR/checked.rs:+3:13: +3:18 + let mut _9: i32; // in scope 0 at $DIR/checked.rs:+6:13: +6:14 + let mut _10: (i32, bool); // in scope 0 at $DIR/checked.rs:+6:13: +6:18 + scope 1 { + debug a => _1; // in scope 1 at $DIR/checked.rs:+1:9: +1:10 + let _2: i32; // in scope 1 at $DIR/checked.rs:+2:9: +2:10 + scope 2 { + debug b => _2; // in scope 2 at $DIR/checked.rs:+2:9: +2:10 + let _3: i32; // in scope 2 at $DIR/checked.rs:+3:9: +3:10 + scope 3 { + debug c => _3; // in scope 3 at $DIR/checked.rs:+3:9: +3:10 + let _7: i32; // in scope 3 at $DIR/checked.rs:+5:9: +5:10 + scope 4 { + debug d => _7; // in scope 4 at $DIR/checked.rs:+5:9: +5:10 + let _8: i32; // in scope 4 at $DIR/checked.rs:+6:9: +6:10 + scope 5 { + debug e => _8; // in scope 5 at $DIR/checked.rs:+6:9: +6:10 + } + } + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/checked.rs:+1:9: +1:10 + _1 = const 1_i32; // scope 0 at $DIR/checked.rs:+1:13: +1:14 + StorageLive(_2); // scope 1 at $DIR/checked.rs:+2:9: +2:10 + _2 = const 2_i32; // scope 1 at $DIR/checked.rs:+2:13: +2:14 + StorageLive(_3); // scope 2 at $DIR/checked.rs:+3:9: +3:10 + StorageLive(_4); // scope 2 at $DIR/checked.rs:+3:13: +3:14 +- _4 = _1; // scope 2 at $DIR/checked.rs:+3:13: +3:14 ++ _4 = const 1_i32; // scope 2 at $DIR/checked.rs:+3:13: +3:14 + StorageLive(_5); // scope 2 at $DIR/checked.rs:+3:17: +3:18 +- _5 = _2; // scope 2 at $DIR/checked.rs:+3:17: +3:18 +- _6 = CheckedAdd(_4, _5); // scope 2 at $DIR/checked.rs:+3:13: +3:18 +- assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, move _5) -> [success: bb1, unwind unreachable]; // scope 2 at $DIR/checked.rs:+3:13: +3:18 ++ _5 = const 2_i32; // scope 2 at $DIR/checked.rs:+3:17: +3:18 ++ _6 = CheckedAdd(const 1_i32, const 2_i32); // scope 2 at $DIR/checked.rs:+3:13: +3:18 ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_i32, const 2_i32) -> [success: bb1, unwind unreachable]; // scope 2 at $DIR/checked.rs:+3:13: +3:18 + } + + bb1: { +- _3 = move (_6.0: i32); // scope 2 at $DIR/checked.rs:+3:13: +3:18 ++ _3 = const 3_i32; // scope 2 at $DIR/checked.rs:+3:13: +3:18 + StorageDead(_5); // scope 2 at $DIR/checked.rs:+3:17: +3:18 + StorageDead(_4); // scope 2 at $DIR/checked.rs:+3:17: +3:18 + StorageLive(_7); // scope 3 at $DIR/checked.rs:+5:9: +5:10 + _7 = const _; // scope 3 at $DIR/checked.rs:+5:13: +5:21 + StorageLive(_8); // scope 4 at $DIR/checked.rs:+6:9: +6:10 + StorageLive(_9); // scope 4 at $DIR/checked.rs:+6:13: +6:14 +- _9 = _7; // scope 4 at $DIR/checked.rs:+6:13: +6:14 +- _10 = CheckedAdd(_9, const 1_i32); // scope 4 at $DIR/checked.rs:+6:13: +6:18 +- assert(!move (_10.1: bool), "attempt to compute `{} + {}`, which would overflow", move _9, const 1_i32) -> [success: bb2, unwind unreachable]; // scope 4 at $DIR/checked.rs:+6:13: +6:18 ++ _9 = const i32::MAX; // scope 4 at $DIR/checked.rs:+6:13: +6:14 ++ _10 = CheckedAdd(const i32::MAX, const 1_i32); // scope 4 at $DIR/checked.rs:+6:13: +6:18 ++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const i32::MAX, const 1_i32) -> [success: bb2, unwind unreachable]; // scope 4 at $DIR/checked.rs:+6:13: +6:18 + } + + bb2: { +- _8 = move (_10.0: i32); // scope 4 at $DIR/checked.rs:+6:13: +6:18 ++ _8 = const i32::MIN; // scope 4 at $DIR/checked.rs:+6:13: +6:18 + StorageDead(_9); // scope 4 at $DIR/checked.rs:+6:17: +6:18 + _0 = const (); // scope 0 at $DIR/checked.rs:+0:11: +7:2 + StorageDead(_8); // scope 4 at $DIR/checked.rs:+7:1: +7:2 + StorageDead(_7); // scope 3 at $DIR/checked.rs:+7:1: +7:2 + StorageDead(_3); // scope 2 at $DIR/checked.rs:+7:1: +7:2 + StorageDead(_2); // scope 1 at $DIR/checked.rs:+7:1: +7:2 + StorageDead(_1); // scope 0 at $DIR/checked.rs:+7:1: +7:2 + return; // scope 0 at $DIR/checked.rs:+7:2: +7:2 + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.diff rename to tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff new file mode 100644 index 00000000000..ff95cba98ad --- /dev/null +++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff @@ -0,0 +1,39 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inherit_overflow.rs:+0:11: +0:11 + let mut _1: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + let mut _2: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + let mut _3: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + scope 1 { + } + scope 2 (inlined ::add) { // at $DIR/inherit_overflow.rs:9:13: 9:47 + debug self => _2; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL + debug other => _3; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL + let mut _4: (u8, bool); // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + StorageLive(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + _2 = const u8::MAX; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + StorageLive(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + _3 = const 1_u8; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 +- _4 = CheckedAdd(_2, _3); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL +- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL ++ _4 = CheckedAdd(const u8::MAX, const 1_u8); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL ++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL + } + + bb1: { +- _1 = move (_4.0: u8); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL ++ _1 = const 0_u8; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL + StorageDead(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + StorageDead(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47 + StorageDead(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:47: +3:48 + _0 = const (); // scope 0 at $DIR/inherit_overflow.rs:+0:11: +4:2 + return; // scope 0 at $DIR/inherit_overflow.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff rename to tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff 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 new file mode 100644 index 00000000000..7a9ab39e0e5 --- /dev/null +++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff @@ -0,0 +1,55 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/ref_without_sb.rs:+0:11: +0:11 + let mut _1: i32; // in scope 0 at $DIR/ref_without_sb.rs:+1:9: +1:14 + let _2: (); // in scope 0 at $DIR/ref_without_sb.rs:+2:5: +2:15 + let mut _3: &i32; // in scope 0 at $DIR/ref_without_sb.rs:+2:12: +2:14 + let _4: &i32; // in scope 0 at $DIR/ref_without_sb.rs:+2:12: +2:14 + let _5: (); // in scope 0 at $DIR/ref_without_sb.rs:+4:5: +4:20 + scope 1 { + debug a => _1; // in scope 1 at $DIR/ref_without_sb.rs:+1:9: +1:14 + let _6: i32; // in scope 1 at $DIR/ref_without_sb.rs:+6:9: +6:10 + scope 2 { + debug b => _6; // in scope 2 at $DIR/ref_without_sb.rs:+6:9: +6:10 + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/ref_without_sb.rs:+1:9: +1:14 + _1 = const 0_i32; // scope 0 at $DIR/ref_without_sb.rs:+1:17: +1:18 + StorageLive(_2); // scope 1 at $DIR/ref_without_sb.rs:+2:5: +2:15 + StorageLive(_3); // scope 1 at $DIR/ref_without_sb.rs:+2:12: +2:14 + StorageLive(_4); // scope 1 at $DIR/ref_without_sb.rs:+2:12: +2:14 + _4 = &_1; // scope 1 at $DIR/ref_without_sb.rs:+2:12: +2:14 + _3 = &(*_4); // scope 1 at $DIR/ref_without_sb.rs:+2:12: +2:14 + _2 = escape::(move _3) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/ref_without_sb.rs:+2:5: +2:15 + // mir::Constant + // + span: $DIR/ref_without_sb.rs:13:5: 13:11 + // + literal: Const { ty: for<'a> fn(&'a i32) {escape::}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 1 at $DIR/ref_without_sb.rs:+2:14: +2:15 + StorageDead(_4); // scope 1 at $DIR/ref_without_sb.rs:+2:15: +2:16 + StorageDead(_2); // scope 1 at $DIR/ref_without_sb.rs:+2:15: +2:16 + _1 = const 1_i32; // scope 1 at $DIR/ref_without_sb.rs:+3:5: +3:10 + StorageLive(_5); // scope 1 at $DIR/ref_without_sb.rs:+4:5: +4:20 + _5 = some_function() -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/ref_without_sb.rs:+4:5: +4:20 + // mir::Constant + // + span: $DIR/ref_without_sb.rs:15:5: 15:18 + // + literal: Const { ty: fn() {some_function}, val: Value() } + } + + bb2: { + StorageDead(_5); // scope 1 at $DIR/ref_without_sb.rs:+4:20: +4:21 + StorageLive(_6); // scope 1 at $DIR/ref_without_sb.rs:+6:9: +6:10 + _6 = _1; // scope 1 at $DIR/ref_without_sb.rs:+6:13: +6:14 + _0 = const (); // scope 0 at $DIR/ref_without_sb.rs:+0:11: +7:2 + StorageDead(_6); // scope 1 at $DIR/ref_without_sb.rs:+7:1: +7:2 + StorageDead(_1); // scope 0 at $DIR/ref_without_sb.rs:+7:1: +7:2 + return; // scope 0 at $DIR/ref_without_sb.rs:+7:2: +7:2 + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.diff rename to tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff new file mode 100644 index 00000000000..ee857e716e2 --- /dev/null +++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff @@ -0,0 +1,54 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/sibling_ptr.rs:+0:11: +0:11 + let mut _1: (u8, u8); // in scope 0 at $DIR/sibling_ptr.rs:+1:9: +1:14 + let _2: (); // in scope 0 at $DIR/sibling_ptr.rs:+2:5: +5:6 + let mut _4: *mut u8; // in scope 0 at $DIR/sibling_ptr.rs:+4:10: +4:18 + let mut _5: *mut u8; // in scope 0 at $DIR/sibling_ptr.rs:+4:10: +4:11 + scope 1 { + debug x => _1; // in scope 1 at $DIR/sibling_ptr.rs:+1:9: +1:14 + let _6: u8; // in scope 1 at $DIR/sibling_ptr.rs:+6:9: +6:11 + scope 2 { + let _3: *mut u8; // in scope 2 at $DIR/sibling_ptr.rs:+3:13: +3:14 + scope 3 { + debug p => _3; // in scope 3 at $DIR/sibling_ptr.rs:+3:13: +3:14 + } + } + scope 4 { + debug x1 => _6; // in scope 4 at $DIR/sibling_ptr.rs:+6:9: +6:11 + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/sibling_ptr.rs:+1:9: +1:14 + _1 = (const 0_u8, const 0_u8); // scope 0 at $DIR/sibling_ptr.rs:+1:27: +1:33 + StorageLive(_2); // scope 1 at $DIR/sibling_ptr.rs:+2:5: +5:6 + StorageLive(_3); // scope 2 at $DIR/sibling_ptr.rs:+3:13: +3:14 + _3 = &raw mut (_1.0: u8); // scope 2 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageLive(_4); // scope 3 at $DIR/sibling_ptr.rs:+4:10: +4:18 + StorageLive(_5); // scope 3 at $DIR/sibling_ptr.rs:+4:10: +4:11 + _5 = _3; // scope 3 at $DIR/sibling_ptr.rs:+4:10: +4:11 + _4 = ptr::mut_ptr::::add(move _5, const 1_usize) -> [return: bb1, unwind unreachable]; // scope 3 at $DIR/sibling_ptr.rs:+4:10: +4:18 + // mir::Constant + // + span: $DIR/sibling_ptr.rs:16:12: 16:15 + // + literal: Const { ty: unsafe fn(*mut u8, usize) -> *mut u8 {ptr::mut_ptr::::add}, val: Value() } + } + + bb1: { + StorageDead(_5); // scope 3 at $DIR/sibling_ptr.rs:+4:17: +4:18 + (*_4) = const 1_u8; // scope 3 at $DIR/sibling_ptr.rs:+4:9: +4:22 + StorageDead(_4); // scope 3 at $DIR/sibling_ptr.rs:+4:22: +4:23 + _2 = const (); // scope 2 at $DIR/sibling_ptr.rs:+2:5: +5:6 + StorageDead(_3); // scope 2 at $DIR/sibling_ptr.rs:+5:5: +5:6 + StorageDead(_2); // scope 1 at $DIR/sibling_ptr.rs:+5:5: +5:6 + StorageLive(_6); // scope 1 at $DIR/sibling_ptr.rs:+6:9: +6:11 + _6 = (_1.1: u8); // scope 1 at $DIR/sibling_ptr.rs:+6:14: +6:17 + _0 = const (); // scope 0 at $DIR/sibling_ptr.rs:+0:11: +7:2 + StorageDead(_6); // scope 1 at $DIR/sibling_ptr.rs:+7:1: +7:2 + StorageDead(_1); // scope 0 at $DIR/sibling_ptr.rs:+7:1: +7:2 + return; // scope 0 at $DIR/sibling_ptr.rs:+7:2: +7:2 + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.diff rename to tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff diff --git a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff new file mode 100644 index 00000000000..94e9595a0e3 --- /dev/null +++ b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff @@ -0,0 +1,40 @@ +- // MIR for `main` before DataflowConstProp ++ // MIR for `main` after DataflowConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/terminator.rs:+0:11: +0:11 + let _1: i32; // in scope 0 at $DIR/terminator.rs:+1:9: +1:10 + let _2: (); // in scope 0 at $DIR/terminator.rs:+3:5: +3:15 + let mut _3: i32; // in scope 0 at $DIR/terminator.rs:+3:9: +3:14 + let mut _4: i32; // in scope 0 at $DIR/terminator.rs:+3:9: +3:10 + scope 1 { + debug a => _1; // in scope 1 at $DIR/terminator.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/terminator.rs:+1:9: +1:10 + _1 = const 1_i32; // scope 0 at $DIR/terminator.rs:+1:13: +1:14 + StorageLive(_2); // scope 1 at $DIR/terminator.rs:+3:5: +3:15 + StorageLive(_3); // scope 1 at $DIR/terminator.rs:+3:9: +3:14 + StorageLive(_4); // scope 1 at $DIR/terminator.rs:+3:9: +3:10 +- _4 = _1; // scope 1 at $DIR/terminator.rs:+3:9: +3:10 +- _3 = Add(move _4, const 1_i32); // scope 1 at $DIR/terminator.rs:+3:9: +3:14 ++ _4 = const 1_i32; // scope 1 at $DIR/terminator.rs:+3:9: +3:10 ++ _3 = const 2_i32; // scope 1 at $DIR/terminator.rs:+3:9: +3:14 + StorageDead(_4); // scope 1 at $DIR/terminator.rs:+3:13: +3:14 +- _2 = foo(move _3) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/terminator.rs:+3:5: +3:15 ++ _2 = foo(const 2_i32) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/terminator.rs:+3:5: +3:15 + // mir::Constant + // + span: $DIR/terminator.rs:10:5: 10:8 + // + literal: Const { ty: fn(i32) {foo}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 1 at $DIR/terminator.rs:+3:14: +3:15 + StorageDead(_2); // scope 1 at $DIR/terminator.rs:+3:15: +3:16 + _0 = const (); // scope 0 at $DIR/terminator.rs:+0:11: +4:2 + StorageDead(_1); // scope 0 at $DIR/terminator.rs:+4:1: +4:2 + return; // scope 0 at $DIR/terminator.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff rename to tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff new file mode 100644 index 00000000000..23cd812cabe --- /dev/null +++ b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff @@ -0,0 +1,76 @@ +- // MIR for `cycle` before DeadStoreElimination ++ // MIR for `cycle` after DeadStoreElimination + + fn cycle(_1: i32, _2: i32, _3: i32) -> () { + debug x => _1; // in scope 0 at $DIR/cycle.rs:+0:10: +0:15 + debug y => _2; // in scope 0 at $DIR/cycle.rs:+0:22: +0:27 + debug z => _3; // in scope 0 at $DIR/cycle.rs:+0:34: +0:39 + let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:46: +0:46 +- let mut _4: (); // in scope 0 at $DIR/cycle.rs:+0:1: +9:2 +- let mut _5: bool; // in scope 0 at $DIR/cycle.rs:+3:11: +3:17 +- let _6: i32; // in scope 0 at $DIR/cycle.rs:+4:13: +4:17 +- let mut _7: i32; // in scope 0 at $DIR/cycle.rs:+5:13: +5:14 +- let mut _8: i32; // in scope 0 at $DIR/cycle.rs:+6:13: +6:14 +- let mut _9: i32; // in scope 0 at $DIR/cycle.rs:+7:13: +7:17 +- let mut _10: !; // in scope 0 at $DIR/cycle.rs:+3:5: +8:6 +- let _11: (); // in scope 0 at $DIR/cycle.rs:+3:5: +8:6 +- let mut _12: !; // in scope 0 at $DIR/cycle.rs:+3:5: +8:6 ++ let mut _4: bool; // in scope 0 at $DIR/cycle.rs:+3:11: +3:17 ++ let _5: i32; // in scope 0 at $DIR/cycle.rs:+4:13: +4:17 + scope 1 { +- debug temp => _6; // in scope 1 at $DIR/cycle.rs:+4:13: +4:17 ++ debug temp => _5; // in scope 1 at $DIR/cycle.rs:+4:13: +4:17 + } + + bb0: { + goto -> bb1; // scope 0 at $DIR/cycle.rs:+3:5: +8:6 + } + + bb1: { +- StorageLive(_5); // scope 0 at $DIR/cycle.rs:+3:11: +3:17 +- _5 = cond() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17 ++ StorageLive(_4); // scope 0 at $DIR/cycle.rs:+3:11: +3:17 ++ _4 = cond() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17 + // mir::Constant + // + span: $DIR/cycle.rs:13:11: 13:15 + // + literal: Const { ty: fn() -> bool {cond}, val: Value() } + } + + bb2: { +- switchInt(move _5) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17 ++ switchInt(move _4) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17 + } + + bb3: { +- StorageLive(_6); // scope 0 at $DIR/cycle.rs:+4:13: +4:17 +- _6 = _3; // scope 0 at $DIR/cycle.rs:+4:20: +4:21 +- StorageLive(_7); // scope 1 at $DIR/cycle.rs:+5:13: +5:14 +- _7 = _2; // scope 1 at $DIR/cycle.rs:+5:13: +5:14 +- _3 = move _7; // scope 1 at $DIR/cycle.rs:+5:9: +5:14 +- StorageDead(_7); // scope 1 at $DIR/cycle.rs:+5:13: +5:14 +- StorageLive(_8); // scope 1 at $DIR/cycle.rs:+6:13: +6:14 +- _8 = _1; // scope 1 at $DIR/cycle.rs:+6:13: +6:14 +- _2 = move _8; // scope 1 at $DIR/cycle.rs:+6:9: +6:14 +- StorageDead(_8); // scope 1 at $DIR/cycle.rs:+6:13: +6:14 +- StorageLive(_9); // scope 1 at $DIR/cycle.rs:+7:13: +7:17 +- _9 = _6; // scope 1 at $DIR/cycle.rs:+7:13: +7:17 +- _1 = move _9; // scope 1 at $DIR/cycle.rs:+7:9: +7:17 +- StorageDead(_9); // scope 1 at $DIR/cycle.rs:+7:16: +7:17 +- _4 = const (); // scope 0 at $DIR/cycle.rs:+3:18: +8:6 +- StorageDead(_6); // scope 0 at $DIR/cycle.rs:+8:5: +8:6 ++ StorageLive(_5); // scope 0 at $DIR/cycle.rs:+4:13: +4:17 + StorageDead(_5); // scope 0 at $DIR/cycle.rs:+8:5: +8:6 ++ StorageDead(_4); // scope 0 at $DIR/cycle.rs:+8:5: +8:6 + goto -> bb1; // scope 0 at $DIR/cycle.rs:+3:5: +8:6 + } + + bb4: { +- StorageLive(_11); // scope 0 at $DIR/cycle.rs:+3:5: +8:6 + _0 = const (); // scope 0 at $DIR/cycle.rs:+3:5: +8:6 +- StorageDead(_11); // scope 0 at $DIR/cycle.rs:+8:5: +8:6 +- StorageDead(_5); // scope 0 at $DIR/cycle.rs:+8:5: +8:6 ++ StorageDead(_4); // scope 0 at $DIR/cycle.rs:+8:5: +8:6 + return; // scope 0 at $DIR/cycle.rs:+9:2: +9:2 + } + } + diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff similarity index 100% rename from tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff rename to tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff diff --git a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff new file mode 100644 index 00000000000..89de03000ae --- /dev/null +++ b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff @@ -0,0 +1,100 @@ +- // MIR for `is_line_doc_comment_2` before DeduplicateBlocks ++ // MIR for `is_line_doc_comment_2` after DeduplicateBlocks + + fn is_line_doc_comment_2(_1: &str) -> bool { + debug s => _1; // in scope 0 at $DIR/deduplicate_blocks.rs:+0:36: +0:37 + let mut _0: bool; // return place in scope 0 at $DIR/deduplicate_blocks.rs:+0:48: +0:52 + let mut _2: &[u8]; // in scope 0 at $DIR/deduplicate_blocks.rs:+1:11: +1:23 + let mut _3: &str; // in scope 0 at $DIR/deduplicate_blocks.rs:+1:11: +1:23 + let mut _4: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31 + let mut _5: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31 + let mut _6: bool; // in scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31 + let mut _7: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37 + let mut _8: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37 + let mut _9: bool; // in scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/deduplicate_blocks.rs:+1:11: +1:23 + StorageLive(_3); // scope 0 at $DIR/deduplicate_blocks.rs:+1:11: +1:23 + _3 = &(*_1); // scope 0 at $DIR/deduplicate_blocks.rs:+1:11: +1:23 + _2 = core::str::::as_bytes(move _3) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:11: +1:23 + // mir::Constant + // + span: $DIR/deduplicate_blocks.rs:6:13: 6:21 + // + literal: Const { ty: for<'a> fn(&'a str) -> &'a [u8] {core::str::::as_bytes}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 0 at $DIR/deduplicate_blocks.rs:+1:22: +1:23 + _7 = Len((*_2)); // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37 + _8 = const 4_usize; // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37 + _9 = Ge(move _7, move _8); // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37 + switchInt(move _9) -> [0: bb6, otherwise: bb2]; // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37 + } + + bb2: { + switchInt((*_2)[0 of 4]) -> [47: bb3, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 + } + + bb3: { + switchInt((*_2)[1 of 4]) -> [47: bb4, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 + } + + bb4: { + switchInt((*_2)[2 of 4]) -> [47: bb5, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 + } + + bb5: { +- switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 ++ switchInt((*_2)[3 of 4]) -> [47: bb10, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 + } + + bb6: { + _4 = Len((*_2)); // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31 + _5 = const 3_usize; // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31 + _6 = Ge(move _4, move _5); // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31 + switchInt(move _6) -> [0: bb10, otherwise: bb7]; // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31 + } + + bb7: { + switchInt((*_2)[0 of 3]) -> [47: bb8, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 + } + + bb8: { + switchInt((*_2)[1 of 3]) -> [47: bb9, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 + } + + bb9: { +- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb13, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 ++ switchInt((*_2)[2 of 3]) -> [47: bb11, 33: bb11, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 + } + + bb10: { +- _0 = const false; // scope 0 at $DIR/deduplicate_blocks.rs:+5:14: +5:19 +- goto -> bb14; // scope 0 at $DIR/deduplicate_blocks.rs:+5:14: +5:19 +- } +- +- bb11: { + _0 = const false; // scope 0 at $DIR/deduplicate_blocks.rs:+2:41: +2:46 +- goto -> bb14; // scope 0 at $DIR/deduplicate_blocks.rs:+2:41: +2:46 ++ goto -> bb12; // scope 0 at $DIR/deduplicate_blocks.rs:+2:41: +2:46 + } + +- bb12: { +- _0 = const true; // scope 0 at $DIR/deduplicate_blocks.rs:+3:35: +3:39 +- goto -> bb14; // scope 0 at $DIR/deduplicate_blocks.rs:+3:35: +3:39 +- } +- +- bb13: { ++ bb11: { + _0 = const true; // scope 0 at $DIR/deduplicate_blocks.rs:+4:35: +4:39 +- goto -> bb14; // scope 0 at $DIR/deduplicate_blocks.rs:+4:35: +4:39 ++ goto -> bb12; // scope 0 at $DIR/deduplicate_blocks.rs:+4:35: +4:39 + } + +- bb14: { ++ bb12: { + StorageDead(_2); // scope 0 at $DIR/deduplicate_blocks.rs:+7:1: +7:2 + return; // scope 0 at $DIR/deduplicate_blocks.rs:+7:2: +7:2 + } + } + diff --git a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff similarity index 100% rename from tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff rename to tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff diff --git a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff new file mode 100644 index 00000000000..6458b06f0e0 --- /dev/null +++ b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff @@ -0,0 +1,109 @@ +- // MIR for `main` before Derefer ++ // MIR for `main` after Derefer + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/derefer_complex_case.rs:+0:11: +0:11 + let mut _1: std::slice::Iter<'_, i32>; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + let mut _2: &[i32; 2]; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + let _3: [i32; 2]; // in scope 0 at $DIR/derefer_complex_case.rs:+1:18: +1:26 + let mut _4: std::slice::Iter<'_, i32>; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + let mut _5: (); // in scope 0 at $DIR/derefer_complex_case.rs:+0:1: +2:2 + let _6: (); // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + let mut _7: std::option::Option<&i32>; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + let mut _8: &mut std::slice::Iter<'_, i32>; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + let mut _9: &mut std::slice::Iter<'_, i32>; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + let mut _10: isize; // in scope 0 at $DIR/derefer_complex_case.rs:+1:5: +1:40 + let mut _11: !; // in scope 0 at $DIR/derefer_complex_case.rs:+1:5: +1:40 + let mut _13: i32; // in scope 0 at $DIR/derefer_complex_case.rs:+1:34: +1:37 + let mut _14: &[i32; 2]; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 ++ let mut _15: &i32; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + scope 1 { + debug iter => _4; // in scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + let _12: i32; // in scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13 + scope 2 { + debug foo => _12; // in scope 2 at $DIR/derefer_complex_case.rs:+1:10: +1:13 + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + StorageLive(_2); // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + _14 = const _; // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + // mir::Constant + // + span: $DIR/derefer_complex_case.rs:6:17: 6:26 + // + literal: Const { ty: &[i32; 2], val: Unevaluated(main, [], Some(promoted[0])) } + _2 = &(*_14); // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + _1 = <&[i32; 2] as IntoIterator>::into_iter(move _2) -> [return: bb1, unwind: bb8]; // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + // mir::Constant + // + span: $DIR/derefer_complex_case.rs:6:17: 6:26 + // + literal: Const { ty: fn(&[i32; 2]) -> <&[i32; 2] as IntoIterator>::IntoIter {<&[i32; 2] as IntoIterator>::into_iter}, val: Value() } + } + + bb1: { + StorageDead(_2); // scope 0 at $DIR/derefer_complex_case.rs:+1:25: +1:26 + StorageLive(_4); // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + _4 = move _1; // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + goto -> bb2; // scope 1 at $DIR/derefer_complex_case.rs:+1:5: +1:40 + } + + bb2: { + StorageLive(_6); // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + StorageLive(_7); // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + StorageLive(_8); // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + StorageLive(_9); // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + _9 = &mut _4; // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + _8 = &mut (*_9); // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + _7 = as Iterator>::next(move _8) -> [return: bb3, unwind: bb8]; // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + // mir::Constant + // + span: $DIR/derefer_complex_case.rs:6:17: 6:26 + // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, i32>) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } + } + + bb3: { + StorageDead(_8); // scope 1 at $DIR/derefer_complex_case.rs:+1:25: +1:26 + _10 = discriminant(_7); // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + } + + bb4: { + StorageLive(_12); // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13 +- _12 = (*((_7 as Some).0: &i32)); // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13 ++ _15 = deref_copy ((_7 as Some).0: &i32); // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13 ++ _12 = (*_15); // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13 + StorageLive(_13); // scope 2 at $DIR/derefer_complex_case.rs:+1:34: +1:37 + _13 = _12; // scope 2 at $DIR/derefer_complex_case.rs:+1:34: +1:37 + _6 = std::mem::drop::(move _13) -> [return: bb7, unwind: bb8]; // scope 2 at $DIR/derefer_complex_case.rs:+1:29: +1:38 + // mir::Constant + // + span: $DIR/derefer_complex_case.rs:6:29: 6:33 + // + literal: Const { ty: fn(i32) {std::mem::drop::}, val: Value() } + } + + bb5: { + unreachable; // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + } + + bb6: { + _0 = const (); // scope 1 at $DIR/derefer_complex_case.rs:+1:5: +1:40 + StorageDead(_9); // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40 + StorageDead(_7); // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40 + StorageDead(_6); // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40 + StorageDead(_4); // scope 0 at $DIR/derefer_complex_case.rs:+1:39: +1:40 + StorageDead(_1); // scope 0 at $DIR/derefer_complex_case.rs:+1:39: +1:40 + return; // scope 0 at $DIR/derefer_complex_case.rs:+2:2: +2:2 + } + + bb7: { + StorageDead(_13); // scope 2 at $DIR/derefer_complex_case.rs:+1:37: +1:38 + StorageDead(_12); // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40 + StorageDead(_9); // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40 + StorageDead(_7); // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40 + StorageDead(_6); // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40 + _5 = const (); // scope 1 at $DIR/derefer_complex_case.rs:+1:5: +1:40 + goto -> bb2; // scope 1 at $DIR/derefer_complex_case.rs:+1:5: +1:40 + } + + bb8 (cleanup): { + resume; // scope 0 at $DIR/derefer_complex_case.rs:+0:1: +2:2 + } + } + diff --git a/tests/mir-opt/derefer_complex_case.main.Derefer.diff b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff similarity index 100% rename from tests/mir-opt/derefer_complex_case.main.Derefer.diff rename to tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff diff --git a/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff new file mode 100644 index 00000000000..92c8f2059e8 --- /dev/null +++ b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff @@ -0,0 +1,45 @@ +- // MIR for `main` before Derefer ++ // MIR for `main` after Derefer + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/derefer_inline_test.rs:+0:11: +0:11 + let _1: std::boxed::Box>; // in scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:18 + let mut _2: std::boxed::Box; // in scope 0 at $DIR/derefer_inline_test.rs:+1:14: +1:17 + + bb0: { + StorageLive(_1); // scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:18 + StorageLive(_2); // scope 0 at $DIR/derefer_inline_test.rs:+1:14: +1:17 + _2 = f() -> [return: bb1, unwind: bb5]; // scope 0 at $DIR/derefer_inline_test.rs:+1:14: +1:17 + // mir::Constant + // + span: $DIR/derefer_inline_test.rs:10:14: 10:15 + // + literal: Const { ty: fn() -> Box {f}, val: Value() } + } + + bb1: { + _1 = Box::>::new(move _2) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:18 + // mir::Constant + // + span: $DIR/derefer_inline_test.rs:10:5: 10:13 + // + user_ty: UserType(0) + // + literal: Const { ty: fn(Box) -> Box> {Box::>::new}, val: Value() } + } + + bb2: { + StorageDead(_2); // scope 0 at $DIR/derefer_inline_test.rs:+1:17: +1:18 + drop(_1) -> [return: bb3, unwind: bb5]; // scope 0 at $DIR/derefer_inline_test.rs:+1:18: +1:19 + } + + bb3: { + StorageDead(_1); // scope 0 at $DIR/derefer_inline_test.rs:+1:18: +1:19 + _0 = const (); // scope 0 at $DIR/derefer_inline_test.rs:+0:11: +2:2 + return; // scope 0 at $DIR/derefer_inline_test.rs:+2:2: +2:2 + } + + bb4 (cleanup): { + drop(_2) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/derefer_inline_test.rs:+1:17: +1:18 + } + + bb5 (cleanup): { + resume; // scope 0 at $DIR/derefer_inline_test.rs:+0:1: +2:2 + } + } + diff --git a/tests/mir-opt/derefer_inline_test.main.Derefer.diff b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff similarity index 100% rename from tests/mir-opt/derefer_inline_test.main.Derefer.diff rename to tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff diff --git a/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff new file mode 100644 index 00000000000..5a218df95b7 --- /dev/null +++ b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff @@ -0,0 +1,96 @@ +- // MIR for `main` before Derefer ++ // MIR for `main` after Derefer + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/derefer_terminator_test.rs:+0:11: +0:11 + let _1: bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+1:9: +1:10 + let _3: (); // in scope 0 at $DIR/derefer_terminator_test.rs:+3:5: +6:6 + let mut _4: &&&&bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+3:15: +3:22 + let _5: &&&bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+3:17: +3:21 + let _6: &&bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+3:18: +3:21 + let _7: &bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+3:19: +3:21 ++ let mut _10: &&&bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+3:15: +3:22 ++ let mut _11: &&bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+3:15: +3:22 ++ let mut _12: &bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+3:15: +3:22 + scope 1 { + debug b => _1; // in scope 1 at $DIR/derefer_terminator_test.rs:+1:9: +1:10 + let _2: bool; // in scope 1 at $DIR/derefer_terminator_test.rs:+2:9: +2:10 + scope 2 { + debug d => _2; // in scope 2 at $DIR/derefer_terminator_test.rs:+2:9: +2:10 + let _8: i32; // in scope 2 at $DIR/derefer_terminator_test.rs:+4:22: +4:23 + let _9: i32; // in scope 2 at $DIR/derefer_terminator_test.rs:+7:9: +7:10 + scope 3 { + debug x => _8; // in scope 3 at $DIR/derefer_terminator_test.rs:+4:22: +4:23 + } + scope 4 { + debug y => _9; // in scope 4 at $DIR/derefer_terminator_test.rs:+7:9: +7:10 + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/derefer_terminator_test.rs:+1:9: +1:10 + _1 = foo() -> [return: bb1, unwind: bb6]; // scope 0 at $DIR/derefer_terminator_test.rs:+1:13: +1:18 + // mir::Constant + // + span: $DIR/derefer_terminator_test.rs:6:13: 6:16 + // + literal: Const { ty: fn() -> bool {foo}, val: Value() } + } + + bb1: { + StorageLive(_2); // scope 1 at $DIR/derefer_terminator_test.rs:+2:9: +2:10 + _2 = foo() -> [return: bb2, unwind: bb6]; // scope 1 at $DIR/derefer_terminator_test.rs:+2:13: +2:18 + // mir::Constant + // + span: $DIR/derefer_terminator_test.rs:7:13: 7:16 + // + literal: Const { ty: fn() -> bool {foo}, val: Value() } + } + + bb2: { + StorageLive(_3); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +6:6 + StorageLive(_4); // scope 2 at $DIR/derefer_terminator_test.rs:+3:15: +3:22 + StorageLive(_5); // scope 2 at $DIR/derefer_terminator_test.rs:+3:17: +3:21 + StorageLive(_6); // scope 2 at $DIR/derefer_terminator_test.rs:+3:18: +3:21 + StorageLive(_7); // scope 2 at $DIR/derefer_terminator_test.rs:+3:19: +3:21 + _7 = &_1; // scope 2 at $DIR/derefer_terminator_test.rs:+3:19: +3:21 + _6 = &_7; // scope 2 at $DIR/derefer_terminator_test.rs:+3:18: +3:21 + _5 = &_6; // scope 2 at $DIR/derefer_terminator_test.rs:+3:17: +3:21 + _4 = &_5; // scope 2 at $DIR/derefer_terminator_test.rs:+3:15: +3:22 +- switchInt((*(*(*(*_4))))) -> [0: bb3, otherwise: bb4]; // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 ++ _10 = deref_copy (*_4); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 ++ _11 = deref_copy (*_10); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 ++ _12 = deref_copy (*_11); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 ++ switchInt((*_12)) -> [0: bb3, otherwise: bb4]; // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 + } + + bb3: { + _3 = const (); // scope 2 at $DIR/derefer_terminator_test.rs:+5:18: +5:20 + goto -> bb5; // scope 2 at $DIR/derefer_terminator_test.rs:+5:18: +5:20 + } + + bb4: { + StorageLive(_8); // scope 2 at $DIR/derefer_terminator_test.rs:+4:22: +4:23 + _8 = const 5_i32; // scope 2 at $DIR/derefer_terminator_test.rs:+4:26: +4:27 + _3 = const (); // scope 2 at $DIR/derefer_terminator_test.rs:+4:17: +4:29 + StorageDead(_8); // scope 2 at $DIR/derefer_terminator_test.rs:+4:28: +4:29 + goto -> bb5; // scope 2 at $DIR/derefer_terminator_test.rs:+4:28: +4:29 + } + + bb5: { + StorageDead(_7); // scope 2 at $DIR/derefer_terminator_test.rs:+6:5: +6:6 + StorageDead(_6); // scope 2 at $DIR/derefer_terminator_test.rs:+6:5: +6:6 + StorageDead(_5); // scope 2 at $DIR/derefer_terminator_test.rs:+6:5: +6:6 + StorageDead(_4); // scope 2 at $DIR/derefer_terminator_test.rs:+6:5: +6:6 + StorageDead(_3); // scope 2 at $DIR/derefer_terminator_test.rs:+6:5: +6:6 + StorageLive(_9); // scope 2 at $DIR/derefer_terminator_test.rs:+7:9: +7:10 + _9 = const 42_i32; // scope 2 at $DIR/derefer_terminator_test.rs:+7:13: +7:15 + _0 = const (); // scope 0 at $DIR/derefer_terminator_test.rs:+0:11: +8:2 + StorageDead(_9); // scope 2 at $DIR/derefer_terminator_test.rs:+8:1: +8:2 + StorageDead(_2); // scope 1 at $DIR/derefer_terminator_test.rs:+8:1: +8:2 + StorageDead(_1); // scope 0 at $DIR/derefer_terminator_test.rs:+8:1: +8:2 + return; // scope 0 at $DIR/derefer_terminator_test.rs:+8:2: +8:2 + } + + bb6 (cleanup): { + resume; // scope 0 at $DIR/derefer_terminator_test.rs:+0:1: +8:2 + } + } + diff --git a/tests/mir-opt/derefer_terminator_test.main.Derefer.diff b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff similarity index 100% rename from tests/mir-opt/derefer_terminator_test.main.Derefer.diff rename to tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff diff --git a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff new file mode 100644 index 00000000000..c039fc76b76 --- /dev/null +++ b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff @@ -0,0 +1,75 @@ +- // MIR for `foo` before DestinationPropagation ++ // MIR for `foo` after DestinationPropagation + + fn foo() -> i32 { + let mut _0: i32; // return place in scope 0 at $DIR/branch.rs:+0:13: +0:16 + let _1: i32; // in scope 0 at $DIR/branch.rs:+1:9: +1:10 + let mut _3: bool; // in scope 0 at $DIR/branch.rs:+3:16: +3:22 + let _4: i32; // in scope 0 at $DIR/branch.rs:+6:9: +6:14 + scope 1 { +- debug x => _1; // in scope 1 at $DIR/branch.rs:+1:9: +1:10 ++ debug x => _0; // in scope 1 at $DIR/branch.rs:+1:9: +1:10 + let _2: i32; // in scope 1 at $DIR/branch.rs:+3:9: +3:10 + scope 2 { +- debug y => _2; // in scope 2 at $DIR/branch.rs:+3:9: +3:10 ++ debug y => _0; // in scope 2 at $DIR/branch.rs:+3:9: +3:10 + } + } + + bb0: { +- StorageLive(_1); // scope 0 at $DIR/branch.rs:+1:9: +1:10 +- _1 = val() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/branch.rs:+1:13: +1:18 ++ nop; // scope 0 at $DIR/branch.rs:+1:9: +1:10 ++ _0 = val() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/branch.rs:+1:13: +1:18 + // mir::Constant + // + span: $DIR/branch.rs:14:13: 14:16 + // + literal: Const { ty: fn() -> i32 {val}, val: Value() } + } + + bb1: { +- StorageLive(_2); // scope 1 at $DIR/branch.rs:+3:9: +3:10 ++ nop; // scope 1 at $DIR/branch.rs:+3:9: +3:10 + StorageLive(_3); // scope 1 at $DIR/branch.rs:+3:16: +3:22 + _3 = cond() -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/branch.rs:+3:16: +3:22 + // mir::Constant + // + span: $DIR/branch.rs:16:16: 16:20 + // + literal: Const { ty: fn() -> bool {cond}, val: Value() } + } + + bb2: { + switchInt(move _3) -> [0: bb4, otherwise: bb3]; // scope 1 at $DIR/branch.rs:+3:16: +3:22 + } + + bb3: { +- _2 = _1; // scope 1 at $DIR/branch.rs:+4:9: +4:10 ++ nop; // scope 1 at $DIR/branch.rs:+4:9: +4:10 + goto -> bb6; // scope 1 at $DIR/branch.rs:+3:13: +8:6 + } + + bb4: { + StorageLive(_4); // scope 1 at $DIR/branch.rs:+6:9: +6:14 + _4 = val() -> [return: bb5, unwind unreachable]; // scope 1 at $DIR/branch.rs:+6:9: +6:14 + // mir::Constant + // + span: $DIR/branch.rs:19:9: 19:12 + // + literal: Const { ty: fn() -> i32 {val}, val: Value() } + } + + bb5: { + StorageDead(_4); // scope 1 at $DIR/branch.rs:+6:14: +6:15 +- _2 = _1; // scope 1 at $DIR/branch.rs:+7:9: +7:10 ++ nop; // scope 1 at $DIR/branch.rs:+7:9: +7:10 + goto -> bb6; // scope 1 at $DIR/branch.rs:+3:13: +8:6 + } + + bb6: { + StorageDead(_3); // scope 1 at $DIR/branch.rs:+8:5: +8:6 +- _0 = _2; // scope 2 at $DIR/branch.rs:+10:5: +10:6 +- StorageDead(_2); // scope 1 at $DIR/branch.rs:+11:1: +11:2 +- StorageDead(_1); // scope 0 at $DIR/branch.rs:+11:1: +11:2 ++ nop; // scope 2 at $DIR/branch.rs:+10:5: +10:6 ++ nop; // scope 1 at $DIR/branch.rs:+11:1: +11:2 ++ nop; // scope 0 at $DIR/branch.rs:+11:1: +11:2 + return; // scope 0 at $DIR/branch.rs:+11:2: +11:2 + } + } + diff --git a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff similarity index 100% rename from tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff rename to tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-abort.diff similarity index 100% rename from tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff rename to tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-abort.diff diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.diff new file mode 100644 index 00000000000..4343a593542 --- /dev/null +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.diff @@ -0,0 +1,26 @@ +- // MIR for `arg_src` before DestinationPropagation ++ // MIR for `arg_src` after DestinationPropagation + + fn arg_src(_1: i32) -> i32 { + debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:12: +0:17 + let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:27: +0:30 + let _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 + scope 1 { +- debug y => _2; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 ++ debug y => _0; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 +- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14 ++ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 ++ _0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14 + _1 = const 123_i32; // scope 1 at $DIR/copy_propagation_arg.rs:+2:5: +2:12 +- _0 = _2; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6 +- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+4:1: +4:2 ++ nop; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6 ++ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+4:1: +4:2 + return; // scope 0 at $DIR/copy_propagation_arg.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff new file mode 100644 index 00000000000..2e1bb2a79ec --- /dev/null +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff @@ -0,0 +1,32 @@ +- // MIR for `bar` before DestinationPropagation ++ // MIR for `bar` after DestinationPropagation + + fn bar(_1: u8) -> () { + debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13 + let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +0:19 + let _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 + let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 +- StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 +- _3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 +- _2 = dummy(move _3) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 ++ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 ++ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12 ++ _2 = dummy(move _1) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13 + // mir::Constant + // + span: $DIR/copy_propagation_arg.rs:17:5: 17:10 + // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value() } + } + + bb1: { +- StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+1:12: +1:13 ++ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:12: +1:13 + StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14 + _1 = const 5_u8; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10 + _0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +3:2 + return; // scope 0 at $DIR/copy_propagation_arg.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff similarity index 100% rename from tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff rename to tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-abort.diff similarity index 100% rename from tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff rename to tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-abort.diff diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff new file mode 100644 index 00000000000..bc88787e64b --- /dev/null +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff @@ -0,0 +1,22 @@ +- // MIR for `baz` before DestinationPropagation ++ // MIR for `baz` after DestinationPropagation + + fn baz(_1: i32) -> i32 { + debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13 + let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:23: +0:26 + let mut _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 +- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 +- _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10 +- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 ++ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 ++ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 ++ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10 ++ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10 + _0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+3:5: +3:6 + return; // scope 0 at $DIR/copy_propagation_arg.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff new file mode 100644 index 00000000000..fce57a03592 --- /dev/null +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff @@ -0,0 +1,32 @@ +- // MIR for `foo` before DestinationPropagation ++ // MIR for `foo` after DestinationPropagation + + fn foo(_1: u8) -> () { + debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13 + let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +0:19 + let mut _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 + let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16 + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 ++ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 + StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16 + _3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16 +- _2 = dummy(move _3) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 ++ _1 = dummy(move _3) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17 + // mir::Constant + // + span: $DIR/copy_propagation_arg.rs:12:9: 12:14 + // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17 +- _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:17 +- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17 ++ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:17 ++ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17 + _0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +3:2 + return; // scope 0 at $DIR/copy_propagation_arg.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff similarity index 100% rename from tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff rename to tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff diff --git a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff new file mode 100644 index 00000000000..35947cace29 --- /dev/null +++ b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff @@ -0,0 +1,77 @@ +- // MIR for `main` before DestinationPropagation ++ // MIR for `main` after DestinationPropagation + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:11: +0:11 + let mut _1: i32; // in scope 0 at $DIR/cycle.rs:+1:9: +1:14 + let mut _4: i32; // in scope 0 at $DIR/cycle.rs:+4:9: +4:10 + let _5: (); // in scope 0 at $DIR/cycle.rs:+6:5: +6:12 + let mut _6: i32; // in scope 0 at $DIR/cycle.rs:+6:10: +6:11 + scope 1 { +- debug x => _1; // in scope 1 at $DIR/cycle.rs:+1:9: +1:14 ++ debug x => _6; // in scope 1 at $DIR/cycle.rs:+1:9: +1:14 + let _2: i32; // in scope 1 at $DIR/cycle.rs:+2:9: +2:10 + scope 2 { +- debug y => _2; // in scope 2 at $DIR/cycle.rs:+2:9: +2:10 ++ debug y => _6; // in scope 2 at $DIR/cycle.rs:+2:9: +2:10 + let _3: i32; // in scope 2 at $DIR/cycle.rs:+3:9: +3:10 + scope 3 { +- debug z => _3; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10 ++ debug z => _6; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10 + } + } + } + + bb0: { +- StorageLive(_1); // scope 0 at $DIR/cycle.rs:+1:9: +1:14 +- _1 = val() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/cycle.rs:+1:17: +1:22 ++ nop; // scope 0 at $DIR/cycle.rs:+1:9: +1:14 ++ _6 = val() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/cycle.rs:+1:17: +1:22 + // mir::Constant + // + span: $DIR/cycle.rs:10:17: 10:20 + // + literal: Const { ty: fn() -> i32 {val}, val: Value() } + } + + bb1: { +- StorageLive(_2); // scope 1 at $DIR/cycle.rs:+2:9: +2:10 +- _2 = _1; // scope 1 at $DIR/cycle.rs:+2:13: +2:14 +- StorageLive(_3); // scope 2 at $DIR/cycle.rs:+3:9: +3:10 +- _3 = _2; // scope 2 at $DIR/cycle.rs:+3:13: +3:14 +- StorageLive(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10 +- _4 = _3; // scope 3 at $DIR/cycle.rs:+4:9: +4:10 +- _1 = move _4; // scope 3 at $DIR/cycle.rs:+4:5: +4:10 +- StorageDead(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10 ++ nop; // scope 1 at $DIR/cycle.rs:+2:9: +2:10 ++ nop; // scope 1 at $DIR/cycle.rs:+2:13: +2:14 ++ nop; // scope 2 at $DIR/cycle.rs:+3:9: +3:10 ++ nop; // scope 2 at $DIR/cycle.rs:+3:13: +3:14 ++ nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10 ++ nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10 ++ nop; // scope 3 at $DIR/cycle.rs:+4:5: +4:10 ++ nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10 + StorageLive(_5); // scope 3 at $DIR/cycle.rs:+6:5: +6:12 +- StorageLive(_6); // scope 3 at $DIR/cycle.rs:+6:10: +6:11 +- _6 = _1; // scope 3 at $DIR/cycle.rs:+6:10: +6:11 ++ nop; // scope 3 at $DIR/cycle.rs:+6:10: +6:11 ++ nop; // scope 3 at $DIR/cycle.rs:+6:10: +6:11 + _5 = std::mem::drop::(move _6) -> [return: bb2, unwind unreachable]; // scope 3 at $DIR/cycle.rs:+6:5: +6:12 + // mir::Constant + // + span: $DIR/cycle.rs:15:5: 15:9 + // + literal: Const { ty: fn(i32) {std::mem::drop::}, val: Value() } + } + + bb2: { +- StorageDead(_6); // scope 3 at $DIR/cycle.rs:+6:11: +6:12 ++ nop; // scope 3 at $DIR/cycle.rs:+6:11: +6:12 + StorageDead(_5); // scope 3 at $DIR/cycle.rs:+6:12: +6:13 + _0 = const (); // scope 0 at $DIR/cycle.rs:+0:11: +7:2 +- StorageDead(_3); // scope 2 at $DIR/cycle.rs:+7:1: +7:2 +- StorageDead(_2); // scope 1 at $DIR/cycle.rs:+7:1: +7:2 +- StorageDead(_1); // scope 0 at $DIR/cycle.rs:+7:1: +7:2 ++ nop; // scope 2 at $DIR/cycle.rs:+7:1: +7:2 ++ nop; // scope 1 at $DIR/cycle.rs:+7:1: +7:2 ++ nop; // scope 0 at $DIR/cycle.rs:+7:1: +7:2 + return; // scope 0 at $DIR/cycle.rs:+7:2: +7:2 + } + } + diff --git a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff similarity index 100% rename from tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff rename to tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir new file mode 100644 index 00000000000..5882e0aee10 --- /dev/null +++ b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir @@ -0,0 +1,34 @@ +// MIR for `f` after DestinationPropagation + +fn f(_1: usize) -> usize { + debug a => _1; // in scope 0 at $DIR/dead_stores_79191.rs:+0:6: +0:11 + let mut _0: usize; // return place in scope 0 at $DIR/dead_stores_79191.rs:+0:23: +0:28 + let _2: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+1:9: +1:10 + let mut _3: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+3:9: +3:10 + let mut _4: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+4:8: +4:9 + scope 1 { + debug b => _3; // in scope 1 at $DIR/dead_stores_79191.rs:+1:9: +1:10 + } + + bb0: { + nop; // scope 0 at $DIR/dead_stores_79191.rs:+1:9: +1:10 + _3 = _1; // scope 0 at $DIR/dead_stores_79191.rs:+1:13: +1:14 + _1 = const 5_usize; // scope 1 at $DIR/dead_stores_79191.rs:+2:5: +2:10 + nop; // scope 1 at $DIR/dead_stores_79191.rs:+3:9: +3:10 + nop; // scope 1 at $DIR/dead_stores_79191.rs:+3:9: +3:10 + _1 = move _3; // scope 1 at $DIR/dead_stores_79191.rs:+3:5: +3:10 + nop; // scope 1 at $DIR/dead_stores_79191.rs:+3:9: +3:10 + nop; // scope 1 at $DIR/dead_stores_79191.rs:+4:8: +4:9 + nop; // scope 1 at $DIR/dead_stores_79191.rs:+4:8: +4:9 + _0 = id::(move _1) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/dead_stores_79191.rs:+4:5: +4:10 + // mir::Constant + // + span: $DIR/dead_stores_79191.rs:13:5: 13:7 + // + literal: Const { ty: fn(usize) -> usize {id::}, val: Value() } + } + + bb1: { + nop; // scope 1 at $DIR/dead_stores_79191.rs:+4:9: +4:10 + nop; // scope 0 at $DIR/dead_stores_79191.rs:+5:1: +5:2 + return; // scope 0 at $DIR/dead_stores_79191.rs:+5:2: +5:2 + } +} diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.mir b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.mir rename to tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir diff --git a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir new file mode 100644 index 00000000000..f4568111d2e --- /dev/null +++ b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir @@ -0,0 +1,33 @@ +// MIR for `f` after DestinationPropagation + +fn f(_1: usize) -> usize { + debug a => _1; // in scope 0 at $DIR/dead_stores_better.rs:+0:10: +0:15 + let mut _0: usize; // return place in scope 0 at $DIR/dead_stores_better.rs:+0:27: +0:32 + let _2: usize; // in scope 0 at $DIR/dead_stores_better.rs:+1:9: +1:10 + let mut _3: usize; // in scope 0 at $DIR/dead_stores_better.rs:+3:9: +3:10 + let mut _4: usize; // in scope 0 at $DIR/dead_stores_better.rs:+4:8: +4:9 + scope 1 { + debug b => _1; // in scope 1 at $DIR/dead_stores_better.rs:+1:9: +1:10 + } + + bb0: { + nop; // scope 0 at $DIR/dead_stores_better.rs:+1:9: +1:10 + nop; // scope 0 at $DIR/dead_stores_better.rs:+1:13: +1:14 + nop; // scope 1 at $DIR/dead_stores_better.rs:+3:9: +3:10 + nop; // scope 1 at $DIR/dead_stores_better.rs:+3:9: +3:10 + nop; // scope 1 at $DIR/dead_stores_better.rs:+3:5: +3:10 + nop; // scope 1 at $DIR/dead_stores_better.rs:+3:9: +3:10 + nop; // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9 + nop; // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9 + _0 = id::(move _1) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/dead_stores_better.rs:+4:5: +4:10 + // mir::Constant + // + span: $DIR/dead_stores_better.rs:17:5: 17:7 + // + literal: Const { ty: fn(usize) -> usize {id::}, val: Value() } + } + + bb1: { + nop; // scope 1 at $DIR/dead_stores_better.rs:+4:9: +4:10 + nop; // scope 0 at $DIR/dead_stores_better.rs:+5:1: +5:2 + return; // scope 0 at $DIR/dead_stores_better.rs:+5:2: +5:2 + } +} diff --git a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.mir b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.mir rename to tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir diff --git a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff new file mode 100644 index 00000000000..0b0eb03b652 --- /dev/null +++ b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff @@ -0,0 +1,43 @@ +- // MIR for `nrvo` before DestinationPropagation ++ // MIR for `nrvo` after DestinationPropagation + + fn nrvo(_1: for<'a> fn(&'a mut [u8; 1024])) -> [u8; 1024] { + debug init => _1; // in scope 0 at $DIR/simple.rs:+0:9: +0:13 + let mut _0: [u8; 1024]; // return place in scope 0 at $DIR/simple.rs:+0:39: +0:49 + let mut _2: [u8; 1024]; // in scope 0 at $DIR/simple.rs:+1:9: +1:16 + let _3: (); // in scope 0 at $DIR/simple.rs:+2:5: +2:19 + let mut _4: for<'a> fn(&'a mut [u8; 1024]); // in scope 0 at $DIR/simple.rs:+2:5: +2:9 + let mut _5: &mut [u8; 1024]; // in scope 0 at $DIR/simple.rs:+2:10: +2:18 + let mut _6: &mut [u8; 1024]; // in scope 0 at $DIR/simple.rs:+2:10: +2:18 + scope 1 { + debug buf => _2; // in scope 1 at $DIR/simple.rs:+1:9: +1:16 + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/simple.rs:+1:9: +1:16 + _2 = [const 0_u8; 1024]; // scope 0 at $DIR/simple.rs:+1:19: +1:28 + StorageLive(_3); // scope 1 at $DIR/simple.rs:+2:5: +2:19 +- StorageLive(_4); // scope 1 at $DIR/simple.rs:+2:5: +2:9 +- _4 = _1; // scope 1 at $DIR/simple.rs:+2:5: +2:9 ++ nop; // scope 1 at $DIR/simple.rs:+2:5: +2:9 ++ nop; // scope 1 at $DIR/simple.rs:+2:5: +2:9 + StorageLive(_5); // scope 1 at $DIR/simple.rs:+2:10: +2:18 + StorageLive(_6); // scope 1 at $DIR/simple.rs:+2:10: +2:18 + _6 = &mut _2; // scope 1 at $DIR/simple.rs:+2:10: +2:18 + _5 = &mut (*_6); // scope 1 at $DIR/simple.rs:+2:10: +2:18 +- _3 = move _4(move _5) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/simple.rs:+2:5: +2:19 ++ _3 = move _1(move _5) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/simple.rs:+2:5: +2:19 + } + + bb1: { + StorageDead(_5); // scope 1 at $DIR/simple.rs:+2:18: +2:19 +- StorageDead(_4); // scope 1 at $DIR/simple.rs:+2:18: +2:19 ++ nop; // scope 1 at $DIR/simple.rs:+2:18: +2:19 + StorageDead(_6); // scope 1 at $DIR/simple.rs:+2:19: +2:20 + StorageDead(_3); // scope 1 at $DIR/simple.rs:+2:19: +2:20 + _0 = _2; // scope 1 at $DIR/simple.rs:+3:5: +3:8 + StorageDead(_2); // scope 0 at $DIR/simple.rs:+4:1: +4:2 + return; // scope 0 at $DIR/simple.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.diff b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff similarity index 100% rename from tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.diff rename to tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff new file mode 100644 index 00000000000..61cdc26dcdc --- /dev/null +++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff @@ -0,0 +1,35 @@ +- // MIR for `main` before DestinationPropagation ++ // MIR for `main` after DestinationPropagation + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/union.rs:+0:11: +0:11 + let _1: main::Un; // in scope 0 at $DIR/union.rs:+5:9: +5:11 + let mut _2: u32; // in scope 0 at $DIR/union.rs:+5:23: +5:28 + let mut _3: u32; // in scope 0 at $DIR/union.rs:+7:10: +7:26 + scope 1 { + debug un => _1; // in scope 1 at $DIR/union.rs:+5:9: +5:11 + scope 2 { + } + scope 3 (inlined std::mem::drop::) { // at $DIR/union.rs:16:5: 16:27 + debug _x => _3; // in scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/union.rs:+5:9: +5:11 + StorageLive(_2); // scope 0 at $DIR/union.rs:+5:23: +5:28 + _2 = val() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/union.rs:+5:23: +5:28 + // mir::Constant + // + span: $DIR/union.rs:14:23: 14:26 + // + literal: Const { ty: fn() -> u32 {val}, val: Value() } + } + + bb1: { + StorageDead(_2); // scope 0 at $DIR/union.rs:+5:29: +5:30 + StorageLive(_3); // scope 1 at $DIR/union.rs:+7:10: +7:26 + StorageDead(_3); // scope 1 at $DIR/union.rs:+7:26: +7:27 + StorageDead(_1); // scope 0 at $DIR/union.rs:+8:1: +8:2 + return; // scope 0 at $DIR/union.rs:+8:2: +8:2 + } + } + diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff similarity index 100% rename from tests/mir-opt/dest-prop/union.main.DestinationPropagation.diff rename to tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff diff --git a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff new file mode 100644 index 00000000000..e8f0b25c59b --- /dev/null +++ b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff @@ -0,0 +1,86 @@ +- // MIR for `f` before DestinationPropagation ++ // MIR for `f` after DestinationPropagation + + fn f(_1: T) -> () { + debug a => _1; // in scope 0 at $DIR/unreachable.rs:+0:19: +0:20 + let mut _0: (); // return place in scope 0 at $DIR/unreachable.rs:+0:25: +0:25 + let _2: T; // in scope 0 at $DIR/unreachable.rs:+1:9: +1:10 + let mut _3: bool; // in scope 0 at $DIR/unreachable.rs:+2:8: +2:13 + let _4: (); // in scope 0 at $DIR/unreachable.rs:+3:9: +3:16 + let mut _5: T; // in scope 0 at $DIR/unreachable.rs:+3:11: +3:12 + let mut _6: T; // in scope 0 at $DIR/unreachable.rs:+3:14: +3:15 + let _7: (); // in scope 0 at $DIR/unreachable.rs:+5:9: +5:16 + let mut _8: T; // in scope 0 at $DIR/unreachable.rs:+5:11: +5:12 + let mut _9: T; // in scope 0 at $DIR/unreachable.rs:+5:14: +5:15 + scope 1 { +- debug b => _2; // in scope 1 at $DIR/unreachable.rs:+1:9: +1:10 ++ debug b => _1; // in scope 1 at $DIR/unreachable.rs:+1:9: +1:10 + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/unreachable.rs:+1:9: +1:10 +- _2 = _1; // scope 0 at $DIR/unreachable.rs:+1:13: +1:14 ++ nop; // scope 0 at $DIR/unreachable.rs:+1:9: +1:10 ++ nop; // scope 0 at $DIR/unreachable.rs:+1:13: +1:14 + StorageLive(_3); // scope 1 at $DIR/unreachable.rs:+2:8: +2:13 + _3 = const false; // scope 1 at $DIR/unreachable.rs:+2:8: +2:13 +- goto -> bb3; // scope 1 at $DIR/unreachable.rs:+2:8: +2:13 ++ goto -> bb1; // scope 1 at $DIR/unreachable.rs:+2:8: +2:13 + } + + bb1: { +- StorageLive(_4); // scope 1 at $DIR/unreachable.rs:+3:9: +3:16 +- StorageLive(_5); // scope 1 at $DIR/unreachable.rs:+3:11: +3:12 +- _5 = _1; // scope 1 at $DIR/unreachable.rs:+3:11: +3:12 +- StorageLive(_6); // scope 1 at $DIR/unreachable.rs:+3:14: +3:15 +- _6 = _2; // scope 1 at $DIR/unreachable.rs:+3:14: +3:15 +- _4 = g::(move _5, move _6) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/unreachable.rs:+3:9: +3:16 +- // mir::Constant +- // + span: $DIR/unreachable.rs:12:9: 12:10 +- // + literal: Const { ty: fn(T, T) {g::}, val: Value() } +- } +- +- bb2: { +- StorageDead(_6); // scope 1 at $DIR/unreachable.rs:+3:15: +3:16 +- StorageDead(_5); // scope 1 at $DIR/unreachable.rs:+3:15: +3:16 +- StorageDead(_4); // scope 1 at $DIR/unreachable.rs:+3:16: +3:17 +- _0 = const (); // scope 1 at $DIR/unreachable.rs:+2:14: +4:6 +- goto -> bb5; // scope 1 at $DIR/unreachable.rs:+2:5: +6:6 +- } +- +- bb3: { + StorageLive(_7); // scope 1 at $DIR/unreachable.rs:+5:9: +5:16 +- StorageLive(_8); // scope 1 at $DIR/unreachable.rs:+5:11: +5:12 +- _8 = _2; // scope 1 at $DIR/unreachable.rs:+5:11: +5:12 ++ nop; // scope 1 at $DIR/unreachable.rs:+5:11: +5:12 ++ nop; // scope 1 at $DIR/unreachable.rs:+5:11: +5:12 + StorageLive(_9); // scope 1 at $DIR/unreachable.rs:+5:14: +5:15 +- _9 = _2; // scope 1 at $DIR/unreachable.rs:+5:14: +5:15 +- _7 = g::(move _8, move _9) -> [return: bb4, unwind unreachable]; // scope 1 at $DIR/unreachable.rs:+5:9: +5:16 ++ _9 = _1; // scope 1 at $DIR/unreachable.rs:+5:14: +5:15 ++ _7 = g::(move _1, move _9) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/unreachable.rs:+5:9: +5:16 + // mir::Constant + // + span: $DIR/unreachable.rs:14:9: 14:10 + // + literal: Const { ty: fn(T, T) {g::}, val: Value() } + } + +- bb4: { ++ bb2: { + StorageDead(_9); // scope 1 at $DIR/unreachable.rs:+5:15: +5:16 +- StorageDead(_8); // scope 1 at $DIR/unreachable.rs:+5:15: +5:16 ++ nop; // scope 1 at $DIR/unreachable.rs:+5:15: +5:16 + StorageDead(_7); // scope 1 at $DIR/unreachable.rs:+5:16: +5:17 + _0 = const (); // scope 1 at $DIR/unreachable.rs:+4:12: +6:6 +- goto -> bb5; // scope 1 at $DIR/unreachable.rs:+2:5: +6:6 ++ goto -> bb3; // scope 1 at $DIR/unreachable.rs:+2:5: +6:6 + } + +- bb5: { ++ bb3: { + StorageDead(_3); // scope 1 at $DIR/unreachable.rs:+6:5: +6:6 +- StorageDead(_2); // scope 0 at $DIR/unreachable.rs:+7:1: +7:2 ++ nop; // scope 0 at $DIR/unreachable.rs:+7:1: +7:2 + return; // scope 0 at $DIR/unreachable.rs:+7:2: +7:2 + } + } + diff --git a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.diff b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff similarity index 100% rename from tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.diff rename to tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..a10c5a79019 --- /dev/null +++ b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff @@ -0,0 +1,129 @@ +- // MIR for `float_to_exponential_common` before ConstProp ++ // MIR for `float_to_exponential_common` after ConstProp + + fn float_to_exponential_common(_1: &mut Formatter<'_>, _2: &T, _3: bool) -> Result<(), std::fmt::Error> { + debug fmt => _1; // in scope 0 at $DIR/funky_arms.rs:+0:35: +0:38 + debug num => _2; // in scope 0 at $DIR/funky_arms.rs:+0:60: +0:63 + debug upper => _3; // in scope 0 at $DIR/funky_arms.rs:+0:69: +0:74 + let mut _0: std::result::Result<(), std::fmt::Error>; // return place in scope 0 at $DIR/funky_arms.rs:+0:85: +0:91 + let _4: bool; // in scope 0 at $DIR/funky_arms.rs:+4:9: +4:19 + let mut _5: &std::fmt::Formatter<'_>; // in scope 0 at $DIR/funky_arms.rs:+4:22: +4:37 + let mut _7: std::option::Option; // in scope 0 at $DIR/funky_arms.rs:+13:30: +13:45 + let mut _8: &std::fmt::Formatter<'_>; // in scope 0 at $DIR/funky_arms.rs:+13:30: +13:45 + let mut _9: isize; // in scope 0 at $DIR/funky_arms.rs:+13:12: +13:27 + let mut _11: &mut std::fmt::Formatter<'_>; // in scope 0 at $DIR/funky_arms.rs:+15:43: +15:46 + let mut _12: &T; // in scope 0 at $DIR/funky_arms.rs:+15:48: +15:51 + let mut _13: core::num::flt2dec::Sign; // in scope 0 at $DIR/funky_arms.rs:+15:53: +15:57 + let mut _14: u32; // in scope 0 at $DIR/funky_arms.rs:+15:59: +15:79 + let mut _15: u32; // in scope 0 at $DIR/funky_arms.rs:+15:59: +15:75 + let mut _16: usize; // in scope 0 at $DIR/funky_arms.rs:+15:59: +15:68 + let mut _17: bool; // in scope 0 at $DIR/funky_arms.rs:+15:81: +15:86 + let mut _18: &mut std::fmt::Formatter<'_>; // in scope 0 at $DIR/funky_arms.rs:+17:46: +17:49 + let mut _19: &T; // in scope 0 at $DIR/funky_arms.rs:+17:51: +17:54 + let mut _20: core::num::flt2dec::Sign; // in scope 0 at $DIR/funky_arms.rs:+17:56: +17:60 + let mut _21: bool; // in scope 0 at $DIR/funky_arms.rs:+17:62: +17:67 + scope 1 { + debug force_sign => _4; // in scope 1 at $DIR/funky_arms.rs:+4:9: +4:19 + let _6: core::num::flt2dec::Sign; // in scope 1 at $DIR/funky_arms.rs:+8:9: +8:13 + scope 2 { + debug sign => _6; // in scope 2 at $DIR/funky_arms.rs:+8:9: +8:13 + scope 3 { + debug precision => _10; // in scope 3 at $DIR/funky_arms.rs:+13:17: +13:26 + let _10: usize; // in scope 3 at $DIR/funky_arms.rs:+13:17: +13:26 + } + } + } + + bb0: { + StorageLive(_4); // scope 0 at $DIR/funky_arms.rs:+4:9: +4:19 + StorageLive(_5); // scope 0 at $DIR/funky_arms.rs:+4:22: +4:37 + _5 = &(*_1); // scope 0 at $DIR/funky_arms.rs:+4:22: +4:37 + _4 = Formatter::<'_>::sign_plus(move _5) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/funky_arms.rs:+4:22: +4:37 + // mir::Constant + // + span: $DIR/funky_arms.rs:16:26: 16:35 + // + literal: Const { ty: for<'a> fn(&'a Formatter<'_>) -> bool {Formatter::<'_>::sign_plus}, val: Value() } + } + + bb1: { + StorageDead(_5); // scope 0 at $DIR/funky_arms.rs:+4:36: +4:37 + StorageLive(_6); // scope 1 at $DIR/funky_arms.rs:+8:9: +8:13 + switchInt(_4) -> [0: bb3, otherwise: bb2]; // scope 1 at $DIR/funky_arms.rs:+8:16: +8:32 + } + + bb2: { +- _6 = MinusPlus; // scope 1 at $DIR/funky_arms.rs:+10:17: +10:41 ++ _6 = const MinusPlus; // scope 1 at $DIR/funky_arms.rs:+10:17: +10:41 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: Sign, val: Value(Scalar(0x01)) } + goto -> bb4; // scope 1 at $DIR/funky_arms.rs:+10:17: +10:41 + } + + bb3: { +- _6 = Minus; // scope 1 at $DIR/funky_arms.rs:+9:18: +9:38 ++ _6 = const Minus; // scope 1 at $DIR/funky_arms.rs:+9:18: +9:38 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: Sign, val: Value(Scalar(0x00)) } + goto -> bb4; // scope 1 at $DIR/funky_arms.rs:+9:18: +9:38 + } + + bb4: { + StorageLive(_7); // scope 3 at $DIR/funky_arms.rs:+13:30: +13:45 + StorageLive(_8); // scope 3 at $DIR/funky_arms.rs:+13:30: +13:45 + _8 = &(*_1); // scope 3 at $DIR/funky_arms.rs:+13:30: +13:45 + _7 = Formatter::<'_>::precision(move _8) -> [return: bb5, unwind unreachable]; // scope 3 at $DIR/funky_arms.rs:+13:30: +13:45 + // mir::Constant + // + span: $DIR/funky_arms.rs:25:34: 25:43 + // + literal: Const { ty: for<'a> fn(&'a Formatter<'_>) -> Option {Formatter::<'_>::precision}, val: Value() } + } + + bb5: { + StorageDead(_8); // scope 3 at $DIR/funky_arms.rs:+13:44: +13:45 + _9 = discriminant(_7); // scope 3 at $DIR/funky_arms.rs:+13:12: +13:27 + switchInt(move _9) -> [1: bb6, otherwise: bb8]; // scope 3 at $DIR/funky_arms.rs:+13:12: +13:27 + } + + bb6: { + _10 = ((_7 as Some).0: usize); // scope 3 at $DIR/funky_arms.rs:+13:17: +13:26 + StorageLive(_13); // scope 3 at $DIR/funky_arms.rs:+15:53: +15:57 + _13 = _6; // scope 3 at $DIR/funky_arms.rs:+15:53: +15:57 + StorageLive(_14); // scope 3 at $DIR/funky_arms.rs:+15:59: +15:79 + StorageLive(_15); // scope 3 at $DIR/funky_arms.rs:+15:59: +15:75 + _15 = _10 as u32 (IntToInt); // scope 3 at $DIR/funky_arms.rs:+15:59: +15:75 + _14 = Add(move _15, const 1_u32); // scope 3 at $DIR/funky_arms.rs:+15:59: +15:79 + StorageDead(_15); // scope 3 at $DIR/funky_arms.rs:+15:78: +15:79 + _0 = float_to_exponential_common_exact::(_1, _2, move _13, move _14, _3) -> [return: bb7, unwind unreachable]; // scope 3 at $DIR/funky_arms.rs:+15:9: +15:87 + // mir::Constant + // + span: $DIR/funky_arms.rs:27:9: 27:42 + // + literal: Const { ty: for<'a, 'b, 'c> fn(&'a mut Formatter<'b>, &'c T, Sign, u32, bool) -> Result<(), std::fmt::Error> {float_to_exponential_common_exact::}, val: Value() } + } + + bb7: { + StorageDead(_14); // scope 3 at $DIR/funky_arms.rs:+15:86: +15:87 + StorageDead(_13); // scope 3 at $DIR/funky_arms.rs:+15:86: +15:87 + goto -> bb10; // scope 2 at $DIR/funky_arms.rs:+13:5: +18:6 + } + + bb8: { + StorageLive(_20); // scope 2 at $DIR/funky_arms.rs:+17:56: +17:60 + _20 = _6; // scope 2 at $DIR/funky_arms.rs:+17:56: +17:60 + _0 = float_to_exponential_common_shortest::(_1, _2, move _20, _3) -> [return: bb9, unwind unreachable]; // scope 2 at $DIR/funky_arms.rs:+17:9: +17:68 + // mir::Constant + // + span: $DIR/funky_arms.rs:29:9: 29:45 + // + literal: Const { ty: for<'a, 'b, 'c> fn(&'a mut Formatter<'b>, &'c T, Sign, bool) -> Result<(), std::fmt::Error> {float_to_exponential_common_shortest::}, val: Value() } + } + + bb9: { + StorageDead(_20); // scope 2 at $DIR/funky_arms.rs:+17:67: +17:68 + goto -> bb10; // scope 2 at $DIR/funky_arms.rs:+13:5: +18:6 + } + + bb10: { + StorageDead(_6); // scope 1 at $DIR/funky_arms.rs:+19:1: +19:2 + StorageDead(_4); // scope 0 at $DIR/funky_arms.rs:+19:1: +19:2 + StorageDead(_7); // scope 0 at $DIR/funky_arms.rs:+19:1: +19:2 + return; // scope 0 at $DIR/funky_arms.rs:+19:2: +19:2 + } + } + diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff rename to tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir new file mode 100644 index 00000000000..16e8c2a8e58 --- /dev/null +++ b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir @@ -0,0 +1,82 @@ +// MIR for `main::{closure#0}` 0 generator_drop +/* generator_layout = GeneratorLayout { + field_tys: { + _0: GeneratorSavedTy { + ty: std::string::String, + source_info: SourceInfo { + span: $DIR/generator_drop_cleanup.rs:11:13: 11:15 (#0), + scope: scope[0], + }, + ignore_for_traits: false, + }, + }, + variant_fields: { + Unresumed(0): [], + Returned (1): [], + Panicked (2): [], + Suspend0 (3): [_0], + }, + storage_conflicts: BitMatrix(1x1) { + (_0, _0), + }, +} */ + +fn main::{closure#0}(_1: *mut [generator@$DIR/generator_drop_cleanup.rs:10:15: 10:17]) -> () { + let mut _0: (); // return place in scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 + let mut _2: (); // in scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 + let _3: std::string::String; // in scope 0 at $DIR/generator_drop_cleanup.rs:+1:13: +1:15 + let _4: (); // in scope 0 at $DIR/generator_drop_cleanup.rs:+2:9: +2:14 + let mut _5: (); // in scope 0 at $DIR/generator_drop_cleanup.rs:+2:9: +2:14 + let mut _6: (); // in scope 0 at $DIR/generator_drop_cleanup.rs:+0:18: +0:18 + let mut _7: (); // in scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 + let mut _8: u32; // in scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 + scope 1 { + debug _s => (((*_1) as variant#3).0: std::string::String); // in scope 1 at $DIR/generator_drop_cleanup.rs:+1:13: +1:15 + } + + bb0: { + _8 = discriminant((*_1)); // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 + switchInt(move _8) -> [0: bb5, 3: bb8, otherwise: bb9]; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 + } + + bb1: { + StorageDead(_5); // scope 1 at $DIR/generator_drop_cleanup.rs:+2:13: +2:14 + StorageDead(_4); // scope 1 at $DIR/generator_drop_cleanup.rs:+2:14: +2:15 + drop((((*_1) as variant#3).0: std::string::String)) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/generator_drop_cleanup.rs:+3:5: +3:6 + } + + bb2: { + nop; // scope 0 at $DIR/generator_drop_cleanup.rs:+3:5: +3:6 + goto -> bb6; // scope 0 at $DIR/generator_drop_cleanup.rs:+3:5: +3:6 + } + + bb3: { + return; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 + } + + bb4: { + return; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 + } + + bb5: { + goto -> bb7; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 + } + + bb6: { + goto -> bb3; // scope 0 at $DIR/generator_drop_cleanup.rs:+3:5: +3:6 + } + + bb7: { + goto -> bb4; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 + } + + bb8: { + StorageLive(_4); // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 + StorageLive(_5); // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 + goto -> bb1; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 + } + + bb9: { + return; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 + } +} diff --git a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir similarity index 100% rename from tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir rename to tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir diff --git a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir new file mode 100644 index 00000000000..5b24dd4602f --- /dev/null +++ b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir @@ -0,0 +1,89 @@ +// MIR for `main::{closure#0}` before StateTransform + +fn main::{closure#0}(_1: [generator@$DIR/generator_storage_dead_unwind.rs:22:16: 22:18], _2: ()) -> () +yields () + { + let mut _0: (); // return place in scope 0 at $DIR/generator_storage_dead_unwind.rs:+0:19: +0:19 + let _3: Foo; // in scope 0 at $DIR/generator_storage_dead_unwind.rs:+1:13: +1:14 + let _5: (); // in scope 0 at $DIR/generator_storage_dead_unwind.rs:+3:9: +3:14 + let mut _6: (); // in scope 0 at $DIR/generator_storage_dead_unwind.rs:+3:9: +3:14 + let _7: (); // in scope 0 at $DIR/generator_storage_dead_unwind.rs:+4:9: +4:16 + let mut _8: Foo; // in scope 0 at $DIR/generator_storage_dead_unwind.rs:+4:14: +4:15 + let _9: (); // in scope 0 at $DIR/generator_storage_dead_unwind.rs:+5:9: +5:16 + let mut _10: Bar; // in scope 0 at $DIR/generator_storage_dead_unwind.rs:+5:14: +5:15 + scope 1 { + debug a => _3; // in scope 1 at $DIR/generator_storage_dead_unwind.rs:+1:13: +1:14 + let _4: Bar; // in scope 1 at $DIR/generator_storage_dead_unwind.rs:+2:13: +2:14 + scope 2 { + debug b => _4; // in scope 2 at $DIR/generator_storage_dead_unwind.rs:+2:13: +2:14 + } + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/generator_storage_dead_unwind.rs:+1:13: +1:14 + _3 = Foo(const 5_i32); // scope 0 at $DIR/generator_storage_dead_unwind.rs:+1:17: +1:23 + StorageLive(_4); // scope 1 at $DIR/generator_storage_dead_unwind.rs:+2:13: +2:14 + _4 = Bar(const 6_i32); // scope 1 at $DIR/generator_storage_dead_unwind.rs:+2:17: +2:23 + StorageLive(_5); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:9: +3:14 + StorageLive(_6); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:9: +3:14 + _6 = (); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:9: +3:14 + _5 = yield(move _6) -> [resume: bb1, drop: bb6]; // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:9: +3:14 + } + + bb1: { + StorageDead(_6); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:13: +3:14 + StorageDead(_5); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:14: +3:15 + StorageLive(_7); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+4:9: +4:16 + StorageLive(_8); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+4:14: +4:15 + _8 = move _3; // scope 2 at $DIR/generator_storage_dead_unwind.rs:+4:14: +4:15 + _7 = take::(move _8) -> [return: bb2, unwind unreachable]; // scope 2 at $DIR/generator_storage_dead_unwind.rs:+4:9: +4:16 + // mir::Constant + // + span: $DIR/generator_storage_dead_unwind.rs:26:9: 26:13 + // + literal: Const { ty: fn(Foo) {take::}, val: Value() } + } + + bb2: { + StorageDead(_8); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+4:15: +4:16 + StorageDead(_7); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+4:16: +4:17 + StorageLive(_9); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+5:9: +5:16 + StorageLive(_10); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+5:14: +5:15 + _10 = move _4; // scope 2 at $DIR/generator_storage_dead_unwind.rs:+5:14: +5:15 + _9 = take::(move _10) -> [return: bb3, unwind unreachable]; // scope 2 at $DIR/generator_storage_dead_unwind.rs:+5:9: +5:16 + // mir::Constant + // + span: $DIR/generator_storage_dead_unwind.rs:27:9: 27:13 + // + literal: Const { ty: fn(Bar) {take::}, val: Value() } + } + + bb3: { + StorageDead(_10); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+5:15: +5:16 + StorageDead(_9); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+5:16: +5:17 + _0 = const (); // scope 0 at $DIR/generator_storage_dead_unwind.rs:+0:19: +6:6 + StorageDead(_4); // scope 1 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6 + goto -> bb4; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6 + } + + bb4: { + StorageDead(_3); // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6 + drop(_1) -> [return: bb5, unwind unreachable]; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6 + } + + bb5: { + return; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:6: +6:6 + } + + bb6: { + StorageDead(_6); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:13: +3:14 + StorageDead(_5); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:14: +3:15 + StorageDead(_4); // scope 1 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6 + drop(_3) -> [return: bb7, unwind unreachable]; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6 + } + + bb7: { + StorageDead(_3); // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6 + drop(_1) -> [return: bb8, unwind unreachable]; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6 + } + + bb8: { + generator_drop; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+0:16: +6:6 + } +} diff --git a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir similarity index 100% rename from tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir rename to tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir diff --git a/tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff new file mode 100644 index 00000000000..8c68e215e4a --- /dev/null +++ b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff @@ -0,0 +1,37 @@ +- // MIR for `main` before Inline ++ // MIR for `main` after Inline + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/asm_unwind.rs:+0:15: +0:15 + let _1: (); // in scope 0 at $DIR/asm_unwind.rs:+1:5: +1:10 ++ scope 1 (inlined foo) { // at $DIR/asm_unwind.rs:21:5: 21:10 ++ let _2: D; // in scope 1 at $DIR/asm_unwind.rs:15:9: 15:11 ++ scope 2 { ++ debug _d => const D; // in scope 2 at $DIR/asm_unwind.rs:15:9: 15:11 ++ scope 3 { ++ } ++ } ++ } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/asm_unwind.rs:+1:5: +1:10 +- _1 = foo() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/asm_unwind.rs:+1:5: +1:10 +- // mir::Constant +- // + span: $DIR/asm_unwind.rs:21:5: 21:8 +- // + literal: Const { ty: fn() {foo}, val: Value() } ++ StorageLive(_2); // scope 0 at $DIR/asm_unwind.rs:+1:5: +1:10 ++ asm!("", options(MAY_UNWIND)) -> [return: bb2, unwind terminate]; // scope 3 at $DIR/asm_unwind.rs:16:14: 16:54 + } + + bb1: { ++ StorageDead(_2); // scope 0 at $DIR/asm_unwind.rs:+1:5: +1:10 + StorageDead(_1); // scope 0 at $DIR/asm_unwind.rs:+1:10: +1:11 + _0 = const (); // scope 0 at $DIR/asm_unwind.rs:+0:15: +2:2 + return; // scope 0 at $DIR/asm_unwind.rs:+2:2: +2:2 ++ } ++ ++ bb2: { ++ drop(_2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/asm_unwind.rs:17:1: 17:2 + } + } + diff --git a/tests/mir-opt/inline/asm_unwind.main.Inline.diff b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/asm_unwind.main.Inline.diff rename to tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.diff b/tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.diff rename to tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/cycle.f.Inline.panic-abort.diff b/tests/mir-opt/inline/cycle.f.Inline.panic-abort.diff new file mode 100644 index 00000000000..a4cb48e66c1 --- /dev/null +++ b/tests/mir-opt/inline/cycle.f.Inline.panic-abort.diff @@ -0,0 +1,35 @@ +- // MIR for `f` before Inline ++ // MIR for `f` after Inline + + fn f(_1: impl Fn()) -> () { + debug g => _1; // in scope 0 at $DIR/cycle.rs:+0:6: +0:7 + let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:20: +0:20 + let _2: (); // in scope 0 at $DIR/cycle.rs:+1:5: +1:8 + let mut _3: &impl Fn(); // in scope 0 at $DIR/cycle.rs:+1:5: +1:6 + let mut _4: (); // in scope 0 at $DIR/cycle.rs:+1:5: +1:8 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/cycle.rs:+1:5: +1:8 + StorageLive(_3); // scope 0 at $DIR/cycle.rs:+1:5: +1:6 + _3 = &_1; // scope 0 at $DIR/cycle.rs:+1:5: +1:6 + StorageLive(_4); // scope 0 at $DIR/cycle.rs:+1:5: +1:8 + _4 = (); // scope 0 at $DIR/cycle.rs:+1:5: +1:8 + _2 = >::call(move _3, move _4) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/cycle.rs:+1:5: +1:8 + // mir::Constant + // + span: $DIR/cycle.rs:6:5: 6:6 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(), ()) -> >::Output {>::call}, val: Value() } + } + + bb1: { + StorageDead(_4); // scope 0 at $DIR/cycle.rs:+1:7: +1:8 + StorageDead(_3); // scope 0 at $DIR/cycle.rs:+1:7: +1:8 + StorageDead(_2); // scope 0 at $DIR/cycle.rs:+1:8: +1:9 + _0 = const (); // scope 0 at $DIR/cycle.rs:+0:20: +2:2 + drop(_1) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/cycle.rs:+2:1: +2:2 + } + + bb2: { + return; // scope 0 at $DIR/cycle.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/cycle.f.Inline.diff b/tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/cycle.f.Inline.diff rename to tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/cycle.g.Inline.panic-abort.diff b/tests/mir-opt/inline/cycle.g.Inline.panic-abort.diff new file mode 100644 index 00000000000..faa0b120ed5 --- /dev/null +++ b/tests/mir-opt/inline/cycle.g.Inline.panic-abort.diff @@ -0,0 +1,50 @@ +- // MIR for `g` before Inline ++ // MIR for `g` after Inline + + fn g() -> () { + let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:8: +0:8 + let _1: (); // in scope 0 at $DIR/cycle.rs:+1:5: +1:12 ++ let mut _2: fn() {main}; // in scope 0 at $DIR/cycle.rs:+1:5: +1:12 ++ let mut _5: (); // in scope 0 at $DIR/cycle.rs:6:5: 6:8 ++ scope 1 (inlined f::) { // at $DIR/cycle.rs:12:5: 12:12 ++ debug g => _2; // in scope 1 at $DIR/cycle.rs:5:6: 5:7 ++ let mut _3: &fn() {main}; // in scope 1 at $DIR/cycle.rs:6:5: 6:6 ++ let _4: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8 ++ scope 2 (inlined >::call - shim(fn() {main})) { // at $DIR/cycle.rs:6:5: 6:8 ++ } ++ } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/cycle.rs:+1:5: +1:12 +- _1 = f::(main) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/cycle.rs:+1:5: +1:12 ++ StorageLive(_2); // scope 0 at $DIR/cycle.rs:+1:5: +1:12 ++ _2 = main; // scope 0 at $DIR/cycle.rs:+1:5: +1:12 + // mir::Constant +- // + span: $DIR/cycle.rs:12:5: 12:6 +- // + literal: Const { ty: fn(fn() {main}) {f::}, val: Value() } +- // mir::Constant + // + span: $DIR/cycle.rs:12:7: 12:11 + // + literal: Const { ty: fn() {main}, val: Value() } ++ StorageLive(_4); // scope 0 at $DIR/cycle.rs:+1:5: +1:12 ++ StorageLive(_3); // scope 1 at $DIR/cycle.rs:6:5: 6:6 ++ _3 = &_2; // scope 1 at $DIR/cycle.rs:6:5: 6:6 ++ StorageLive(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8 ++ _5 = const (); // scope 1 at $DIR/cycle.rs:6:5: 6:8 ++ _4 = move (*_3)() -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL + } + + bb1: { ++ StorageDead(_4); // scope 0 at $DIR/cycle.rs:+1:5: +1:12 ++ StorageDead(_2); // scope 0 at $DIR/cycle.rs:+1:5: +1:12 + StorageDead(_1); // scope 0 at $DIR/cycle.rs:+1:12: +1:13 + _0 = const (); // scope 0 at $DIR/cycle.rs:+0:8: +2:2 + return; // scope 0 at $DIR/cycle.rs:+2:2: +2:2 ++ } ++ ++ bb2: { ++ StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8 ++ StorageDead(_3); // scope 1 at $DIR/cycle.rs:6:7: 6:8 ++ drop(_2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/cycle.rs:7:1: 7:2 + } + } + diff --git a/tests/mir-opt/inline/cycle.g.Inline.diff b/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/cycle.g.Inline.diff rename to tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/cycle.main.Inline.panic-abort.diff b/tests/mir-opt/inline/cycle.main.Inline.panic-abort.diff new file mode 100644 index 00000000000..55a0f92197b --- /dev/null +++ b/tests/mir-opt/inline/cycle.main.Inline.panic-abort.diff @@ -0,0 +1,63 @@ +- // MIR for `main` before Inline ++ // MIR for `main` after Inline + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:11: +0:11 + let _1: (); // in scope 0 at $DIR/cycle.rs:+1:5: +1:9 ++ let mut _2: fn() {g}; // in scope 0 at $DIR/cycle.rs:+1:5: +1:9 ++ let mut _5: (); // in scope 0 at $DIR/cycle.rs:6:5: 6:8 ++ scope 1 (inlined f::) { // at $DIR/cycle.rs:17:5: 17:9 ++ debug g => _2; // in scope 1 at $DIR/cycle.rs:5:6: 5:7 ++ let mut _3: &fn() {g}; // in scope 1 at $DIR/cycle.rs:6:5: 6:6 ++ let _4: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8 ++ scope 2 (inlined >::call - shim(fn() {g})) { // at $DIR/cycle.rs:6:5: 6:8 ++ scope 3 (inlined g) { // at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ scope 4 (inlined f::) { // at $DIR/cycle.rs:12:5: 12:12 ++ debug g => main; // in scope 4 at $DIR/cycle.rs:5:6: 5:7 ++ let _6: (); // in scope 4 at $DIR/cycle.rs:6:5: 6:8 ++ scope 5 (inlined >::call - shim(fn() {main})) { // at $DIR/cycle.rs:6:5: 6:8 ++ } ++ } ++ } ++ } ++ } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/cycle.rs:+1:5: +1:9 +- _1 = f::(g) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/cycle.rs:+1:5: +1:9 ++ StorageLive(_2); // scope 0 at $DIR/cycle.rs:+1:5: +1:9 ++ _2 = g; // scope 0 at $DIR/cycle.rs:+1:5: +1:9 + // mir::Constant +- // + span: $DIR/cycle.rs:17:5: 17:6 +- // + literal: Const { ty: fn(fn() {g}) {f::}, val: Value() } +- // mir::Constant + // + span: $DIR/cycle.rs:17:7: 17:8 + // + literal: Const { ty: fn() {g}, val: Value() } ++ StorageLive(_4); // scope 0 at $DIR/cycle.rs:+1:5: +1:9 ++ StorageLive(_3); // scope 1 at $DIR/cycle.rs:6:5: 6:6 ++ _3 = &_2; // scope 1 at $DIR/cycle.rs:6:5: 6:6 ++ StorageLive(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8 ++ _5 = const (); // scope 1 at $DIR/cycle.rs:6:5: 6:8 ++ StorageLive(_6); // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ _6 = main() -> [return: bb2, unwind unreachable]; // scope 5 at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: fn() {main}, val: Value() } + } + + bb1: { ++ StorageDead(_4); // scope 0 at $DIR/cycle.rs:+1:5: +1:9 ++ StorageDead(_2); // scope 0 at $DIR/cycle.rs:+1:5: +1:9 + StorageDead(_1); // scope 0 at $DIR/cycle.rs:+1:9: +1:10 + _0 = const (); // scope 0 at $DIR/cycle.rs:+0:11: +2:2 + return; // scope 0 at $DIR/cycle.rs:+2:2: +2:2 ++ } ++ ++ bb2: { ++ StorageDead(_6); // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8 ++ StorageDead(_3); // scope 1 at $DIR/cycle.rs:6:7: 6:8 ++ drop(_2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/cycle.rs:7:1: 7:2 + } + } + diff --git a/tests/mir-opt/inline/cycle.main.Inline.diff b/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/cycle.main.Inline.diff rename to tests/mir-opt/inline/cycle.main.Inline.panic-unwind.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 new file mode 100644 index 00000000000..2e5afd6cece --- /dev/null +++ b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff @@ -0,0 +1,54 @@ +- // MIR for `get_query` before Inline ++ // MIR for `get_query` after Inline + + fn get_query(_1: &T) -> () { + debug t => _1; // in scope 0 at $DIR/dyn_trait.rs:+0:31: +0:32 + let mut _0: (); // return place in scope 0 at $DIR/dyn_trait.rs:+0:38: +0:38 + let _2: &::C; // in scope 0 at $DIR/dyn_trait.rs:+1:9: +1:10 + let mut _3: &T; // in scope 0 at $DIR/dyn_trait.rs:+1:22: +1:23 + let mut _4: &::C; // in scope 0 at $DIR/dyn_trait.rs:+2:23: +2:24 + scope 1 { + debug c => _2; // in scope 1 at $DIR/dyn_trait.rs:+1:9: +1:10 ++ scope 2 (inlined try_execute_query::<::C>) { // at $DIR/dyn_trait.rs:35:5: 35:25 ++ debug c => _4; // in scope 2 at $DIR/dyn_trait.rs:27:36: 27:37 ++ let mut _5: &dyn Cache::V>; // in scope 2 at $DIR/dyn_trait.rs:28:14: 28:15 ++ scope 3 (inlined mk_cycle::<::V>) { // at $DIR/dyn_trait.rs:28:5: 28:16 ++ debug c => _5; // in scope 3 at $DIR/dyn_trait.rs:21:27: 21:28 ++ } ++ } + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/dyn_trait.rs:+1:9: +1:10 + StorageLive(_3); // scope 0 at $DIR/dyn_trait.rs:+1:22: +1:23 + _3 = &(*_1); // scope 0 at $DIR/dyn_trait.rs:+1:22: +1:23 + _2 = ::cache::(move _3) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/dyn_trait.rs:+1:13: +1:24 + // mir::Constant + // + span: $DIR/dyn_trait.rs:34:13: 34:21 + // + user_ty: UserType(0) + // + literal: Const { ty: for<'a> fn(&'a T) -> &'a ::C {::cache::}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 0 at $DIR/dyn_trait.rs:+1:23: +1:24 + StorageLive(_4); // scope 1 at $DIR/dyn_trait.rs:+2:23: +2:24 + _4 = &(*_2); // scope 1 at $DIR/dyn_trait.rs:+2:23: +2:24 +- _0 = try_execute_query::<::C>(move _4) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/dyn_trait.rs:+2:5: +2:25 ++ StorageLive(_5); // scope 2 at $DIR/dyn_trait.rs:28:14: 28:15 ++ _5 = _4 as &dyn Cache::V> (Pointer(Unsize)); // scope 2 at $DIR/dyn_trait.rs:28:14: 28:15 ++ _0 = ::V> as Cache>::store_nocache(_5) -> [return: bb2, unwind unreachable]; // scope 3 at $DIR/dyn_trait.rs:22:5: 22:22 + // mir::Constant +- // + span: $DIR/dyn_trait.rs:35:5: 35:22 +- // + literal: Const { ty: for<'a> fn(&'a ::C) {try_execute_query::<::C>}, val: Value() } ++ // + span: $DIR/dyn_trait.rs:22:7: 22:20 ++ // + literal: Const { ty: for<'a> fn(&'a dyn Cache::V>) {::V> as Cache>::store_nocache}, val: Value() } + } + + bb2: { ++ StorageDead(_5); // scope 2 at $DIR/dyn_trait.rs:28:15: 28:16 + StorageDead(_4); // scope 1 at $DIR/dyn_trait.rs:+2:24: +2:25 + StorageDead(_2); // scope 0 at $DIR/dyn_trait.rs:+3:1: +3:2 + return; // scope 0 at $DIR/dyn_trait.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/inline/dyn_trait.get_query.Inline.diff b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/dyn_trait.get_query.Inline.diff rename to tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff 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 new file mode 100644 index 00000000000..46a1ea59bc2 --- /dev/null +++ b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff @@ -0,0 +1,23 @@ +- // MIR for `mk_cycle` before Inline ++ // MIR for `mk_cycle` after Inline + + fn mk_cycle(_1: &dyn Cache) -> () { + debug c => _1; // in scope 0 at $DIR/dyn_trait.rs:+0:27: +0:28 + let mut _0: (); // return place in scope 0 at $DIR/dyn_trait.rs:+0:49: +0:49 + let mut _2: &dyn Cache; // in scope 0 at $DIR/dyn_trait.rs:+1:5: +1:22 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/dyn_trait.rs:+1:5: +1:22 + _2 = &(*_1); // scope 0 at $DIR/dyn_trait.rs:+1:5: +1:22 + _0 = as Cache>::store_nocache(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/dyn_trait.rs:+1:5: +1:22 + // mir::Constant + // + span: $DIR/dyn_trait.rs:22:7: 22:20 + // + literal: Const { ty: for<'a> fn(&'a dyn Cache) { as Cache>::store_nocache}, val: Value() } + } + + bb1: { + StorageDead(_2); // scope 0 at $DIR/dyn_trait.rs:+1:21: +1:22 + return; // scope 0 at $DIR/dyn_trait.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.diff b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.diff rename to tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff 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 new file mode 100644 index 00000000000..5d84f0f508a --- /dev/null +++ b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff @@ -0,0 +1,33 @@ +- // MIR for `try_execute_query` before Inline ++ // MIR for `try_execute_query` after Inline + + fn try_execute_query(_1: &C) -> () { + debug c => _1; // in scope 0 at $DIR/dyn_trait.rs:+0:36: +0:37 + let mut _0: (); // return place in scope 0 at $DIR/dyn_trait.rs:+0:43: +0:43 + let mut _2: &dyn Cache::V>; // in scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15 + let mut _3: &C; // in scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15 ++ scope 1 (inlined mk_cycle::<::V>) { // at $DIR/dyn_trait.rs:28:5: 28:16 ++ debug c => _2; // in scope 1 at $DIR/dyn_trait.rs:21:27: 21:28 ++ } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15 + StorageLive(_3); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15 + _3 = &(*_1); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15 + _2 = move _3 as &dyn Cache::V> (Pointer(Unsize)); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15 + StorageDead(_3); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15 +- _0 = mk_cycle::<::V>(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/dyn_trait.rs:+1:5: +1:16 ++ _0 = ::V> as Cache>::store_nocache(_2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/dyn_trait.rs:22:5: 22:22 + // mir::Constant +- // + span: $DIR/dyn_trait.rs:28:5: 28:13 +- // + literal: Const { ty: for<'a> fn(&'a (dyn Cache::V> + 'a)) {mk_cycle::<::V>}, val: Value() } ++ // + span: $DIR/dyn_trait.rs:22:7: 22:20 ++ // + literal: Const { ty: for<'a> fn(&'a dyn Cache::V>) {::V> as Cache>::store_nocache}, val: Value() } + } + + bb1: { + StorageDead(_2); // scope 0 at $DIR/dyn_trait.rs:+1:15: +1:16 + return; // scope 0 at $DIR/dyn_trait.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.diff b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.diff rename to tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-abort.diff b/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-abort.diff new file mode 100644 index 00000000000..967186b1989 --- /dev/null +++ b/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-abort.diff @@ -0,0 +1,175 @@ +- // MIR for `main` before Inline ++ // MIR for `main` after Inline + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/exponential_runtime.rs:+0:11: +0:11 + let _1: (); // in scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 ++ scope 1 (inlined <() as G>::call) { // at $DIR/exponential_runtime.rs:87:5: 87:22 ++ let _2: (); // in scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ let _3: (); // in scope 1 at $DIR/exponential_runtime.rs:75:9: 75:25 ++ let _4: (); // in scope 1 at $DIR/exponential_runtime.rs:76:9: 76:25 ++ scope 2 (inlined <() as F>::call) { // at $DIR/exponential_runtime.rs:74:9: 74:25 ++ let _5: (); // in scope 2 at $DIR/exponential_runtime.rs:62:9: 62:25 ++ let _6: (); // in scope 2 at $DIR/exponential_runtime.rs:63:9: 63:25 ++ let _7: (); // in scope 2 at $DIR/exponential_runtime.rs:64:9: 64:25 ++ scope 3 (inlined <() as E>::call) { // at $DIR/exponential_runtime.rs:62:9: 62:25 ++ let _8: (); // in scope 3 at $DIR/exponential_runtime.rs:50:9: 50:25 ++ let _9: (); // in scope 3 at $DIR/exponential_runtime.rs:51:9: 51:25 ++ let _10: (); // in scope 3 at $DIR/exponential_runtime.rs:52:9: 52:25 ++ scope 4 (inlined <() as D>::call) { // at $DIR/exponential_runtime.rs:50:9: 50:25 ++ let _11: (); // in scope 4 at $DIR/exponential_runtime.rs:38:9: 38:25 ++ let _12: (); // in scope 4 at $DIR/exponential_runtime.rs:39:9: 39:25 ++ let _13: (); // in scope 4 at $DIR/exponential_runtime.rs:40:9: 40:25 ++ scope 5 (inlined <() as C>::call) { // at $DIR/exponential_runtime.rs:38:9: 38:25 ++ let _14: (); // in scope 5 at $DIR/exponential_runtime.rs:26:9: 26:25 ++ let _15: (); // in scope 5 at $DIR/exponential_runtime.rs:27:9: 27:25 ++ let _16: (); // in scope 5 at $DIR/exponential_runtime.rs:28:9: 28:25 ++ scope 6 (inlined <() as B>::call) { // at $DIR/exponential_runtime.rs:26:9: 26:25 ++ let _17: (); // in scope 6 at $DIR/exponential_runtime.rs:14:9: 14:25 ++ let _18: (); // in scope 6 at $DIR/exponential_runtime.rs:15:9: 15:25 ++ let _19: (); // in scope 6 at $DIR/exponential_runtime.rs:16:9: 16:25 ++ } ++ } ++ } ++ } ++ } ++ } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 +- _1 = <() as G>::call() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 ++ StorageLive(_2); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 ++ StorageLive(_3); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 ++ StorageLive(_4); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 ++ StorageLive(_5); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ StorageLive(_6); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ StorageLive(_7); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ StorageLive(_8); // scope 2 at $DIR/exponential_runtime.rs:62:9: 62:25 ++ StorageLive(_9); // scope 2 at $DIR/exponential_runtime.rs:62:9: 62:25 ++ StorageLive(_10); // scope 2 at $DIR/exponential_runtime.rs:62:9: 62:25 ++ StorageLive(_11); // scope 3 at $DIR/exponential_runtime.rs:50:9: 50:25 ++ StorageLive(_12); // scope 3 at $DIR/exponential_runtime.rs:50:9: 50:25 ++ StorageLive(_13); // scope 3 at $DIR/exponential_runtime.rs:50:9: 50:25 ++ StorageLive(_14); // scope 4 at $DIR/exponential_runtime.rs:38:9: 38:25 ++ StorageLive(_15); // scope 4 at $DIR/exponential_runtime.rs:38:9: 38:25 ++ StorageLive(_16); // scope 4 at $DIR/exponential_runtime.rs:38:9: 38:25 ++ StorageLive(_17); // scope 5 at $DIR/exponential_runtime.rs:26:9: 26:25 ++ StorageLive(_18); // scope 5 at $DIR/exponential_runtime.rs:26:9: 26:25 ++ StorageLive(_19); // scope 5 at $DIR/exponential_runtime.rs:26:9: 26:25 ++ _17 = <() as A>::call() -> [return: bb12, unwind unreachable]; // scope 6 at $DIR/exponential_runtime.rs:14:9: 14:25 + // mir::Constant +- // + span: $DIR/exponential_runtime.rs:87:5: 87:20 +- // + literal: Const { ty: fn() {<() as G>::call}, val: Value() } ++ // + span: $DIR/exponential_runtime.rs:14:9: 14:23 ++ // + literal: Const { ty: fn() {<() as A>::call}, val: Value() } + } + + bb1: { ++ StorageDead(_4); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 ++ StorageDead(_3); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 ++ StorageDead(_2); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 + StorageDead(_1); // scope 0 at $DIR/exponential_runtime.rs:+1:22: +1:23 + _0 = const (); // scope 0 at $DIR/exponential_runtime.rs:+0:11: +2:2 + return; // scope 0 at $DIR/exponential_runtime.rs:+2:2: +2:2 ++ } ++ ++ bb2: { ++ StorageDead(_7); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ StorageDead(_6); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ StorageDead(_5); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ _3 = <() as F>::call() -> [return: bb3, unwind unreachable]; // scope 1 at $DIR/exponential_runtime.rs:75:9: 75:25 ++ // mir::Constant ++ // + span: $DIR/exponential_runtime.rs:75:9: 75:23 ++ // + literal: Const { ty: fn() {<() as F>::call}, val: Value() } ++ } ++ ++ bb3: { ++ _4 = <() as F>::call() -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/exponential_runtime.rs:76:9: 76:25 ++ // mir::Constant ++ // + span: $DIR/exponential_runtime.rs:76:9: 76:23 ++ // + literal: Const { ty: fn() {<() as F>::call}, val: Value() } ++ } ++ ++ bb4: { ++ StorageDead(_10); // scope 2 at $DIR/exponential_runtime.rs:62:9: 62:25 ++ StorageDead(_9); // scope 2 at $DIR/exponential_runtime.rs:62:9: 62:25 ++ StorageDead(_8); // scope 2 at $DIR/exponential_runtime.rs:62:9: 62:25 ++ _6 = <() as E>::call() -> [return: bb5, unwind unreachable]; // scope 2 at $DIR/exponential_runtime.rs:63:9: 63:25 ++ // mir::Constant ++ // + span: $DIR/exponential_runtime.rs:63:9: 63:23 ++ // + literal: Const { ty: fn() {<() as E>::call}, val: Value() } ++ } ++ ++ bb5: { ++ _7 = <() as E>::call() -> [return: bb2, unwind unreachable]; // scope 2 at $DIR/exponential_runtime.rs:64:9: 64:25 ++ // mir::Constant ++ // + span: $DIR/exponential_runtime.rs:64:9: 64:23 ++ // + literal: Const { ty: fn() {<() as E>::call}, val: Value() } ++ } ++ ++ bb6: { ++ StorageDead(_13); // scope 3 at $DIR/exponential_runtime.rs:50:9: 50:25 ++ StorageDead(_12); // scope 3 at $DIR/exponential_runtime.rs:50:9: 50:25 ++ StorageDead(_11); // scope 3 at $DIR/exponential_runtime.rs:50:9: 50:25 ++ _9 = <() as D>::call() -> [return: bb7, unwind unreachable]; // scope 3 at $DIR/exponential_runtime.rs:51:9: 51:25 ++ // mir::Constant ++ // + span: $DIR/exponential_runtime.rs:51:9: 51:23 ++ // + literal: Const { ty: fn() {<() as D>::call}, val: Value() } ++ } ++ ++ bb7: { ++ _10 = <() as D>::call() -> [return: bb4, unwind unreachable]; // scope 3 at $DIR/exponential_runtime.rs:52:9: 52:25 ++ // mir::Constant ++ // + span: $DIR/exponential_runtime.rs:52:9: 52:23 ++ // + literal: Const { ty: fn() {<() as D>::call}, val: Value() } ++ } ++ ++ bb8: { ++ StorageDead(_16); // scope 4 at $DIR/exponential_runtime.rs:38:9: 38:25 ++ StorageDead(_15); // scope 4 at $DIR/exponential_runtime.rs:38:9: 38:25 ++ StorageDead(_14); // scope 4 at $DIR/exponential_runtime.rs:38:9: 38:25 ++ _12 = <() as C>::call() -> [return: bb9, unwind unreachable]; // scope 4 at $DIR/exponential_runtime.rs:39:9: 39:25 ++ // mir::Constant ++ // + span: $DIR/exponential_runtime.rs:39:9: 39:23 ++ // + literal: Const { ty: fn() {<() as C>::call}, val: Value() } ++ } ++ ++ bb9: { ++ _13 = <() as C>::call() -> [return: bb6, unwind unreachable]; // scope 4 at $DIR/exponential_runtime.rs:40:9: 40:25 ++ // mir::Constant ++ // + span: $DIR/exponential_runtime.rs:40:9: 40:23 ++ // + literal: Const { ty: fn() {<() as C>::call}, val: Value() } ++ } ++ ++ bb10: { ++ StorageDead(_19); // scope 5 at $DIR/exponential_runtime.rs:26:9: 26:25 ++ StorageDead(_18); // scope 5 at $DIR/exponential_runtime.rs:26:9: 26:25 ++ StorageDead(_17); // scope 5 at $DIR/exponential_runtime.rs:26:9: 26:25 ++ _15 = <() as B>::call() -> [return: bb11, unwind unreachable]; // scope 5 at $DIR/exponential_runtime.rs:27:9: 27:25 ++ // mir::Constant ++ // + span: $DIR/exponential_runtime.rs:27:9: 27:23 ++ // + literal: Const { ty: fn() {<() as B>::call}, val: Value() } ++ } ++ ++ bb11: { ++ _16 = <() as B>::call() -> [return: bb8, unwind unreachable]; // scope 5 at $DIR/exponential_runtime.rs:28:9: 28:25 ++ // mir::Constant ++ // + span: $DIR/exponential_runtime.rs:28:9: 28:23 ++ // + literal: Const { ty: fn() {<() as B>::call}, val: Value() } ++ } ++ ++ bb12: { ++ _18 = <() as A>::call() -> [return: bb13, unwind unreachable]; // scope 6 at $DIR/exponential_runtime.rs:15:9: 15:25 ++ // mir::Constant ++ // + span: $DIR/exponential_runtime.rs:15:9: 15:23 ++ // + literal: Const { ty: fn() {<() as A>::call}, val: Value() } ++ } ++ ++ bb13: { ++ _19 = <() as A>::call() -> [return: bb10, unwind unreachable]; // scope 6 at $DIR/exponential_runtime.rs:16:9: 16:25 ++ // mir::Constant ++ // + span: $DIR/exponential_runtime.rs:16:9: 16:23 ++ // + literal: Const { ty: fn() {<() as A>::call}, val: Value() } + } + } + diff --git a/tests/mir-opt/inline/exponential_runtime.main.Inline.diff b/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/exponential_runtime.main.Inline.diff rename to tests/mir-opt/inline/exponential_runtime.main.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-abort.diff new file mode 100644 index 00000000000..abb0263d7e4 --- /dev/null +++ b/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-abort.diff @@ -0,0 +1,24 @@ +- // MIR for `inlined_no_sanitize` before Inline ++ // MIR for `inlined_no_sanitize` after Inline + + fn inlined_no_sanitize() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:37: +0:37 + let _1: (); // in scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18 ++ scope 1 (inlined no_sanitize) { // at $DIR/inline_compatibility.rs:25:5: 25:18 ++ } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18 +- _1 = no_sanitize() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18 +- // mir::Constant +- // + span: $DIR/inline_compatibility.rs:25:5: 25:16 +- // + literal: Const { ty: unsafe fn() {no_sanitize}, val: Value() } +- } +- +- bb1: { + StorageDead(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:18: +1:19 + _0 = const (); // scope 0 at $DIR/inline_compatibility.rs:+0:37: +2:2 + return; // scope 0 at $DIR/inline_compatibility.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.diff b/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff similarity index 95% rename from tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.diff rename to tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff index e30a5e116ea..de4462227fd 100644 --- a/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.diff +++ b/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff @@ -4,14 +4,14 @@ fn inlined_no_sanitize() -> () { let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:37: +0:37 let _1: (); // in scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18 -+ scope 1 (inlined no_sanitize) { // at $DIR/inline_compatibility.rs:24:5: 24:18 ++ scope 1 (inlined no_sanitize) { // at $DIR/inline_compatibility.rs:25:5: 25:18 + } bb0: { StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18 - _1 = no_sanitize() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18 - // mir::Constant -- // + span: $DIR/inline_compatibility.rs:24:5: 24:16 +- // + span: $DIR/inline_compatibility.rs:25:5: 25:16 - // + literal: Const { ty: unsafe fn() {no_sanitize}, val: Value() } - } - diff --git a/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-abort.diff new file mode 100644 index 00000000000..e758127265e --- /dev/null +++ b/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-abort.diff @@ -0,0 +1,24 @@ +- // MIR for `inlined_target_feature` before Inline ++ // MIR for `inlined_target_feature` after Inline + + fn inlined_target_feature() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:40: +0:40 + let _1: (); // in scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21 ++ scope 1 (inlined target_feature) { // at $DIR/inline_compatibility.rs:14:5: 14:21 ++ } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21 +- _1 = target_feature() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21 +- // mir::Constant +- // + span: $DIR/inline_compatibility.rs:14:5: 14:19 +- // + literal: Const { ty: unsafe fn() {target_feature}, val: Value() } +- } +- +- bb1: { + StorageDead(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:21: +1:22 + _0 = const (); // scope 0 at $DIR/inline_compatibility.rs:+0:40: +2:2 + return; // scope 0 at $DIR/inline_compatibility.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.diff b/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff similarity index 95% rename from tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.diff rename to tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff index c2b3c46a30c..9eb565bd0e7 100644 --- a/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.diff +++ b/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff @@ -4,14 +4,14 @@ fn inlined_target_feature() -> () { let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:40: +0:40 let _1: (); // in scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21 -+ scope 1 (inlined target_feature) { // at $DIR/inline_compatibility.rs:13:5: 13:21 ++ scope 1 (inlined target_feature) { // at $DIR/inline_compatibility.rs:14:5: 14:21 + } bb0: { StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21 - _1 = target_feature() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21 - // mir::Constant -- // + span: $DIR/inline_compatibility.rs:13:5: 13:19 +- // + span: $DIR/inline_compatibility.rs:14:5: 14:19 - // + literal: Const { ty: unsafe fn() {target_feature}, val: Value() } - } - diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-abort.diff new file mode 100644 index 00000000000..124435cd258 --- /dev/null +++ b/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-abort.diff @@ -0,0 +1,25 @@ +- // MIR for `not_inlined_c_variadic` before Inline ++ // MIR for `not_inlined_c_variadic` after Inline + + fn not_inlined_c_variadic() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:40: +0:40 + let _1: u32; // in scope 0 at $DIR/inline_compatibility.rs:+1:9: +1:10 + scope 1 { + debug s => _1; // in scope 1 at $DIR/inline_compatibility.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:9: +1:10 + _1 = sum(const 4_u32, const 4_u32, const 30_u32, const 200_u32, const 1000_u32) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_compatibility.rs:+1:13: +1:52 + // mir::Constant + // + span: $DIR/inline_compatibility.rs:43:13: 43:16 + // + literal: Const { ty: unsafe extern "C" fn(u32, ...) -> u32 {sum}, val: Value() } + } + + bb1: { + _0 = const (); // scope 0 at $DIR/inline_compatibility.rs:+0:40: +2:2 + StorageDead(_1); // scope 0 at $DIR/inline_compatibility.rs:+2:1: +2:2 + return; // scope 0 at $DIR/inline_compatibility.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff similarity index 97% rename from tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.diff rename to tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff index 0ca5a5f70b7..775f3af76b6 100644 --- a/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.diff +++ b/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff @@ -12,7 +12,7 @@ StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:9: +1:10 _1 = sum(const 4_u32, const 4_u32, const 30_u32, const 200_u32, const 1000_u32) -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:13: +1:52 // mir::Constant - // + span: $DIR/inline_compatibility.rs:42:13: 42:16 + // + span: $DIR/inline_compatibility.rs:43:13: 43:16 // + literal: Const { ty: unsafe extern "C" fn(u32, ...) -> u32 {sum}, val: Value() } } diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-abort.diff new file mode 100644 index 00000000000..21dc2ee8da1 --- /dev/null +++ b/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-abort.diff @@ -0,0 +1,22 @@ +- // MIR for `not_inlined_no_sanitize` before Inline ++ // MIR for `not_inlined_no_sanitize` after Inline + + fn not_inlined_no_sanitize() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:41: +0:41 + let _1: (); // in scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18 + + bb0: { + StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18 + _1 = no_sanitize() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18 + // mir::Constant + // + span: $DIR/inline_compatibility.rs:30:5: 30:16 + // + literal: Const { ty: unsafe fn() {no_sanitize}, val: Value() } + } + + bb1: { + StorageDead(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:18: +1:19 + _0 = const (); // scope 0 at $DIR/inline_compatibility.rs:+0:41: +2:2 + return; // scope 0 at $DIR/inline_compatibility.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff similarity index 97% rename from tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.diff rename to tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff index 00d405c77f9..8ef5b8ba98e 100644 --- a/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.diff +++ b/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff @@ -9,7 +9,7 @@ StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18 _1 = no_sanitize() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18 // mir::Constant - // + span: $DIR/inline_compatibility.rs:29:5: 29:16 + // + span: $DIR/inline_compatibility.rs:30:5: 30:16 // + literal: Const { ty: unsafe fn() {no_sanitize}, val: Value() } } diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-abort.diff new file mode 100644 index 00000000000..02feec05bef --- /dev/null +++ b/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-abort.diff @@ -0,0 +1,22 @@ +- // MIR for `not_inlined_target_feature` before Inline ++ // MIR for `not_inlined_target_feature` after Inline + + fn not_inlined_target_feature() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:44: +0:44 + let _1: (); // in scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21 + + bb0: { + StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21 + _1 = target_feature() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21 + // mir::Constant + // + span: $DIR/inline_compatibility.rs:19:5: 19:19 + // + literal: Const { ty: unsafe fn() {target_feature}, val: Value() } + } + + bb1: { + StorageDead(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:21: +1:22 + _0 = const (); // scope 0 at $DIR/inline_compatibility.rs:+0:44: +2:2 + return; // scope 0 at $DIR/inline_compatibility.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff similarity index 97% rename from tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.diff rename to tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff index 8b9c86f5515..2523162dfff 100644 --- a/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.diff +++ b/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff @@ -9,7 +9,7 @@ StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21 _1 = target_feature() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21 // mir::Constant - // + span: $DIR/inline_compatibility.rs:18:5: 18:19 + // + span: $DIR/inline_compatibility.rs:19:5: 19:19 // + literal: Const { ty: unsafe fn() {target_feature}, val: Value() } } diff --git a/tests/mir-opt/inline/inline_cycle.one.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_cycle.one.Inline.panic-abort.diff new file mode 100644 index 00000000000..228a34a492e --- /dev/null +++ b/tests/mir-opt/inline/inline_cycle.one.Inline.panic-abort.diff @@ -0,0 +1,30 @@ +- // MIR for `one` before Inline ++ // MIR for `one` after Inline + + fn one() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inline_cycle.rs:+0:10: +0:10 + let _1: (); // in scope 0 at $DIR/inline_cycle.rs:+1:5: +1:24 ++ scope 1 (inlined ::call) { // at $DIR/inline_cycle.rs:15:5: 15:24 ++ scope 2 (inlined as Call>::call) { // at $DIR/inline_cycle.rs:44:9: 44:23 ++ scope 3 (inlined as Call>::call) { // at $DIR/inline_cycle.rs:29:9: 29:31 ++ } ++ } ++ } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:24 +- _1 = ::call() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:24 ++ _1 = ::call() -> [return: bb1, unwind unreachable]; // scope 3 at $DIR/inline_cycle.rs:37:9: 37:28 + // mir::Constant +- // + span: $DIR/inline_cycle.rs:15:5: 15:22 ++ // + span: $DIR/inline_cycle.rs:37:9: 37:26 + // + literal: Const { ty: fn() {::call}, val: Value() } + } + + bb1: { + StorageDead(_1); // scope 0 at $DIR/inline_cycle.rs:+1:24: +1:25 + _0 = const (); // scope 0 at $DIR/inline_cycle.rs:+0:10: +2:2 + return; // scope 0 at $DIR/inline_cycle.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/inline_cycle.one.Inline.diff b/tests/mir-opt/inline/inline_cycle.one.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/inline_cycle.one.Inline.diff rename to tests/mir-opt/inline/inline_cycle.one.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff new file mode 100644 index 00000000000..123fa5cb913 --- /dev/null +++ b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff @@ -0,0 +1,55 @@ +- // MIR for `two` before Inline ++ // MIR for `two` after Inline + + fn two() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inline_cycle.rs:+0:10: +0:10 + let _1: (); // in scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 ++ let mut _2: fn() {f}; // in scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 ++ let mut _4: (); // in scope 0 at $DIR/inline_cycle.rs:55:5: 55:8 ++ scope 1 (inlined call::) { // at $DIR/inline_cycle.rs:50:5: 50:12 ++ debug f => _2; // in scope 1 at $DIR/inline_cycle.rs:54:22: 54:23 ++ let _3: (); // in scope 1 at $DIR/inline_cycle.rs:55:5: 55:8 ++ scope 2 (inlined >::call_once - shim(fn() {f})) { // at $DIR/inline_cycle.rs:55:5: 55:8 ++ scope 3 (inlined f) { // at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ scope 4 (inlined call::) { // at $DIR/inline_cycle.rs:60:5: 60:12 ++ debug f => f; // in scope 4 at $DIR/inline_cycle.rs:54:22: 54:23 ++ let _5: (); // in scope 4 at $DIR/inline_cycle.rs:55:5: 55:8 ++ scope 5 (inlined >::call_once - shim(fn() {f})) { // at $DIR/inline_cycle.rs:55:5: 55:8 ++ } ++ } ++ } ++ } ++ } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 +- _1 = call::(f) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 ++ StorageLive(_2); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 ++ _2 = f; // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 + // mir::Constant +- // + span: $DIR/inline_cycle.rs:50:5: 50:9 +- // + literal: Const { ty: fn(fn() {f}) {call::}, val: Value() } +- // mir::Constant + // + span: $DIR/inline_cycle.rs:50:10: 50:11 + // + literal: Const { ty: fn() {f}, val: Value() } ++ StorageLive(_3); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 ++ StorageLive(_4); // scope 1 at $DIR/inline_cycle.rs:55:5: 55:8 ++ _4 = const (); // scope 1 at $DIR/inline_cycle.rs:55:5: 55:8 ++ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ _5 = f() -> [return: bb1, unwind unreachable]; // scope 5 at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: fn() {f}, val: Value() } + } + + bb1: { ++ StorageDead(_5); // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ StorageDead(_4); // scope 1 at $DIR/inline_cycle.rs:55:5: 55:8 ++ StorageDead(_3); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 ++ StorageDead(_2); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 + StorageDead(_1); // scope 0 at $DIR/inline_cycle.rs:+1:12: +1:13 + _0 = const (); // scope 0 at $DIR/inline_cycle.rs:+0:10: +2:2 + return; // scope 0 at $DIR/inline_cycle.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/inline_cycle.two.Inline.diff b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/inline_cycle.two.Inline.diff rename to tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-abort.diff new file mode 100644 index 00000000000..25a97cf0210 --- /dev/null +++ b/tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-abort.diff @@ -0,0 +1,31 @@ +- // MIR for `main` before Inline ++ // MIR for `main` after Inline + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inline_cycle_generic.rs:+0:11: +0:11 + let _1: (); // in scope 0 at $DIR/inline_cycle_generic.rs:+1:5: +1:24 ++ scope 1 (inlined ::call) { // at $DIR/inline_cycle_generic.rs:10:5: 10:24 ++ scope 2 (inlined as Call>::call) { // at $DIR/inline_cycle_generic.rs:39:9: 39:31 ++ scope 3 (inlined ::call) { // at $DIR/inline_cycle_generic.rs:32:9: 32:28 ++ } ++ } ++ } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/inline_cycle_generic.rs:+1:5: +1:24 +- _1 = ::call() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_cycle_generic.rs:+1:5: +1:24 ++ _1 = as Call>::call() -> [return: bb1, unwind unreachable]; // scope 3 at $DIR/inline_cycle_generic.rs:24:9: 24:31 + // mir::Constant +- // + span: $DIR/inline_cycle_generic.rs:10:5: 10:22 +- // + literal: Const { ty: fn() {::call}, val: Value() } ++ // + span: $DIR/inline_cycle_generic.rs:24:9: 24:29 ++ // + literal: Const { ty: fn() { as Call>::call}, val: Value() } + } + + bb1: { + StorageDead(_1); // scope 0 at $DIR/inline_cycle_generic.rs:+1:24: +1:25 + _0 = const (); // scope 0 at $DIR/inline_cycle_generic.rs:+0:11: +2:2 + return; // scope 0 at $DIR/inline_cycle_generic.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/inline_cycle_generic.main.Inline.diff b/tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/inline_cycle_generic.main.Inline.diff rename to tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/inline_diverging.f.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.f.Inline.panic-abort.diff new file mode 100644 index 00000000000..a818e7355ba --- /dev/null +++ b/tests/mir-opt/inline/inline_diverging.f.Inline.panic-abort.diff @@ -0,0 +1,24 @@ +- // MIR for `f` before Inline ++ // MIR for `f` after Inline + + fn f() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inline_diverging.rs:+0:12: +0:12 + let mut _1: !; // in scope 0 at $DIR/inline_diverging.rs:+0:12: +2:2 + let _2: !; // in scope 0 at $DIR/inline_diverging.rs:+1:5: +1:12 ++ scope 1 (inlined sleep) { // at $DIR/inline_diverging.rs:8:5: 8:12 ++ } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:12 +- _2 = sleep() -> unwind unreachable; // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:12 +- // mir::Constant +- // + span: $DIR/inline_diverging.rs:8:5: 8:10 +- // + literal: Const { ty: fn() -> ! {sleep}, val: Value() } ++ goto -> bb1; // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:12 ++ } ++ ++ bb1: { ++ goto -> bb1; // scope 1 at $DIR/inline_diverging.rs:39:5: 39:12 + } + } + diff --git a/tests/mir-opt/inline/inline_diverging.f.Inline.diff b/tests/mir-opt/inline/inline_diverging.f.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/inline_diverging.f.Inline.diff rename to tests/mir-opt/inline/inline_diverging.f.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff new file mode 100644 index 00000000000..77a156a513e --- /dev/null +++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff @@ -0,0 +1,49 @@ +- // MIR for `g` before Inline ++ // MIR for `g` after Inline + + fn g(_1: i32) -> u32 { + debug i => _1; // in scope 0 at $DIR/inline_diverging.rs:+0:10: +0:11 + let mut _0: u32; // return place in scope 0 at $DIR/inline_diverging.rs:+0:21: +0:24 + let mut _2: bool; // in scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13 + let mut _3: i32; // in scope 0 at $DIR/inline_diverging.rs:+1:8: +1:9 + let mut _4: i32; // in scope 0 at $DIR/inline_diverging.rs:+2:9: +2:10 + let mut _5: !; // in scope 0 at $DIR/inline_diverging.rs:+3:12: +5:6 + let _6: !; // in scope 0 at $DIR/inline_diverging.rs:+4:9: +4:16 ++ scope 1 (inlined panic) { // at $DIR/inline_diverging.rs:16:9: 16:16 ++ let mut _7: !; // in scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL ++ } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13 + StorageLive(_3); // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:9 + _3 = _1; // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:9 + _2 = Gt(move _3, const 0_i32); // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13 + StorageDead(_3); // scope 0 at $DIR/inline_diverging.rs:+1:12: +1:13 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13 + } + + bb1: { + StorageLive(_4); // scope 0 at $DIR/inline_diverging.rs:+2:9: +2:10 + _4 = _1; // scope 0 at $DIR/inline_diverging.rs:+2:9: +2:10 + _0 = move _4 as u32 (IntToInt); // scope 0 at $DIR/inline_diverging.rs:+2:9: +2:17 + StorageDead(_4); // scope 0 at $DIR/inline_diverging.rs:+2:16: +2:17 + StorageDead(_2); // scope 0 at $DIR/inline_diverging.rs:+5:5: +5:6 + return; // scope 0 at $DIR/inline_diverging.rs:+6:2: +6:2 + } + + bb2: { + StorageLive(_6); // scope 0 at $DIR/inline_diverging.rs:+4:9: +4:16 +- _6 = panic() -> unwind unreachable; // scope 0 at $DIR/inline_diverging.rs:+4:9: +4:16 ++ StorageLive(_7); // scope 0 at $DIR/inline_diverging.rs:+4:9: +4:16 ++ _7 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable; // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL + // mir::Constant +- // + span: $DIR/inline_diverging.rs:16:9: 16:14 +- // + literal: Const { ty: fn() -> ! {panic}, val: Value() } ++ // + span: $SRC_DIR/std/src/panic.rs:LL:COL ++ // + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value() } ++ // mir::Constant ++ // + span: $SRC_DIR/std/src/panic.rs:LL:COL ++ // + literal: Const { ty: &str, val: Value(Slice(..)) } + } + } + diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/inline_diverging.g.Inline.diff rename to tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff new file mode 100644 index 00000000000..b864cbdfad0 --- /dev/null +++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff @@ -0,0 +1,51 @@ +- // MIR for `h` before Inline ++ // MIR for `h` after Inline + + fn h() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inline_diverging.rs:+0:12: +0:12 + let _1: (!, !); // in scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22 ++ let mut _2: fn() -> ! {sleep}; // in scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22 ++ let mut _7: (); // in scope 0 at $DIR/inline_diverging.rs:27:13: 27:16 ++ scope 1 (inlined call_twice:: ! {sleep}>) { // at $DIR/inline_diverging.rs:22:5: 22:22 ++ debug f => _2; // in scope 1 at $DIR/inline_diverging.rs:26:36: 26:37 ++ let mut _3: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 ++ let mut _4: !; // in scope 1 at $DIR/inline_diverging.rs:29:6: 29:7 ++ let mut _5: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline_diverging.rs:28:13: 28:14 ++ let mut _6: !; // in scope 1 at $DIR/inline_diverging.rs:29:9: 29:10 ++ scope 2 { ++ debug a => _4; // in scope 2 at $DIR/inline_diverging.rs:27:9: 27:10 ++ scope 3 { ++ debug b => _6; // in scope 3 at $DIR/inline_diverging.rs:28:9: 28:10 ++ } ++ } ++ scope 4 (inlined ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) { // at $DIR/inline_diverging.rs:27:13: 27:16 ++ scope 5 (inlined sleep) { // at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ } ++ } ++ } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22 +- _1 = call_twice:: ! {sleep}>(sleep) -> unwind unreachable; // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22 ++ StorageLive(_2); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22 ++ _2 = sleep; // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22 + // mir::Constant +- // + span: $DIR/inline_diverging.rs:22:5: 22:15 +- // + literal: Const { ty: fn(fn() -> ! {sleep}) -> (!, !) {call_twice:: ! {sleep}>}, val: Value() } +- // mir::Constant + // + span: $DIR/inline_diverging.rs:22:16: 22:21 + // + literal: Const { ty: fn() -> ! {sleep}, val: Value() } ++ StorageLive(_4); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22 ++ StorageLive(_6); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22 ++ StorageLive(_3); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 ++ _3 = &_2; // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 ++ StorageLive(_7); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:16 ++ _7 = const (); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:16 ++ goto -> bb1; // scope 5 at $DIR/inline_diverging.rs:39:5: 39:12 ++ } ++ ++ bb1: { ++ goto -> bb1; // scope 5 at $DIR/inline_diverging.rs:39:5: 39:12 + } + } + diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/inline_diverging.h.Inline.diff rename to tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff new file mode 100644 index 00000000000..21a8bf09254 --- /dev/null +++ b/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff @@ -0,0 +1,127 @@ +- // MIR for `main` before Inline ++ // MIR for `main` after Inline + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inline_generator.rs:+0:11: +0:11 + let _1: std::ops::GeneratorState; // in scope 0 at $DIR/inline_generator.rs:+1:9: +1:11 + let mut _2: std::pin::Pin<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>; // in scope 0 at $DIR/inline_generator.rs:+1:14: +1:32 + let mut _3: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 0 at $DIR/inline_generator.rs:+1:23: +1:31 + let mut _4: [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 0 at $DIR/inline_generator.rs:+1:28: +1:31 ++ let mut _5: bool; // in scope 0 at $DIR/inline_generator.rs:+1:33: +1:46 + scope 1 { + debug _r => _1; // in scope 1 at $DIR/inline_generator.rs:+1:9: +1:11 + } ++ scope 2 (inlined g) { // at $DIR/inline_generator.rs:9:28: 9:31 ++ } ++ scope 3 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new) { // at $DIR/inline_generator.rs:9:14: 9:32 ++ debug pointer => _3; // in scope 3 at $SRC_DIR/core/src/pin.rs:LL:COL ++ scope 4 { ++ scope 5 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new_unchecked) { // at $SRC_DIR/core/src/pin.rs:LL:COL ++ debug pointer => _3; // in scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL ++ } ++ } ++ } ++ scope 6 (inlined g::{closure#0}) { // at $DIR/inline_generator.rs:9:33: 9:46 ++ debug a => _5; // in scope 6 at $DIR/inline_generator.rs:15:6: 15:7 ++ let mut _6: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41 ++ let mut _7: u32; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41 ++ let mut _8: i32; // in scope 6 at $DIR/inline_generator.rs:15:17: 15:39 ++ let mut _9: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41 ++ let mut _10: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41 ++ } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/inline_generator.rs:+1:9: +1:11 + StorageLive(_2); // scope 0 at $DIR/inline_generator.rs:+1:14: +1:32 + StorageLive(_3); // scope 0 at $DIR/inline_generator.rs:+1:23: +1:31 + StorageLive(_4); // scope 0 at $DIR/inline_generator.rs:+1:28: +1:31 +- _4 = g() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_generator.rs:+1:28: +1:31 +- // mir::Constant +- // + span: $DIR/inline_generator.rs:9:28: 9:29 +- // + literal: Const { ty: fn() -> impl Generator {g}, val: Value() } +- } +- +- bb1: { ++ _4 = [generator@$DIR/inline_generator.rs:15:5: 15:8 (#0)]; // scope 2 at $DIR/inline_generator.rs:15:5: 15:41 ++ // generator ++ // + def_id: DefId(0:7 ~ inline_generator[e37e]::g::{closure#0}) ++ // + substs: [ ++ // bool, ++ // i32, ++ // bool, ++ // {bool, i32}, ++ // (), ++ // ] ++ // + movability: Movable + _3 = &mut _4; // scope 0 at $DIR/inline_generator.rs:+1:23: +1:31 +- _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new(move _3) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/inline_generator.rs:+1:14: +1:32 +- // mir::Constant +- // + span: $DIR/inline_generator.rs:9:14: 9:22 +- // + user_ty: UserType(0) +- // + literal: Const { ty: fn(&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]) -> Pin<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]> {Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new}, val: Value() } +- } +- +- bb2: { ++ _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]> { pointer: move _3 }; // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL + StorageDead(_3); // scope 0 at $DIR/inline_generator.rs:+1:31: +1:32 +- _1 = <[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator>::resume(move _2, const false) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46 +- // mir::Constant +- // + span: $DIR/inline_generator.rs:9:33: 9:39 +- // + literal: Const { ty: for<'a> fn(Pin<&'a mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>, bool) -> GeneratorState<<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator>::Yield, <[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator>::Return> {<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator>::resume}, val: Value() } ++ StorageLive(_5); // scope 0 at $DIR/inline_generator.rs:+1:33: +1:46 ++ _5 = const false; // scope 0 at $DIR/inline_generator.rs:+1:33: +1:46 ++ _6 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 ++ _7 = discriminant((*_6)); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 ++ switchInt(move _7) -> [0: bb2, 1: bb6, 3: bb7, otherwise: bb8]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 + } + +- bb3: { ++ bb1: { ++ StorageDead(_5); // scope 0 at $DIR/inline_generator.rs:+1:33: +1:46 + StorageDead(_2); // scope 0 at $DIR/inline_generator.rs:+1:45: +1:46 + StorageDead(_4); // scope 0 at $DIR/inline_generator.rs:+1:46: +1:47 + _0 = const (); // scope 0 at $DIR/inline_generator.rs:+0:11: +2:2 + StorageDead(_1); // scope 0 at $DIR/inline_generator.rs:+2:1: +2:2 + return; // scope 0 at $DIR/inline_generator.rs:+2:2: +2:2 ++ } ++ ++ bb2: { ++ StorageLive(_8); // scope 6 at $DIR/inline_generator.rs:15:17: 15:39 ++ switchInt(_5) -> [0: bb3, otherwise: bb4]; // scope 6 at $DIR/inline_generator.rs:15:20: 15:21 ++ } ++ ++ bb3: { ++ _8 = const 13_i32; // scope 6 at $DIR/inline_generator.rs:15:35: 15:37 ++ goto -> bb5; // scope 6 at $DIR/inline_generator.rs:15:17: 15:39 ++ } ++ ++ bb4: { ++ _8 = const 7_i32; // scope 6 at $DIR/inline_generator.rs:15:24: 15:25 ++ goto -> bb5; // scope 6 at $DIR/inline_generator.rs:15:17: 15:39 ++ } ++ ++ bb5: { ++ _1 = GeneratorState::::Yielded(move _8); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39 ++ _9 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39 ++ discriminant((*_9)) = 3; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39 ++ goto -> bb1; // scope 0 at $DIR/inline_generator.rs:15:11: 15:39 ++ } ++ ++ bb6: { ++ assert(const false, "generator resumed after completion") -> [success: bb6, unwind unreachable]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 ++ } ++ ++ bb7: { ++ StorageLive(_8); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 ++ StorageDead(_8); // scope 6 at $DIR/inline_generator.rs:15:38: 15:39 ++ _1 = GeneratorState::::Complete(_5); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41 ++ _10 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41 ++ discriminant((*_10)) = 1; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41 ++ goto -> bb1; // scope 0 at $DIR/inline_generator.rs:15:41: 15:41 ++ } ++ ++ bb8: { ++ unreachable; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 + } + } + diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/inline_generator.main.Inline.diff rename to tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff new file mode 100644 index 00000000000..3b3b29af394 --- /dev/null +++ b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff @@ -0,0 +1,72 @@ +- // MIR for `main` before Inline ++ // MIR for `main` after Inline + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inline_into_box_place.rs:+0:11: +0:11 + let _1: std::boxed::Box>; // in scope 0 at $DIR/inline_into_box_place.rs:+1:9: +1:11 + let mut _2: std::vec::Vec; // in scope 0 at $DIR/inline_into_box_place.rs:+1:38: +1:48 + scope 1 { + debug _x => _1; // in scope 1 at $DIR/inline_into_box_place.rs:+1:9: +1:11 + } ++ scope 2 (inlined Vec::::new) { // at $DIR/inline_into_box_place.rs:8:38: 8:48 ++ let mut _3: alloc::raw_vec::RawVec; // in scope 2 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ } ++ scope 3 (inlined Box::>::new) { // at $DIR/inline_into_box_place.rs:8:29: 8:49 ++ debug x => _2; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ let mut _4: usize; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ let mut _5: usize; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ let mut _6: *mut u8; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ let mut _7: *const std::vec::Vec; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ scope 4 { ++ } ++ } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/inline_into_box_place.rs:+1:9: +1:11 + StorageLive(_2); // scope 0 at $DIR/inline_into_box_place.rs:+1:38: +1:48 +- _2 = Vec::::new() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_into_box_place.rs:+1:38: +1:48 ++ StorageLive(_3); // scope 2 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ _3 = const _; // scope 2 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + // mir::Constant +- // + span: $DIR/inline_into_box_place.rs:8:38: 8:46 +- // + user_ty: UserType(2) +- // + literal: Const { ty: fn() -> Vec {Vec::::new}, val: Value() } ++ // + span: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ // + user_ty: UserType(0) ++ // + literal: Const { ty: alloc::raw_vec::RawVec, val: Unevaluated(alloc::raw_vec::RawVec::::NEW, [u32], None) } ++ _2 = Vec:: { buf: move _3, len: const 0_usize }; // scope 2 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ StorageDead(_3); // scope 2 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL ++ _4 = SizeOf(std::vec::Vec); // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ _5 = AlignOf(std::vec::Vec); // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb2, unwind unreachable]; // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ // mir::Constant ++ // + span: $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } + } + + bb1: { +- _1 = Box::>::new(move _2) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/inline_into_box_place.rs:+1:29: +1:49 +- // mir::Constant +- // + span: $DIR/inline_into_box_place.rs:8:29: 8:37 +- // + user_ty: UserType(1) +- // + literal: Const { ty: fn(Vec) -> Box> {Box::>::new}, val: Value() } ++ StorageDead(_1); // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2 ++ return; // scope 0 at $DIR/inline_into_box_place.rs:+2:2: +2:2 + } + + bb2: { ++ _1 = ShallowInitBox(move _6, std::vec::Vec); // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ _7 = (((_1.0: std::ptr::Unique>).0: std::ptr::NonNull>).0: *const std::vec::Vec); // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ (*_7) = move _2; // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + StorageDead(_2); // scope 0 at $DIR/inline_into_box_place.rs:+1:48: +1:49 + _0 = const (); // scope 0 at $DIR/inline_into_box_place.rs:+0:11: +2:2 +- drop(_1) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2 +- } +- +- bb3: { +- StorageDead(_1); // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2 +- return; // scope 0 at $DIR/inline_into_box_place.rs:+2:2: +2:2 ++ drop(_1) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2 + } + } + diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/inline_into_box_place.main.Inline.diff rename to tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/inline_options.main.Inline.after.panic-abort.mir b/tests/mir-opt/inline/inline_options.main.Inline.after.panic-abort.mir new file mode 100644 index 00000000000..755ef3fa3d8 --- /dev/null +++ b/tests/mir-opt/inline/inline_options.main.Inline.after.panic-abort.mir @@ -0,0 +1,55 @@ +// MIR for `main` after Inline + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inline_options.rs:+0:11: +0:11 + let _1: (); // in scope 0 at $DIR/inline_options.rs:+1:5: +1:18 + let _2: (); // in scope 0 at $DIR/inline_options.rs:+2:5: +2:21 + scope 1 (inlined inlined::) { // at $DIR/inline_options.rs:11:5: 11:21 + let _3: (); // in scope 1 at $DIR/inline_options.rs:17:23: 17:26 + let _4: (); // in scope 1 at $DIR/inline_options.rs:17:28: 17:31 + let _5: (); // in scope 1 at $DIR/inline_options.rs:17:33: 17:36 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/inline_options.rs:+1:5: +1:18 + _1 = not_inlined() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_options.rs:+1:5: +1:18 + // mir::Constant + // + span: $DIR/inline_options.rs:10:5: 10:16 + // + literal: Const { ty: fn() {not_inlined}, val: Value() } + } + + bb1: { + StorageDead(_1); // scope 0 at $DIR/inline_options.rs:+1:18: +1:19 + StorageLive(_2); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21 + StorageLive(_3); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21 + StorageLive(_4); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21 + StorageLive(_5); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21 + _3 = g() -> [return: bb3, unwind unreachable]; // scope 1 at $DIR/inline_options.rs:17:23: 17:26 + // mir::Constant + // + span: $DIR/inline_options.rs:17:23: 17:24 + // + literal: Const { ty: fn() {g}, val: Value() } + } + + bb2: { + StorageDead(_5); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21 + StorageDead(_4); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21 + StorageDead(_3); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21 + StorageDead(_2); // scope 0 at $DIR/inline_options.rs:+2:21: +2:22 + _0 = const (); // scope 0 at $DIR/inline_options.rs:+0:11: +3:2 + return; // scope 0 at $DIR/inline_options.rs:+3:2: +3:2 + } + + bb3: { + _4 = g() -> [return: bb4, unwind unreachable]; // scope 1 at $DIR/inline_options.rs:17:28: 17:31 + // mir::Constant + // + span: $DIR/inline_options.rs:17:28: 17:29 + // + literal: Const { ty: fn() {g}, val: Value() } + } + + bb4: { + _5 = g() -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/inline_options.rs:17:33: 17:36 + // mir::Constant + // + span: $DIR/inline_options.rs:17:33: 17:34 + // + literal: Const { ty: fn() {g}, val: Value() } + } +} diff --git a/tests/mir-opt/inline/inline_options.main.Inline.after.mir b/tests/mir-opt/inline/inline_options.main.Inline.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/inline/inline_options.main.Inline.after.mir rename to tests/mir-opt/inline/inline_options.main.Inline.after.panic-unwind.mir diff --git a/tests/mir-opt/inline/inline_shims.clone.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_shims.clone.Inline.panic-abort.diff new file mode 100644 index 00000000000..d8521bb1d62 --- /dev/null +++ b/tests/mir-opt/inline/inline_shims.clone.Inline.panic-abort.diff @@ -0,0 +1,26 @@ +- // MIR for `clone` before Inline ++ // MIR for `clone` after Inline + + fn clone(_1: fn(A, B)) -> fn(A, B) { + debug f => _1; // in scope 0 at $DIR/inline_shims.rs:+0:20: +0:21 + let mut _0: fn(A, B); // return place in scope 0 at $DIR/inline_shims.rs:+0:36: +0:44 + let mut _2: &fn(A, B); // in scope 0 at $DIR/inline_shims.rs:+1:5: +1:14 ++ scope 1 (inlined ::clone - shim(fn(A, B))) { // at $DIR/inline_shims.rs:6:7: 6:14 ++ } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/inline_shims.rs:+1:5: +1:14 + _2 = &_1; // scope 0 at $DIR/inline_shims.rs:+1:5: +1:14 +- _0 = ::clone(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_shims.rs:+1:5: +1:14 +- // mir::Constant +- // + span: $DIR/inline_shims.rs:6:7: 6:12 +- // + literal: Const { ty: for<'a> fn(&'a fn(A, B)) -> fn(A, B) {::clone}, val: Value() } +- } +- +- bb1: { ++ _0 = (*_2); // scope 1 at $SRC_DIR/core/src/clone.rs:LL:COL + StorageDead(_2); // scope 0 at $DIR/inline_shims.rs:+1:13: +1:14 + return; // scope 0 at $DIR/inline_shims.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/inline_shims.clone.Inline.diff b/tests/mir-opt/inline/inline_shims.clone.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/inline_shims.clone.Inline.diff rename to tests/mir-opt/inline/inline_shims.clone.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff new file mode 100644 index 00000000000..49b36f0d91b --- /dev/null +++ b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff @@ -0,0 +1,72 @@ +- // MIR for `drop` before Inline ++ // MIR for `drop` after Inline + + fn drop(_1: *mut Vec, _2: *mut Option) -> () { + debug a => _1; // in scope 0 at $DIR/inline_shims.rs:+0:19: +0:20 + debug b => _2; // in scope 0 at $DIR/inline_shims.rs:+0:35: +0:36 + let mut _0: (); // return place in scope 0 at $DIR/inline_shims.rs:+0:54: +0:54 + let _3: (); // in scope 0 at $DIR/inline_shims.rs:+1:14: +1:40 + let mut _4: *mut std::vec::Vec; // in scope 0 at $DIR/inline_shims.rs:+1:38: +1:39 + let mut _5: *mut std::option::Option; // in scope 0 at $DIR/inline_shims.rs:+2:38: +2:39 + scope 1 { ++ scope 3 (inlined std::ptr::drop_in_place::> - shim(Some(Vec))) { // at $DIR/inline_shims.rs:11:14: 11:40 ++ let mut _6: &mut std::vec::Vec; // in scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL ++ let mut _7: (); // in scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL ++ } + } + scope 2 { ++ scope 4 (inlined std::ptr::drop_in_place::> - shim(Some(Option))) { // at $DIR/inline_shims.rs:12:14: 12:40 ++ let mut _8: isize; // in scope 4 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL ++ let mut _9: isize; // in scope 4 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL ++ } + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/inline_shims.rs:+1:5: +1:42 + StorageLive(_4); // scope 1 at $DIR/inline_shims.rs:+1:38: +1:39 + _4 = _1; // scope 1 at $DIR/inline_shims.rs:+1:38: +1:39 +- _3 = std::ptr::drop_in_place::>(move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/inline_shims.rs:+1:14: +1:40 ++ StorageLive(_6); // scope 1 at $DIR/inline_shims.rs:+1:14: +1:40 ++ StorageLive(_7); // scope 1 at $DIR/inline_shims.rs:+1:14: +1:40 ++ _6 = &mut (*_4); // scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL ++ _7 = as Drop>::drop(move _6) -> [return: bb2, unwind unreachable]; // scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + // mir::Constant +- // + span: $DIR/inline_shims.rs:11:14: 11:37 +- // + literal: Const { ty: unsafe fn(*mut Vec) {std::ptr::drop_in_place::>}, val: Value() } ++ // + span: $SRC_DIR/core/src/ptr/mod.rs:LL:COL ++ // + literal: Const { ty: for<'a> fn(&'a mut Vec) { as Drop>::drop}, val: Value() } + } + + bb1: { ++ StorageDead(_7); // scope 1 at $DIR/inline_shims.rs:+1:14: +1:40 ++ StorageDead(_6); // scope 1 at $DIR/inline_shims.rs:+1:14: +1:40 + StorageDead(_4); // scope 1 at $DIR/inline_shims.rs:+1:39: +1:40 + StorageDead(_3); // scope 0 at $DIR/inline_shims.rs:+1:41: +1:42 + StorageLive(_5); // scope 2 at $DIR/inline_shims.rs:+2:38: +2:39 + _5 = _2; // scope 2 at $DIR/inline_shims.rs:+2:38: +2:39 +- _0 = std::ptr::drop_in_place::>(move _5) -> [return: bb2, unwind unreachable]; // scope 2 at $DIR/inline_shims.rs:+2:14: +2:40 +- // mir::Constant +- // + span: $DIR/inline_shims.rs:12:14: 12:37 +- // + literal: Const { ty: unsafe fn(*mut Option) {std::ptr::drop_in_place::>}, val: Value() } ++ StorageLive(_8); // scope 2 at $DIR/inline_shims.rs:+2:14: +2:40 ++ StorageLive(_9); // scope 2 at $DIR/inline_shims.rs:+2:14: +2:40 ++ _8 = discriminant((*_5)); // scope 4 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL ++ switchInt(move _8) -> [0: bb3, otherwise: bb4]; // scope 4 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + } + + bb2: { ++ drop(((*_4).0: alloc::raw_vec::RawVec)) -> [return: bb1, unwind unreachable]; // scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL ++ } ++ ++ bb3: { ++ StorageDead(_9); // scope 2 at $DIR/inline_shims.rs:+2:14: +2:40 ++ StorageDead(_8); // scope 2 at $DIR/inline_shims.rs:+2:14: +2:40 + StorageDead(_5); // scope 2 at $DIR/inline_shims.rs:+2:39: +2:40 + return; // scope 0 at $DIR/inline_shims.rs:+3:2: +3:2 ++ } ++ ++ bb4: { ++ drop((((*_5) as Some).0: B)) -> [return: bb3, unwind unreachable]; // scope 4 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + } + } + diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/inline_shims.drop.Inline.diff rename to tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/inline_specialization.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_specialization.main.Inline.panic-abort.diff new file mode 100644 index 00000000000..451c90b1605 --- /dev/null +++ b/tests/mir-opt/inline/inline_specialization.main.Inline.panic-abort.diff @@ -0,0 +1,28 @@ +- // MIR for `main` before Inline ++ // MIR for `main` after Inline + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/inline_specialization.rs:+0:11: +0:11 + let _1: u32; // in scope 0 at $DIR/inline_specialization.rs:+1:9: +1:10 + scope 1 { + debug x => _1; // in scope 1 at $DIR/inline_specialization.rs:+1:9: +1:10 + } ++ scope 2 (inlined as Foo>::bar) { // at $DIR/inline_specialization.rs:6:13: 6:38 ++ } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/inline_specialization.rs:+1:9: +1:10 +- _1 = as Foo>::bar() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_specialization.rs:+1:13: +1:38 +- // mir::Constant +- // + span: $DIR/inline_specialization.rs:6:13: 6:36 +- // + literal: Const { ty: fn() -> u32 { as Foo>::bar}, val: Value() } +- } +- +- bb1: { ++ _1 = const 123_u32; // scope 2 at $DIR/inline_specialization.rs:15:31: 15:34 + _0 = const (); // scope 0 at $DIR/inline_specialization.rs:+0:11: +2:2 + StorageDead(_1); // scope 0 at $DIR/inline_specialization.rs:+2:1: +2:2 + return; // scope 0 at $DIR/inline_specialization.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/inline_specialization.main.Inline.diff b/tests/mir-opt/inline/inline_specialization.main.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/inline_specialization.main.Inline.diff rename to tests/mir-opt/inline/inline_specialization.main.Inline.panic-unwind.diff 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 new file mode 100644 index 00000000000..a6496bf5f0d --- /dev/null +++ b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir @@ -0,0 +1,21 @@ +// MIR for `test` after Inline + +fn test(_1: &dyn X) -> u32 { + debug x => _1; // in scope 0 at $DIR/inline_trait_method.rs:+0:9: +0:10 + let mut _0: u32; // return place in scope 0 at $DIR/inline_trait_method.rs:+0:23: +0:26 + let mut _2: &dyn X; // in scope 0 at $DIR/inline_trait_method.rs:+1:5: +1:10 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/inline_trait_method.rs:+1:5: +1:10 + _2 = &(*_1); // scope 0 at $DIR/inline_trait_method.rs:+1:5: +1:10 + _0 = ::y(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_trait_method.rs:+1:5: +1:10 + // mir::Constant + // + span: $DIR/inline_trait_method.rs:10:7: 10:8 + // + literal: Const { ty: for<'a> fn(&'a dyn X) -> u32 {::y}, val: Value() } + } + + bb1: { + StorageDead(_2); // scope 0 at $DIR/inline_trait_method.rs:+1:9: +1:10 + return; // scope 0 at $DIR/inline_trait_method.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.mir b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/inline/inline_trait_method.test.Inline.after.mir rename to tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir 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 new file mode 100644 index 00000000000..8e37c7dca6c --- /dev/null +++ b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir @@ -0,0 +1,28 @@ +// MIR for `test2` after Inline + +fn test2(_1: &dyn X) -> bool { + debug x => _1; // in scope 0 at $DIR/inline_trait_method_2.rs:+0:10: +0:11 + let mut _0: bool; // return place in scope 0 at $DIR/inline_trait_method_2.rs:+0:24: +0:28 + let mut _2: &dyn X; // in scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 + let mut _3: &dyn X; // in scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 + scope 1 (inlined test) { // at $DIR/inline_trait_method_2.rs:6:5: 6:12 + debug x => _2; // in scope 1 at $DIR/inline_trait_method_2.rs:10:9: 10:10 + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 + StorageLive(_3); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 + _3 = &(*_1); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 + _2 = move _3 as &dyn X (Pointer(Unsize)); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 + StorageDead(_3); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11 + _0 = ::y(_2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/inline_trait_method_2.rs:11:5: 11:10 + // mir::Constant + // + span: $DIR/inline_trait_method_2.rs:11:7: 11:8 + // + literal: Const { ty: for<'a> fn(&'a dyn X) -> bool {::y}, val: Value() } + } + + bb1: { + StorageDead(_2); // scope 0 at $DIR/inline_trait_method_2.rs:+1:11: +1:12 + return; // scope 0 at $DIR/inline_trait_method_2.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.mir b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.mir rename to tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff new file mode 100644 index 00000000000..4f8c7123aaf --- /dev/null +++ b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff @@ -0,0 +1,55 @@ +- // MIR for `outer` before Inline ++ // MIR for `outer` after Inline + + fn outer() -> usize { + let mut _0: usize; // return place in scope 0 at $DIR/issue_106141.rs:+0:19: +0:24 ++ scope 1 (inlined inner) { // at $DIR/issue_106141.rs:3:5: 3:12 ++ let mut _1: &[bool; 1]; // in scope 1 at $DIR/issue_106141.rs:12:18: 12:25 ++ let mut _2: bool; // in scope 1 at $DIR/issue_106141.rs:14:8: 14:21 ++ let mut _3: bool; // in scope 1 at $DIR/issue_106141.rs:14:8: 14:21 ++ scope 2 { ++ debug buffer => const _; // in scope 2 at $DIR/issue_106141.rs:12:9: 12:15 ++ scope 3 { ++ debug index => _0; // in scope 3 at $DIR/issue_106141.rs:13:9: 13:14 ++ } ++ } ++ } + + bb0: { +- _0 = inner() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/issue_106141.rs:+1:5: +1:12 ++ StorageLive(_1); // scope 0 at $DIR/issue_106141.rs:+1:5: +1:12 ++ _1 = const _; // scope 1 at $DIR/issue_106141.rs:12:18: 12:25 + // mir::Constant +- // + span: $DIR/issue_106141.rs:3:5: 3:10 +- // + literal: Const { ty: fn() -> usize {inner}, val: Value() } ++ // + span: $DIR/issue_106141.rs:12:18: 12:25 ++ // + literal: Const { ty: &[bool; 1], val: Unevaluated(inner, [], Some(promoted[0])) } ++ _0 = index() -> [return: bb1, unwind unreachable]; // scope 2 at $DIR/issue_106141.rs:13:17: 13:24 ++ // mir::Constant ++ // + span: $DIR/issue_106141.rs:13:17: 13:22 ++ // + literal: Const { ty: fn() -> usize {index}, val: Value() } + } + + bb1: { ++ StorageLive(_3); // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 ++ _2 = Lt(_0, const 1_usize); // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 ++ assert(move _2, "index out of bounds: the length is {} but the index is {}", const 1_usize, _0) -> [success: bb2, unwind unreachable]; // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 ++ } ++ ++ bb2: { ++ _3 = (*_1)[_0]; // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 ++ switchInt(move _3) -> [0: bb3, otherwise: bb4]; // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 ++ } ++ ++ bb3: { ++ _0 = const 0_usize; // scope 3 at $DIR/issue_106141.rs:17:9: 17:10 ++ goto -> bb4; // scope 3 at $DIR/issue_106141.rs:14:5: 18:6 ++ } ++ ++ bb4: { ++ StorageDead(_3); // scope 3 at $DIR/issue_106141.rs:18:5: 18:6 ++ StorageDead(_1); // scope 0 at $DIR/issue_106141.rs:+1:5: +1:12 + return; // scope 0 at $DIR/issue_106141.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/issue_106141.outer.Inline.diff rename to tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff new file mode 100644 index 00000000000..4d9215ee7e4 --- /dev/null +++ b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff @@ -0,0 +1,53 @@ +- // MIR for `bar` before Inline ++ // MIR for `bar` after Inline + + fn bar(_1: P) -> () { + debug _baz => _1; // in scope 0 at $DIR/issue_78442.rs:+2:5: +2:9 + let mut _0: (); // return place in scope 0 at $DIR/issue_78442.rs:+3:3: +3:3 + let _2: (); // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:17 + let mut _3: &fn() {foo}; // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:15 + let _4: fn() {foo}; // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:15 + let mut _5: (); // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:17 ++ scope 1 (inlined >::call - shim(fn() {foo})) { // at $DIR/issue_78442.rs:11:5: 11:17 ++ } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17 + StorageLive(_3); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15 + StorageLive(_4); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15 + _4 = hide_foo() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15 + // mir::Constant + // + span: $DIR/issue_78442.rs:11:5: 11:13 + // + literal: Const { ty: fn() -> impl Fn() {hide_foo}, val: Value() } + } + + bb1: { + _3 = &_4; // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15 + StorageLive(_5); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17 + _5 = (); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17 +- _2 = >::call(move _3, move _5) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17 +- // mir::Constant +- // + span: $DIR/issue_78442.rs:11:5: 11:15 +- // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a fn() {foo}, ()) -> >::Output {>::call}, val: Value() } ++ _2 = move (*_3)() -> [return: bb3, unwind unreachable]; // scope 1 at $SRC_DIR/core/src/ops/function.rs:LL:COL + } + + bb2: { ++ return; // scope 0 at $DIR/issue_78442.rs:+5:2: +5:2 ++ } ++ ++ bb3: { + StorageDead(_5); // scope 0 at $DIR/issue_78442.rs:+4:16: +4:17 + StorageDead(_3); // scope 0 at $DIR/issue_78442.rs:+4:16: +4:17 + StorageDead(_4); // scope 0 at $DIR/issue_78442.rs:+4:17: +4:18 + StorageDead(_2); // scope 0 at $DIR/issue_78442.rs:+4:17: +4:18 + _0 = const (); // scope 0 at $DIR/issue_78442.rs:+3:3: +5:2 +- drop(_1) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/issue_78442.rs:+5:1: +5:2 +- } +- +- bb3: { +- return; // scope 0 at $DIR/issue_78442.rs:+5:2: +5:2 ++ drop(_1) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/issue_78442.rs:+5:1: +5:2 + } + } + diff --git a/tests/mir-opt/inline/issue_78442.bar.Inline.diff b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/issue_78442.bar.Inline.diff rename to tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff b/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff new file mode 100644 index 00000000000..dcdb1069605 --- /dev/null +++ b/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff @@ -0,0 +1,49 @@ +- // MIR for `bar` before RevealAll ++ // MIR for `bar` after RevealAll + + fn bar(_1: P) -> () { + debug _baz => _1; // in scope 0 at $DIR/issue_78442.rs:+2:5: +2:9 + let mut _0: (); // return place in scope 0 at $DIR/issue_78442.rs:+3:3: +3:3 + let _2: (); // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:17 +- let mut _3: &impl Fn(); // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:15 +- let _4: impl Fn(); // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:15 ++ let mut _3: &fn() {foo}; // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:15 ++ let _4: fn() {foo}; // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:15 + let mut _5: (); // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:17 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17 + StorageLive(_3); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15 + StorageLive(_4); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15 + _4 = hide_foo() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15 + // mir::Constant + // + span: $DIR/issue_78442.rs:11:5: 11:13 + // + literal: Const { ty: fn() -> impl Fn() {hide_foo}, val: Value() } + } + + bb1: { + _3 = &_4; // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15 + StorageLive(_5); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17 + _5 = (); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17 +- _2 = >::call(move _3, move _5) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17 ++ _2 = >::call(move _3, move _5) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17 + // mir::Constant + // + span: $DIR/issue_78442.rs:11:5: 11:15 +- // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(), ()) -> >::Output {>::call}, val: Value() } ++ // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a fn() {foo}, ()) -> >::Output {>::call}, val: Value() } + } + + bb2: { + StorageDead(_5); // scope 0 at $DIR/issue_78442.rs:+4:16: +4:17 + StorageDead(_3); // scope 0 at $DIR/issue_78442.rs:+4:16: +4:17 + StorageDead(_4); // scope 0 at $DIR/issue_78442.rs:+4:17: +4:18 + StorageDead(_2); // scope 0 at $DIR/issue_78442.rs:+4:17: +4:18 + _0 = const (); // scope 0 at $DIR/issue_78442.rs:+3:3: +5:2 + drop(_1) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/issue_78442.rs:+5:1: +5:2 + } + + bb3: { + return; // scope 0 at $DIR/issue_78442.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/inline/issue_78442.bar.RevealAll.diff b/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/issue_78442.bar.RevealAll.diff rename to tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-unwind.diff diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff new file mode 100644 index 00000000000..fa82ff4b122 --- /dev/null +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff @@ -0,0 +1,144 @@ +- // MIR for `unchecked_shl_unsigned_smaller` before Inline ++ // MIR for `unchecked_shl_unsigned_smaller` after Inline + + fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { + debug a => _1; // in scope 0 at $DIR/unchecked_shifts.rs:+0:46: +0:47 + debug b => _2; // in scope 0 at $DIR/unchecked_shifts.rs:+0:54: +0:55 + let mut _0: u16; // return place in scope 0 at $DIR/unchecked_shifts.rs:+0:65: +0:68 + let mut _3: u16; // in scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6 + let mut _4: u32; // in scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 ++ scope 1 (inlined core::num::::unchecked_shl) { // at $DIR/unchecked_shifts.rs:11:7: 11:23 ++ debug self => _3; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL ++ debug rhs => _4; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL ++ let mut _5: u16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ scope 2 { ++ scope 3 (inlined core::num::::unchecked_shl::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug x => _4; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ let mut _6: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ let mut _7: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ scope 4 { ++ scope 5 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug self => _4; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL ++ scope 6 (inlined convert::num:: for u16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL ++ debug u => _4; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ let mut _8: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ let mut _9: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ let mut _10: u16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ } ++ } ++ scope 7 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug self => _7; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ let mut _11: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ let _12: u16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ scope 8 { ++ debug x => _12; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL ++ } ++ } ++ scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ let mut _13: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ scope 10 { ++ debug val => _5; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL ++ } ++ scope 11 { ++ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL ++ scope 14 { ++ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL ++ } ++ } ++ } ++ } ++ scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL ++ debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL ++ } ++ } ++ } ++ } ++ } ++ } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6 + _3 = _1; // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6 + StorageLive(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 + _4 = _2; // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 +- _0 = core::num::::unchecked_shl(move _3, move _4) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:23 +- // mir::Constant +- // + span: $DIR/unchecked_shifts.rs:11:7: 11:20 +- // + literal: Const { ty: unsafe fn(u16, u32) -> u16 {core::num::::unchecked_shl}, val: Value() } ++ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageLive(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _9 = const 65535_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _8 = Gt(_4, move _9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageDead(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ switchInt(move _8) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } + + bb1: { ++ StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageDead(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23 + StorageDead(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23 + return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 ++ } ++ ++ bb2: { ++ _7 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: TryFromIntError, val: Value() } ++ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ } ++ ++ bb3: { ++ StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _10 = _4 as u16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _7 = Result::::Ok(move _10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ } ++ ++ bb4: { ++ StorageDead(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageLive(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _11 = discriminant(_7); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ switchInt(move _11) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ } ++ ++ bb5: { ++ _6 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ } ++ ++ bb6: { ++ unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ } ++ ++ bb7: { ++ _12 = move ((_7 as Ok).0: u16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ _6 = Option::::Some(move _12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL ++ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ } ++ ++ bb8: { ++ StorageDead(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageDead(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ switchInt(move _14) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ } ++ ++ bb9: { ++ _5 = move ((_6 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ StorageDead(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageDead(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _0 = unchecked_shl::(_3, move _5) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL ++ // mir::Constant ++ // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL ++ // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u16, u16) -> u16 {unchecked_shl::}, val: Value() } + } + } + diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff rename to tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir similarity index 100% rename from tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir rename to tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir new file mode 100644 index 00000000000..8fa4fdaa49a --- /dev/null +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir @@ -0,0 +1,130 @@ +// MIR for `unchecked_shl_unsigned_smaller` after PreCodegen + +fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { + debug a => _1; // in scope 0 at $DIR/unchecked_shifts.rs:+0:46: +0:47 + debug b => _2; // in scope 0 at $DIR/unchecked_shifts.rs:+0:54: +0:55 + let mut _0: u16; // return place in scope 0 at $DIR/unchecked_shifts.rs:+0:65: +0:68 + scope 1 (inlined core::num::::unchecked_shl) { // at $DIR/unchecked_shifts.rs:11:7: 11:23 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _11: u16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + scope 2 { + scope 3 (inlined core::num::::unchecked_shl::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug x => _2; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _6: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _9: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + scope 4 { + scope 5 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug self => _2; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + scope 6 (inlined convert::num:: for u16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug u => _2; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _3: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _4: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _5: u16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } + } + scope 7 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug self => _6; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + let mut _7: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + let _8: u16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + scope 8 { + debug x => _8; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + } + } + scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug self => _9; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _10: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _12: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + scope 10 { + debug val => _11; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL + } + scope 11 { + scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL + scope 14 { + scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + } + } + } + scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _12; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL + } + } + } + } + } + } + + bb0: { + StorageLive(_11); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_4); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageLive(_3); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _3 = const 65535_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _4 = Gt(_2, move _3); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_3); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + switchInt(move _4) -> [0: bb1, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } + + bb1: { + StorageLive(_5); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _5 = _2 as u16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _6 = Result::::Ok(move _5); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_5); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } + + bb2: { + _6 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: TryFromIntError, val: Value() } + goto -> bb3; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } + + bb3: { + StorageDead(_4); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageLive(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _7 = discriminant(_6); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + switchInt(move _7) -> [0: bb4, 1: bb5, otherwise: bb9]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } + + bb4: { + _8 = move ((_6 as Ok).0: u16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + _9 = Option::::Some(move _8); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + goto -> bb6; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } + + bb5: { + _9 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + goto -> bb6; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } + + bb6: { + StorageDead(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _10 = discriminant(_9); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + switchInt(move _10) -> [1: bb7, otherwise: bb9]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + } + + bb7: { + _11 = move ((_9 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _0 = unchecked_shl::(_1, move _11) -> [return: bb8, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u16, u16) -> u16 {unchecked_shl::}, val: Value() } + } + + bb8: { + StorageDead(_11); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 + } + + bb9: { + unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } +} diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff new file mode 100644 index 00000000000..0e37e40fbb6 --- /dev/null +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff @@ -0,0 +1,144 @@ +- // MIR for `unchecked_shr_signed_smaller` before Inline ++ // MIR for `unchecked_shr_signed_smaller` after Inline + + fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { + debug a => _1; // in scope 0 at $DIR/unchecked_shifts.rs:+0:44: +0:45 + debug b => _2; // in scope 0 at $DIR/unchecked_shifts.rs:+0:52: +0:53 + let mut _0: i16; // return place in scope 0 at $DIR/unchecked_shifts.rs:+0:63: +0:66 + let mut _3: i16; // in scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6 + let mut _4: u32; // in scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 ++ scope 1 (inlined core::num::::unchecked_shr) { // at $DIR/unchecked_shifts.rs:17:7: 17:23 ++ debug self => _3; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL ++ debug rhs => _4; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL ++ let mut _5: i16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ scope 2 { ++ scope 3 (inlined core::num::::unchecked_shr::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug x => _4; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ let mut _6: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ let mut _7: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ scope 4 { ++ scope 5 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug self => _4; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL ++ scope 6 (inlined convert::num:: for i16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL ++ debug u => _4; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ let mut _8: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ let mut _9: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ let mut _10: i16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ } ++ } ++ scope 7 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug self => _7; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ let mut _11: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ let _12: i16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ scope 8 { ++ debug x => _12; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL ++ } ++ } ++ scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ let mut _13: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ scope 10 { ++ debug val => _5; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL ++ } ++ scope 11 { ++ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL ++ scope 14 { ++ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL ++ } ++ } ++ } ++ } ++ scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL ++ debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL ++ } ++ } ++ } ++ } ++ } ++ } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6 + _3 = _1; // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6 + StorageLive(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 + _4 = _2; // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 +- _0 = core::num::::unchecked_shr(move _3, move _4) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:23 +- // mir::Constant +- // + span: $DIR/unchecked_shifts.rs:17:7: 17:20 +- // + literal: Const { ty: unsafe fn(i16, u32) -> i16 {core::num::::unchecked_shr}, val: Value() } ++ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageLive(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _9 = const 32767_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _8 = Gt(_4, move _9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageDead(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ switchInt(move _8) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } + + bb1: { ++ StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL + StorageDead(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23 + StorageDead(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23 + return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 ++ } ++ ++ bb2: { ++ _7 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: TryFromIntError, val: Value() } ++ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ } ++ ++ bb3: { ++ StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _10 = _4 as i16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _7 = Result::::Ok(move _10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ } ++ ++ bb4: { ++ StorageDead(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageLive(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _11 = discriminant(_7); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ switchInt(move _11) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ } ++ ++ bb5: { ++ _6 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ } ++ ++ bb6: { ++ unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ } ++ ++ bb7: { ++ _12 = move ((_7 as Ok).0: i16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ _6 = Option::::Some(move _12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL ++ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ } ++ ++ bb8: { ++ StorageDead(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageDead(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ switchInt(move _14) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ } ++ ++ bb9: { ++ _5 = move ((_6 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ StorageDead(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageDead(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _0 = unchecked_shr::(_3, move _5) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL ++ // mir::Constant ++ // + span: $SRC_DIR/core/src/num/int_macros.rs:LL:COL ++ // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i16, i16) -> i16 {unchecked_shr::}, val: Value() } + } + } + diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff rename to tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir similarity index 100% rename from tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir rename to tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir new file mode 100644 index 00000000000..7f737abb936 --- /dev/null +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir @@ -0,0 +1,130 @@ +// MIR for `unchecked_shr_signed_smaller` after PreCodegen + +fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { + debug a => _1; // in scope 0 at $DIR/unchecked_shifts.rs:+0:44: +0:45 + debug b => _2; // in scope 0 at $DIR/unchecked_shifts.rs:+0:52: +0:53 + let mut _0: i16; // return place in scope 0 at $DIR/unchecked_shifts.rs:+0:63: +0:66 + scope 1 (inlined core::num::::unchecked_shr) { // at $DIR/unchecked_shifts.rs:17:7: 17:23 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL + debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL + let mut _11: i16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + scope 2 { + scope 3 (inlined core::num::::unchecked_shr::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug x => _2; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _6: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _9: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + scope 4 { + scope 5 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug self => _2; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + scope 6 (inlined convert::num:: for i16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug u => _2; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _3: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _4: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _5: i16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } + } + scope 7 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug self => _6; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + let mut _7: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + let _8: i16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + scope 8 { + debug x => _8; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + } + } + scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug self => _9; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _10: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _12: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + scope 10 { + debug val => _11; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL + } + scope 11 { + scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL + scope 14 { + scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + } + } + } + scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _12; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL + } + } + } + } + } + } + + bb0: { + StorageLive(_11); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_4); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageLive(_3); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _3 = const 32767_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _4 = Gt(_2, move _3); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_3); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + switchInt(move _4) -> [0: bb1, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } + + bb1: { + StorageLive(_5); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _5 = _2 as i16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _6 = Result::::Ok(move _5); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_5); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } + + bb2: { + _6 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: TryFromIntError, val: Value() } + goto -> bb3; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } + + bb3: { + StorageDead(_4); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageLive(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _7 = discriminant(_6); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + switchInt(move _7) -> [0: bb4, 1: bb5, otherwise: bb9]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } + + bb4: { + _8 = move ((_6 as Ok).0: i16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + _9 = Option::::Some(move _8); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + goto -> bb6; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } + + bb5: { + _9 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + goto -> bb6; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } + + bb6: { + StorageDead(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _10 = discriminant(_9); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + switchInt(move _10) -> [1: bb7, otherwise: bb9]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + } + + bb7: { + _11 = move ((_9 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _0 = unchecked_shr::(_1, move _11) -> [return: bb8, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/num/int_macros.rs:LL:COL + // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i16, i16) -> i16 {unchecked_shr::}, val: Value() } + } + + bb8: { + StorageDead(_11); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL + return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 + } + + bb9: { + unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } +} diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff new file mode 100644 index 00000000000..4f2a32fa641 --- /dev/null +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff @@ -0,0 +1,51 @@ +- // MIR for `unwrap_unchecked` before Inline ++ // MIR for `unwrap_unchecked` after Inline + + fn unwrap_unchecked(_1: Option) -> T { + debug slf => _1; // in scope 0 at $DIR/unwrap_unchecked.rs:+0:35: +0:38 + let mut _0: T; // return place in scope 0 at $DIR/unwrap_unchecked.rs:+0:54: +0:55 + let mut _2: std::option::Option; // in scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:8 ++ scope 1 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $DIR/unwrap_unchecked.rs:10:9: 10:27 ++ debug self => _2; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL ++ let mut _3: &std::option::Option; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL ++ let mut _4: isize; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL ++ scope 2 { ++ debug val => _0; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL ++ } ++ scope 3 { ++ scope 5 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL ++ scope 6 { ++ scope 7 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL ++ } ++ } ++ } ++ } ++ scope 4 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL ++ debug self => _3; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL ++ } ++ } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:8 + _2 = move _1; // scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:8 +- _0 = Option::::unwrap_unchecked(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:27 +- // mir::Constant +- // + span: $DIR/unwrap_unchecked.rs:10:9: 10:25 +- // + literal: Const { ty: unsafe fn(Option) -> T {Option::::unwrap_unchecked}, val: Value() } ++ StorageLive(_3); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27 ++ _4 = discriminant(_2); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL ++ switchInt(move _4) -> [1: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + } + + bb1: { ++ unreachable; // scope 6 at $SRC_DIR/core/src/intrinsics.rs:LL:COL ++ } ++ ++ bb2: { ++ _0 = move ((_2 as Some).0: T); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL ++ StorageDead(_3); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27 + StorageDead(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:26: +1:27 + return; // scope 0 at $DIR/unwrap_unchecked.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff similarity index 100% rename from tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff rename to tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir similarity index 100% rename from tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir rename to tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir new file mode 100644 index 00000000000..601d83702f4 --- /dev/null +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir @@ -0,0 +1,41 @@ +// MIR for `unwrap_unchecked` after PreCodegen + +fn unwrap_unchecked(_1: Option) -> T { + debug slf => _1; // in scope 0 at $DIR/unwrap_unchecked.rs:+0:35: +0:38 + let mut _0: T; // return place in scope 0 at $DIR/unwrap_unchecked.rs:+0:54: +0:55 + scope 1 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $DIR/unwrap_unchecked.rs:10:9: 10:27 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _2: isize; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _3: &std::option::Option; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + scope 2 { + debug val => _0; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + } + scope 3 { + scope 5 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL + scope 6 { + scope 7 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + } + } + } + scope 4 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _3; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + } + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27 + _2 = discriminant(_1); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + switchInt(move _2) -> [1: bb1, otherwise: bb2]; // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + } + + bb1: { + _0 = move ((_1 as Some).0: T); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_3); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27 + return; // scope 0 at $DIR/unwrap_unchecked.rs:+2:2: +2:2 + } + + bb2: { + unreachable; // scope 6 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } +} diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff b/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..eb47f0d3183 --- /dev/null +++ b/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff @@ -0,0 +1,85 @@ +- // MIR for `inner` before ConstProp ++ // MIR for `inner` after ConstProp + + fn inner(_1: u32) -> i64 { + debug fields => _1; // in scope 0 at $DIR/issue_101973.rs:+0:14: +0:20 + let mut _0: i64; // return place in scope 0 at $DIR/issue_101973.rs:+0:30: +0:33 + let mut _2: i32; // in scope 0 at $DIR/issue_101973.rs:+1:5: +1:65 + let mut _3: u32; // in scope 0 at $DIR/issue_101973.rs:+1:5: +1:58 + let mut _4: u32; // in scope 0 at $DIR/issue_101973.rs:+1:5: +1:17 + let mut _5: u32; // in scope 0 at $DIR/issue_101973.rs:+1:10: +1:16 + let mut _6: u32; // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 + let mut _7: u32; // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:52 + let mut _8: u32; // in scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 + let mut _9: u32; // in scope 0 at $DIR/issue_101973.rs:+1:33: +1:39 + let mut _10: u32; // in scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 + let mut _11: bool; // in scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 + let mut _12: u32; // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 + let mut _13: bool; // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 + scope 1 (inlined imm8) { // at $DIR/issue_101973.rs:15:5: 15:17 + debug x => _1; // in scope 1 at $DIR/issue_101973.rs:6:13: 6:14 + let mut _14: u32; // in scope 1 at $DIR/issue_101973.rs:8:12: 8:20 + let mut _15: u32; // in scope 1 at $DIR/issue_101973.rs:8:12: 8:27 + scope 2 { + debug out => _4; // in scope 2 at $DIR/issue_101973.rs:7:9: 7:16 + } + } + scope 3 (inlined core::num::::rotate_right) { // at $DIR/issue_101973.rs:15:18: 15:58 + debug self => _4; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + debug n => _6; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:65 + StorageLive(_3); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:58 + StorageLive(_4); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:17 + StorageLive(_15); // scope 2 at $DIR/issue_101973.rs:8:12: 8:27 + StorageLive(_14); // scope 2 at $DIR/issue_101973.rs:8:12: 8:20 + _14 = Shr(_1, const 0_i32); // scope 2 at $DIR/issue_101973.rs:8:12: 8:20 + _15 = BitAnd(move _14, const 255_u32); // scope 2 at $DIR/issue_101973.rs:8:12: 8:27 + StorageDead(_14); // scope 2 at $DIR/issue_101973.rs:8:26: 8:27 + _4 = BitOr(const 0_u32, move _15); // scope 2 at $DIR/issue_101973.rs:8:5: 8:27 + StorageDead(_15); // scope 2 at $DIR/issue_101973.rs:8:26: 8:27 + StorageLive(_6); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 + StorageLive(_7); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:52 + StorageLive(_8); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 +- _10 = const 8_i32 as u32 (IntToInt); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 +- _11 = Lt(move _10, const 32_u32); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 +- assert(move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 ++ _10 = const 8_u32; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 ++ _11 = const true; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 ++ assert(const true, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 + } + + bb1: { + _8 = Shr(_1, const 8_i32); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 + _7 = BitAnd(move _8, const 15_u32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:52 + StorageDead(_8); // scope 0 at $DIR/issue_101973.rs:+1:51: +1:52 +- _12 = const 1_i32 as u32 (IntToInt); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 +- _13 = Lt(move _12, const 32_u32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 +- assert(move _13, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> [success: bb2, unwind unreachable]; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 ++ _12 = const 1_u32; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 ++ _13 = const true; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 ++ assert(const true, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> [success: bb2, unwind unreachable]; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 + } + + bb2: { + _6 = Shl(move _7, const 1_i32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 + StorageDead(_7); // scope 0 at $DIR/issue_101973.rs:+1:56: +1:57 + _3 = rotate_right::(_4, _6) -> [return: bb3, unwind unreachable]; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + // + literal: Const { ty: extern "rust-intrinsic" fn(u32, u32) -> u32 {rotate_right::}, val: Value() } + } + + bb3: { + StorageDead(_6); // scope 0 at $DIR/issue_101973.rs:+1:57: +1:58 + StorageDead(_4); // scope 0 at $DIR/issue_101973.rs:+1:57: +1:58 + _2 = move _3 as i32 (IntToInt); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:65 + StorageDead(_3); // scope 0 at $DIR/issue_101973.rs:+1:64: +1:65 + _0 = move _2 as i64 (IntToInt); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:72 + StorageDead(_2); // scope 0 at $DIR/issue_101973.rs:+1:71: +1:72 + return; // scope 0 at $DIR/issue_101973.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.diff b/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/issue_101973.inner.ConstProp.diff rename to tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-abort.mir b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-abort.mir new file mode 100644 index 00000000000..a8e2bc7186d --- /dev/null +++ b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-abort.mir @@ -0,0 +1,25 @@ +// MIR for `main` after AbortUnwindingCalls + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/issue_104451_unwindable_intrinsics.rs:+0:11: +0:11 + let mut _1: !; // in scope 0 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:9: +2:62 + let mut _2: (); // in scope 0 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:45: +2:47 + scope 1 { + } + + bb0: { + StorageLive(_1); // scope 1 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:9: +2:62 + StorageLive(_2); // scope 1 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:45: +2:47 + _2 = (); // scope 1 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:45: +2:47 + _1 = const_eval_select::<(), fn() -> ! {ow_ct}, fn() -> ! {ow_ct}, !>(move _2, ow_ct, ow_ct) -> unwind unreachable; // scope 1 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:9: +2:62 + // mir::Constant + // + span: $DIR/issue_104451_unwindable_intrinsics.rs:8:9: 8:44 + // + literal: Const { ty: unsafe extern "rust-intrinsic" fn((), fn() -> ! {ow_ct}, fn() -> ! {ow_ct}) -> ! {const_eval_select::<(), fn() -> ! {ow_ct}, fn() -> ! {ow_ct}, !>}, val: Value() } + // mir::Constant + // + span: $DIR/issue_104451_unwindable_intrinsics.rs:8:49: 8:54 + // + literal: Const { ty: fn() -> ! {ow_ct}, val: Value() } + // mir::Constant + // + span: $DIR/issue_104451_unwindable_intrinsics.rs:8:56: 8:61 + // + literal: Const { ty: fn() -> ! {ow_ct}, val: Value() } + } +} diff --git a/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.mir b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.mir rename to tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-unwind.mir diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff similarity index 100% rename from tests/mir-opt/issue_41110.main.ElaborateDrops.diff rename to tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff new file mode 100644 index 00000000000..ac252024928 --- /dev/null +++ b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff @@ -0,0 +1,75 @@ +- // MIR for `main` before ElaborateDrops ++ // MIR for `main` after ElaborateDrops + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/issue_41110.rs:+0:11: +0:11 + let _1: (); // in scope 0 at $DIR/issue_41110.rs:+1:9: +1:10 + let mut _2: S; // in scope 0 at $DIR/issue_41110.rs:+1:13: +1:14 + let mut _3: S; // in scope 0 at $DIR/issue_41110.rs:+1:21: +1:27 + let mut _4: S; // in scope 0 at $DIR/issue_41110.rs:+1:21: +1:22 ++ let mut _5: bool; // in scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 + scope 1 { + debug x => _1; // in scope 1 at $DIR/issue_41110.rs:+1:9: +1:10 + } + + bb0: { ++ _5 = const false; // scope 0 at $DIR/issue_41110.rs:+1:9: +1:10 + StorageLive(_1); // scope 0 at $DIR/issue_41110.rs:+1:9: +1:10 + StorageLive(_2); // scope 0 at $DIR/issue_41110.rs:+1:13: +1:14 ++ _5 = const true; // scope 0 at $DIR/issue_41110.rs:+1:13: +1:14 + _2 = S; // scope 0 at $DIR/issue_41110.rs:+1:13: +1:14 + StorageLive(_3); // scope 0 at $DIR/issue_41110.rs:+1:21: +1:27 + StorageLive(_4); // scope 0 at $DIR/issue_41110.rs:+1:21: +1:22 + _4 = S; // scope 0 at $DIR/issue_41110.rs:+1:21: +1:22 + _3 = S::id(move _4) -> [return: bb1, unwind: bb4]; // scope 0 at $DIR/issue_41110.rs:+1:21: +1:27 + // mir::Constant + // + span: $DIR/issue_41110.rs:8:23: 8:25 + // + literal: Const { ty: fn(S) -> S {S::id}, val: Value() } + } + + bb1: { + StorageDead(_4); // scope 0 at $DIR/issue_41110.rs:+1:26: +1:27 ++ _5 = const false; // scope 0 at $DIR/issue_41110.rs:+1:13: +1:28 + _1 = S::other(move _2, move _3) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/issue_41110.rs:+1:13: +1:28 + // mir::Constant + // + span: $DIR/issue_41110.rs:8:15: 8:20 + // + literal: Const { ty: fn(S, S) {S::other}, val: Value() } + } + + bb2: { + StorageDead(_3); // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 ++ _5 = const false; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 + StorageDead(_2); // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 + _0 = const (); // scope 0 at $DIR/issue_41110.rs:+0:11: +2:2 + StorageDead(_1); // scope 0 at $DIR/issue_41110.rs:+2:1: +2:2 + return; // scope 0 at $DIR/issue_41110.rs:+2:2: +2:2 + } + + bb3 (cleanup): { +- drop(_3) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 ++ goto -> bb5; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 + } + + bb4 (cleanup): { +- drop(_4) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+1:26: +1:27 ++ goto -> bb5; // scope 0 at $DIR/issue_41110.rs:+1:26: +1:27 + } + + bb5 (cleanup): { +- drop(_2) -> [return: bb6, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 ++ goto -> bb8; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 + } + + bb6 (cleanup): { + resume; // scope 0 at $DIR/issue_41110.rs:+0:1: +2:2 ++ } ++ ++ bb7 (cleanup): { ++ drop(_2) -> [return: bb6, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 ++ } ++ ++ bb8 (cleanup): { ++ switchInt(_5) -> [0: bb6, otherwise: bb7]; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 + } + } + diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff new file mode 100644 index 00000000000..84bcab000af --- /dev/null +++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff @@ -0,0 +1,105 @@ +- // MIR for `test` before ElaborateDrops ++ // MIR for `test` after ElaborateDrops + + fn test() -> () { + let mut _0: (); // return place in scope 0 at $DIR/issue_41110.rs:+0:15: +0:15 + let _1: S; // in scope 0 at $DIR/issue_41110.rs:+1:9: +1:10 + let _3: (); // in scope 0 at $DIR/issue_41110.rs:+3:5: +3:12 + let mut _4: S; // in scope 0 at $DIR/issue_41110.rs:+3:10: +3:11 + let mut _5: S; // in scope 0 at $DIR/issue_41110.rs:+4:9: +4:10 ++ let mut _6: bool; // in scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 + scope 1 { + debug u => _1; // in scope 1 at $DIR/issue_41110.rs:+1:9: +1:10 + let mut _2: S; // in scope 1 at $DIR/issue_41110.rs:+2:9: +2:14 + scope 2 { + debug v => _2; // in scope 2 at $DIR/issue_41110.rs:+2:9: +2:14 + } + } + + bb0: { ++ _6 = const false; // scope 0 at $DIR/issue_41110.rs:+1:9: +1:10 + StorageLive(_1); // scope 0 at $DIR/issue_41110.rs:+1:9: +1:10 ++ _6 = const true; // scope 0 at $DIR/issue_41110.rs:+1:13: +1:14 + _1 = S; // scope 0 at $DIR/issue_41110.rs:+1:13: +1:14 + StorageLive(_2); // scope 1 at $DIR/issue_41110.rs:+2:9: +2:14 + _2 = S; // scope 1 at $DIR/issue_41110.rs:+2:17: +2:18 + StorageLive(_3); // scope 2 at $DIR/issue_41110.rs:+3:5: +3:12 + StorageLive(_4); // scope 2 at $DIR/issue_41110.rs:+3:10: +3:11 + _4 = move _2; // scope 2 at $DIR/issue_41110.rs:+3:10: +3:11 + _3 = std::mem::drop::(move _4) -> [return: bb1, unwind: bb7]; // scope 2 at $DIR/issue_41110.rs:+3:5: +3:12 + // mir::Constant + // + span: $DIR/issue_41110.rs:17:5: 17:9 + // + literal: Const { ty: fn(S) {std::mem::drop::}, val: Value() } + } + + bb1: { + StorageDead(_4); // scope 2 at $DIR/issue_41110.rs:+3:11: +3:12 + StorageDead(_3); // scope 2 at $DIR/issue_41110.rs:+3:12: +3:13 + StorageLive(_5); // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 ++ _6 = const false; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 + _5 = move _1; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 +- drop(_2) -> [return: bb2, unwind: bb3]; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6 ++ goto -> bb2; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6 + } + + bb2: { + _2 = move _5; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6 +- drop(_5) -> [return: bb4, unwind: bb8]; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 ++ goto -> bb4; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 + } + + bb3 (cleanup): { + _2 = move _5; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6 + drop(_5) -> [return: bb8, unwind terminate]; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 + } + + bb4: { + StorageDead(_5); // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10 + _0 = const (); // scope 0 at $DIR/issue_41110.rs:+0:15: +5:2 + drop(_2) -> [return: bb5, unwind: bb9]; // scope 1 at $DIR/issue_41110.rs:+5:1: +5:2 + } + + bb5: { + StorageDead(_2); // scope 1 at $DIR/issue_41110.rs:+5:1: +5:2 +- drop(_1) -> [return: bb6, unwind: bb10]; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 ++ goto -> bb6; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 + } + + bb6: { ++ _6 = const false; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 + StorageDead(_1); // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 + return; // scope 0 at $DIR/issue_41110.rs:+5:2: +5:2 + } + + bb7 (cleanup): { +- drop(_4) -> [return: bb8, unwind terminate]; // scope 2 at $DIR/issue_41110.rs:+3:11: +3:12 ++ goto -> bb8; // scope 2 at $DIR/issue_41110.rs:+3:11: +3:12 + } + + bb8 (cleanup): { +- drop(_2) -> [return: bb9, unwind terminate]; // scope 1 at $DIR/issue_41110.rs:+5:1: +5:2 ++ goto -> bb9; // scope 1 at $DIR/issue_41110.rs:+5:1: +5:2 + } + + bb9 (cleanup): { +- drop(_1) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 ++ goto -> bb13; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 + } + + bb10 (cleanup): { + resume; // scope 0 at $DIR/issue_41110.rs:+0:1: +5:2 ++ } ++ ++ bb11 (cleanup): { ++ unreachable; // scope 0 at $DIR/issue_41110.rs:+0:1: +5:2 ++ } ++ ++ bb12 (cleanup): { ++ drop(_1) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 ++ } ++ ++ bb13 (cleanup): { ++ switchInt(_6) -> [0: bb10, otherwise: bb12]; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 + } + } + diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff similarity index 100% rename from tests/mir-opt/issue_41110.test.ElaborateDrops.diff rename to tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff new file mode 100644 index 00000000000..d4d19b97a92 --- /dev/null +++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff @@ -0,0 +1,151 @@ +- // MIR for `main` before ElaborateDrops ++ // MIR for `main` after ElaborateDrops + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/issue_41888.rs:+0:11: +0:11 + let _1: E; // in scope 0 at $DIR/issue_41888.rs:+1:9: +1:10 + let mut _2: bool; // in scope 0 at $DIR/issue_41888.rs:+2:8: +2:14 + let mut _3: E; // in scope 0 at $DIR/issue_41888.rs:+3:13: +3:20 + let mut _4: K; // in scope 0 at $DIR/issue_41888.rs:+3:18: +3:19 + let mut _5: isize; // in scope 0 at $DIR/issue_41888.rs:+4:16: +4:24 ++ let mut _7: bool; // in scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ let mut _8: bool; // in scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ let mut _9: bool; // in scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ let mut _10: isize; // in scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ let mut _11: isize; // in scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + scope 1 { + debug e => _1; // in scope 1 at $DIR/issue_41888.rs:+1:9: +1:10 + scope 2 { + debug _k => _6; // in scope 2 at $DIR/issue_41888.rs:+4:21: +4:23 + let _6: K; // in scope 2 at $DIR/issue_41888.rs:+4:21: +4:23 + } + } + + bb0: { ++ _7 = const false; // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10 ++ _8 = const false; // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10 ++ _9 = const false; // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10 + StorageLive(_1); // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10 + StorageLive(_2); // scope 1 at $DIR/issue_41888.rs:+2:8: +2:14 + _2 = cond() -> [return: bb1, unwind: bb11]; // scope 1 at $DIR/issue_41888.rs:+2:8: +2:14 + // mir::Constant + // + span: $DIR/issue_41888.rs:8:8: 8:12 + // + literal: Const { ty: fn() -> bool {cond}, val: Value() } + } + + bb1: { + switchInt(move _2) -> [0: bb8, otherwise: bb2]; // scope 1 at $DIR/issue_41888.rs:+2:8: +2:14 + } + + bb2: { + StorageLive(_3); // scope 1 at $DIR/issue_41888.rs:+3:13: +3:20 + StorageLive(_4); // scope 1 at $DIR/issue_41888.rs:+3:18: +3:19 + _4 = K; // scope 1 at $DIR/issue_41888.rs:+3:18: +3:19 + _3 = E::F(move _4); // scope 1 at $DIR/issue_41888.rs:+3:13: +3:20 + StorageDead(_4); // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20 +- drop(_1) -> [return: bb3, unwind: bb4]; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 ++ goto -> bb3; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 + } + + bb3: { ++ _7 = const true; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 ++ _8 = const true; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 ++ _9 = const true; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 + _1 = move _3; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 +- drop(_3) -> [return: bb5, unwind: bb11]; // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20 ++ goto -> bb5; // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20 + } + + bb4 (cleanup): { + _1 = move _3; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10 + drop(_3) -> [return: bb11, unwind terminate]; // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20 + } + + bb5: { + StorageDead(_3); // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20 + _5 = discriminant(_1); // scope 2 at $DIR/issue_41888.rs:+4:16: +4:24 + switchInt(move _5) -> [0: bb6, otherwise: bb7]; // scope 2 at $DIR/issue_41888.rs:+4:16: +4:24 + } + + bb6: { + StorageLive(_6); // scope 2 at $DIR/issue_41888.rs:+4:21: +4:23 ++ _9 = const false; // scope 2 at $DIR/issue_41888.rs:+4:21: +4:23 + _6 = move ((_1 as F).0: K); // scope 2 at $DIR/issue_41888.rs:+4:21: +4:23 + _0 = const (); // scope 2 at $DIR/issue_41888.rs:+4:29: +7:10 + StorageDead(_6); // scope 1 at $DIR/issue_41888.rs:+7:9: +7:10 + goto -> bb9; // scope 1 at $DIR/issue_41888.rs:+4:9: +7:10 + } + + bb7: { + _0 = const (); // scope 1 at $DIR/issue_41888.rs:+7:10: +7:10 + goto -> bb9; // scope 1 at $DIR/issue_41888.rs:+4:9: +7:10 + } + + bb8: { + _0 = const (); // scope 1 at $DIR/issue_41888.rs:+8:6: +8:6 + goto -> bb9; // scope 1 at $DIR/issue_41888.rs:+2:5: +8:6 + } + + bb9: { + StorageDead(_2); // scope 1 at $DIR/issue_41888.rs:+8:5: +8:6 +- drop(_1) -> [return: bb10, unwind: bb12]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ goto -> bb19; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + } + + bb10: { ++ _7 = const false; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ _8 = const false; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ _9 = const false; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + StorageDead(_1); // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + return; // scope 0 at $DIR/issue_41888.rs:+9:2: +9:2 + } + + bb11 (cleanup): { +- drop(_1) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ goto -> bb12; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + } + + bb12 (cleanup): { + resume; // scope 0 at $DIR/issue_41888.rs:+0:1: +9:2 ++ } ++ ++ bb13 (cleanup): { ++ unreachable; // scope 0 at $DIR/issue_41888.rs:+0:1: +9:2 ++ } ++ ++ bb14: { ++ _7 = const false; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ goto -> bb10; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ } ++ ++ bb15 (cleanup): { ++ goto -> bb12; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ } ++ ++ bb16: { ++ drop(_1) -> [return: bb14, unwind: bb12]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ } ++ ++ bb17 (cleanup): { ++ drop(_1) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ } ++ ++ bb18: { ++ _10 = discriminant(_1); // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ switchInt(move _10) -> [0: bb14, otherwise: bb16]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ } ++ ++ bb19: { ++ switchInt(_7) -> [0: bb14, otherwise: bb18]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ } ++ ++ bb20 (cleanup): { ++ _11 = discriminant(_1); // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ switchInt(move _11) -> [0: bb15, otherwise: bb17]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 ++ } ++ ++ bb21 (cleanup): { ++ switchInt(_7) -> [0: bb12, otherwise: bb20]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + } + } + diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff similarity index 100% rename from tests/mir-opt/issue_41888.main.ElaborateDrops.diff rename to tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir new file mode 100644 index 00000000000..b3566e475b5 --- /dev/null +++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir @@ -0,0 +1,122 @@ +// MIR for `test` before ElaborateDrops + +fn test() -> Option> { + let mut _0: std::option::Option>; // return place in scope 0 at $DIR/issue_62289.rs:+0:14: +0:30 + let mut _1: std::boxed::Box; // in scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + let mut _2: usize; // in scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + let mut _3: usize; // in scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + let mut _4: *mut u8; // in scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + let mut _5: std::boxed::Box; // in scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + let mut _6: std::ops::ControlFlow, u32>; // in scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 + let mut _7: std::option::Option; // in scope 0 at $DIR/issue_62289.rs:+3:18: +3:22 + let mut _8: isize; // in scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + let _9: std::option::Option; // in scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + let mut _10: !; // in scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + let mut _11: std::option::Option; // in scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + let _12: u32; // in scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 + scope 1 { + } + scope 2 { + debug residual => _9; // in scope 2 at $DIR/issue_62289.rs:+3:22: +3:23 + scope 3 { + } + } + scope 4 { + debug val => _12; // in scope 4 at $DIR/issue_62289.rs:+3:18: +3:23 + scope 5 { + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + _2 = SizeOf(u32); // scope 1 at $DIR/issue_62289.rs:+3:9: +3:24 + _3 = AlignOf(u32); // scope 1 at $DIR/issue_62289.rs:+3:9: +3:24 + _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind: bb13]; // scope 1 at $DIR/issue_62289.rs:+3:9: +3:24 + // mir::Constant + // + span: $DIR/issue_62289.rs:11:9: 11:24 + // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } + } + + bb1: { + StorageLive(_5); // scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + _5 = ShallowInitBox(move _4, u32); // scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + StorageLive(_6); // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 + StorageLive(_7); // scope 0 at $DIR/issue_62289.rs:+3:18: +3:22 + _7 = Option::::None; // scope 0 at $DIR/issue_62289.rs:+3:18: +3:22 + _6 = as Try>::branch(move _7) -> [return: bb2, unwind: bb12]; // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 + // mir::Constant + // + span: $DIR/issue_62289.rs:11:18: 11:23 + // + literal: Const { ty: fn(Option) -> ControlFlow< as Try>::Residual, as Try>::Output> { as Try>::branch}, val: Value() } + } + + bb2: { + StorageDead(_7); // scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + _8 = discriminant(_6); // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 + switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4]; // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 + } + + bb3: { + StorageLive(_12); // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 + _12 = ((_6 as Continue).0: u32); // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 + (*_5) = _12; // scope 5 at $DIR/issue_62289.rs:+3:18: +3:23 + StorageDead(_12); // scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + _1 = move _5; // scope 0 at $DIR/issue_62289.rs:+3:9: +3:24 + drop(_5) -> [return: bb7, unwind: bb11]; // scope 0 at $DIR/issue_62289.rs:+3:23: +3:24 + } + + bb4: { + unreachable; // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23 + } + + bb5: { + StorageLive(_9); // scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + _9 = ((_6 as Break).0: std::option::Option); // scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + StorageLive(_11); // scope 3 at $DIR/issue_62289.rs:+3:22: +3:23 + _11 = _9; // scope 3 at $DIR/issue_62289.rs:+3:22: +3:23 + _0 = > as FromResidual>>::from_residual(move _11) -> [return: bb6, unwind: bb12]; // scope 3 at $DIR/issue_62289.rs:+3:18: +3:23 + // mir::Constant + // + span: $DIR/issue_62289.rs:11:22: 11:23 + // + literal: Const { ty: fn(Option) -> Option> {> as FromResidual>>::from_residual}, val: Value() } + } + + bb6: { + StorageDead(_11); // scope 3 at $DIR/issue_62289.rs:+3:22: +3:23 + StorageDead(_9); // scope 0 at $DIR/issue_62289.rs:+3:22: +3:23 + drop(_5) -> [return: bb9, unwind: bb13]; // scope 0 at $DIR/issue_62289.rs:+3:23: +3:24 + } + + bb7: { + StorageDead(_5); // scope 0 at $DIR/issue_62289.rs:+3:23: +3:24 + _0 = Option::>::Some(move _1); // scope 0 at $DIR/issue_62289.rs:+1:5: +4:6 + drop(_1) -> [return: bb8, unwind: bb13]; // scope 0 at $DIR/issue_62289.rs:+4:5: +4:6 + } + + bb8: { + StorageDead(_1); // scope 0 at $DIR/issue_62289.rs:+4:5: +4:6 + StorageDead(_6); // scope 0 at $DIR/issue_62289.rs:+5:1: +5:2 + goto -> bb10; // scope 0 at $DIR/issue_62289.rs:+5:2: +5:2 + } + + bb9: { + StorageDead(_5); // scope 0 at $DIR/issue_62289.rs:+3:23: +3:24 + StorageDead(_1); // scope 0 at $DIR/issue_62289.rs:+4:5: +4:6 + StorageDead(_6); // scope 0 at $DIR/issue_62289.rs:+5:1: +5:2 + goto -> bb10; // scope 0 at $DIR/issue_62289.rs:+5:2: +5:2 + } + + bb10: { + return; // scope 0 at $DIR/issue_62289.rs:+5:2: +5:2 + } + + bb11 (cleanup): { + drop(_1) -> [return: bb13, unwind terminate]; // scope 0 at $DIR/issue_62289.rs:+4:5: +4:6 + } + + bb12 (cleanup): { + drop(_5) -> [return: bb13, unwind terminate]; // scope 0 at $DIR/issue_62289.rs:+3:23: +3:24 + } + + bb13 (cleanup): { + resume; // scope 0 at $DIR/issue_62289.rs:+0:1: +5:2 + } +} diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir similarity index 100% rename from tests/mir-opt/issue_62289.test.ElaborateDrops.before.mir rename to tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff new file mode 100644 index 00000000000..6515aeceed3 --- /dev/null +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff @@ -0,0 +1,60 @@ +- // MIR for `test` before SimplifyComparisonIntegral ++ // MIR for `test` after SimplifyComparisonIntegral + + fn test(_1: T) -> () { + debug x => _1; // in scope 0 at $DIR/issue_76432.rs:+0:38: +0:39 + let mut _0: (); // return place in scope 0 at $DIR/issue_76432.rs:+0:44: +0:44 + let _2: &[T]; // in scope 0 at $DIR/issue_76432.rs:+1:9: +1:10 + let mut _3: &[T; 3]; // in scope 0 at $DIR/issue_76432.rs:+1:19: +1:29 + let _4: &[T; 3]; // in scope 0 at $DIR/issue_76432.rs:+1:19: +1:29 + let _5: [T; 3]; // in scope 0 at $DIR/issue_76432.rs:+1:20: +1:29 + let mut _6: T; // in scope 0 at $DIR/issue_76432.rs:+1:21: +1:22 + let mut _7: T; // in scope 0 at $DIR/issue_76432.rs:+1:24: +1:25 + let mut _8: T; // in scope 0 at $DIR/issue_76432.rs:+1:27: +1:28 + let mut _9: usize; // in scope 0 at $DIR/issue_76432.rs:+3:9: +3:33 + let mut _10: usize; // in scope 0 at $DIR/issue_76432.rs:+3:9: +3:33 + let mut _11: bool; // in scope 0 at $DIR/issue_76432.rs:+3:9: +3:33 + let mut _15: !; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL + scope 1 { + debug v => _2; // in scope 1 at $DIR/issue_76432.rs:+1:9: +1:10 + let _12: &T; // in scope 1 at $DIR/issue_76432.rs:+3:10: +3:16 + let _13: &T; // in scope 1 at $DIR/issue_76432.rs:+3:18: +3:24 + let _14: &T; // in scope 1 at $DIR/issue_76432.rs:+3:26: +3:32 + scope 2 { + debug v1 => &(*_2)[0 of 3]; // in scope 2 at $DIR/issue_76432.rs:+3:10: +3:16 + debug v2 => &(*_2)[1 of 3]; // in scope 2 at $DIR/issue_76432.rs:+3:18: +3:24 + debug v3 => &(*_2)[2 of 3]; // in scope 2 at $DIR/issue_76432.rs:+3:26: +3:32 + } + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/issue_76432.rs:+1:9: +1:10 + StorageLive(_5); // scope 0 at $DIR/issue_76432.rs:+1:20: +1:29 + _5 = [_1, _1, _1]; // scope 0 at $DIR/issue_76432.rs:+1:20: +1:29 + _4 = &_5; // scope 0 at $DIR/issue_76432.rs:+1:19: +1:29 + _2 = _4 as &[T] (Pointer(Unsize)); // scope 0 at $DIR/issue_76432.rs:+1:19: +1:29 + _9 = Len((*_2)); // scope 1 at $DIR/issue_76432.rs:+3:9: +3:33 + _10 = const 3_usize; // scope 1 at $DIR/issue_76432.rs:+3:9: +3:33 +- _11 = Eq(move _9, const 3_usize); // scope 1 at $DIR/issue_76432.rs:+3:9: +3:33 +- switchInt(move _11) -> [0: bb1, otherwise: bb2]; // scope 1 at $DIR/issue_76432.rs:+3:9: +3:33 ++ nop; // scope 1 at $DIR/issue_76432.rs:+3:9: +3:33 ++ switchInt(move _9) -> [3: bb2, otherwise: bb1]; // scope 1 at $DIR/issue_76432.rs:+3:9: +3:33 + } + + bb1: { + _15 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind unreachable; // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/panic.rs:LL:COL + // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value() } + // mir::Constant + // + span: $SRC_DIR/core/src/panic.rs:LL:COL + // + literal: Const { ty: &str, val: Value(Slice(..)) } + } + + bb2: { + StorageDead(_5); // scope 0 at $DIR/issue_76432.rs:+6:1: +6:2 + StorageDead(_2); // scope 0 at $DIR/issue_76432.rs:+6:1: +6:2 + return; // scope 0 at $DIR/issue_76432.rs:+6:2: +6:2 + } + } + diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff similarity index 100% rename from tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff rename to tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..a25d8e27330 --- /dev/null +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir @@ -0,0 +1,84 @@ +// MIR for `num_to_digit` after PreCodegen + +fn num_to_digit(_1: char) -> u32 { + debug num => _1; // in scope 0 at $DIR/issue_59352.rs:+0:21: +0:24 + let mut _0: u32; // return place in scope 0 at $DIR/issue_59352.rs:+0:35: +0:38 + let mut _5: std::option::Option; // in scope 0 at $DIR/issue_59352.rs:+2:26: +2:41 + scope 1 (inlined char::methods::::is_digit) { // at $DIR/issue_59352.rs:15:12: 15:23 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + debug radix => const 8_u32; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + let _2: std::option::Option; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + let mut _3: &std::option::Option; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + scope 2 (inlined Option::::is_some) { // at $SRC_DIR/core/src/char/methods.rs:LL:COL + debug self => _3; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _4: isize; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + } + } + scope 3 (inlined #[track_caller] Option::::unwrap) { // at $DIR/issue_59352.rs:15:42: 15:50 + debug self => _5; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _6: isize; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _7: !; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + scope 4 { + debug val => _0; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + } + } + + bb0: { + StorageLive(_3); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageLive(_2); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + _2 = char::methods::::to_digit(_1, const 8_u32) -> [return: bb1, unwind unreachable]; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/char/methods.rs:LL:COL + // + literal: Const { ty: fn(char, u32) -> Option {char::methods::::to_digit}, val: Value() } + } + + bb1: { + _3 = &_2; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + _4 = discriminant((*_3)); // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_3); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageDead(_2); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + switchInt(move _4) -> [1: bb2, otherwise: bb7]; // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23 + } + + bb2: { + StorageLive(_5); // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41 + _5 = char::methods::::to_digit(_1, const 8_u32) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41 + // mir::Constant + // + span: $DIR/issue_59352.rs:15:30: 15:38 + // + literal: Const { ty: fn(char, u32) -> Option {char::methods::::to_digit}, val: Value() } + } + + bb3: { + _6 = discriminant(_5); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb6]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + } + + bb4: { + _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/option.rs:LL:COL + // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value() } + // mir::Constant + // + span: $SRC_DIR/core/src/option.rs:LL:COL + // + literal: Const { ty: &str, val: Value(Slice(..)) } + } + + bb5: { + _0 = move ((_5 as Some).0: u32); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_5); // scope 0 at $DIR/issue_59352.rs:+2:49: +2:50 + goto -> bb8; // scope 0 at $DIR/issue_59352.rs:+2:5: +2:63 + } + + bb6: { + unreachable; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + } + + bb7: { + _0 = const 0_u32; // scope 0 at $DIR/issue_59352.rs:+2:60: +2:61 + goto -> bb8; // scope 0 at $DIR/issue_59352.rs:+2:5: +2:63 + } + + bb8: { + return; // scope 0 at $DIR/issue_59352.rs:+3:2: +3:2 + } +} diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir rename to tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir diff --git a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff new file mode 100644 index 00000000000..8b7f6936186 --- /dev/null +++ b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff @@ -0,0 +1,64 @@ +- // MIR for `array_bound` before NormalizeArrayLen ++ // MIR for `array_bound` after NormalizeArrayLen + + fn array_bound(_1: usize, _2: &[u8; N]) -> u8 { + debug index => _1; // in scope 0 at $DIR/lower_array_len.rs:+0:36: +0:41 + debug slice => _2; // in scope 0 at $DIR/lower_array_len.rs:+0:50: +0:55 + let mut _0: u8; // return place in scope 0 at $DIR/lower_array_len.rs:+0:70: +0:72 + let mut _3: bool; // in scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 + let mut _4: usize; // in scope 0 at $DIR/lower_array_len.rs:+1:8: +1:13 + let mut _5: usize; // in scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + let mut _6: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + let mut _7: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + let _8: usize; // in scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20 + let mut _9: usize; // in scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21 + let mut _10: bool; // in scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21 + + bb0: { + StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 + StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:13 + _4 = _1; // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:13 + StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + _7 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:+1:20: +1:21 +- _5 = Len((*_6)); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 ++ _5 = const N; // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + goto -> bb1; // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + } + + bb1: { + StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 + _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 + StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 + StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 + switchInt(move _3) -> [0: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 + } + + bb2: { + StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20 + _8 = _1; // scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20 + _9 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21 + _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21 + assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind unreachable]; // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21 + } + + bb3: { + _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21 + StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:+3:5: +3:6 + goto -> bb5; // scope 0 at $DIR/lower_array_len.rs:+1:5: +5:6 + } + + bb4: { + _0 = const 42_u8; // scope 0 at $DIR/lower_array_len.rs:+4:9: +4:11 + goto -> bb5; // scope 0 at $DIR/lower_array_len.rs:+1:5: +5:6 + } + + bb5: { + StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:+5:5: +5:6 + return; // scope 0 at $DIR/lower_array_len.rs:+6:2: +6:2 + } + } + diff --git a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff similarity index 100% rename from tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff rename to tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff diff --git a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff new file mode 100644 index 00000000000..50903ccb161 --- /dev/null +++ b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff @@ -0,0 +1,77 @@ +- // MIR for `array_bound_mut` before NormalizeArrayLen ++ // MIR for `array_bound_mut` after NormalizeArrayLen + + fn array_bound_mut(_1: usize, _2: &mut [u8; N]) -> u8 { + debug index => _1; // in scope 0 at $DIR/lower_array_len.rs:+0:40: +0:45 + debug slice => _2; // in scope 0 at $DIR/lower_array_len.rs:+0:54: +0:59 + let mut _0: u8; // return place in scope 0 at $DIR/lower_array_len.rs:+0:78: +0:80 + let mut _3: bool; // in scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 + let mut _4: usize; // in scope 0 at $DIR/lower_array_len.rs:+1:8: +1:13 + let mut _5: usize; // in scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + let mut _6: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + let mut _7: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + let _8: usize; // in scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20 + let mut _9: usize; // in scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21 + let mut _10: bool; // in scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21 + let _11: usize; // in scope 0 at $DIR/lower_array_len.rs:+4:15: +4:16 + let mut _12: usize; // in scope 0 at $DIR/lower_array_len.rs:+4:9: +4:17 + let mut _13: bool; // in scope 0 at $DIR/lower_array_len.rs:+4:9: +4:17 + + bb0: { + StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 + StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:13 + _4 = _1; // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:13 + StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + _7 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:+1:20: +1:21 +- _5 = Len((*_6)); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 ++ _5 = const N; // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + goto -> bb1; // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27 + } + + bb1: { + StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 + _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 + StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 + StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 + switchInt(move _3) -> [0: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 + } + + bb2: { + StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20 + _8 = _1; // scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20 + _9 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21 + _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21 + assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind unreachable]; // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21 + } + + bb3: { + _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21 + StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:+3:5: +3:6 + goto -> bb6; // scope 0 at $DIR/lower_array_len.rs:+1:5: +7:6 + } + + bb4: { + StorageLive(_11); // scope 0 at $DIR/lower_array_len.rs:+4:15: +4:16 + _11 = const 0_usize; // scope 0 at $DIR/lower_array_len.rs:+4:15: +4:16 + _12 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:+4:9: +4:17 + _13 = Lt(_11, _12); // scope 0 at $DIR/lower_array_len.rs:+4:9: +4:17 + assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb5, unwind unreachable]; // scope 0 at $DIR/lower_array_len.rs:+4:9: +4:17 + } + + bb5: { + (*_2)[_11] = const 42_u8; // scope 0 at $DIR/lower_array_len.rs:+4:9: +4:22 + StorageDead(_11); // scope 0 at $DIR/lower_array_len.rs:+4:22: +4:23 + _0 = const 42_u8; // scope 0 at $DIR/lower_array_len.rs:+6:9: +6:11 + goto -> bb6; // scope 0 at $DIR/lower_array_len.rs:+1:5: +7:6 + } + + bb6: { + StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:+7:5: +7:6 + return; // scope 0 at $DIR/lower_array_len.rs:+8:2: +8:2 + } + } + diff --git a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff similarity index 100% rename from tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff rename to tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff diff --git a/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.diff b/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.diff rename to tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-abort.diff diff --git a/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-unwind.diff new file mode 100644 index 00000000000..66feff62f42 --- /dev/null +++ b/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-unwind.diff @@ -0,0 +1,26 @@ +- // MIR for `array_len` before NormalizeArrayLen ++ // MIR for `array_len` after NormalizeArrayLen + + fn array_len(_1: &[u8; N]) -> usize { + debug arr => _1; // in scope 0 at $DIR/lower_array_len.rs:+0:34: +0:37 + let mut _0: usize; // return place in scope 0 at $DIR/lower_array_len.rs:+0:52: +0:57 + let mut _2: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + let mut _3: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + _3 = &(*_1); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + _2 = move _3 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:+1:7: +1:8 +- _0 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 ++ _0 = const N; // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + goto -> bb1; // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + } + + bb1: { + StorageDead(_2); // scope 0 at $DIR/lower_array_len.rs:+1:13: +1:14 + return; // scope 0 at $DIR/lower_array_len.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.diff b/tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.diff rename to tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.panic-abort.diff diff --git a/tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.panic-unwind.diff new file mode 100644 index 00000000000..c0a277edc46 --- /dev/null +++ b/tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.panic-unwind.diff @@ -0,0 +1,26 @@ +- // MIR for `array_len_by_value` before NormalizeArrayLen ++ // MIR for `array_len_by_value` after NormalizeArrayLen + + fn array_len_by_value(_1: [u8; N]) -> usize { + debug arr => _1; // in scope 0 at $DIR/lower_array_len.rs:+0:43: +0:46 + let mut _0: usize; // return place in scope 0 at $DIR/lower_array_len.rs:+0:60: +0:65 + let mut _2: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + let mut _3: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + _3 = &_1; // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + _2 = move _3 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:+1:7: +1:8 +- _0 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 ++ _0 = const N; // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + goto -> bb1; // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14 + } + + bb1: { + StorageDead(_2); // scope 0 at $DIR/lower_array_len.rs:+1:13: +1:14 + return; // scope 0 at $DIR/lower_array_len.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff b/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff rename to tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-abort.diff diff --git a/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-unwind.diff new file mode 100644 index 00000000000..8b35fd57fa0 --- /dev/null +++ b/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-unwind.diff @@ -0,0 +1,50 @@ +- // MIR for `array_len_raw` before NormalizeArrayLen ++ // MIR for `array_len_raw` after NormalizeArrayLen + + fn array_len_raw(_1: [u8; N]) -> usize { + debug arr => _1; // in scope 0 at $DIR/lower_array_len.rs:+0:38: +0:41 + let mut _0: usize; // return place in scope 0 at $DIR/lower_array_len.rs:+0:55: +0:60 + let _2: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+1:9: +1:12 + let mut _3: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25 + let _4: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25 + let mut _6: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+3:5: +3:27 + let _7: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+3:14: +3:19 + scope 1 { + debug arr => _2; // in scope 1 at $DIR/lower_array_len.rs:+1:9: +1:12 + let _5: *const [u8]; // in scope 1 at $DIR/lower_array_len.rs:+2:9: +2:12 + scope 2 { + debug arr => _5; // in scope 2 at $DIR/lower_array_len.rs:+2:9: +2:12 + scope 3 { + } + } + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/lower_array_len.rs:+1:9: +1:12 + StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25 + StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25 + _4 = &_1; // scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25 + _3 = &(*_4); // scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25 + _2 = move _3 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25 + StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:+1:24: +1:25 + StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:25: +1:26 + StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:+2:9: +2:12 + _5 = &raw const (*_2); // scope 1 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageLive(_6); // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:27 + StorageLive(_7); // scope 2 at $DIR/lower_array_len.rs:+3:14: +3:19 + _7 = &(*_5); // scope 3 at $DIR/lower_array_len.rs:+3:14: +3:19 + _6 = &(*_7); // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:27 +- _0 = Len((*_6)); // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:27 ++ _0 = const N; // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:27 + goto -> bb1; // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:27 + } + + bb1: { + StorageDead(_6); // scope 2 at $DIR/lower_array_len.rs:+3:26: +3:27 + StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:+4:1: +4:2 + StorageDead(_2); // scope 0 at $DIR/lower_array_len.rs:+4:1: +4:2 + StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:+4:1: +4:2 + return; // scope 0 at $DIR/lower_array_len.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.diff b/tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.diff rename to tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.panic-abort.diff diff --git a/tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.panic-unwind.diff new file mode 100644 index 00000000000..8bdd2ede6bc --- /dev/null +++ b/tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.panic-unwind.diff @@ -0,0 +1,44 @@ +- // MIR for `array_len_reborrow` before NormalizeArrayLen ++ // MIR for `array_len_reborrow` after NormalizeArrayLen + + fn array_len_reborrow(_1: [u8; N]) -> usize { + debug arr => _1; // in scope 0 at $DIR/lower_array_len.rs:+0:43: +0:50 + let mut _0: usize; // return place in scope 0 at $DIR/lower_array_len.rs:+0:64: +0:69 + let _2: &mut [u8]; // in scope 0 at $DIR/lower_array_len.rs:+1:9: +1:12 + let mut _3: &mut [u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:25: +1:33 + let mut _4: &mut [u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:25: +1:33 + let mut _6: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+3:5: +3:14 + scope 1 { + debug arr => _2; // in scope 1 at $DIR/lower_array_len.rs:+1:9: +1:12 + let _5: &[u8]; // in scope 1 at $DIR/lower_array_len.rs:+2:9: +2:12 + scope 2 { + debug arr => _5; // in scope 2 at $DIR/lower_array_len.rs:+2:9: +2:12 + } + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/lower_array_len.rs:+1:9: +1:12 + StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:+1:25: +1:33 + StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:+1:25: +1:33 + _4 = &mut _1; // scope 0 at $DIR/lower_array_len.rs:+1:25: +1:33 + _3 = &mut (*_4); // scope 0 at $DIR/lower_array_len.rs:+1:25: +1:33 + _2 = move _3 as &mut [u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:+1:25: +1:33 + StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:+1:32: +1:33 + StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:33: +1:34 + StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:+2:9: +2:12 + _5 = &(*_2); // scope 1 at $DIR/lower_array_len.rs:+2:15: +2:20 + StorageLive(_6); // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:14 + _6 = &(*_5); // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:14 +- _0 = Len((*_6)); // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:14 ++ _0 = const N; // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:14 + goto -> bb1; // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:14 + } + + bb1: { + StorageDead(_6); // scope 2 at $DIR/lower_array_len.rs:+3:13: +3:14 + StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:+4:1: +4:2 + StorageDead(_2); // scope 0 at $DIR/lower_array_len.rs:+4:1: +4:2 + return; // scope 0 at $DIR/lower_array_len.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..3530f4a807f --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,20 @@ +- // MIR for `align_of` before LowerIntrinsics ++ // MIR for `align_of` after LowerIntrinsics + + fn align_of() -> usize { + let mut _0: usize; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:25: +0:30 + + bb0: { +- _0 = std::intrinsics::min_align_of::() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:42 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:27:5: 27:40 +- // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::min_align_of::}, val: Value() } ++ _0 = AlignOf(T); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:42 ++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:42 + } + + bb1: { + return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..158ce62e209 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,26 @@ +- // MIR for `assume` before LowerIntrinsics ++ // MIR for `assume` after LowerIntrinsics + + fn assume() -> () { + let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:17: +0:17 + let _1: (); // in scope 0 at $DIR/lower_intrinsics.rs:+2:9: +2:38 + scope 1 { + } + + bb0: { + StorageLive(_1); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38 +- _1 = std::intrinsics::assume(const true) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:112:9: 112:32 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(bool) {std::intrinsics::assume}, val: Value() } ++ assume(const true); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38 ++ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38 + } + + bb1: { + StorageDead(_1); // scope 1 at $DIR/lower_intrinsics.rs:+2:38: +2:39 + _0 = const (); // scope 1 at $DIR/lower_intrinsics.rs:+1:5: +3:6 + return; // scope 0 at $DIR/lower_intrinsics.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-abort.diff new file mode 100644 index 00000000000..63f5b80e276 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-abort.diff @@ -0,0 +1,115 @@ +- // MIR for `discriminant` before LowerIntrinsics ++ // MIR for `discriminant` after LowerIntrinsics + + fn discriminant(_1: T) -> () { + debug t => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:24: +0:25 + let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:30: +0:30 + let _2: ::Discriminant; // in scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45 + let mut _3: &T; // in scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44 + let _4: &T; // in scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44 + let _5: u8; // in scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45 + let mut _6: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44 + let _7: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44 + let _8: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:43: +2:44 + let _9: u8; // in scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46 + let mut _10: &(); // in scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45 + let _11: &(); // in scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45 + let _12: (); // in scope 0 at $DIR/lower_intrinsics.rs:+3:43: +3:45 + let _13: isize; // in scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48 + let mut _14: &E; // in scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47 + let _15: &E; // in scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47 + let _16: E; // in scope 0 at $DIR/lower_intrinsics.rs:+4:43: +4:47 + let mut _17: &E; // in scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47 + let mut _18: &(); // in scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45 + let mut _19: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45 + StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44 + StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44 + _4 = &_1; // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44 + _3 = &(*_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44 +- _2 = discriminant_value::(move _3) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:88:5: 88:41 +- // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a T) -> ::Discriminant {discriminant_value::}, val: Value() } ++ _2 = discriminant((*_3)); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45 ++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45 + } + + bb1: { + StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:44: +1:45 + StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:45: +1:46 + StorageDead(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:45: +1:46 + StorageLive(_5); // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45 + StorageLive(_6); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44 + StorageLive(_7); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44 + _19 = const _; // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44 + // mir::Constant + // + span: $DIR/lower_intrinsics.rs:89:42: 89:44 + // + literal: Const { ty: &i32, val: Unevaluated(discriminant, [T], Some(promoted[2])) } + _7 = &(*_19); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44 + _6 = &(*_7); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44 +- _5 = discriminant_value::(move _6) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:89:5: 89:41 +- // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a i32) -> ::Discriminant {discriminant_value::}, val: Value() } ++ _5 = discriminant((*_6)); // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45 ++ goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45 + } + + bb2: { + StorageDead(_6); // scope 0 at $DIR/lower_intrinsics.rs:+2:44: +2:45 + StorageDead(_7); // scope 0 at $DIR/lower_intrinsics.rs:+2:45: +2:46 + StorageDead(_5); // scope 0 at $DIR/lower_intrinsics.rs:+2:45: +2:46 + StorageLive(_9); // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46 + StorageLive(_10); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45 + StorageLive(_11); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45 + _18 = const _; // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45 + // mir::Constant + // + span: $DIR/lower_intrinsics.rs:90:42: 90:45 + // + literal: Const { ty: &(), val: Unevaluated(discriminant, [T], Some(promoted[1])) } + _11 = &(*_18); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45 + _10 = &(*_11); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45 +- _9 = discriminant_value::<()>(move _10) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:90:5: 90:41 +- // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a ()) -> <() as DiscriminantKind>::Discriminant {discriminant_value::<()>}, val: Value() } ++ _9 = discriminant((*_10)); // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46 ++ goto -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46 + } + + bb3: { + StorageDead(_10); // scope 0 at $DIR/lower_intrinsics.rs:+3:45: +3:46 + StorageDead(_11); // scope 0 at $DIR/lower_intrinsics.rs:+3:46: +3:47 + StorageDead(_9); // scope 0 at $DIR/lower_intrinsics.rs:+3:46: +3:47 + StorageLive(_13); // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48 + StorageLive(_14); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47 + StorageLive(_15); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47 + _17 = const _; // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47 + // mir::Constant + // + span: $DIR/lower_intrinsics.rs:91:42: 91:47 + // + literal: Const { ty: &E, val: Unevaluated(discriminant, [T], Some(promoted[0])) } + _15 = &(*_17); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47 + _14 = &(*_15); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47 +- _13 = discriminant_value::(move _14) -> [return: bb4, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:91:5: 91:41 +- // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a E) -> ::Discriminant {discriminant_value::}, val: Value() } ++ _13 = discriminant((*_14)); // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48 ++ goto -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48 + } + + bb4: { + StorageDead(_14); // scope 0 at $DIR/lower_intrinsics.rs:+4:47: +4:48 + StorageDead(_15); // scope 0 at $DIR/lower_intrinsics.rs:+4:48: +4:49 + StorageDead(_13); // scope 0 at $DIR/lower_intrinsics.rs:+4:48: +4:49 + _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:+0:30: +5:2 + drop(_1) -> [return: bb5, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+5:1: +5:2 + } + + bb5: { + return; // scope 0 at $DIR/lower_intrinsics.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-unwind.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-unwind.diff diff --git a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..5b870ccf5ee --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,72 @@ +- // MIR for `f_copy_nonoverlapping` before LowerIntrinsics ++ // MIR for `f_copy_nonoverlapping` after LowerIntrinsics + + fn f_copy_nonoverlapping() -> () { + let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:32: +0:32 + let _1: (); // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:12 + let _3: (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:9: +4:95 + let mut _4: *const i32; // in scope 0 at $DIR/lower_intrinsics.rs:+4:29: +4:59 + let mut _5: *const (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:29: +4:45 + let mut _6: *const (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:29: +4:45 + let _7: &(); // in scope 0 at $DIR/lower_intrinsics.rs:+4:29: +4:33 + let mut _8: *mut i32; // in scope 0 at $DIR/lower_intrinsics.rs:+4:61: +4:91 + let mut _9: *mut (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:61: +4:79 + let mut _10: *mut (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:61: +4:79 + let mut _11: &mut (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:61: +4:69 + scope 1 { + debug src => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:12 + let mut _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:16 + scope 2 { + debug dst => _2; // in scope 2 at $DIR/lower_intrinsics.rs:+2:9: +2:16 + scope 3 { + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:12 + _1 = (); // scope 0 at $DIR/lower_intrinsics.rs:+1:15: +1:17 + StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:16 + _2 = (); // scope 1 at $DIR/lower_intrinsics.rs:+2:19: +2:21 + StorageLive(_3); // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95 + StorageLive(_4); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:59 + StorageLive(_5); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:45 + StorageLive(_6); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:45 + StorageLive(_7); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:33 + _7 = &_1; // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:33 + _6 = &raw const (*_7); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:33 + _5 = _6; // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:45 + _4 = move _5 as *const i32 (PtrToPtr); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:59 + StorageDead(_5); // scope 3 at $DIR/lower_intrinsics.rs:+4:58: +4:59 + StorageLive(_8); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:91 + StorageLive(_9); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:79 + StorageLive(_10); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:79 + StorageLive(_11); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:69 + _11 = &mut _2; // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:69 + _10 = &raw mut (*_11); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:69 + _9 = _10; // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:79 + _8 = move _9 as *mut i32 (PtrToPtr); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:91 + StorageDead(_9); // scope 3 at $DIR/lower_intrinsics.rs:+4:90: +4:91 +- _3 = copy_nonoverlapping::(move _4, move _8, const 0_usize) -> [return: bb1, unwind unreachable]; // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:105:9: 105:28 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32, *mut i32, usize) {copy_nonoverlapping::}, val: Value() } ++ copy_nonoverlapping(dst = move _8, src = move _4, count = const 0_usize); // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95 ++ goto -> bb1; // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95 + } + + bb1: { + StorageDead(_8); // scope 3 at $DIR/lower_intrinsics.rs:+4:94: +4:95 + StorageDead(_4); // scope 3 at $DIR/lower_intrinsics.rs:+4:94: +4:95 + StorageDead(_11); // scope 3 at $DIR/lower_intrinsics.rs:+4:95: +4:96 + StorageDead(_10); // scope 3 at $DIR/lower_intrinsics.rs:+4:95: +4:96 + StorageDead(_7); // scope 3 at $DIR/lower_intrinsics.rs:+4:95: +4:96 + StorageDead(_6); // scope 3 at $DIR/lower_intrinsics.rs:+4:95: +4:96 + StorageDead(_3); // scope 3 at $DIR/lower_intrinsics.rs:+4:95: +4:96 + _0 = const (); // scope 3 at $DIR/lower_intrinsics.rs:+3:5: +5:6 + StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:+6:1: +6:2 + StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:+6:1: +6:2 + return; // scope 0 at $DIR/lower_intrinsics.rs:+6:2: +6:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..582a79f48d8 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,29 @@ +- // MIR for `forget` before LowerIntrinsics ++ // MIR for `forget` after LowerIntrinsics + + fn forget(_1: T) -> () { + debug t => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:18: +0:19 + let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:24: +0:24 + let mut _2: T; // in scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31 + _2 = move _1; // scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31 +- _0 = std::intrinsics::forget::(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:32 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:32:5: 32:29 +- // + literal: Const { ty: extern "rust-intrinsic" fn(T) {std::intrinsics::forget::}, val: Value() } ++ _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:32 ++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:32 + } + + bb1: { + StorageDead(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:31: +1:32 + goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:+2:1: +2:2 + } + + bb2: { + return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..81ad97077b4 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,31 @@ +- // MIR for `non_const` before LowerIntrinsics ++ // MIR for `non_const` after LowerIntrinsics + + fn non_const() -> usize { + let mut _0: usize; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:26: +0:31 + let _1: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::}; // in scope 0 at $DIR/lower_intrinsics.rs:+2:9: +2:18 + let mut _2: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::}; // in scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:14 + scope 1 { + debug size_of_t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:18 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+2:9: +2:18 + _1 = std::intrinsics::size_of::; // scope 0 at $DIR/lower_intrinsics.rs:+2:21: +2:51 + // mir::Constant + // + span: $DIR/lower_intrinsics.rs:43:21: 43:51 + // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::}, val: Value() } + StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:14 + _2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:14 +- _0 = move _2() -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:16 ++ _0 = SizeOf(T); // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:16 ++ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:16 + } + + bb1: { + StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:+3:15: +3:16 + StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:+4:1: +4:2 + return; // scope 0 at $DIR/lower_intrinsics.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..edc66e2c75c --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,54 @@ +- // MIR for `option_payload` before LowerIntrinsics ++ // MIR for `option_payload` after LowerIntrinsics + + fn option_payload(_1: &Option, _2: &Option) -> () { + debug o => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:23: +0:24 + debug p => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:42: +0:43 + let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:62: +0:62 + let mut _4: *const std::option::Option; // in scope 0 at $DIR/lower_intrinsics.rs:+2:55: +2:56 + let mut _6: *const std::option::Option; // in scope 0 at $DIR/lower_intrinsics.rs:+3:55: +3:56 + scope 1 { + let _3: *const usize; // in scope 1 at $DIR/lower_intrinsics.rs:+2:13: +2:15 + scope 2 { + debug _x => _3; // in scope 2 at $DIR/lower_intrinsics.rs:+2:13: +2:15 + let _5: *const std::string::String; // in scope 2 at $DIR/lower_intrinsics.rs:+3:13: +3:15 + scope 3 { + debug _y => _5; // in scope 3 at $DIR/lower_intrinsics.rs:+3:13: +3:15 + } + } + } + + bb0: { + StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:+2:13: +2:15 + StorageLive(_4); // scope 1 at $DIR/lower_intrinsics.rs:+2:55: +2:56 + _4 = &raw const (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+2:55: +2:56 +- _3 = option_payload_ptr::(move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:143:18: 143:54 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Option) -> *const usize {option_payload_ptr::}, val: Value() } ++ _3 = &raw const (((*_4) as Some).0: usize); // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57 ++ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57 + } + + bb1: { + StorageDead(_4); // scope 1 at $DIR/lower_intrinsics.rs:+2:56: +2:57 + StorageLive(_5); // scope 2 at $DIR/lower_intrinsics.rs:+3:13: +3:15 + StorageLive(_6); // scope 2 at $DIR/lower_intrinsics.rs:+3:55: +3:56 + _6 = &raw const (*_2); // scope 2 at $DIR/lower_intrinsics.rs:+3:55: +3:56 +- _5 = option_payload_ptr::(move _6) -> [return: bb2, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:144:18: 144:54 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Option) -> *const String {option_payload_ptr::}, val: Value() } ++ _5 = &raw const (((*_6) as Some).0: std::string::String); // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57 ++ goto -> bb2; // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57 + } + + bb2: { + StorageDead(_6); // scope 2 at $DIR/lower_intrinsics.rs:+3:56: +3:57 + _0 = const (); // scope 1 at $DIR/lower_intrinsics.rs:+1:5: +4:6 + StorageDead(_5); // scope 2 at $DIR/lower_intrinsics.rs:+4:5: +4:6 + StorageDead(_3); // scope 1 at $DIR/lower_intrinsics.rs:+4:5: +4:6 + return; // scope 0 at $DIR/lower_intrinsics.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..1760efe77d9 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,30 @@ +- // MIR for `ptr_offset` before LowerIntrinsics ++ // MIR for `ptr_offset` after LowerIntrinsics + + fn ptr_offset(_1: *const i32, _2: isize) -> *const i32 { + debug p => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:26: +0:27 + debug d => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:41: +0:42 + let mut _0: *const i32; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:54: +0:64 + let mut _3: *const i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31 + let mut _4: isize; // in scope 0 at $DIR/lower_intrinsics.rs:+1:33: +1:34 + + bb0: { + StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31 + _3 = _1; // scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31 + StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:33: +1:34 + _4 = _2; // scope 0 at $DIR/lower_intrinsics.rs:+1:33: +1:34 +- _0 = offset::<*const i32, isize>(move _3, move _4) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:150:5: 150:29 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32, isize) -> *const i32 {offset::<*const i32, isize>}, val: Value() } ++ _0 = Offset(move _3, move _4); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35 ++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35 + } + + bb1: { + StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:34: +1:35 + StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:34: +1:35 + return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..8583766348a --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,27 @@ +- // MIR for `read_via_copy_primitive` before LowerIntrinsics ++ // MIR for `read_via_copy_primitive` after LowerIntrinsics + + fn read_via_copy_primitive(_1: &i32) -> i32 { + debug r => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:32: +0:33 + let mut _0: i32; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:44: +0:47 + let mut _2: *const i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:46: +1:47 + scope 1 { + } + + bb0: { + StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:46: +1:47 + _2 = &raw const (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+1:46: +1:47 +- _0 = read_via_copy::(move _2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:125:14: 125:45 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32) -> i32 {read_via_copy::}, val: Value() } ++ _0 = (*_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48 ++ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48 + } + + bb1: { + StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48 + return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..f64bc9dcf62 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,21 @@ +- // MIR for `read_via_copy_uninhabited` before LowerIntrinsics ++ // MIR for `read_via_copy_uninhabited` after LowerIntrinsics + + fn read_via_copy_uninhabited(_1: &Never) -> Never { + debug r => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:34: +0:35 + let mut _0: Never; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:48: +0:53 + let mut _2: *const Never; // in scope 0 at $DIR/lower_intrinsics.rs:+1:46: +1:47 + scope 1 { + } + + bb0: { + StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:46: +1:47 + _2 = &raw const (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+1:46: +1:47 +- _0 = read_via_copy::(move _2) -> unwind unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:130:14: 130:45 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Never) -> Never {read_via_copy::}, val: Value() } ++ unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..a880df6a5c2 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,20 @@ +- // MIR for `size_of` before LowerIntrinsics ++ // MIR for `size_of` after LowerIntrinsics + + fn size_of() -> usize { + let mut _0: usize; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:24: +0:29 + + bb0: { +- _0 = std::intrinsics::size_of::() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:37 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:22:5: 22:35 +- // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::}, val: Value() } ++ _0 = SizeOf(T); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:37 ++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:37 + } + + bb1: { + return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..cde7c64c57a --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,27 @@ +- // MIR for `transmute_inhabited` before LowerIntrinsics ++ // MIR for `transmute_inhabited` after LowerIntrinsics + + fn transmute_inhabited(_1: std::cmp::Ordering) -> i8 { + debug c => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:28: +0:29 + let mut _0: i8; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:54: +0:56 + let mut _2: std::cmp::Ordering; // in scope 0 at $DIR/lower_intrinsics.rs:+1:34: +1:35 + scope 1 { + } + + bb0: { + StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:34: +1:35 + _2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+1:34: +1:35 +- _0 = transmute::(move _2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:49:14: 49:33 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(std::cmp::Ordering) -> i8 {transmute::}, val: Value() } ++ _0 = move _2 as i8 (Transmute); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36 ++ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36 + } + + bb1: { + StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:35: +1:36 + return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..6fc0f3d3e3f --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,27 @@ +- // MIR for `transmute_ref_dst` before LowerIntrinsics ++ // MIR for `transmute_ref_dst` after LowerIntrinsics + + fn transmute_ref_dst(_1: &T) -> *const T { + debug u => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:44: +0:45 + let mut _0: *const T; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:54: +0:62 + let mut _2: &T; // in scope 0 at $DIR/lower_intrinsics.rs:+1:34: +1:35 + scope 1 { + } + + bb0: { + StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:34: +1:35 + _2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+1:34: +1:35 +- _0 = transmute::<&T, *const T>(move _2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:59:14: 59:33 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&T) -> *const T {transmute::<&T, *const T>}, val: Value() } ++ _0 = move _2 as *const T (Transmute); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36 ++ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36 + } + + bb1: { + StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:35: +1:36 + return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..e6887a382a2 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,25 @@ +- // MIR for `transmute_to_box_uninhabited` before LowerIntrinsics ++ // MIR for `transmute_to_box_uninhabited` after LowerIntrinsics + + fn transmute_to_box_uninhabited() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:49: +0:50 + let _1: std::boxed::Box; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 + scope 1 { + debug x => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 +- _1 = transmute::>(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:76:25: 76:44 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize) -> Box {transmute::>}, val: Value() } ++ _1 = const 1_usize as std::boxed::Box (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 ++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 + } + + bb1: { + unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+2:11: +2:13 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..b2a44b7c561 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,25 @@ +- // MIR for `transmute_to_mut_uninhabited` before LowerIntrinsics ++ // MIR for `transmute_to_mut_uninhabited` after LowerIntrinsics + + fn transmute_to_mut_uninhabited() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:49: +0:50 + let _1: &mut Never; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 + scope 1 { + debug x => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 +- _1 = transmute::(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:70:25: 70:44 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize) -> &mut Never {transmute::}, val: Value() } ++ _1 = const 1_usize as &mut Never (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 ++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 + } + + bb1: { + unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+2:11: +2:13 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..c49d3aeff70 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,25 @@ +- // MIR for `transmute_to_ref_uninhabited` before LowerIntrinsics ++ // MIR for `transmute_to_ref_uninhabited` after LowerIntrinsics + + fn transmute_to_ref_uninhabited() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:49: +0:50 + let _1: &Never; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 + scope 1 { + debug x => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 +- _1 = transmute::(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:64:21: 64:40 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize) -> &Never {transmute::}, val: Value() } ++ _1 = const 1_usize as &Never (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48 ++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48 + } + + bb1: { + unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+2:11: +2:13 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..06759d74a32 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,22 @@ +- // MIR for `transmute_uninhabited` before LowerIntrinsics ++ // MIR for `transmute_uninhabited` after LowerIntrinsics + + fn transmute_uninhabited(_1: ()) -> Never { + debug u => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:37: +0:38 + let mut _0: Never; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:47: +0:52 + let mut _2: (); // in scope 0 at $DIR/lower_intrinsics.rs:+1:47: +1:48 + scope 1 { + } + + bb0: { + StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48 + _2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48 +- _0 = transmute::<(), Never>(move _2) -> unwind unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:49 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:54:14: 54:46 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(()) -> Never {transmute::<(), Never>}, val: Value() } ++ _0 = move _2 as Never (Transmute); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:49 ++ unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:49 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..9bb43d850eb --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,60 @@ +- // MIR for `unchecked` before LowerIntrinsics ++ // MIR for `unchecked` after LowerIntrinsics + + fn unchecked(_1: i32, _2: i32) -> () { + debug a => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:25: +0:26 + debug b => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:33: +0:34 + let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:41: +0:41 + let _3: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:11 + let mut _4: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:46: +1:47 + let mut _5: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:49: +1:50 + let mut _7: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:46: +2:47 + let mut _8: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:49: +2:50 + scope 1 { + debug _x => _3; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:11 + let _6: i32; // in scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:11 + scope 2 { + debug _y => _6; // in scope 2 at $DIR/lower_intrinsics.rs:+2:9: +2:11 + } + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:11 + StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:46: +1:47 + _4 = _1; // scope 0 at $DIR/lower_intrinsics.rs:+1:46: +1:47 + StorageLive(_5); // scope 0 at $DIR/lower_intrinsics.rs:+1:49: +1:50 + _5 = _2; // scope 0 at $DIR/lower_intrinsics.rs:+1:49: +1:50 +- _3 = unchecked_div::(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:51 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:16:14: 16:45 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i32, i32) -> i32 {unchecked_div::}, val: Value() } ++ _3 = Div(move _4, move _5); // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:51 ++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:51 + } + + bb1: { + StorageDead(_5); // scope 0 at $DIR/lower_intrinsics.rs:+1:50: +1:51 + StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:50: +1:51 + StorageLive(_6); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:11 + StorageLive(_7); // scope 1 at $DIR/lower_intrinsics.rs:+2:46: +2:47 + _7 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+2:46: +2:47 + StorageLive(_8); // scope 1 at $DIR/lower_intrinsics.rs:+2:49: +2:50 + _8 = _2; // scope 1 at $DIR/lower_intrinsics.rs:+2:49: +2:50 +- _6 = unchecked_rem::(move _7, move _8) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:51 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:17:14: 17:45 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i32, i32) -> i32 {unchecked_rem::}, val: Value() } ++ _6 = Rem(move _7, move _8); // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:51 ++ goto -> bb2; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:51 + } + + bb2: { + StorageDead(_8); // scope 1 at $DIR/lower_intrinsics.rs:+2:50: +2:51 + StorageDead(_7); // scope 1 at $DIR/lower_intrinsics.rs:+2:50: +2:51 + _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:+0:41: +3:2 + StorageDead(_6); // scope 1 at $DIR/lower_intrinsics.rs:+3:1: +3:2 + StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:+3:1: +3:2 + return; // scope 0 at $DIR/lower_intrinsics.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..83c9c508bc0 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,21 @@ +- // MIR for `unreachable` before LowerIntrinsics ++ // MIR for `unreachable` after LowerIntrinsics + + fn unreachable() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:25: +0:26 + let _1: (); // in scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:45 + let mut _2: !; // in scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:45 + scope 1 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:47 + StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45 +- _2 = std::intrinsics::unreachable() -> unwind unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:37:14: 37:43 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn() -> ! {std::intrinsics::unreachable}, val: Value() } ++ unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..4ae4466a600 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,83 @@ +- // MIR for `with_overflow` before LowerIntrinsics ++ // MIR for `with_overflow` after LowerIntrinsics + + fn with_overflow(_1: i32, _2: i32) -> () { + debug a => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:22: +0:23 + debug b => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:30: +0:31 + let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:38: +0:38 + let _3: (i32, bool); // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:11 + let mut _4: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:50: +1:51 + let mut _5: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:53: +1:54 + let mut _7: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:50: +2:51 + let mut _8: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:53: +2:54 + let mut _10: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+3:50: +3:51 + let mut _11: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+3:53: +3:54 + scope 1 { + debug _x => _3; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:11 + let _6: (i32, bool); // in scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:11 + scope 2 { + debug _y => _6; // in scope 2 at $DIR/lower_intrinsics.rs:+2:9: +2:11 + let _9: (i32, bool); // in scope 2 at $DIR/lower_intrinsics.rs:+3:9: +3:11 + scope 3 { + debug _z => _9; // in scope 3 at $DIR/lower_intrinsics.rs:+3:9: +3:11 + } + } + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:11 + StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:50: +1:51 + _4 = _1; // scope 0 at $DIR/lower_intrinsics.rs:+1:50: +1:51 + StorageLive(_5); // scope 0 at $DIR/lower_intrinsics.rs:+1:53: +1:54 + _5 = _2; // scope 0 at $DIR/lower_intrinsics.rs:+1:53: +1:54 +- _3 = add_with_overflow::(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:55 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:118:14: 118:49 +- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> (i32, bool) {add_with_overflow::}, val: Value() } ++ _3 = CheckedAdd(move _4, move _5); // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:55 ++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:55 + } + + bb1: { + StorageDead(_5); // scope 0 at $DIR/lower_intrinsics.rs:+1:54: +1:55 + StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:54: +1:55 + StorageLive(_6); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:11 + StorageLive(_7); // scope 1 at $DIR/lower_intrinsics.rs:+2:50: +2:51 + _7 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+2:50: +2:51 + StorageLive(_8); // scope 1 at $DIR/lower_intrinsics.rs:+2:53: +2:54 + _8 = _2; // scope 1 at $DIR/lower_intrinsics.rs:+2:53: +2:54 +- _6 = sub_with_overflow::(move _7, move _8) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:55 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:119:14: 119:49 +- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> (i32, bool) {sub_with_overflow::}, val: Value() } ++ _6 = CheckedSub(move _7, move _8); // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:55 ++ goto -> bb2; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:55 + } + + bb2: { + StorageDead(_8); // scope 1 at $DIR/lower_intrinsics.rs:+2:54: +2:55 + StorageDead(_7); // scope 1 at $DIR/lower_intrinsics.rs:+2:54: +2:55 + StorageLive(_9); // scope 2 at $DIR/lower_intrinsics.rs:+3:9: +3:11 + StorageLive(_10); // scope 2 at $DIR/lower_intrinsics.rs:+3:50: +3:51 + _10 = _1; // scope 2 at $DIR/lower_intrinsics.rs:+3:50: +3:51 + StorageLive(_11); // scope 2 at $DIR/lower_intrinsics.rs:+3:53: +3:54 + _11 = _2; // scope 2 at $DIR/lower_intrinsics.rs:+3:53: +3:54 +- _9 = mul_with_overflow::(move _10, move _11) -> [return: bb3, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:55 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:120:14: 120:49 +- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> (i32, bool) {mul_with_overflow::}, val: Value() } ++ _9 = CheckedMul(move _10, move _11); // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:55 ++ goto -> bb3; // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:55 + } + + bb3: { + StorageDead(_11); // scope 2 at $DIR/lower_intrinsics.rs:+3:54: +3:55 + StorageDead(_10); // scope 2 at $DIR/lower_intrinsics.rs:+3:54: +3:55 + _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:+0:38: +4:2 + StorageDead(_9); // scope 2 at $DIR/lower_intrinsics.rs:+4:1: +4:2 + StorageDead(_6); // scope 1 at $DIR/lower_intrinsics.rs:+4:1: +4:2 + StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:+4:1: +4:2 + return; // scope 0 at $DIR/lower_intrinsics.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..217f27efe5c --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,83 @@ +- // MIR for `wrapping` before LowerIntrinsics ++ // MIR for `wrapping` after LowerIntrinsics + + fn wrapping(_1: i32, _2: i32) -> () { + debug a => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:17: +0:18 + debug b => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:25: +0:26 + let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:33: +0:33 + let _3: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:11 + let mut _4: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:45: +1:46 + let mut _5: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:48: +1:49 + let mut _7: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:45: +2:46 + let mut _8: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:48: +2:49 + let mut _10: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+3:45: +3:46 + let mut _11: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+3:48: +3:49 + scope 1 { + debug _x => _3; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:11 + let _6: i32; // in scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:11 + scope 2 { + debug _y => _6; // in scope 2 at $DIR/lower_intrinsics.rs:+2:9: +2:11 + let _9: i32; // in scope 2 at $DIR/lower_intrinsics.rs:+3:9: +3:11 + scope 3 { + debug _z => _9; // in scope 3 at $DIR/lower_intrinsics.rs:+3:9: +3:11 + } + } + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:11 + StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:45: +1:46 + _4 = _1; // scope 0 at $DIR/lower_intrinsics.rs:+1:45: +1:46 + StorageLive(_5); // scope 0 at $DIR/lower_intrinsics.rs:+1:48: +1:49 + _5 = _2; // scope 0 at $DIR/lower_intrinsics.rs:+1:48: +1:49 +- _3 = std::intrinsics::wrapping_add::(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:50 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:9:14: 9:44 +- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> i32 {std::intrinsics::wrapping_add::}, val: Value() } ++ _3 = Add(move _4, move _5); // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:50 ++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:50 + } + + bb1: { + StorageDead(_5); // scope 0 at $DIR/lower_intrinsics.rs:+1:49: +1:50 + StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:49: +1:50 + StorageLive(_6); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:11 + StorageLive(_7); // scope 1 at $DIR/lower_intrinsics.rs:+2:45: +2:46 + _7 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+2:45: +2:46 + StorageLive(_8); // scope 1 at $DIR/lower_intrinsics.rs:+2:48: +2:49 + _8 = _2; // scope 1 at $DIR/lower_intrinsics.rs:+2:48: +2:49 +- _6 = std::intrinsics::wrapping_sub::(move _7, move _8) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:50 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:10:14: 10:44 +- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> i32 {std::intrinsics::wrapping_sub::}, val: Value() } ++ _6 = Sub(move _7, move _8); // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:50 ++ goto -> bb2; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:50 + } + + bb2: { + StorageDead(_8); // scope 1 at $DIR/lower_intrinsics.rs:+2:49: +2:50 + StorageDead(_7); // scope 1 at $DIR/lower_intrinsics.rs:+2:49: +2:50 + StorageLive(_9); // scope 2 at $DIR/lower_intrinsics.rs:+3:9: +3:11 + StorageLive(_10); // scope 2 at $DIR/lower_intrinsics.rs:+3:45: +3:46 + _10 = _1; // scope 2 at $DIR/lower_intrinsics.rs:+3:45: +3:46 + StorageLive(_11); // scope 2 at $DIR/lower_intrinsics.rs:+3:48: +3:49 + _11 = _2; // scope 2 at $DIR/lower_intrinsics.rs:+3:48: +3:49 +- _9 = wrapping_mul::(move _10, move _11) -> [return: bb3, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:50 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:11:14: 11:44 +- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> i32 {wrapping_mul::}, val: Value() } ++ _9 = Mul(move _10, move _11); // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:50 ++ goto -> bb3; // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:50 + } + + bb3: { + StorageDead(_11); // scope 2 at $DIR/lower_intrinsics.rs:+3:49: +3:50 + StorageDead(_10); // scope 2 at $DIR/lower_intrinsics.rs:+3:49: +3:50 + _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:+0:33: +4:2 + StorageDead(_9); // scope 2 at $DIR/lower_intrinsics.rs:+4:1: +4:2 + StorageDead(_6); // scope 1 at $DIR/lower_intrinsics.rs:+4:1: +4:2 + StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:+4:1: +4:2 + return; // scope 0 at $DIR/lower_intrinsics.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-abort.diff similarity index 100% rename from tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff rename to tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-abort.diff diff --git a/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..2eabd7f626b --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,36 @@ +- // MIR for `write_via_move_string` before LowerIntrinsics ++ // MIR for `write_via_move_string` after LowerIntrinsics + + fn write_via_move_string(_1: &mut String, _2: String) -> () { + debug r => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:30: +0:31 + debug v => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:46: +0:47 + let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:57: +0:57 + let mut _3: *mut std::string::String; // in scope 0 at $DIR/lower_intrinsics.rs:+1:47: +1:48 + let mut _4: std::string::String; // in scope 0 at $DIR/lower_intrinsics.rs:+1:50: +1:51 + scope 1 { + } + + bb0: { + StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48 + _3 = &raw mut (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48 + StorageLive(_4); // scope 1 at $DIR/lower_intrinsics.rs:+1:50: +1:51 + _4 = move _2; // scope 1 at $DIR/lower_intrinsics.rs:+1:50: +1:51 +- _0 = write_via_move::(move _3, move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:52 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:135:14: 135:46 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*mut String, String) {write_via_move::}, val: Value() } ++ (*_3) = move _4; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:52 ++ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:52 + } + + bb1: { + StorageDead(_4); // scope 1 at $DIR/lower_intrinsics.rs:+1:51: +1:52 + StorageDead(_3); // scope 1 at $DIR/lower_intrinsics.rs:+1:51: +1:52 + goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:+2:1: +2:2 + } + + bb2: { + return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2 + } + } + 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 new file mode 100644 index 00000000000..8a9ac6b6673 --- /dev/null +++ b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff @@ -0,0 +1,63 @@ +- // MIR for `bound` before LowerSliceLenCalls ++ // MIR for `bound` after LowerSliceLenCalls + + fn bound(_1: usize, _2: &[u8]) -> u8 { + debug index => _1; // in scope 0 at $DIR/lower_slice_len.rs:+0:14: +0:19 + debug slice => _2; // in scope 0 at $DIR/lower_slice_len.rs:+0:28: +0:33 + let mut _0: u8; // return place in scope 0 at $DIR/lower_slice_len.rs:+0:45: +0:47 + let mut _3: bool; // in scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:27 + let mut _4: usize; // in scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:13 + let mut _5: usize; // in scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27 + let mut _6: &[u8]; // in scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27 + let _7: usize; // in scope 0 at $DIR/lower_slice_len.rs:+2:15: +2:20 + let mut _8: usize; // in scope 0 at $DIR/lower_slice_len.rs:+2:9: +2:21 + let mut _9: bool; // in scope 0 at $DIR/lower_slice_len.rs:+2:9: +2:21 + + bb0: { + StorageLive(_3); // scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:27 + StorageLive(_4); // scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:13 + _4 = _1; // scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:13 + StorageLive(_5); // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27 + StorageLive(_6); // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27 + _6 = &(*_2); // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27 +- _5 = core::slice::::len(move _6) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27 +- // mir::Constant +- // + span: $DIR/lower_slice_len.rs:6:22: 6:25 +- // + literal: Const { ty: for<'a> fn(&'a [u8]) -> usize {core::slice::::len}, val: Value() } ++ _5 = Len((*_6)); // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27 ++ goto -> bb1; // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27 + } + + bb1: { + StorageDead(_6); // scope 0 at $DIR/lower_slice_len.rs:+1:26: +1:27 + _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:27 + StorageDead(_5); // scope 0 at $DIR/lower_slice_len.rs:+1:26: +1:27 + StorageDead(_4); // scope 0 at $DIR/lower_slice_len.rs:+1:26: +1:27 + switchInt(move _3) -> [0: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:27 + } + + bb2: { + StorageLive(_7); // scope 0 at $DIR/lower_slice_len.rs:+2:15: +2:20 + _7 = _1; // scope 0 at $DIR/lower_slice_len.rs:+2:15: +2:20 + _8 = Len((*_2)); // scope 0 at $DIR/lower_slice_len.rs:+2:9: +2:21 + _9 = Lt(_7, _8); // scope 0 at $DIR/lower_slice_len.rs:+2:9: +2:21 + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb3, unwind unreachable]; // scope 0 at $DIR/lower_slice_len.rs:+2:9: +2:21 + } + + bb3: { + _0 = (*_2)[_7]; // scope 0 at $DIR/lower_slice_len.rs:+2:9: +2:21 + StorageDead(_7); // scope 0 at $DIR/lower_slice_len.rs:+3:5: +3:6 + goto -> bb5; // scope 0 at $DIR/lower_slice_len.rs:+1:5: +5:6 + } + + bb4: { + _0 = const 42_u8; // scope 0 at $DIR/lower_slice_len.rs:+4:9: +4:11 + goto -> bb5; // scope 0 at $DIR/lower_slice_len.rs:+1:5: +5:6 + } + + bb5: { + StorageDead(_3); // scope 0 at $DIR/lower_slice_len.rs:+5:5: +5:6 + return; // scope 0 at $DIR/lower_slice_len.rs:+6:2: +6:2 + } + } + diff --git a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff similarity index 100% rename from tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff rename to tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff similarity index 100% rename from tests/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff rename to tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff new file mode 100644 index 00000000000..3081e78f26d --- /dev/null +++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff @@ -0,0 +1,272 @@ +- // MIR for `complicated_match` after SimplifyCfg-initial ++ // MIR for `complicated_match` after ElaborateDrops + + fn complicated_match(_1: bool, _2: (bool, bool, String)) -> i32 { + debug cond => _1; // in scope 0 at $DIR/match_arm_scopes.rs:+0:22: +0:26 + debug items => _2; // in scope 0 at $DIR/match_arm_scopes.rs:+0:34: +0:39 + let mut _0: i32; // return place in scope 0 at $DIR/match_arm_scopes.rs:+0:66: +0:69 + let mut _3: &bool; // in scope 0 at $DIR/match_arm_scopes.rs:+1:11: +1:16 + let mut _4: &bool; // in scope 0 at $DIR/match_arm_scopes.rs:+1:11: +1:16 + let _5: bool; // in scope 0 at $DIR/match_arm_scopes.rs:+2:17: +2:18 + let _6: &bool; // in scope 0 at $DIR/match_arm_scopes.rs:+2:17: +2:18 + let _7: std::string::String; // in scope 0 at $DIR/match_arm_scopes.rs:+2:20: +2:21 + let _8: &std::string::String; // in scope 0 at $DIR/match_arm_scopes.rs:+2:20: +2:21 + let mut _9: bool; // in scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 + let mut _10: bool; // in scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 + let mut _11: !; // in scope 0 at $DIR/match_arm_scopes.rs:+2:52: +2:60 + let mut _12: bool; // in scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 + let mut _13: bool; // in scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 + let mut _14: !; // in scope 0 at $DIR/match_arm_scopes.rs:+2:52: +2:60 + let _15: bool; // in scope 0 at $DIR/match_arm_scopes.rs:+3:16: +3:17 + let _16: std::string::String; // in scope 0 at $DIR/match_arm_scopes.rs:+3:19: +3:20 + scope 1 { + debug a => _5; // in scope 1 at $DIR/match_arm_scopes.rs:+2:17: +2:18 + debug a => _6; // in scope 1 at $DIR/match_arm_scopes.rs:+2:17: +2:18 + debug s => _7; // in scope 1 at $DIR/match_arm_scopes.rs:+2:20: +2:21 + debug s => _8; // in scope 1 at $DIR/match_arm_scopes.rs:+2:20: +2:21 + } + scope 2 { + debug b => _15; // in scope 2 at $DIR/match_arm_scopes.rs:+3:16: +3:17 + debug t => _16; // in scope 2 at $DIR/match_arm_scopes.rs:+3:19: +3:20 + } + + bb0: { +- FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_arm_scopes.rs:+1:11: +1:16 +- switchInt((_2.0: bool)) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 ++ switchInt((_2.0: bool)) -> [0: bb5, otherwise: bb1]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 + } + + bb1: { +- falseEdge -> [real: bb8, imaginary: bb3]; // scope 0 at $DIR/match_arm_scopes.rs:+2:9: +2:22 ++ switchInt((_2.1: bool)) -> [0: bb10, otherwise: bb2]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 + } + + bb2: { +- switchInt((_2.1: bool)) -> [0: bb3, otherwise: bb4]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 ++ switchInt((_2.0: bool)) -> [0: bb3, otherwise: bb17]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 + } + + bb3: { +- falseEdge -> [real: bb13, imaginary: bb5]; // scope 0 at $DIR/match_arm_scopes.rs:+2:25: +2:38 +- } +- +- bb4: { +- switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb5]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 +- } +- +- bb5: { +- falseEdge -> [real: bb20, imaginary: bb6]; // scope 0 at $DIR/match_arm_scopes.rs:+3:9: +3:21 +- } +- +- bb6: { + StorageLive(_15); // scope 0 at $DIR/match_arm_scopes.rs:+3:32: +3:33 + _15 = (_2.1: bool); // scope 0 at $DIR/match_arm_scopes.rs:+3:32: +3:33 + StorageLive(_16); // scope 0 at $DIR/match_arm_scopes.rs:+3:35: +3:36 + _16 = move (_2.2: std::string::String); // scope 0 at $DIR/match_arm_scopes.rs:+3:35: +3:36 +- goto -> bb19; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6 ++ goto -> bb16; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6 + } + +- bb7: { ++ bb4: { + _0 = const 1_i32; // scope 1 at $DIR/match_arm_scopes.rs:+2:77: +2:78 +- drop(_7) -> [return: bb18, unwind: bb25]; // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78 ++ drop(_7) -> [return: bb15, unwind: bb22]; // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78 + } + +- bb8: { ++ bb5: { + StorageLive(_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:17: +2:18 + _6 = &(_2.1: bool); // scope 0 at $DIR/match_arm_scopes.rs:+2:17: +2:18 + StorageLive(_8); // scope 0 at $DIR/match_arm_scopes.rs:+2:20: +2:21 + _8 = &(_2.2: std::string::String); // scope 0 at $DIR/match_arm_scopes.rs:+2:20: +2:21 +- _3 = &shallow (_2.0: bool); // scope 0 at $DIR/match_arm_scopes.rs:+1:11: +1:16 +- _4 = &shallow (_2.1: bool); // scope 0 at $DIR/match_arm_scopes.rs:+1:11: +1:16 + StorageLive(_9); // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 + StorageLive(_10); // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 + _10 = _1; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 +- switchInt(move _10) -> [0: bb10, otherwise: bb9]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 ++ switchInt(move _10) -> [0: bb7, otherwise: bb6]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 + } + +- bb9: { ++ bb6: { + _0 = const 3_i32; // scope 0 at $DIR/match_arm_scopes.rs:+2:59: +2:60 + StorageDead(_10); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 + StorageDead(_9); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 +- goto -> bb23; // scope 0 at no-location ++ goto -> bb20; // scope 0 at no-location + } + +- bb10: { ++ bb7: { + _9 = (*_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:70: +2:71 +- switchInt(move _9) -> [0: bb12, otherwise: bb11]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 ++ switchInt(move _9) -> [0: bb9, otherwise: bb8]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 + } + +- bb11: { ++ bb8: { + StorageDead(_10); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 + StorageDead(_9); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 +- FakeRead(ForMatchGuard, _3); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 +- FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 +- FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 +- FakeRead(ForGuardBinding, _8); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 + StorageLive(_5); // scope 0 at $DIR/match_arm_scopes.rs:+2:17: +2:18 + _5 = (_2.1: bool); // scope 0 at $DIR/match_arm_scopes.rs:+2:17: +2:18 + StorageLive(_7); // scope 0 at $DIR/match_arm_scopes.rs:+2:20: +2:21 + _7 = move (_2.2: std::string::String); // scope 0 at $DIR/match_arm_scopes.rs:+2:20: +2:21 +- goto -> bb7; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6 ++ goto -> bb4; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6 + } + +- bb12: { ++ bb9: { + StorageDead(_10); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 + StorageDead(_9); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 + StorageDead(_8); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78 + StorageDead(_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78 +- falseEdge -> [real: bb2, imaginary: bb3]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 ++ goto -> bb1; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 + } + +- bb13: { ++ bb10: { + StorageLive(_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:26: +2:27 + _6 = &(_2.0: bool); // scope 0 at $DIR/match_arm_scopes.rs:+2:26: +2:27 + StorageLive(_8); // scope 0 at $DIR/match_arm_scopes.rs:+2:36: +2:37 + _8 = &(_2.2: std::string::String); // scope 0 at $DIR/match_arm_scopes.rs:+2:36: +2:37 +- _3 = &shallow (_2.0: bool); // scope 0 at $DIR/match_arm_scopes.rs:+1:11: +1:16 +- _4 = &shallow (_2.1: bool); // scope 0 at $DIR/match_arm_scopes.rs:+1:11: +1:16 + StorageLive(_12); // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 + StorageLive(_13); // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 + _13 = _1; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 +- switchInt(move _13) -> [0: bb15, otherwise: bb14]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 ++ switchInt(move _13) -> [0: bb12, otherwise: bb11]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 + } + +- bb14: { ++ bb11: { + _0 = const 3_i32; // scope 0 at $DIR/match_arm_scopes.rs:+2:59: +2:60 + StorageDead(_13); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 + StorageDead(_12); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 +- goto -> bb23; // scope 0 at no-location ++ goto -> bb20; // scope 0 at no-location + } + +- bb15: { ++ bb12: { + _12 = (*_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:70: +2:71 +- switchInt(move _12) -> [0: bb17, otherwise: bb16]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 ++ switchInt(move _12) -> [0: bb14, otherwise: bb13]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 + } + +- bb16: { ++ bb13: { + StorageDead(_13); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 + StorageDead(_12); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 +- FakeRead(ForMatchGuard, _3); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 +- FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 +- FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 +- FakeRead(ForGuardBinding, _8); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 + StorageLive(_5); // scope 0 at $DIR/match_arm_scopes.rs:+2:26: +2:27 + _5 = (_2.0: bool); // scope 0 at $DIR/match_arm_scopes.rs:+2:26: +2:27 + StorageLive(_7); // scope 0 at $DIR/match_arm_scopes.rs:+2:36: +2:37 + _7 = move (_2.2: std::string::String); // scope 0 at $DIR/match_arm_scopes.rs:+2:36: +2:37 +- goto -> bb7; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6 ++ goto -> bb4; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6 + } + +- bb17: { ++ bb14: { + StorageDead(_13); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 + StorageDead(_12); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73 + StorageDead(_8); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78 + StorageDead(_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78 +- falseEdge -> [real: bb4, imaginary: bb5]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 ++ goto -> bb2; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 + } + +- bb18: { ++ bb15: { + StorageDead(_7); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78 + StorageDead(_5); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78 + StorageDead(_8); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78 + StorageDead(_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78 +- goto -> bb22; // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78 ++ goto -> bb19; // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78 + } + +- bb19: { ++ bb16: { + _0 = const 2_i32; // scope 2 at $DIR/match_arm_scopes.rs:+3:41: +3:42 +- drop(_16) -> [return: bb21, unwind: bb25]; // scope 0 at $DIR/match_arm_scopes.rs:+3:41: +3:42 ++ drop(_16) -> [return: bb18, unwind: bb22]; // scope 0 at $DIR/match_arm_scopes.rs:+3:41: +3:42 + } + +- bb20: { ++ bb17: { + StorageLive(_15); // scope 0 at $DIR/match_arm_scopes.rs:+3:16: +3:17 + _15 = (_2.1: bool); // scope 0 at $DIR/match_arm_scopes.rs:+3:16: +3:17 + StorageLive(_16); // scope 0 at $DIR/match_arm_scopes.rs:+3:19: +3:20 + _16 = move (_2.2: std::string::String); // scope 0 at $DIR/match_arm_scopes.rs:+3:19: +3:20 +- goto -> bb19; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6 ++ goto -> bb16; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6 + } + +- bb21: { ++ bb18: { + StorageDead(_16); // scope 0 at $DIR/match_arm_scopes.rs:+3:41: +3:42 + StorageDead(_15); // scope 0 at $DIR/match_arm_scopes.rs:+3:41: +3:42 +- goto -> bb22; // scope 0 at $DIR/match_arm_scopes.rs:+3:41: +3:42 ++ goto -> bb19; // scope 0 at $DIR/match_arm_scopes.rs:+3:41: +3:42 + } + +- bb22: { +- drop(_2) -> [return: bb24, unwind: bb26]; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2 ++ bb19: { ++ goto -> bb26; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2 + } + +- bb23: { ++ bb20: { + StorageDead(_8); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78 + StorageDead(_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78 +- drop(_2) -> [return: bb24, unwind: bb26]; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2 ++ drop(_2) -> [return: bb21, unwind: bb23]; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2 + } + +- bb24: { ++ bb21: { + return; // scope 0 at $DIR/match_arm_scopes.rs:+5:2: +5:2 + } + +- bb25 (cleanup): { +- drop(_2) -> [return: bb26, unwind terminate]; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2 ++ bb22 (cleanup): { ++ goto -> bb27; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2 + } + +- bb26 (cleanup): { ++ bb23 (cleanup): { + resume; // scope 0 at $DIR/match_arm_scopes.rs:+0:1: +5:2 ++ } ++ ++ bb24: { ++ goto -> bb21; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2 ++ } ++ ++ bb25 (cleanup): { ++ goto -> bb23; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2 ++ } ++ ++ bb26: { ++ goto -> bb24; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2 ++ } ++ ++ bb27 (cleanup): { ++ goto -> bb23; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2 + } + } + diff --git a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-abort.mir new file mode 100644 index 00000000000..90b547913e4 --- /dev/null +++ b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-abort.mir @@ -0,0 +1,44 @@ +// MIR for `unwrap` after SimplifyCfg-elaborate-drops + +fn unwrap(_1: Option) -> T { + debug opt => _1; // in scope 0 at $DIR/no_drop_for_inactive_variant.rs:+0:14: +0:17 + let mut _0: T; // return place in scope 0 at $DIR/no_drop_for_inactive_variant.rs:+0:33: +0:34 + let mut _2: isize; // in scope 0 at $DIR/no_drop_for_inactive_variant.rs:+2:9: +2:16 + let _3: T; // in scope 0 at $DIR/no_drop_for_inactive_variant.rs:+2:14: +2:15 + let mut _4: !; // in scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL + let mut _5: isize; // in scope 0 at $DIR/no_drop_for_inactive_variant.rs:+5:1: +5:2 + let mut _6: isize; // in scope 0 at $DIR/no_drop_for_inactive_variant.rs:+5:1: +5:2 + let mut _7: isize; // in scope 0 at $DIR/no_drop_for_inactive_variant.rs:+5:1: +5:2 + scope 1 { + debug x => _3; // in scope 1 at $DIR/no_drop_for_inactive_variant.rs:+2:14: +2:15 + } + + bb0: { + _2 = discriminant(_1); // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+1:11: +1:14 + switchInt(move _2) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+1:5: +1:14 + } + + bb1: { + StorageLive(_4); // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL + _4 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable; // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/std/src/panic.rs:LL:COL + // + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value() } + // mir::Constant + // + span: $SRC_DIR/std/src/panic.rs:LL:COL + // + literal: Const { ty: &str, val: Value(Slice(..)) } + } + + bb2: { + unreachable; // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+1:11: +1:14 + } + + bb3: { + StorageLive(_3); // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+2:14: +2:15 + _3 = move ((_1 as Some).0: T); // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+2:14: +2:15 + _0 = move _3; // scope 1 at $DIR/no_drop_for_inactive_variant.rs:+2:20: +2:21 + StorageDead(_3); // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+2:20: +2:21 + _5 = discriminant(_1); // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+5:1: +5:2 + return; // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+5:2: +5:2 + } +} diff --git a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir rename to tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-unwind.mir 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 new file mode 100644 index 00000000000..14b315ad9a3 --- /dev/null +++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir @@ -0,0 +1,49 @@ +// MIR for `main` before ElaborateDrops + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/no_spurious_drop_after_call.rs:+0:11: +0:11 + let _1: (); // in scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:5: +1:35 + let mut _2: std::string::String; // in scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:34 + let mut _3: &str; // in scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:34 + let _4: &str; // in scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:22 + + bb0: { + StorageLive(_1); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:5: +1:35 + StorageLive(_2); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:34 + StorageLive(_3); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:34 + StorageLive(_4); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:22 + _4 = const ""; // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:22 + // mir::Constant + // + span: $DIR/no_spurious_drop_after_call.rs:9:20: 9:22 + // + literal: Const { ty: &str, val: Value(Slice(..)) } + _3 = &(*_4); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:34 + _2 = ::to_string(move _3) -> [return: bb1, unwind: bb4]; // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:34 + // mir::Constant + // + span: $DIR/no_spurious_drop_after_call.rs:9:23: 9:32 + // + literal: Const { ty: for<'a> fn(&'a str) -> String {::to_string}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:33: +1:34 + _1 = std::mem::drop::(move _2) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:5: +1:35 + // mir::Constant + // + span: $DIR/no_spurious_drop_after_call.rs:9:5: 9:19 + // + literal: Const { ty: fn(String) {std::mem::drop::}, val: Value() } + } + + bb2: { + StorageDead(_2); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:34: +1:35 + StorageDead(_4); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:35: +1:36 + StorageDead(_1); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:35: +1:36 + _0 = const (); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+0:11: +2:2 + return; // scope 0 at $DIR/no_spurious_drop_after_call.rs:+2:2: +2:2 + } + + bb3 (cleanup): { + drop(_2) -> [return: bb4, unwind terminate]; // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:34: +1:35 + } + + bb4 (cleanup): { + resume; // scope 0 at $DIR/no_spurious_drop_after_call.rs:+0:1: +2:2 + } +} diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir similarity index 100% rename from tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.mir rename to tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir diff --git a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-abort.diff b/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-abort.diff new file mode 100644 index 00000000000..45b2efa3fe2 --- /dev/null +++ b/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-abort.diff @@ -0,0 +1,43 @@ +- // MIR for `nrvo` before RenameReturnPlace ++ // MIR for `nrvo` after RenameReturnPlace + + fn nrvo(_1: for<'a> fn(&'a mut [u8; 1024])) -> [u8; 1024] { + debug init => _1; // in scope 0 at $DIR/nrvo_simple.rs:+0:9: +0:13 +- let mut _0: [u8; 1024]; // return place in scope 0 at $DIR/nrvo_simple.rs:+0:39: +0:49 ++ let mut _0: [u8; 1024]; // return place in scope 0 at $DIR/nrvo_simple.rs:+1:9: +1:16 + let mut _2: [u8; 1024]; // in scope 0 at $DIR/nrvo_simple.rs:+1:9: +1:16 + let _3: (); // in scope 0 at $DIR/nrvo_simple.rs:+2:5: +2:19 + let mut _4: for<'a> fn(&'a mut [u8; 1024]); // in scope 0 at $DIR/nrvo_simple.rs:+2:5: +2:9 + let mut _5: &mut [u8; 1024]; // in scope 0 at $DIR/nrvo_simple.rs:+2:10: +2:18 + let mut _6: &mut [u8; 1024]; // in scope 0 at $DIR/nrvo_simple.rs:+2:10: +2:18 + scope 1 { +- debug buf => _2; // in scope 1 at $DIR/nrvo_simple.rs:+1:9: +1:16 ++ debug buf => _0; // in scope 1 at $DIR/nrvo_simple.rs:+1:9: +1:16 + } + + bb0: { +- StorageLive(_2); // scope 0 at $DIR/nrvo_simple.rs:+1:9: +1:16 +- _2 = [const 0_u8; 1024]; // scope 0 at $DIR/nrvo_simple.rs:+1:19: +1:28 ++ _0 = [const 0_u8; 1024]; // scope 0 at $DIR/nrvo_simple.rs:+1:19: +1:28 + StorageLive(_3); // scope 1 at $DIR/nrvo_simple.rs:+2:5: +2:19 + StorageLive(_4); // scope 1 at $DIR/nrvo_simple.rs:+2:5: +2:9 + _4 = _1; // scope 1 at $DIR/nrvo_simple.rs:+2:5: +2:9 + StorageLive(_5); // scope 1 at $DIR/nrvo_simple.rs:+2:10: +2:18 + StorageLive(_6); // scope 1 at $DIR/nrvo_simple.rs:+2:10: +2:18 +- _6 = &mut _2; // scope 1 at $DIR/nrvo_simple.rs:+2:10: +2:18 ++ _6 = &mut _0; // scope 1 at $DIR/nrvo_simple.rs:+2:10: +2:18 + _5 = &mut (*_6); // scope 1 at $DIR/nrvo_simple.rs:+2:10: +2:18 + _3 = move _4(move _5) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/nrvo_simple.rs:+2:5: +2:19 + } + + bb1: { + StorageDead(_5); // scope 1 at $DIR/nrvo_simple.rs:+2:18: +2:19 + StorageDead(_4); // scope 1 at $DIR/nrvo_simple.rs:+2:18: +2:19 + StorageDead(_6); // scope 1 at $DIR/nrvo_simple.rs:+2:19: +2:20 + StorageDead(_3); // scope 1 at $DIR/nrvo_simple.rs:+2:19: +2:20 +- _0 = _2; // scope 1 at $DIR/nrvo_simple.rs:+3:5: +3:8 +- StorageDead(_2); // scope 0 at $DIR/nrvo_simple.rs:+4:1: +4:2 + return; // scope 0 at $DIR/nrvo_simple.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.diff b/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff similarity index 100% rename from tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.diff rename to tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff diff --git a/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir new file mode 100644 index 00000000000..f17682ae71d --- /dev/null +++ b/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir @@ -0,0 +1,46 @@ +// MIR for `main` after SimplifyCfg-elaborate-drops + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/packed_struct_drop_aligned.rs:+0:11: +0:11 + let mut _1: Packed; // in scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:9: +1:14 + let mut _2: Aligned; // in scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:24: +1:42 + let mut _3: Droppy; // in scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:32: +1:41 + let mut _4: Aligned; // in scope 0 at $DIR/packed_struct_drop_aligned.rs:+2:11: +2:29 + let mut _5: Droppy; // in scope 0 at $DIR/packed_struct_drop_aligned.rs:+2:19: +2:28 + let mut _6: Aligned; // in scope 0 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8 + scope 1 { + debug x => _1; // in scope 1 at $DIR/packed_struct_drop_aligned.rs:+1:9: +1:14 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:9: +1:14 + StorageLive(_2); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:24: +1:42 + StorageLive(_3); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:32: +1:41 + _3 = Droppy(const 0_usize); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:32: +1:41 + _2 = Aligned(move _3); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:24: +1:42 + StorageDead(_3); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:41: +1:42 + _1 = Packed(move _2); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:17: +1:43 + StorageDead(_2); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:42: +1:43 + StorageLive(_4); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:11: +2:29 + StorageLive(_5); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:19: +2:28 + _5 = Droppy(const 0_usize); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:19: +2:28 + _4 = Aligned(move _5); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:11: +2:29 + StorageDead(_5); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:28: +2:29 + StorageLive(_6); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8 + _6 = move (_1.0: Aligned); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8 + drop(_6) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8 + } + + bb1: { + StorageDead(_1); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+3:1: +3:2 + return; // scope 0 at $DIR/packed_struct_drop_aligned.rs:+3:2: +3:2 + } + + bb2: { + StorageDead(_6); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8 + (_1.0: Aligned) = move _4; // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8 + StorageDead(_4); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:28: +2:29 + _0 = const (); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+0:11: +3:2 + drop(_1) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/packed_struct_drop_aligned.rs:+3:1: +3:2 + } +} diff --git a/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir rename to tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff new file mode 100644 index 00000000000..eeb67c44126 --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff @@ -0,0 +1,59 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _9: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + scope 1 { + debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 2 { + debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + scope 3 { + debug z => _9; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 +- _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 +- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 ++ _2 = const (4_i32, false); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + } + + bb1: { +- _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 ++ _1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _6 = const 6_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 +- _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 ++ _7 = const true; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + } + + bb2: { +- _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 ++ _3 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + _9 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff similarity index 100% rename from tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.diff rename to tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff new file mode 100644 index 00000000000..eeb67c44126 --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff @@ -0,0 +1,59 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _9: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + scope 1 { + debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 2 { + debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + scope 3 { + debug z => _9; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 +- _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 +- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 ++ _2 = const (4_i32, false); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + } + + bb1: { +- _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 ++ _1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _6 = const 6_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 +- _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 ++ _7 = const true; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + } + + bb2: { +- _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 ++ _3 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + _9 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff similarity index 100% rename from tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.diff rename to tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.panic-abort.mir similarity index 100% rename from tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.mir rename to tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.panic-abort.mir diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.panic-unwind.mir similarity index 100% rename from tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.mir rename to tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.panic-unwind.mir diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-abort.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-abort.mir new file mode 100644 index 00000000000..7886bf19e0c --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-abort.mir @@ -0,0 +1,18 @@ +// MIR for `main` after PreCodegen + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + scope 1 { + debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + scope 2 { + debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 3 { + debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } +} diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-unwind.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-unwind.mir new file mode 100644 index 00000000000..7886bf19e0c --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-unwind.mir @@ -0,0 +1,18 @@ +// MIR for `main` after PreCodegen + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + scope 1 { + debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + scope 2 { + debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 3 { + debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } +} 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 new file mode 100644 index 00000000000..2c0e15fc74a --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff @@ -0,0 +1,71 @@ +- // MIR for `main` before ScalarReplacementOfAggregates ++ // MIR for `main` after ScalarReplacementOfAggregates + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ let mut _10: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ let mut _11: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + scope 1 { + debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 2 { + debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + scope 3 { + debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + } + + bb1: { + _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _6 = Len(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + } + + bb2: { + _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + StorageLive(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 +- StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 +- _9 = Point { x: const 12_u32, y: const 42_u32 }; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 +- _8 = (_9.1: u32); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 +- StorageDead(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 ++ StorageLive(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ StorageLive(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ _10 = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ _11 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ _8 = _11; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 ++ StorageDead(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 ++ StorageDead(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 ++ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 + nop; // scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +4:2 + StorageDead(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff similarity index 100% rename from tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff rename to tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff 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 new file mode 100644 index 00000000000..2c0e15fc74a --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff @@ -0,0 +1,71 @@ +- // MIR for `main` before ScalarReplacementOfAggregates ++ // MIR for `main` after ScalarReplacementOfAggregates + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ let mut _10: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ let mut _11: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + scope 1 { + debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 2 { + debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + scope 3 { + debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + } + + bb1: { + _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _6 = Len(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + } + + bb2: { + _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + StorageLive(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 +- StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 +- _9 = Point { x: const 12_u32, y: const 42_u32 }; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 +- _8 = (_9.1: u32); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 +- StorageDead(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 ++ StorageLive(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ StorageLive(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ _10 = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ _11 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ _8 = _11; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 ++ StorageDead(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 ++ StorageDead(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 ++ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 + nop; // scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +4:2 + StorageDead(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff similarity index 100% rename from tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff rename to tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-abort.mir similarity index 100% rename from tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir rename to tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-abort.mir diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-unwind.mir similarity index 100% rename from tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir rename to tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-unwind.mir diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-abort.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-abort.mir new file mode 100644 index 00000000000..5bea94c7fe8 --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-abort.mir @@ -0,0 +1,18 @@ +// MIR for `main` after SimplifyLocals-final + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + scope 1 { + debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + scope 2 { + debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 3 { + debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } +} diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-unwind.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-unwind.mir new file mode 100644 index 00000000000..5bea94c7fe8 --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-unwind.mir @@ -0,0 +1,18 @@ +// MIR for `main` after SimplifyLocals-final + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + scope 1 { + debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + scope 2 { + debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 3 { + debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } +} diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..d150a57a898 --- /dev/null +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -0,0 +1,137 @@ +// MIR for `forward_loop` after PreCodegen + +fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { + debug start => _1; // in scope 0 at $DIR/range_iter.rs:+0:21: +0:26 + debug end => _2; // in scope 0 at $DIR/range_iter.rs:+0:33: +0:36 + debug f => _3; // in scope 0 at $DIR/range_iter.rs:+0:43: +0:44 + let mut _0: (); // return place in scope 0 at $DIR/range_iter.rs:+0:60: +0:60 + let mut _4: std::ops::Range; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + let mut _5: std::ops::Range; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + let mut _6: &mut std::ops::Range; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + let mut _12: std::option::Option; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + let mut _15: isize; // in scope 0 at $DIR/range_iter.rs:+1:5: +3:6 + let mut _17: &impl Fn(u32); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:10 + let mut _18: (u32,); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:13 + let _19: (); // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + scope 1 { + debug iter => _5; // in scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + let _16: u32; // in scope 1 at $DIR/range_iter.rs:+1:9: +1:10 + scope 2 { + debug x => _16; // in scope 2 at $DIR/range_iter.rs:+1:9: +1:10 + } + scope 4 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:22:14: 22:24 + debug self => _6; // in scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 5 (inlined as iter::range::RangeIteratorImpl>::spec_next) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL + debug self => _6; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _7: &u32; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _8: &u32; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _11: bool; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let _13: u32; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _14: u32; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 6 { + debug old => _13; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 7 { + } + } + scope 8 (inlined cmp::impls::::lt) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL + debug self => _7; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _8; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _9: u32; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _10: u32; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + } + } + } + } + scope 3 (inlined as IntoIterator>::into_iter) { // at $DIR/range_iter.rs:22:14: 22:24 + debug self => _4; // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + _4 = std::ops::Range:: { start: _1, end: _2 }; // scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + StorageLive(_5); // scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + _5 = move _4; // scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6 + } + + bb1: { + StorageLive(_12); // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + _6 = &mut _5; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + StorageLive(_13); // scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_11); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_7); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _7 = &((*_6).0: u32); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_8); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _8 = &((*_6).1: u32); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_9); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + _9 = (*_7); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_10); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + _10 = (*_8); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + _11 = Lt(move _9, move _10); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_10); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_9); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_8); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_7); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + switchInt(move _11) -> [0: bb2, otherwise: bb3]; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb2: { + _12 = Option::::None; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + goto -> bb5; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb3: { + _13 = ((*_6).0: u32); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_14); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _14 = ::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind unreachable]; // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: unsafe fn(u32, usize) -> u32 {::forward_unchecked}, val: Value() } + } + + bb4: { + ((*_6).0: u32) = move _14; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_14); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _12 = Option::::Some(_13); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + goto -> bb5; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb5: { + StorageDead(_11); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_13); // scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _15 = discriminant(_12); // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10]; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + } + + bb6: { + StorageDead(_12); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6 + StorageDead(_5); // scope 0 at $DIR/range_iter.rs:+3:5: +3:6 + drop(_3) -> [return: bb7, unwind unreachable]; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2 + } + + bb7: { + return; // scope 0 at $DIR/range_iter.rs:+4:2: +4:2 + } + + bb8: { + _16 = ((_12 as Some).0: u32); // scope 1 at $DIR/range_iter.rs:+1:9: +1:10 + StorageLive(_17); // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 + _17 = &_3; // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 + StorageLive(_18); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + _18 = (_16,); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + _19 = >::call(move _17, move _18) -> [return: bb9, unwind unreachable]; // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + // mir::Constant + // + span: $DIR/range_iter.rs:23:9: 23:10 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(u32), (u32,)) -> >::Output {>::call}, val: Value() } + } + + bb9: { + StorageDead(_18); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13 + StorageDead(_17); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13 + StorageDead(_12); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6 + goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6 + } + + bb10: { + unreachable; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + } +} diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir similarity index 98% rename from tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir rename to tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir index 06a4e35f1f9..28ec230619f 100644 --- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -19,7 +19,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { scope 2 { debug x => _16; // in scope 2 at $DIR/range_iter.rs:+1:9: +1:10 } - scope 4 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:21:14: 21:24 + scope 4 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:22:14: 22:24 debug self => _6; // in scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL scope 5 (inlined as iter::range::RangeIteratorImpl>::spec_next) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL debug self => _6; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL @@ -42,7 +42,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { } } } - scope 3 (inlined as IntoIterator>::into_iter) { // at $DIR/range_iter.rs:21:14: 21:24 + scope 3 (inlined as IntoIterator>::into_iter) { // at $DIR/range_iter.rs:22:14: 22:24 debug self => _4; // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL } @@ -120,7 +120,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { _18 = (_16,); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 _19 = >::call(move _17, move _18) -> [return: bb9, unwind: bb11]; // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 // mir::Constant - // + span: $DIR/range_iter.rs:22:9: 22:10 + // + span: $DIR/range_iter.rs:23:9: 23:10 // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(u32), (u32,)) -> >::Output {>::call}, val: Value() } } 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 new file mode 100644 index 00000000000..e242f519c5d --- /dev/null +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir @@ -0,0 +1,87 @@ +// MIR for `inclusive_loop` after PreCodegen + +fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { + debug start => _1; // in scope 0 at $DIR/range_iter.rs:+0:23: +0:28 + debug end => _2; // in scope 0 at $DIR/range_iter.rs:+0:35: +0:38 + debug f => _3; // in scope 0 at $DIR/range_iter.rs:+0:45: +0:46 + let mut _0: (); // return place in scope 0 at $DIR/range_iter.rs:+0:62: +0:62 + let mut _4: std::ops::RangeInclusive; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 + let mut _5: std::ops::RangeInclusive; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 + let mut _6: &mut std::ops::RangeInclusive; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 + let mut _7: std::option::Option; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 + let mut _8: isize; // in scope 0 at $DIR/range_iter.rs:+1:5: +3:6 + let mut _10: &impl Fn(u32); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:10 + let mut _11: (u32,); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:13 + let _12: (); // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 + scope 1 { + debug iter => _5; // in scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + let _9: u32; // in scope 1 at $DIR/range_iter.rs:+1:9: +1:10 + scope 2 { + debug x => _9; // in scope 2 at $DIR/range_iter.rs:+1:9: +1:10 + } + scope 5 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:29:14: 29:25 + debug self => _6; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + } + scope 3 (inlined RangeInclusive::::new) { // at $DIR/range_iter.rs:29:14: 29:25 + debug start => _1; // in scope 3 at $SRC_DIR/core/src/ops/range.rs:LL:COL + debug end => _2; // in scope 3 at $SRC_DIR/core/src/ops/range.rs:LL:COL + } + scope 4 (inlined as IntoIterator>::into_iter) { // at $DIR/range_iter.rs:29:14: 29:25 + debug self => _4; // in scope 4 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + _4 = RangeInclusive:: { start: _1, end: _2, exhausted: const false }; // scope 3 at $SRC_DIR/core/src/ops/range.rs:LL:COL + StorageLive(_5); // scope 0 at $DIR/range_iter.rs:+1:14: +1:25 + _5 = move _4; // scope 0 at $DIR/range_iter.rs:+1:14: +1:25 + goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6 + } + + bb1: { + StorageLive(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + _6 = &mut _5; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + _7 = as iter::range::RangeInclusiveIteratorImpl>::spec_next(_6) -> [return: bb2, unwind unreachable]; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut RangeInclusive) -> Option< as iter::range::RangeInclusiveIteratorImpl>::Item> { as iter::range::RangeInclusiveIteratorImpl>::spec_next}, val: Value() } + } + + bb2: { + _8 = discriminant(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb7]; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + } + + bb3: { + StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6 + StorageDead(_5); // scope 0 at $DIR/range_iter.rs:+3:5: +3:6 + drop(_3) -> [return: bb4, unwind unreachable]; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2 + } + + bb4: { + return; // scope 0 at $DIR/range_iter.rs:+4:2: +4:2 + } + + bb5: { + _9 = ((_7 as Some).0: u32); // scope 1 at $DIR/range_iter.rs:+1:9: +1:10 + StorageLive(_10); // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 + _10 = &_3; // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 + StorageLive(_11); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + _11 = (_9,); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + _12 = >::call(move _10, move _11) -> [return: bb6, unwind unreachable]; // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + // mir::Constant + // + span: $DIR/range_iter.rs:30:9: 30:10 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(u32), (u32,)) -> >::Output {>::call}, val: Value() } + } + + bb6: { + StorageDead(_11); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13 + StorageDead(_10); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13 + StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6 + goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6 + } + + bb7: { + unreachable; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + } +} diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir similarity index 97% rename from tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir rename to tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir index a187d650a77..e24bcb3045d 100644 --- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir @@ -19,15 +19,15 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { scope 2 { debug x => _9; // in scope 2 at $DIR/range_iter.rs:+1:9: +1:10 } - scope 5 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:28:14: 28:25 + scope 5 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:29:14: 29:25 debug self => _6; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL } } - scope 3 (inlined RangeInclusive::::new) { // at $DIR/range_iter.rs:28:14: 28:25 + scope 3 (inlined RangeInclusive::::new) { // at $DIR/range_iter.rs:29:14: 29:25 debug start => _1; // in scope 3 at $SRC_DIR/core/src/ops/range.rs:LL:COL debug end => _2; // in scope 3 at $SRC_DIR/core/src/ops/range.rs:LL:COL } - scope 4 (inlined as IntoIterator>::into_iter) { // at $DIR/range_iter.rs:28:14: 28:25 + scope 4 (inlined as IntoIterator>::into_iter) { // at $DIR/range_iter.rs:29:14: 29:25 debug self => _4; // in scope 4 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL } @@ -70,7 +70,7 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { _11 = (_9,); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 _12 = >::call(move _10, move _11) -> [return: bb6, unwind: bb8]; // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 // mir::Constant - // + span: $DIR/range_iter.rs:29:9: 29:10 + // + span: $DIR/range_iter.rs:30:9: 30:10 // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(u32), (u32,)) -> >::Output {>::call}, val: Value() } } diff --git a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..347ccba28c5 --- /dev/null +++ b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir @@ -0,0 +1,20 @@ +// MIR for `range_inclusive_iter_next` after PreCodegen + +fn range_inclusive_iter_next(_1: &mut RangeInclusive) -> Option { + debug it => _1; // in scope 0 at $DIR/range_iter.rs:+0:34: +0:36 + let mut _0: std::option::Option; // return place in scope 0 at $DIR/range_iter.rs:+0:67: +0:78 + scope 1 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:17:8: 17:14 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb0: { + _0 = as iter::range::RangeInclusiveIteratorImpl>::spec_next(_1) -> [return: bb1, unwind unreachable]; // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut RangeInclusive) -> Option< as iter::range::RangeInclusiveIteratorImpl>::Item> { as iter::range::RangeInclusiveIteratorImpl>::spec_next}, val: Value() } + } + + bb1: { + return; // scope 0 at $DIR/range_iter.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir similarity index 95% rename from tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.mir rename to tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir index d013b1b9462..e5f257d199d 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir @@ -3,7 +3,7 @@ fn range_inclusive_iter_next(_1: &mut RangeInclusive) -> Option { debug it => _1; // in scope 0 at $DIR/range_iter.rs:+0:34: +0:36 let mut _0: std::option::Option; // return place in scope 0 at $DIR/range_iter.rs:+0:67: +0:78 - scope 1 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:16:8: 16:14 + scope 1 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:17:8: 17:14 debug self => _1; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL } diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..35f85f173ea --- /dev/null +++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir @@ -0,0 +1,74 @@ +// MIR for `range_iter_next` after PreCodegen + +fn range_iter_next(_1: &mut std::ops::Range) -> Option { + debug it => _1; // in scope 0 at $DIR/range_iter.rs:+0:24: +0:26 + let mut _0: std::option::Option; // return place in scope 0 at $DIR/range_iter.rs:+0:48: +0:59 + scope 1 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:12:8: 12:14 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 2 (inlined as iter::range::RangeIteratorImpl>::spec_next) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL + debug self => _1; // in scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _2: &u32; // in scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _3: &u32; // in scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _6: bool; // in scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let _7: u32; // in scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _8: u32; // in scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 3 { + debug old => _7; // in scope 3 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 4 { + } + } + scope 5 (inlined cmp::impls::::lt) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL + debug self => _2; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _3; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _4: u32; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _5: u32; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + } + } + } + + bb0: { + StorageLive(_7); // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_6); // scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_2); // scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _2 = &((*_1).0: u32); // scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_3); // scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _3 = &((*_1).1: u32); // scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_4); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + _4 = (*_2); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_5); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + _5 = (*_3); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + _6 = Lt(move _4, move _5); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_5); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_4); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_3); // scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_2); // scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + switchInt(move _6) -> [0: bb1, otherwise: bb2]; // scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb1: { + _0 = Option::::None; // scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + goto -> bb4; // scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb2: { + _7 = ((*_1).0: u32); // scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_8); // scope 3 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _8 = ::forward_unchecked(_7, const 1_usize) -> [return: bb3, unwind unreachable]; // scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: unsafe fn(u32, usize) -> u32 {::forward_unchecked}, val: Value() } + } + + bb3: { + ((*_1).0: u32) = move _8; // scope 3 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_8); // scope 3 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _0 = Option::::Some(_7); // scope 3 at $SRC_DIR/core/src/iter/range.rs:LL:COL + goto -> bb4; // scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb4: { + StorageDead(_6); // scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_7); // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + return; // scope 0 at $DIR/range_iter.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir similarity index 98% rename from tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.mir rename to tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir index f15722deee0..09b9539681f 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir @@ -3,7 +3,7 @@ fn range_iter_next(_1: &mut std::ops::Range) -> Option { debug it => _1; // in scope 0 at $DIR/range_iter.rs:+0:24: +0:26 let mut _0: std::option::Option; // return place in scope 0 at $DIR/range_iter.rs:+0:48: +0:59 - scope 1 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:11:8: 11:14 + scope 1 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:12:8: 12:14 debug self => _1; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL scope 2 (inlined as iter::range::RangeIteratorImpl>::spec_next) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL debug self => _1; // in scope 2 at $SRC_DIR/core/src/iter/range.rs:LL:COL diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir similarity index 99% rename from tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir rename to tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir index 6c306280536..0e2821ab5fc 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir @@ -4,7 +4,7 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:28: +0:33 debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:47: +0:52 let mut _0: std::option::Option<&mut u32>; // return place in scope 0 at $DIR/slice_index.rs:+0:64: +0:80 - scope 1 (inlined core::slice::::get_mut::) { // at $DIR/slice_index.rs:16:11: 16:25 + scope 1 (inlined core::slice::::get_mut::) { // at $DIR/slice_index.rs:17:11: 17:25 debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL scope 2 (inlined >::get_mut) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL 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 new file mode 100644 index 00000000000..0e2821ab5fc --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir @@ -0,0 +1,99 @@ +// MIR for `slice_get_mut_usize` after PreCodegen + +fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { + debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:28: +0:33 + debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:47: +0:52 + let mut _0: std::option::Option<&mut u32>; // return place in scope 0 at $DIR/slice_index.rs:+0:64: +0:80 + scope 1 (inlined core::slice::::get_mut::) { // at $DIR/slice_index.rs:17:11: 17:25 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + scope 2 (inlined >::get_mut) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug self => _2; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug slice => _1; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _3: &[u32]; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _4: usize; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _5: bool; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _6: *mut [u32]; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _8: *mut u32; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _9: &mut u32; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + scope 3 { + scope 4 (inlined >::get_unchecked_mut) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug self => _2; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug slice => _6; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _7: *mut u32; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL + scope 5 { + debug this => _2; // in scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + scope 6 { + scope 7 (inlined >::get_unchecked_mut::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug this => _2; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug slice => _6; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 8 (inlined ptr::mut_ptr::::len) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug self => _6; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _10: *const [u32]; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 9 (inlined std::ptr::metadata::<[u32]>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _10; // in scope 9 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + scope 10 { + } + } + } + } + scope 11 (inlined ptr::mut_ptr::::as_mut_ptr) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug self => _6; // in scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + scope 12 (inlined ptr::mut_ptr::::add) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug self => _7; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug count => _2; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 13 { + } + } + } + } + } + } + } + } + + bb0: { + StorageLive(_9); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_5); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_3); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _3 = &(*_1); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _4 = Len((*_3)); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_3); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _5 = Lt(_2, move _4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + switchInt(move _5) -> [0: bb1, otherwise: bb2]; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + } + + bb1: { + _0 = const Option::<&mut u32>::None; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: Option<&mut u32>, val: Value(Scalar(0x0000000000000000)) } + goto -> bb3; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + } + + bb2: { + StorageLive(_8); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_6); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _6 = &raw mut (*_1); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_10); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_7); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _7 = _6 as *mut u32 (PtrToPtr); // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + _8 = Offset(_7, _2); // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_10); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_6); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _9 = &mut (*_8); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _0 = Option::<&mut u32>::Some(_9); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_8); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + goto -> bb3; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + } + + bb3: { + StorageDead(_5); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_9); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir similarity index 99% rename from tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir rename to tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir index 727ccc1de53..646d88ded52 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir @@ -6,7 +6,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> let mut _0: &mut [u32]; // return place in scope 0 at $DIR/slice_index.rs:+0:88: +0:98 let mut _3: usize; // in scope 0 at $DIR/slice_index.rs:+1:29: +1:34 let mut _4: usize; // in scope 0 at $DIR/slice_index.rs:+1:29: +1:34 - scope 1 (inlined core::slice::::get_unchecked_mut::>) { // at $DIR/slice_index.rs:26:11: 26:35 + scope 1 (inlined core::slice::::get_unchecked_mut::>) { // at $DIR/slice_index.rs:27:11: 27:35 debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL debug index => std::ops::Range{ .0 => _3, .1 => _4, }; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL let mut _5: *mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL 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 new file mode 100644 index 00000000000..646d88ded52 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir @@ -0,0 +1,123 @@ +// MIR for `slice_get_unchecked_mut_range` after PreCodegen + +fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> &mut [u32] { + debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:45: +0:50 + debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:64: +0:69 + let mut _0: &mut [u32]; // return place in scope 0 at $DIR/slice_index.rs:+0:88: +0:98 + let mut _3: usize; // in scope 0 at $DIR/slice_index.rs:+1:29: +1:34 + let mut _4: usize; // in scope 0 at $DIR/slice_index.rs:+1:29: +1:34 + scope 1 (inlined core::slice::::get_unchecked_mut::>) { // at $DIR/slice_index.rs:27:11: 27:35 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug index => std::ops::Range{ .0 => _3, .1 => _4, }; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _5: *mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _14: *mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + scope 2 { + scope 3 (inlined as SliceIndex<[u32]>>::get_unchecked_mut) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug self => std::ops::Range{ .0 => _3, .1 => _4, }; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug slice => _5; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _7: *mut u32; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _8: *mut u32; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _9: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let _16: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let _17: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + scope 4 { + debug this => std::ops::Range{ .0 => _16, .1 => _17, }; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL + scope 5 { + let _6: usize; // in scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + scope 6 { + debug new_len => _6; // in scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + scope 11 (inlined ptr::mut_ptr::::as_mut_ptr) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug self => _5; // in scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + scope 12 (inlined ptr::mut_ptr::::add) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug self => _7; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug count => _3; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 13 { + } + } + scope 14 (inlined slice_from_raw_parts_mut::) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug data => _8; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug len => _9; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + let mut _10: *mut (); // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 15 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug self => _8; // in scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + scope 16 (inlined std::ptr::from_raw_parts_mut::<[u32]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug data_address => _10; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + debug metadata => _9; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _11: *const (); // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _12: std::ptr::metadata::PtrComponents<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _13: std::ptr::metadata::PtrRepr<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + scope 17 { + } + } + } + } + scope 7 (inlined as SliceIndex<[T]>>::get_unchecked_mut::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug this => std::ops::Range{ .0 => _16, .1 => _17, }; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug slice => _5; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 8 (inlined ptr::mut_ptr::::len) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug self => _5; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _15: *const [u32]; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 9 (inlined std::ptr::metadata::<[u32]>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _15; // in scope 9 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + scope 10 { + } + } + } + } + } + } + } + } + } + + bb0: { + _3 = move (_2.0: usize); // scope 0 at $DIR/slice_index.rs:+1:29: +1:34 + _4 = move (_2.1: usize); // scope 0 at $DIR/slice_index.rs:+1:29: +1:34 + StorageLive(_14); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_5); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _5 = &raw mut (*_1); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_15); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_16); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_17); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_6); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _6 = unchecked_sub::(_4, _3) -> [return: bb1, unwind unreachable]; // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/slice/index.rs:LL:COL + // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize, usize) -> usize {unchecked_sub::}, val: Value() } + } + + bb1: { + StorageLive(_8); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_7); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _7 = _5 as *mut u32 (PtrToPtr); // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + _8 = Offset(_7, _3); // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _9 = _6; // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_10); // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + _10 = _8 as *mut () (PtrToPtr); // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageLive(_13); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageLive(_12); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageLive(_11); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _11 = _10 as *const () (Pointer(MutToConstPointer)); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _12 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _11, metadata: _9 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_11); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _13 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _12 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_12); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _14 = (_13.1: *mut [u32]); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_13); // scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_10); // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_8); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_6); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_17); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_16); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_15); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_5); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _0 = &mut (*_14); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_14); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..4739693d259 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir @@ -0,0 +1,26 @@ +// MIR for `slice_index_range` after PreCodegen + +fn slice_index_range(_1: &[u32], _2: std::ops::Range) -> &[u32] { + debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:26: +0:31 + debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:41: +0:46 + let mut _0: &[u32]; // return place in scope 0 at $DIR/slice_index.rs:+0:65: +0:71 + scope 1 (inlined #[track_caller] core::slice::index::> for [u32]>::index) { // at $DIR/slice_index.rs:22:6: 22:18 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let _3: &[u32]; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + } + + bb0: { + StorageLive(_3); // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _3 = as SliceIndex<[u32]>>::index(move _2, _1) -> [return: bb1, unwind unreachable]; // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/slice/index.rs:LL:COL + // + literal: Const { ty: for<'a> fn(std::ops::Range, &'a [u32]) -> &'a as SliceIndex<[u32]>>::Output { as SliceIndex<[u32]>>::index}, val: Value() } + } + + bb1: { + _0 = _3; // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_3); // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir similarity index 98% rename from tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir rename to tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir index dcf79a4a4e7..3136282c827 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir @@ -4,7 +4,7 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range) -> &[u32] { debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:26: +0:31 debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:41: +0:46 let mut _0: &[u32]; // return place in scope 0 at $DIR/slice_index.rs:+0:65: +0:71 - scope 1 (inlined #[track_caller] core::slice::index::> for [u32]>::index) { // at $DIR/slice_index.rs:21:6: 21:18 + scope 1 (inlined #[track_caller] core::slice::index::> for [u32]>::index) { // at $DIR/slice_index.rs:22:6: 22:18 debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL let _3: &[u32]; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..d3a64d5feb5 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir @@ -0,0 +1,20 @@ +// MIR for `slice_index_usize` after PreCodegen + +fn slice_index_usize(_1: &[u32], _2: usize) -> u32 { + debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:26: +0:31 + debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:41: +0:46 + let mut _0: u32; // return place in scope 0 at $DIR/slice_index.rs:+0:58: +0:61 + let mut _3: usize; // in scope 0 at $DIR/slice_index.rs:+1:5: +1:17 + let mut _4: bool; // in scope 0 at $DIR/slice_index.rs:+1:5: +1:17 + + bb0: { + _3 = Len((*_1)); // scope 0 at $DIR/slice_index.rs:+1:5: +1:17 + _4 = Lt(_2, _3); // scope 0 at $DIR/slice_index.rs:+1:5: +1:17 + assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, _2) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/slice_index.rs:+1:5: +1:17 + } + + bb1: { + _0 = (*_1)[_2]; // scope 0 at $DIR/slice_index.rs:+1:5: +1:17 + return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.mir rename to tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..e1446291bff --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir @@ -0,0 +1,205 @@ +// MIR for `enumerated_loop` after PreCodegen + +fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { + debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:31: +0:36 + debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:47: +0:48 + let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:70: +0:70 + let mut _13: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:31 + let mut _14: std::iter::Enumerate>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + let mut _15: std::iter::Enumerate>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + let mut _16: &mut std::iter::Enumerate>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + let mut _17: std::option::Option<(usize, &T)>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + let mut _18: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6 + let mut _21: &impl Fn(usize, &T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10 + let mut _22: (usize, &T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:16 + let _23: (); // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + scope 1 { + debug iter => _15; // in scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + let _19: usize; // in scope 1 at $DIR/slice_iter.rs:+1:10: +1:11 + let _20: &T; // in scope 1 at $DIR/slice_iter.rs:+1:13: +1:14 + scope 2 { + debug i => _19; // in scope 2 at $DIR/slice_iter.rs:+1:10: +1:11 + debug x => _20; // in scope 2 at $DIR/slice_iter.rs:+1:13: +1:14 + } + } + scope 3 (inlined core::slice::::iter) { // at $DIR/slice_iter.rs:43:25: 43:31 + debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let _4: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _5: bool; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _6: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _8: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _9: *mut T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _11: std::ptr::NonNull; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _12: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 5 { + debug ptr => _4; // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 6 { + let _7: *const T; // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 7 { + debug end => _7; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 13 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug ptr => _9; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _10: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + scope 14 { + scope 15 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug ptr => _9; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 16 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + debug self => _9; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _24: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 17 { + scope 18 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _24; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 19 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _24; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 20 { + scope 21 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _24; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + } + } + } + } + } + } + } + } + } + scope 9 (inlined invalid::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug addr => _8; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 10 { + } + } + scope 11 (inlined ptr::const_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _4; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + debug count => _6; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + scope 12 { + } + } + } + } + scope 8 (inlined core::slice::::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _1; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _3: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + } + } + } + scope 22 (inlined as Iterator>::enumerate) { // at $DIR/slice_iter.rs:43:32: 43:43 + debug self => _13; // in scope 22 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + scope 23 (inlined Enumerate::>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + debug iter => _13; // in scope 23 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL + } + } + scope 24 (inlined > as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:43:19: 43:43 + debug self => _14; // in scope 24 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_13); // scope 0 at $DIR/slice_iter.rs:+1:19: +1:31 + StorageLive(_4); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_3); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _3 = &raw const (*_1); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _4 = move _3 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_3); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_7); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_5); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _5 = const _; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + switchInt(move _5) -> [0: bb1, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb1: { + StorageLive(_6); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _6 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _7 = Offset(_4, _6); // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + StorageDead(_6); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb2: { + StorageLive(_8); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _8 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _7 = _8 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_8); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb3: { + StorageDead(_5); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_11); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_9); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _9 = _4 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _10 = _9 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _11 = NonNull:: { pointer: _10 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_9); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_12); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _12 = _7; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _13 = std::slice::Iter::<'_, T> { ptr: move _11, end: move _12, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: PhantomData<&T>, val: Value() } + // adt + // + user_ty: UserType(1) + StorageDead(_12); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_11); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_4); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _14 = Enumerate::> { iter: move _13, count: const 0_usize }; // scope 23 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL + StorageDead(_13); // scope 0 at $DIR/slice_iter.rs:+1:42: +1:43 + StorageLive(_15); // scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + _15 = move _14; // scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + goto -> bb4; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } + + bb4: { + StorageLive(_17); // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + _16 = &mut _15; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + _17 = > as Iterator>::next(_16) -> [return: bb5, unwind unreachable]; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + // mir::Constant + // + span: $DIR/slice_iter.rs:43:19: 43:43 + // + literal: Const { ty: for<'a> fn(&'a mut Enumerate>) -> Option<> as Iterator>::Item> {> as Iterator>::next}, val: Value() } + } + + bb5: { + _18 = discriminant(_17); // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + } + + bb6: { + StorageDead(_17); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + StorageDead(_15); // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6 + drop(_2) -> [return: bb7, unwind unreachable]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 + } + + bb7: { + return; // scope 0 at $DIR/slice_iter.rs:+4:2: +4:2 + } + + bb8: { + _19 = (((_17 as Some).0: (usize, &T)).0: usize); // scope 1 at $DIR/slice_iter.rs:+1:10: +1:11 + _20 = (((_17 as Some).0: (usize, &T)).1: &T); // scope 1 at $DIR/slice_iter.rs:+1:13: +1:14 + StorageLive(_21); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + _21 = &_2; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + StorageLive(_22); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:16 + _22 = (_19, _20); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:16 + _23 = >::call(move _21, move _22) -> [return: bb9, unwind unreachable]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:16 + // mir::Constant + // + span: $DIR/slice_iter.rs:44:9: 44:10 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(usize, &T), (usize, &T)) -> >::Output {>::call}, val: Value() } + } + + bb9: { + StorageDead(_22); // scope 2 at $DIR/slice_iter.rs:+2:15: +2:16 + StorageDead(_21); // scope 2 at $DIR/slice_iter.rs:+2:15: +2:16 + StorageDead(_17); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + goto -> bb4; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } + + bb10: { + unreachable; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir similarity index 98% rename from tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir rename to tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir index 4dd11c1e529..f35ea0fa057 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir @@ -22,7 +22,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug x => _20; // in scope 2 at $DIR/slice_iter.rs:+1:13: +1:14 } } - scope 3 (inlined core::slice::::iter) { // at $DIR/slice_iter.rs:42:25: 42:31 + scope 3 (inlined core::slice::::iter) { // at $DIR/slice_iter.rs:43:25: 43:31 debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL @@ -85,13 +85,13 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } } } - scope 22 (inlined as Iterator>::enumerate) { // at $DIR/slice_iter.rs:42:32: 42:43 + scope 22 (inlined as Iterator>::enumerate) { // at $DIR/slice_iter.rs:43:32: 43:43 debug self => _13; // in scope 22 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL scope 23 (inlined Enumerate::>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL debug iter => _13; // in scope 23 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL } } - scope 24 (inlined > as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:42:19: 42:43 + scope 24 (inlined > as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:43:19: 43:43 debug self => _14; // in scope 24 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL } @@ -160,7 +160,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { _16 = &mut _15; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 _17 = > as Iterator>::next(_16) -> [return: bb5, unwind: bb11]; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 // mir::Constant - // + span: $DIR/slice_iter.rs:42:19: 42:43 + // + span: $DIR/slice_iter.rs:43:19: 43:43 // + literal: Const { ty: for<'a> fn(&'a mut Enumerate>) -> Option<> as Iterator>::Item> {> as Iterator>::next}, val: Value() } } @@ -188,7 +188,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { _22 = (_19, _20); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:16 _23 = >::call(move _21, move _22) -> [return: bb9, unwind: bb11]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:16 // mir::Constant - // + span: $DIR/slice_iter.rs:43:9: 43:10 + // + span: $DIR/slice_iter.rs:44:9: 44:10 // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(usize, &T), (usize, &T)) -> >::Output {>::call}, val: Value() } } 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 new file mode 100644 index 00000000000..1ffda32509e --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -0,0 +1,192 @@ +// MIR for `forward_loop` after PreCodegen + +fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { + debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:28: +0:33 + debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:44: +0:45 + let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:60: +0:60 + let mut _13: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let mut _14: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let mut _15: &mut std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let mut _16: std::option::Option<&T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let mut _17: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6 + let mut _19: &impl Fn(&T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10 + let mut _20: (&T,); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:13 + let _21: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + scope 1 { + debug iter => _14; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + let _18: &T; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + scope 2 { + debug x => _18; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 + } + } + scope 3 (inlined core::slice::::iter) { // at $DIR/slice_iter.rs:29:20: 29:26 + debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let _4: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _5: bool; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _6: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _8: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _9: *mut T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _11: std::ptr::NonNull; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _12: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 5 { + debug ptr => _4; // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 6 { + let _7: *const T; // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 7 { + debug end => _7; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 13 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug ptr => _9; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _10: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + scope 14 { + scope 15 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug ptr => _9; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 16 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + debug self => _9; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _22: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 17 { + scope 18 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _22; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 19 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _22; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 20 { + scope 21 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _22; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + } + } + } + } + } + } + } + } + } + scope 9 (inlined invalid::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug addr => _8; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 10 { + } + } + scope 11 (inlined ptr::const_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _4; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + debug count => _6; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + scope 12 { + } + } + } + } + scope 8 (inlined core::slice::::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _1; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _3: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + } + } + } + scope 22 (inlined as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:29:14: 29:26 + debug self => _13; // in scope 22 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_4); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_3); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _3 = &raw const (*_1); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _4 = move _3 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_3); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_7); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_5); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _5 = const _; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + switchInt(move _5) -> [0: bb1, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb1: { + StorageLive(_6); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _6 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _7 = Offset(_4, _6); // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + StorageDead(_6); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb2: { + StorageLive(_8); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _8 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _7 = _8 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_8); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb3: { + StorageDead(_5); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_11); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_9); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _9 = _4 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _10 = _9 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _11 = NonNull:: { pointer: _10 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_9); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_12); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _12 = _7; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _13 = std::slice::Iter::<'_, T> { ptr: move _11, end: move _12, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: PhantomData<&T>, val: Value() } + // adt + // + user_ty: UserType(1) + StorageDead(_12); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_11); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_4); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_14); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + _14 = move _13; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + goto -> bb4; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } + + bb4: { + StorageLive(_16); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + _15 = &mut _14; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + _16 = as Iterator>::next(_15) -> [return: bb5, unwind unreachable]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + // mir::Constant + // + span: $DIR/slice_iter.rs:29:14: 29:26 + // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } + } + + bb5: { + _17 = discriminant(_16); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + } + + bb6: { + StorageDead(_16); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + StorageDead(_14); // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6 + drop(_2) -> [return: bb7, unwind unreachable]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 + } + + bb7: { + return; // scope 0 at $DIR/slice_iter.rs:+4:2: +4:2 + } + + bb8: { + _18 = ((_16 as Some).0: &T); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + StorageLive(_19); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + _19 = &_2; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + StorageLive(_20); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + _20 = (_18,); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + _21 = >::call(move _19, move _20) -> [return: bb9, unwind unreachable]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + // mir::Constant + // + span: $DIR/slice_iter.rs:30:9: 30:10 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(&T), (&T,)) -> >::Output {>::call}, val: Value() } + } + + bb9: { + StorageDead(_20); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 + StorageDead(_19); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 + StorageDead(_16); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + goto -> bb4; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } + + bb10: { + unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir similarity index 99% rename from tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir rename to tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir index 0c18fb84bcd..899e5f58a98 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -19,7 +19,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { debug x => _18; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 } } - scope 3 (inlined core::slice::::iter) { // at $DIR/slice_iter.rs:28:20: 28:26 + scope 3 (inlined core::slice::::iter) { // at $DIR/slice_iter.rs:29:20: 29:26 debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL @@ -82,7 +82,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } } } - scope 22 (inlined as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:28:14: 28:26 + scope 22 (inlined as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:29:14: 29:26 debug self => _13; // in scope 22 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL } @@ -148,7 +148,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { _15 = &mut _14; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 _16 = as Iterator>::next(_15) -> [return: bb5, unwind: bb11]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 // mir::Constant - // + span: $DIR/slice_iter.rs:28:14: 28:26 + // + span: $DIR/slice_iter.rs:29:14: 29:26 // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } } @@ -175,7 +175,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { _20 = (_18,); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 _21 = >::call(move _19, move _20) -> [return: bb9, unwind: bb11]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 // mir::Constant - // + span: $DIR/slice_iter.rs:29:9: 29:10 + // + span: $DIR/slice_iter.rs:30:9: 30:10 // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(&T), (&T,)) -> >::Output {>::call}, val: Value() } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..119b68bdac4 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir @@ -0,0 +1,153 @@ +// MIR for `range_loop` after PreCodegen + +fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { + debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:26: +0:31 + debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:42: +0:43 + let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:65: +0:65 + let mut _3: usize; // in scope 0 at $DIR/slice_iter.rs:+1:17: +1:28 + let mut _4: std::ops::Range; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + let mut _5: std::ops::Range; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + let mut _6: &mut std::ops::Range; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + let mut _12: std::option::Option; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + let mut _15: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +4:6 + let mut _17: usize; // in scope 0 at $DIR/slice_iter.rs:+2:18: +2:26 + let mut _18: bool; // in scope 0 at $DIR/slice_iter.rs:+2:18: +2:26 + let mut _20: &impl Fn(usize, &T); // in scope 0 at $DIR/slice_iter.rs:+3:9: +3:10 + let mut _21: (usize, &T); // in scope 0 at $DIR/slice_iter.rs:+3:9: +3:16 + let _22: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + scope 1 { + debug iter => _5; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + let _16: usize; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + scope 2 { + debug i => _16; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 + let _19: &T; // in scope 2 at $DIR/slice_iter.rs:+2:13: +2:14 + scope 3 { + debug x => _19; // in scope 3 at $DIR/slice_iter.rs:+2:13: +2:14 + } + } + scope 5 (inlined iter::range::>::next) { // at $DIR/slice_iter.rs:50:14: 50:28 + debug self => _6; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 6 (inlined as iter::range::RangeIteratorImpl>::spec_next) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL + debug self => _6; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _7: &usize; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _8: &usize; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _11: bool; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let _13: usize; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _14: usize; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 7 { + debug old => _13; // in scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 8 { + } + } + scope 9 (inlined cmp::impls::::lt) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL + debug self => _7; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _8; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _9: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _10: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + } + } + } + } + scope 4 (inlined as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:50:14: 50:28 + debug self => _4; // in scope 4 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/slice_iter.rs:+1:17: +1:28 + _3 = Len((*_1)); // scope 0 at $DIR/slice_iter.rs:+1:17: +1:28 + _4 = std::ops::Range:: { start: const 0_usize, end: move _3 }; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + StorageDead(_3); // scope 0 at $DIR/slice_iter.rs:+1:27: +1:28 + StorageLive(_5); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + _5 = move _4; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +4:6 + } + + bb1: { + StorageLive(_12); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + _6 = &mut _5; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + StorageLive(_13); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_11); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_7); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _7 = &((*_6).0: usize); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_8); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _8 = &((*_6).1: usize); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_9); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + _9 = (*_7); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_10); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + _10 = (*_8); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + _11 = Lt(move _9, move _10); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_10); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_9); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_8); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + switchInt(move _11) -> [0: bb2, otherwise: bb3]; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb2: { + _12 = Option::::None; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + goto -> bb5; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb3: { + _13 = ((*_6).0: usize); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_14); // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _14 = ::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind unreachable]; // scope 8 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: unsafe fn(usize, usize) -> usize {::forward_unchecked}, val: Value() } + } + + bb4: { + ((*_6).0: usize) = move _14; // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_14); // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _12 = Option::::Some(_13); // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL + goto -> bb5; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb5: { + StorageDead(_11); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_13); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _15 = discriminant(_12); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + } + + bb6: { + StorageDead(_12); // scope 1 at $DIR/slice_iter.rs:+4:5: +4:6 + StorageDead(_5); // scope 0 at $DIR/slice_iter.rs:+4:5: +4:6 + drop(_2) -> [return: bb7, unwind unreachable]; // scope 0 at $DIR/slice_iter.rs:+5:1: +5:2 + } + + bb7: { + return; // scope 0 at $DIR/slice_iter.rs:+5:2: +5:2 + } + + bb8: { + _16 = ((_12 as Some).0: usize); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + _17 = Len((*_1)); // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 + _18 = Lt(_16, _17); // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 + assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb9, unwind unreachable]; // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 + } + + bb9: { + _19 = &(*_1)[_16]; // scope 2 at $DIR/slice_iter.rs:+2:17: +2:26 + StorageLive(_20); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:10 + _20 = &_2; // scope 3 at $DIR/slice_iter.rs:+3:9: +3:10 + StorageLive(_21); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 + _21 = (_16, _19); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 + _22 = >::call(move _20, move _21) -> [return: bb10, unwind unreachable]; // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 + // mir::Constant + // + span: $DIR/slice_iter.rs:52:9: 52:10 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(usize, &T), (usize, &T)) -> >::Output {>::call}, val: Value() } + } + + bb10: { + StorageDead(_21); // scope 3 at $DIR/slice_iter.rs:+3:15: +3:16 + StorageDead(_20); // scope 3 at $DIR/slice_iter.rs:+3:15: +3:16 + StorageDead(_12); // scope 1 at $DIR/slice_iter.rs:+4:5: +4:6 + goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +4:6 + } + + bb11: { + unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir similarity index 98% rename from tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir rename to tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir index 870496f14ea..2ec1ffd875c 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir @@ -25,7 +25,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug x => _19; // in scope 3 at $DIR/slice_iter.rs:+2:13: +2:14 } } - scope 5 (inlined iter::range::>::next) { // at $DIR/slice_iter.rs:49:14: 49:28 + scope 5 (inlined iter::range::>::next) { // at $DIR/slice_iter.rs:50:14: 50:28 debug self => _6; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL scope 6 (inlined as iter::range::RangeIteratorImpl>::spec_next) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL debug self => _6; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL @@ -48,7 +48,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } } } - scope 4 (inlined as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:49:14: 49:28 + scope 4 (inlined as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:50:14: 50:28 debug self => _4; // in scope 4 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL } @@ -136,7 +136,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { _21 = (_16, _19); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 _22 = >::call(move _20, move _21) -> [return: bb10, unwind: bb12]; // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 // mir::Constant - // + span: $DIR/slice_iter.rs:51:9: 51:10 + // + span: $DIR/slice_iter.rs:52:9: 52:10 // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(usize, &T), (usize, &T)) -> >::Output {>::call}, val: Value() } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..bb76212c8ba --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir @@ -0,0 +1,209 @@ +// MIR for `reverse_loop` after PreCodegen + +fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { + debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:28: +0:33 + debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:44: +0:45 + let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:60: +0:60 + let mut _13: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let mut _14: std::iter::Rev>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + let mut _15: std::iter::Rev>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + let mut _16: &mut std::iter::Rev>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + let mut _18: std::option::Option<&T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + let mut _19: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6 + let mut _21: &impl Fn(&T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10 + let mut _22: (&T,); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:13 + let _23: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + scope 1 { + debug iter => _15; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + let _20: &T; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + scope 2 { + debug x => _20; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 + } + scope 25 (inlined > as Iterator>::next) { // at $DIR/slice_iter.rs:36:14: 36:32 + debug self => _16; // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + let mut _17: &mut std::slice::Iter<'_, T>; // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + } + } + scope 3 (inlined core::slice::::iter) { // at $DIR/slice_iter.rs:36:20: 36:26 + debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let _4: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _5: bool; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _6: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _8: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _9: *mut T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _11: std::ptr::NonNull; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _12: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 5 { + debug ptr => _4; // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 6 { + let _7: *const T; // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 7 { + debug end => _7; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 13 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug ptr => _9; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _10: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + scope 14 { + scope 15 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug ptr => _9; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 16 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + debug self => _9; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _24: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 17 { + scope 18 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _24; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 19 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _24; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 20 { + scope 21 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _24; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + } + } + } + } + } + } + } + } + } + scope 9 (inlined invalid::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug addr => _8; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 10 { + } + } + scope 11 (inlined ptr::const_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _4; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + debug count => _6; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + scope 12 { + } + } + } + } + scope 8 (inlined core::slice::::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _1; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _3: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + } + } + } + scope 22 (inlined as Iterator>::rev) { // at $DIR/slice_iter.rs:36:27: 36:32 + debug self => _13; // in scope 22 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + scope 23 (inlined Rev::>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + debug iter => _13; // in scope 23 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + } + } + scope 24 (inlined > as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:36:14: 36:32 + debug self => _14; // in scope 24 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_13); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + StorageLive(_4); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_3); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _3 = &raw const (*_1); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _4 = move _3 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_3); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_7); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_5); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _5 = const _; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + switchInt(move _5) -> [0: bb1, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb1: { + StorageLive(_6); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _6 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _7 = Offset(_4, _6); // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + StorageDead(_6); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb2: { + StorageLive(_8); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _8 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _7 = _8 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_8); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb3: { + StorageDead(_5); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_11); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_9); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _9 = _4 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _10 = _9 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _11 = NonNull:: { pointer: _10 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_9); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_12); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _12 = _7; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _13 = std::slice::Iter::<'_, T> { ptr: move _11, end: move _12, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: PhantomData<&T>, val: Value() } + // adt + // + user_ty: UserType(1) + StorageDead(_12); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_11); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_4); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _14 = Rev::> { iter: move _13 }; // scope 23 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + StorageDead(_13); // scope 0 at $DIR/slice_iter.rs:+1:31: +1:32 + StorageLive(_15); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + _15 = move _14; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + goto -> bb4; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } + + bb4: { + StorageLive(_18); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + _16 = &mut _15; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + StorageLive(_17); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + _17 = &mut ((*_16).0: std::slice::Iter<'_, T>); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + _18 = as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind unreachable]; // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option< as Iterator>::Item> { as DoubleEndedIterator>::next_back}, val: Value() } + } + + bb5: { + StorageDead(_17); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + _19 = discriminant(_18); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + } + + bb6: { + StorageDead(_18); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + StorageDead(_15); // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6 + drop(_2) -> [return: bb7, unwind unreachable]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 + } + + bb7: { + return; // scope 0 at $DIR/slice_iter.rs:+4:2: +4:2 + } + + bb8: { + _20 = ((_18 as Some).0: &T); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + StorageLive(_21); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + _21 = &_2; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + StorageLive(_22); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + _22 = (_20,); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + _23 = >::call(move _21, move _22) -> [return: bb9, unwind unreachable]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + // mir::Constant + // + span: $DIR/slice_iter.rs:37:9: 37:10 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(&T), (&T,)) -> >::Output {>::call}, val: Value() } + } + + bb9: { + StorageDead(_22); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 + StorageDead(_21); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 + StorageDead(_18); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + goto -> bb4; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } + + bb10: { + unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir similarity index 98% rename from tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir rename to tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir index 1aa05cbeb97..6058e5fba59 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir @@ -19,12 +19,12 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { scope 2 { debug x => _20; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 } - scope 25 (inlined > as Iterator>::next) { // at $DIR/slice_iter.rs:35:14: 35:32 + scope 25 (inlined > as Iterator>::next) { // at $DIR/slice_iter.rs:36:14: 36:32 debug self => _16; // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL let mut _17: &mut std::slice::Iter<'_, T>; // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL } } - scope 3 (inlined core::slice::::iter) { // at $DIR/slice_iter.rs:35:20: 35:26 + scope 3 (inlined core::slice::::iter) { // at $DIR/slice_iter.rs:36:20: 36:26 debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL @@ -87,13 +87,13 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } } } - scope 22 (inlined as Iterator>::rev) { // at $DIR/slice_iter.rs:35:27: 35:32 + scope 22 (inlined as Iterator>::rev) { // at $DIR/slice_iter.rs:36:27: 36:32 debug self => _13; // in scope 22 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL scope 23 (inlined Rev::>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL debug iter => _13; // in scope 23 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL } } - scope 24 (inlined > as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:35:14: 35:32 + scope 24 (inlined > as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:36:14: 36:32 debug self => _14; // in scope 24 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL } @@ -192,7 +192,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { _22 = (_20,); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 _23 = >::call(move _21, move _22) -> [return: bb9, unwind: bb11]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 // mir::Constant - // + span: $DIR/slice_iter.rs:36:9: 36:10 + // + span: $DIR/slice_iter.rs:37:9: 37:10 // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(&T), (&T,)) -> >::Output {>::call}, val: Value() } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..bc0257b8db2 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir @@ -0,0 +1,17 @@ +// MIR for `slice_iter_mut_next_back` after PreCodegen + +fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut T> { + debug it => _1; // in scope 0 at $DIR/slice_iter.rs:+0:40: +0:42 + let mut _0: std::option::Option<&mut T>; // return place in scope 0 at $DIR/slice_iter.rs:+0:80: +0:97 + + bb0: { + _0 = as DoubleEndedIterator>::next_back(_1) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/slice_iter.rs:+1:5: +1:19 + // mir::Constant + // + span: $DIR/slice_iter.rs:24:8: 24:17 + // + literal: Const { ty: for<'a> fn(&'a mut std::slice::IterMut<'_, T>) -> Option< as Iterator>::Item> { as DoubleEndedIterator>::next_back}, val: Value() } + } + + bb1: { + return; // scope 0 at $DIR/slice_iter.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir similarity index 98% rename from tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir rename to tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir index a1431d473bc..a1de522826d 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir @@ -7,7 +7,7 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut bb0: { _0 = as DoubleEndedIterator>::next_back(_1) -> bb1; // scope 0 at $DIR/slice_iter.rs:+1:5: +1:19 // mir::Constant - // + span: $DIR/slice_iter.rs:23:8: 23:17 + // + span: $DIR/slice_iter.rs:24:8: 24:17 // + literal: Const { ty: for<'a> fn(&'a mut std::slice::IterMut<'_, T>) -> Option< as Iterator>::Item> { as DoubleEndedIterator>::next_back}, val: Value() } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..1dfcb04c421 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir @@ -0,0 +1,17 @@ +// MIR for `slice_iter_next` after PreCodegen + +fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { + debug it => _1; // in scope 0 at $DIR/slice_iter.rs:+0:31: +0:33 + let mut _0: std::option::Option<&T>; // return place in scope 0 at $DIR/slice_iter.rs:+0:68: +0:81 + + bb0: { + _0 = as Iterator>::next(_1) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/slice_iter.rs:+1:5: +1:14 + // mir::Constant + // + span: $DIR/slice_iter.rs:19:8: 19:12 + // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } + } + + bb1: { + return; // scope 0 at $DIR/slice_iter.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir similarity index 97% rename from tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.mir rename to tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir index d2a963cad12..2aef35e771e 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir @@ -7,7 +7,7 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { bb0: { _0 = as Iterator>::next(_1) -> bb1; // scope 0 at $DIR/slice_iter.rs:+1:5: +1:14 // mir::Constant - // + span: $DIR/slice_iter.rs:18:8: 18:12 + // + span: $DIR/slice_iter.rs:19:8: 19:12 // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } } diff --git a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.diff b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff similarity index 100% rename from tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.diff rename to tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff diff --git a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff new file mode 100644 index 00000000000..0b3da98a5a1 --- /dev/null +++ b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff @@ -0,0 +1,74 @@ +- // MIR for `match_guard` before CleanupPostBorrowck ++ // MIR for `match_guard` after CleanupPostBorrowck + + fn match_guard(_1: Option<&&i32>, _2: bool) -> i32 { + debug x => _1; // in scope 0 at $DIR/remove_fake_borrows.rs:+0:16: +0:17 + debug c => _2; // in scope 0 at $DIR/remove_fake_borrows.rs:+0:34: +0:35 + let mut _0: i32; // return place in scope 0 at $DIR/remove_fake_borrows.rs:+0:46: +0:49 + let mut _3: isize; // in scope 0 at $DIR/remove_fake_borrows.rs:+2:9: +2:16 + let mut _4: &std::option::Option<&&i32>; // in scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 + let mut _5: &&i32; // in scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 + let mut _6: &&&i32; // in scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 + let mut _7: &i32; // in scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 + let mut _8: bool; // in scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 + + bb0: { +- FakeRead(ForMatchedPlace(None), _1); // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 ++ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 + _3 = discriminant(_1); // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 + switchInt(move _3) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/remove_fake_borrows.rs:+1:5: +1:12 + } + + bb1: { + _0 = const 1_i32; // scope 0 at $DIR/remove_fake_borrows.rs:+3:14: +3:15 + goto -> bb7; // scope 0 at $DIR/remove_fake_borrows.rs:+3:14: +3:15 + } + + bb2: { + switchInt((*(*((_1 as Some).0: &&i32)))) -> [0: bb3, otherwise: bb1]; // scope 0 at $DIR/remove_fake_borrows.rs:+1:5: +1:12 + } + + bb3: { +- falseEdge -> [real: bb4, imaginary: bb1]; // scope 0 at $DIR/remove_fake_borrows.rs:+2:9: +2:16 ++ goto -> bb4; // scope 0 at $DIR/remove_fake_borrows.rs:+2:9: +2:16 + } + + bb4: { +- _4 = &shallow _1; // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 +- _5 = &shallow (*((_1 as Some).0: &&i32)); // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 +- _6 = &shallow ((_1 as Some).0: &&i32); // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 +- _7 = &shallow (*(*((_1 as Some).0: &&i32))); // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 ++ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 ++ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 ++ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 ++ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 + StorageLive(_8); // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 + _8 = _2; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 + switchInt(move _8) -> [0: bb6, otherwise: bb5]; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 + } + + bb5: { + StorageDead(_8); // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 +- FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 +- FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 +- FakeRead(ForMatchGuard, _6); // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 +- FakeRead(ForMatchGuard, _7); // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 ++ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 ++ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 ++ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 ++ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 + _0 = const 0_i32; // scope 0 at $DIR/remove_fake_borrows.rs:+2:25: +2:26 + goto -> bb7; // scope 0 at $DIR/remove_fake_borrows.rs:+2:25: +2:26 + } + + bb6: { + StorageDead(_8); // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 +- falseEdge -> [real: bb1, imaginary: bb1]; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 ++ goto -> bb1; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 + } + + bb7: { + return; // scope 0 at $DIR/remove_fake_borrows.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff new file mode 100644 index 00000000000..895c62bb5d0 --- /dev/null +++ b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff @@ -0,0 +1,98 @@ +- // MIR for `main` before RemoveStorageMarkers ++ // MIR for `main` after RemoveStorageMarkers + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/remove_storage_markers.rs:+0:11: +0:11 + let mut _1: i32; // in scope 0 at $DIR/remove_storage_markers.rs:+1:9: +1:16 + let mut _2: std::ops::Range; // in scope 0 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + let mut _3: std::ops::Range; // in scope 0 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + let mut _5: (); // in scope 0 at $DIR/remove_storage_markers.rs:+0:1: +5:2 + let _6: (); // in scope 0 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + let mut _7: std::option::Option; // in scope 0 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + let mut _8: &mut std::ops::Range; // in scope 0 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + let mut _9: &mut std::ops::Range; // in scope 0 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + let mut _10: isize; // in scope 0 at $DIR/remove_storage_markers.rs:+2:5: +4:6 + let mut _11: !; // in scope 0 at $DIR/remove_storage_markers.rs:+2:5: +4:6 + let mut _13: i32; // in scope 0 at $DIR/remove_storage_markers.rs:+3:16: +3:17 + scope 1 { + debug sum => _1; // in scope 1 at $DIR/remove_storage_markers.rs:+1:9: +1:16 + let mut _4: std::ops::Range; // in scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + scope 2 { + debug iter => _4; // in scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + let _12: i32; // in scope 2 at $DIR/remove_storage_markers.rs:+2:9: +2:10 + scope 3 { + debug i => _12; // in scope 3 at $DIR/remove_storage_markers.rs:+2:9: +2:10 + } + } + } + + bb0: { +- StorageLive(_1); // scope 0 at $DIR/remove_storage_markers.rs:+1:9: +1:16 + _1 = const 0_i32; // scope 0 at $DIR/remove_storage_markers.rs:+1:19: +1:20 +- StorageLive(_2); // scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19 +- StorageLive(_3); // scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + _3 = std::ops::Range:: { start: const 0_i32, end: const 10_i32 }; // scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + _2 = as IntoIterator>::into_iter(move _3) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + // mir::Constant + // + span: $DIR/remove_storage_markers.rs:11:14: 11:19 + // + literal: Const { ty: fn(std::ops::Range) -> as IntoIterator>::IntoIter { as IntoIterator>::into_iter}, val: Value() } + } + + bb1: { +- StorageDead(_3); // scope 1 at $DIR/remove_storage_markers.rs:+2:18: +2:19 +- StorageLive(_4); // scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + _4 = move _2; // scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + goto -> bb2; // scope 2 at $DIR/remove_storage_markers.rs:+2:5: +4:6 + } + + bb2: { +- StorageLive(_6); // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 +- StorageLive(_7); // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 +- StorageLive(_8); // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 +- StorageLive(_9); // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + _9 = &mut _4; // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + _8 = &mut (*_9); // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + _7 = as Iterator>::next(move _8) -> [return: bb3, unwind unreachable]; // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + // mir::Constant + // + span: $DIR/remove_storage_markers.rs:11:14: 11:19 + // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } + } + + bb3: { +- StorageDead(_8); // scope 2 at $DIR/remove_storage_markers.rs:+2:18: +2:19 + _10 = discriminant(_7); // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + } + + bb4: { +- StorageLive(_12); // scope 2 at $DIR/remove_storage_markers.rs:+2:9: +2:10 + _12 = ((_7 as Some).0: i32); // scope 2 at $DIR/remove_storage_markers.rs:+2:9: +2:10 +- StorageLive(_13); // scope 3 at $DIR/remove_storage_markers.rs:+3:16: +3:17 + _13 = _12; // scope 3 at $DIR/remove_storage_markers.rs:+3:16: +3:17 + _1 = Add(_1, move _13); // scope 3 at $DIR/remove_storage_markers.rs:+3:9: +3:17 +- StorageDead(_13); // scope 3 at $DIR/remove_storage_markers.rs:+3:16: +3:17 + _6 = const (); // scope 3 at $DIR/remove_storage_markers.rs:+2:20: +4:6 +- StorageDead(_12); // scope 2 at $DIR/remove_storage_markers.rs:+4:5: +4:6 +- StorageDead(_9); // scope 2 at $DIR/remove_storage_markers.rs:+4:5: +4:6 +- StorageDead(_7); // scope 2 at $DIR/remove_storage_markers.rs:+4:5: +4:6 +- StorageDead(_6); // scope 2 at $DIR/remove_storage_markers.rs:+4:5: +4:6 + _5 = const (); // scope 2 at $DIR/remove_storage_markers.rs:+2:5: +4:6 + goto -> bb2; // scope 2 at $DIR/remove_storage_markers.rs:+2:5: +4:6 + } + + bb5: { + unreachable; // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + } + + bb6: { + _0 = const (); // scope 2 at $DIR/remove_storage_markers.rs:+2:5: +4:6 +- StorageDead(_9); // scope 2 at $DIR/remove_storage_markers.rs:+4:5: +4:6 +- StorageDead(_7); // scope 2 at $DIR/remove_storage_markers.rs:+4:5: +4:6 +- StorageDead(_6); // scope 2 at $DIR/remove_storage_markers.rs:+4:5: +4:6 +- StorageDead(_4); // scope 1 at $DIR/remove_storage_markers.rs:+4:5: +4:6 +- StorageDead(_2); // scope 1 at $DIR/remove_storage_markers.rs:+4:5: +4:6 +- StorageDead(_1); // scope 0 at $DIR/remove_storage_markers.rs:+5:1: +5:2 + return; // scope 0 at $DIR/remove_storage_markers.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-unwind.diff similarity index 100% rename from tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff rename to tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-unwind.diff diff --git a/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-abort.diff b/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-abort.diff new file mode 100644 index 00000000000..3c8f40d13e4 --- /dev/null +++ b/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-abort.diff @@ -0,0 +1,27 @@ +- // MIR for `cannot_opt_generic` before RemoveUnneededDrops ++ // MIR for `cannot_opt_generic` after RemoveUnneededDrops + + fn cannot_opt_generic(_1: T) -> () { + debug x => _1; // in scope 0 at $DIR/remove_unneeded_drops.rs:+0:26: +0:27 + let mut _0: (); // return place in scope 0 at $DIR/remove_unneeded_drops.rs:+0:32: +0:32 + let _2: (); // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 + let mut _3: T; // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 + scope 1 (inlined std::mem::drop::) { // at $DIR/remove_unneeded_drops.rs:21:5: 21:12 + debug _x => _3; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + } + + bb0: { + nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 + StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 + _3 = move _1; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 + drop(_3) -> [return: bb1, unwind unreachable]; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + } + + bb1: { + StorageDead(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:11: +1:12 + nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13 + nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+0:32: +2:2 + return; // scope 0 at $DIR/remove_unneeded_drops.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-unwind.diff similarity index 100% rename from tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff rename to tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-unwind.diff diff --git a/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-abort.diff b/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-abort.diff new file mode 100644 index 00000000000..1a7e1a7fa67 --- /dev/null +++ b/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-abort.diff @@ -0,0 +1,27 @@ +- // MIR for `dont_opt` before RemoveUnneededDrops ++ // MIR for `dont_opt` after RemoveUnneededDrops + + fn dont_opt(_1: Vec) -> () { + debug x => _1; // in scope 0 at $DIR/remove_unneeded_drops.rs:+0:13: +0:14 + let mut _0: (); // return place in scope 0 at $DIR/remove_unneeded_drops.rs:+0:27: +0:27 + let _2: (); // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 + let mut _3: std::vec::Vec; // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 + scope 1 (inlined std::mem::drop::>) { // at $DIR/remove_unneeded_drops.rs:9:5: 9:12 + debug _x => _3; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + } + + bb0: { + nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 + StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 + _3 = move _1; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 + drop(_3) -> [return: bb1, unwind unreachable]; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + } + + bb1: { + StorageDead(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:11: +1:12 + nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13 + nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+0:27: +2:2 + return; // scope 0 at $DIR/remove_unneeded_drops.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-unwind.diff similarity index 100% rename from tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff rename to tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-unwind.diff diff --git a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-abort.diff b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-abort.diff new file mode 100644 index 00000000000..4a1517b5b93 --- /dev/null +++ b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-abort.diff @@ -0,0 +1,27 @@ +- // MIR for `opt` before RemoveUnneededDrops ++ // MIR for `opt` after RemoveUnneededDrops + + fn opt(_1: bool) -> () { + debug x => _1; // in scope 0 at $DIR/remove_unneeded_drops.rs:+0:8: +0:9 + let mut _0: (); // return place in scope 0 at $DIR/remove_unneeded_drops.rs:+0:17: +0:17 + let _2: (); // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 + let mut _3: bool; // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 + scope 1 (inlined std::mem::drop::) { // at $DIR/remove_unneeded_drops.rs:4:5: 4:12 + debug _x => _3; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + } + + bb0: { +- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 + StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 + _3 = _1; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 +- drop(_3) -> [return: bb1, unwind unreachable]; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL +- } +- +- bb1: { + StorageDead(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:11: +1:12 +- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13 +- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+0:17: +2:2 + return; // scope 0 at $DIR/remove_unneeded_drops.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff similarity index 100% rename from tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.diff rename to tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff diff --git a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-abort.diff b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-abort.diff new file mode 100644 index 00000000000..a7325d92e68 --- /dev/null +++ b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-abort.diff @@ -0,0 +1,27 @@ +- // MIR for `opt_generic_copy` before RemoveUnneededDrops ++ // MIR for `opt_generic_copy` after RemoveUnneededDrops + + fn opt_generic_copy(_1: T) -> () { + debug x => _1; // in scope 0 at $DIR/remove_unneeded_drops.rs:+0:30: +0:31 + let mut _0: (); // return place in scope 0 at $DIR/remove_unneeded_drops.rs:+0:36: +0:36 + let _2: (); // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 + let mut _3: T; // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 + scope 1 (inlined std::mem::drop::) { // at $DIR/remove_unneeded_drops.rs:14:5: 14:12 + debug _x => _3; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + } + + bb0: { +- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12 + StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 + _3 = _1; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11 +- drop(_3) -> [return: bb1, unwind unreachable]; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL +- } +- +- bb1: { + StorageDead(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:11: +1:12 +- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13 +- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+0:36: +2:2 + return; // scope 0 at $DIR/remove_unneeded_drops.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff similarity index 100% rename from tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff rename to tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff diff --git a/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-abort.mir new file mode 100644 index 00000000000..ff0f12fd63d --- /dev/null +++ b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-abort.mir @@ -0,0 +1,188 @@ +// MIR for `array_casts` after SimplifyCfg-elaborate-drops + +fn array_casts() -> () { + let mut _0: (); // return place in scope 0 at $DIR/retag.rs:+0:18: +0:18 + let mut _1: [usize; 2]; // in scope 0 at $DIR/retag.rs:+1:9: +1:14 + let mut _3: *mut [usize; 2]; // in scope 0 at $DIR/retag.rs:+2:13: +2:19 + let mut _4: &mut [usize; 2]; // in scope 0 at $DIR/retag.rs:+2:13: +2:19 + let _5: (); // in scope 0 at $DIR/retag.rs:+3:5: +3:30 + let mut _6: *mut usize; // in scope 0 at $DIR/retag.rs:+3:15: +3:23 + let mut _7: *mut usize; // in scope 0 at $DIR/retag.rs:+3:15: +3:16 + let mut _10: *const [usize; 2]; // in scope 0 at $DIR/retag.rs:+6:13: +6:15 + let _11: &[usize; 2]; // in scope 0 at $DIR/retag.rs:+6:13: +6:15 + let _12: (); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _13: (&usize, &usize); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _14: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _15: usize; // in scope 0 at $DIR/retag.rs:+7:16: +7:36 + let mut _16: *const usize; // in scope 0 at $DIR/retag.rs:+7:26: +7:34 + let mut _17: *const usize; // in scope 0 at $DIR/retag.rs:+7:26: +7:27 + let mut _18: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _19: usize; // in scope 0 at $DIR/retag.rs:+7:38: +7:39 + let mut _22: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _23: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _24: usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _25: usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _26: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _28: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _29: core::panicking::AssertKind; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _30: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _31: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _32: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _33: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _34: std::option::Option>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 1 { + debug x => _1; // in scope 1 at $DIR/retag.rs:+1:9: +1:14 + let _2: *mut usize; // in scope 1 at $DIR/retag.rs:+2:9: +2:10 + scope 2 { + debug p => _2; // in scope 2 at $DIR/retag.rs:+2:9: +2:10 + let _8: [usize; 2]; // in scope 2 at $DIR/retag.rs:+5:9: +5:10 + scope 3 { + } + scope 4 { + debug x => _8; // in scope 4 at $DIR/retag.rs:+5:9: +5:10 + let _9: *const usize; // in scope 4 at $DIR/retag.rs:+6:9: +6:10 + scope 5 { + debug p => _9; // in scope 5 at $DIR/retag.rs:+6:9: +6:10 + let _20: &usize; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _21: &usize; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _35: &usize; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 6 { + } + scope 7 { + debug left_val => _20; // in scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug right_val => _21; // in scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _27: core::panicking::AssertKind; // in scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 8 { + debug kind => _27; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + } + } + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/retag.rs:+1:9: +1:14 + _1 = [const 0_usize, const 0_usize]; // scope 0 at $DIR/retag.rs:+1:29: +1:35 + StorageLive(_2); // scope 1 at $DIR/retag.rs:+2:9: +2:10 + StorageLive(_3); // scope 1 at $DIR/retag.rs:+2:13: +2:19 + StorageLive(_4); // scope 1 at $DIR/retag.rs:+2:13: +2:19 + _4 = &mut _1; // scope 1 at $DIR/retag.rs:+2:13: +2:19 + _3 = &raw mut (*_4); // scope 1 at $DIR/retag.rs:+2:13: +2:19 + _2 = move _3 as *mut usize (Pointer(ArrayToPointer)); // scope 1 at $DIR/retag.rs:+2:13: +2:33 + StorageDead(_3); // scope 1 at $DIR/retag.rs:+2:32: +2:33 + StorageDead(_4); // scope 1 at $DIR/retag.rs:+2:33: +2:34 + StorageLive(_5); // scope 2 at $DIR/retag.rs:+3:5: +3:30 + StorageLive(_6); // scope 3 at $DIR/retag.rs:+3:15: +3:23 + StorageLive(_7); // scope 3 at $DIR/retag.rs:+3:15: +3:16 + _7 = _2; // scope 3 at $DIR/retag.rs:+3:15: +3:16 + _6 = ptr::mut_ptr::::add(move _7, const 1_usize) -> [return: bb1, unwind unreachable]; // scope 3 at $DIR/retag.rs:+3:15: +3:23 + // mir::Constant + // + span: $DIR/retag.rs:61:17: 61:20 + // + literal: Const { ty: unsafe fn(*mut usize, usize) -> *mut usize {ptr::mut_ptr::::add}, val: Value() } + } + + bb1: { + StorageDead(_7); // scope 3 at $DIR/retag.rs:+3:22: +3:23 + (*_6) = const 1_usize; // scope 3 at $DIR/retag.rs:+3:14: +3:27 + StorageDead(_6); // scope 3 at $DIR/retag.rs:+3:27: +3:28 + _5 = const (); // scope 3 at $DIR/retag.rs:+3:5: +3:30 + StorageDead(_5); // scope 2 at $DIR/retag.rs:+3:29: +3:30 + StorageLive(_8); // scope 2 at $DIR/retag.rs:+5:9: +5:10 + _8 = [const 0_usize, const 1_usize]; // scope 2 at $DIR/retag.rs:+5:25: +5:31 + StorageLive(_9); // scope 4 at $DIR/retag.rs:+6:9: +6:10 + StorageLive(_10); // scope 4 at $DIR/retag.rs:+6:13: +6:15 + StorageLive(_11); // scope 4 at $DIR/retag.rs:+6:13: +6:15 + _11 = &_8; // scope 4 at $DIR/retag.rs:+6:13: +6:15 + _10 = &raw const (*_11); // scope 4 at $DIR/retag.rs:+6:13: +6:15 + _9 = move _10 as *const usize (Pointer(ArrayToPointer)); // scope 4 at $DIR/retag.rs:+6:13: +6:31 + StorageDead(_10); // scope 4 at $DIR/retag.rs:+6:30: +6:31 + StorageDead(_11); // scope 4 at $DIR/retag.rs:+6:31: +6:32 + StorageLive(_12); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_14); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_15); // scope 5 at $DIR/retag.rs:+7:16: +7:36 + StorageLive(_16); // scope 6 at $DIR/retag.rs:+7:26: +7:34 + StorageLive(_17); // scope 6 at $DIR/retag.rs:+7:26: +7:27 + _17 = _9; // scope 6 at $DIR/retag.rs:+7:26: +7:27 + _16 = ptr::const_ptr::::add(move _17, const 1_usize) -> [return: bb2, unwind unreachable]; // scope 6 at $DIR/retag.rs:+7:26: +7:34 + // mir::Constant + // + span: $DIR/retag.rs:65:28: 65:31 + // + literal: Const { ty: unsafe fn(*const usize, usize) -> *const usize {ptr::const_ptr::::add}, val: Value() } + } + + bb2: { + StorageDead(_17); // scope 6 at $DIR/retag.rs:+7:33: +7:34 + _15 = (*_16); // scope 6 at $DIR/retag.rs:+7:25: +7:34 + _14 = &_15; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _35 = const _; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: &usize, val: Unevaluated(array_casts, [], Some(promoted[0])) } + Retag(_35); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _18 = &(*_35); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _13 = (move _14, move _18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_14); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _20 = (_13.0: &usize); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _21 = (_13.1: &usize); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_22); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_24); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _24 = (*_20); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = (*_21); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _23 = Eq(move _24, move _25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_24); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = Not(move _23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _22) -> [0: bb4, otherwise: bb3]; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb3: { + StorageLive(_27); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _27 = core::panicking::AssertKind::Eq; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_28); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_29); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _29 = move _27; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_30); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _31 = &(*_20); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _30 = &(*_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_32); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _33 = &(*_21); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _32 = &(*_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _34 = Option::>::None; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _28 = core::panicking::assert_failed::(move _29, move _30, move _32, move _34) -> unwind unreachable; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: for<'a, 'b, 'c> fn(core::panicking::AssertKind, &'a usize, &'b usize, Option>) -> ! {core::panicking::assert_failed::}, val: Value() } + } + + bb4: { + _12 = const (); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_22); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_16); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_15); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_12); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _0 = const (); // scope 0 at $DIR/retag.rs:+0:18: +8:2 + StorageDead(_9); // scope 4 at $DIR/retag.rs:+8:1: +8:2 + StorageDead(_8); // scope 2 at $DIR/retag.rs:+8:1: +8:2 + StorageDead(_2); // scope 1 at $DIR/retag.rs:+8:1: +8:2 + StorageDead(_1); // scope 0 at $DIR/retag.rs:+8:1: +8:2 + return; // scope 0 at $DIR/retag.rs:+8:2: +8:2 + } +} diff --git a/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir rename to tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir diff --git a/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-abort.mir b/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-abort.mir new file mode 100644 index 00000000000..7de6c67980a --- /dev/null +++ b/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-abort.mir @@ -0,0 +1,26 @@ +// MIR for `std::ptr::drop_in_place` after SimplifyCfg-make_shim + +fn std::ptr::drop_in_place(_1: *mut Test) -> () { + let mut _0: (); // return place in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + let mut _2: &mut Test; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + let mut _3: &mut Test; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + let mut _4: (); // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + + bb0: { + _2 = &mut (*_1); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + Retag([fn entry] _2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + _3 = &mut (*_2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + _4 = ::drop(move _3) -> [return: bb2, unwind: bb1]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + // mir::Constant + // + span: $SRC_DIR/core/src/ptr/mod.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut Test) {::drop}, val: Value() } + } + + bb1 (cleanup): { + resume; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + } + + bb2: { + return; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + } +} diff --git a/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir b/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir rename to tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-unwind.mir diff --git a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir similarity index 100% rename from tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.mir rename to tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir diff --git a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-unwind.mir new file mode 100644 index 00000000000..9e5c119a2b2 --- /dev/null +++ b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-unwind.mir @@ -0,0 +1,21 @@ +// MIR for `main::{closure#0}` after SimplifyCfg-elaborate-drops + +fn main::{closure#0}(_1: &[closure@main::{closure#0}], _2: &i32) -> &i32 { + debug x => _2; // in scope 0 at $DIR/retag.rs:+0:32: +0:33 + let mut _0: &i32; // return place in scope 0 at $DIR/retag.rs:+0:44: +0:48 + let _3: &i32; // in scope 0 at $DIR/retag.rs:+1:13: +1:15 + scope 1 { + debug _y => _3; // in scope 1 at $DIR/retag.rs:+1:13: +1:15 + } + + bb0: { + Retag([fn entry] _1); // scope 0 at $DIR/retag.rs:+0:31: +3:6 + Retag([fn entry] _2); // scope 0 at $DIR/retag.rs:+0:32: +0:33 + StorageLive(_3); // scope 0 at $DIR/retag.rs:+1:13: +1:15 + _3 = _2; // scope 0 at $DIR/retag.rs:+1:18: +1:19 + Retag(_3); // scope 0 at $DIR/retag.rs:+1:18: +1:19 + _0 = &(*_2); // scope 1 at $DIR/retag.rs:+2:9: +2:10 + StorageDead(_3); // scope 0 at $DIR/retag.rs:+3:5: +3:6 + return; // scope 0 at $DIR/retag.rs:+3:6: +3:6 + } +} diff --git a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir new file mode 100644 index 00000000000..32d70a33bb6 --- /dev/null +++ b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir @@ -0,0 +1,187 @@ +// MIR for `main` after SimplifyCfg-elaborate-drops + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/retag.rs:+0:11: +0:11 + let mut _1: i32; // in scope 0 at $DIR/retag.rs:+1:9: +1:14 + let _2: (); // in scope 0 at $DIR/retag.rs:+2:5: +8:6 + let mut _4: &Test; // in scope 0 at $DIR/retag.rs:+3:17: +3:36 + let _5: Test; // in scope 0 at $DIR/retag.rs:+3:17: +3:24 + let mut _6: &mut i32; // in scope 0 at $DIR/retag.rs:+3:29: +3:35 + let mut _7: &mut i32; // in scope 0 at $DIR/retag.rs:+3:29: +3:35 + let mut _9: &mut i32; // in scope 0 at $DIR/retag.rs:+4:19: +4:20 + let mut _12: *mut i32; // in scope 0 at $DIR/retag.rs:+7:18: +7:29 + let mut _14: [closure@main::{closure#0}]; // in scope 0 at $DIR/retag.rs:+11:31: +14:6 + let mut _16: for<'a> fn(&'a i32) -> &'a i32; // in scope 0 at $DIR/retag.rs:+15:14: +15:15 + let mut _17: &i32; // in scope 0 at $DIR/retag.rs:+15:16: +15:18 + let _18: &i32; // in scope 0 at $DIR/retag.rs:+15:16: +15:18 + let _19: &i32; // in scope 0 at $DIR/retag.rs:+18:5: +18:24 + let mut _20: &Test; // in scope 0 at $DIR/retag.rs:+18:5: +18:24 + let _21: Test; // in scope 0 at $DIR/retag.rs:+18:5: +18:12 + let mut _22: &i32; // in scope 0 at $DIR/retag.rs:+18:21: +18:23 + let _23: &i32; // in scope 0 at $DIR/retag.rs:+18:21: +18:23 + let _24: i32; // in scope 0 at $DIR/retag.rs:+18:22: +18:23 + let mut _26: *const i32; // in scope 0 at $DIR/retag.rs:+21:14: +21:28 + let _27: (); // in scope 0 at $DIR/retag.rs:+23:5: +23:18 + scope 1 { + debug x => _1; // in scope 1 at $DIR/retag.rs:+1:9: +1:14 + let _3: &mut i32; // in scope 1 at $DIR/retag.rs:+3:13: +3:14 + let _13: for<'a> fn(&'a i32) -> &'a i32; // in scope 1 at $DIR/retag.rs:+11:9: +11:10 + scope 2 { + debug v => _3; // in scope 2 at $DIR/retag.rs:+3:13: +3:14 + let _8: &mut i32; // in scope 2 at $DIR/retag.rs:+4:13: +4:14 + scope 3 { + debug w => _8; // in scope 3 at $DIR/retag.rs:+4:13: +4:14 + let _10: &mut i32; // in scope 3 at $DIR/retag.rs:+5:13: +5:14 + scope 4 { + debug w => _10; // in scope 4 at $DIR/retag.rs:+5:13: +5:14 + let _11: *mut i32; // in scope 4 at $DIR/retag.rs:+7:13: +7:15 + scope 5 { + debug _w => _11; // in scope 5 at $DIR/retag.rs:+7:13: +7:15 + } + } + } + } + scope 6 { + debug c => _13; // in scope 6 at $DIR/retag.rs:+11:9: +11:10 + let _15: &i32; // in scope 6 at $DIR/retag.rs:+15:9: +15:11 + scope 7 { + debug _w => _15; // in scope 7 at $DIR/retag.rs:+15:9: +15:11 + let _25: *const i32; // in scope 7 at $DIR/retag.rs:+21:9: +21:11 + let mut _28: &i32; // in scope 7 at $DIR/retag.rs:+18:21: +18:23 + scope 8 { + debug _w => _25; // in scope 8 at $DIR/retag.rs:+21:9: +21:11 + } + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/retag.rs:+1:9: +1:14 + _1 = const 0_i32; // scope 0 at $DIR/retag.rs:+1:17: +1:18 + StorageLive(_2); // scope 1 at $DIR/retag.rs:+2:5: +8:6 + StorageLive(_3); // scope 1 at $DIR/retag.rs:+3:13: +3:14 + StorageLive(_4); // scope 1 at $DIR/retag.rs:+3:17: +3:36 + StorageLive(_5); // scope 1 at $DIR/retag.rs:+3:17: +3:24 + _5 = Test(const 0_i32); // scope 1 at $DIR/retag.rs:+3:17: +3:24 + _4 = &_5; // scope 1 at $DIR/retag.rs:+3:17: +3:36 + StorageLive(_6); // scope 1 at $DIR/retag.rs:+3:29: +3:35 + StorageLive(_7); // scope 1 at $DIR/retag.rs:+3:29: +3:35 + _7 = &mut _1; // scope 1 at $DIR/retag.rs:+3:29: +3:35 + _6 = &mut (*_7); // scope 1 at $DIR/retag.rs:+3:29: +3:35 + _3 = Test::foo(move _4, move _6) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/retag.rs:+3:17: +3:36 + // mir::Constant + // + span: $DIR/retag.rs:33:25: 33:28 + // + literal: Const { ty: for<'a, 'x> fn(&'a Test, &'x mut i32) -> &'x mut i32 {Test::foo}, val: Value() } + } + + bb1: { + Retag(_3); // scope 1 at $DIR/retag.rs:+3:17: +3:36 + StorageDead(_6); // scope 1 at $DIR/retag.rs:+3:35: +3:36 + StorageDead(_4); // scope 1 at $DIR/retag.rs:+3:35: +3:36 + StorageDead(_7); // scope 1 at $DIR/retag.rs:+3:36: +3:37 + drop(_5) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/retag.rs:+3:36: +3:37 + } + + bb2: { + StorageDead(_5); // scope 1 at $DIR/retag.rs:+3:36: +3:37 + StorageLive(_8); // scope 2 at $DIR/retag.rs:+4:13: +4:14 + StorageLive(_9); // scope 2 at $DIR/retag.rs:+4:19: +4:20 + _9 = move _3; // scope 2 at $DIR/retag.rs:+4:19: +4:20 + Retag(_9); // scope 2 at $DIR/retag.rs:+4:19: +4:20 + _8 = &mut (*_9); // scope 2 at $DIR/retag.rs:+4:19: +4:20 + StorageDead(_9); // scope 2 at $DIR/retag.rs:+4:22: +4:23 + StorageLive(_10); // scope 3 at $DIR/retag.rs:+5:13: +5:14 + _10 = move _8; // scope 3 at $DIR/retag.rs:+5:17: +5:18 + Retag(_10); // scope 3 at $DIR/retag.rs:+5:17: +5:18 + StorageLive(_11); // scope 4 at $DIR/retag.rs:+7:13: +7:15 + StorageLive(_12); // scope 4 at $DIR/retag.rs:+7:18: +7:29 + _12 = &raw mut (*_10); // scope 4 at $DIR/retag.rs:+7:18: +7:19 + _11 = _12; // scope 4 at $DIR/retag.rs:+7:18: +7:29 + StorageDead(_12); // scope 4 at $DIR/retag.rs:+7:29: +7:30 + _2 = const (); // scope 1 at $DIR/retag.rs:+2:5: +8:6 + StorageDead(_11); // scope 4 at $DIR/retag.rs:+8:5: +8:6 + StorageDead(_10); // scope 3 at $DIR/retag.rs:+8:5: +8:6 + StorageDead(_8); // scope 2 at $DIR/retag.rs:+8:5: +8:6 + StorageDead(_3); // scope 1 at $DIR/retag.rs:+8:5: +8:6 + StorageDead(_2); // scope 1 at $DIR/retag.rs:+8:5: +8:6 + StorageLive(_13); // scope 1 at $DIR/retag.rs:+11:9: +11:10 + StorageLive(_14); // scope 1 at $DIR/retag.rs:+11:31: +14:6 + _14 = [closure@main::{closure#0}]; // scope 1 at $DIR/retag.rs:+11:31: +14:6 + // closure + // + def_id: DefId(0:14 ~ retag[7654]::main::{closure#0}) + // + substs: [ + // i8, + // for<'a> extern "rust-call" fn((&'a i32,)) -> &'a i32, + // (), + // ] + Retag(_14); // scope 1 at $DIR/retag.rs:+11:31: +14:6 + _13 = move _14 as for<'a> fn(&'a i32) -> &'a i32 (Pointer(ClosureFnPointer(Normal))); // scope 1 at $DIR/retag.rs:+11:31: +14:6 + StorageDead(_14); // scope 1 at $DIR/retag.rs:+11:47: +11:48 + StorageLive(_15); // scope 6 at $DIR/retag.rs:+15:9: +15:11 + StorageLive(_16); // scope 6 at $DIR/retag.rs:+15:14: +15:15 + _16 = _13; // scope 6 at $DIR/retag.rs:+15:14: +15:15 + StorageLive(_17); // scope 6 at $DIR/retag.rs:+15:16: +15:18 + StorageLive(_18); // scope 6 at $DIR/retag.rs:+15:16: +15:18 + _18 = &_1; // scope 6 at $DIR/retag.rs:+15:16: +15:18 + _17 = &(*_18); // scope 6 at $DIR/retag.rs:+15:16: +15:18 + _15 = move _16(move _17) -> [return: bb3, unwind unreachable]; // scope 6 at $DIR/retag.rs:+15:14: +15:19 + } + + bb3: { + Retag(_15); // scope 6 at $DIR/retag.rs:+15:14: +15:19 + StorageDead(_17); // scope 6 at $DIR/retag.rs:+15:18: +15:19 + StorageDead(_16); // scope 6 at $DIR/retag.rs:+15:18: +15:19 + StorageDead(_18); // scope 6 at $DIR/retag.rs:+15:19: +15:20 + StorageLive(_19); // scope 7 at $DIR/retag.rs:+18:5: +18:24 + StorageLive(_20); // scope 7 at $DIR/retag.rs:+18:5: +18:24 + StorageLive(_21); // scope 7 at $DIR/retag.rs:+18:5: +18:12 + _21 = Test(const 0_i32); // scope 7 at $DIR/retag.rs:+18:5: +18:12 + _20 = &_21; // scope 7 at $DIR/retag.rs:+18:5: +18:24 + StorageLive(_22); // scope 7 at $DIR/retag.rs:+18:21: +18:23 + StorageLive(_23); // scope 7 at $DIR/retag.rs:+18:21: +18:23 + _28 = const _; // scope 7 at $DIR/retag.rs:+18:21: +18:23 + // mir::Constant + // + span: $DIR/retag.rs:48:21: 48:23 + // + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) } + Retag(_28); // scope 7 at $DIR/retag.rs:+18:21: +18:23 + _23 = &(*_28); // scope 7 at $DIR/retag.rs:+18:21: +18:23 + _22 = &(*_23); // scope 7 at $DIR/retag.rs:+18:21: +18:23 + _19 = Test::foo_shr(move _20, move _22) -> [return: bb4, unwind unreachable]; // scope 7 at $DIR/retag.rs:+18:5: +18:24 + // mir::Constant + // + span: $DIR/retag.rs:48:13: 48:20 + // + literal: Const { ty: for<'a, 'x> fn(&'a Test, &'x i32) -> &'x i32 {Test::foo_shr}, val: Value() } + } + + bb4: { + Retag(_19); // scope 7 at $DIR/retag.rs:+18:5: +18:24 + StorageDead(_22); // scope 7 at $DIR/retag.rs:+18:23: +18:24 + StorageDead(_20); // scope 7 at $DIR/retag.rs:+18:23: +18:24 + StorageDead(_23); // scope 7 at $DIR/retag.rs:+18:24: +18:25 + drop(_21) -> [return: bb5, unwind unreachable]; // scope 7 at $DIR/retag.rs:+18:24: +18:25 + } + + bb5: { + StorageDead(_21); // scope 7 at $DIR/retag.rs:+18:24: +18:25 + StorageDead(_19); // scope 7 at $DIR/retag.rs:+18:24: +18:25 + StorageLive(_25); // scope 7 at $DIR/retag.rs:+21:9: +21:11 + StorageLive(_26); // scope 7 at $DIR/retag.rs:+21:14: +21:28 + _26 = &raw const (*_15); // scope 7 at $DIR/retag.rs:+21:14: +21:16 + _25 = _26; // scope 7 at $DIR/retag.rs:+21:14: +21:28 + StorageDead(_26); // scope 7 at $DIR/retag.rs:+21:28: +21:29 + StorageLive(_27); // scope 8 at $DIR/retag.rs:+23:5: +23:18 + _27 = array_casts() -> [return: bb6, unwind unreachable]; // scope 8 at $DIR/retag.rs:+23:5: +23:18 + // mir::Constant + // + span: $DIR/retag.rs:53:5: 53:16 + // + literal: Const { ty: fn() {array_casts}, val: Value() } + } + + bb6: { + StorageDead(_27); // scope 8 at $DIR/retag.rs:+23:18: +23:19 + _0 = const (); // scope 0 at $DIR/retag.rs:+0:11: +24:2 + StorageDead(_25); // scope 7 at $DIR/retag.rs:+24:1: +24:2 + StorageDead(_15); // scope 6 at $DIR/retag.rs:+24:1: +24:2 + StorageDead(_13); // scope 1 at $DIR/retag.rs:+24:1: +24:2 + StorageDead(_1); // scope 0 at $DIR/retag.rs:+24:1: +24:2 + return; // scope 0 at $DIR/retag.rs:+24:2: +24:2 + } +} diff --git a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir rename to tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir diff --git a/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir similarity index 100% rename from tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir rename to tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir diff --git a/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir new file mode 100644 index 00000000000..4b50205fa80 --- /dev/null +++ b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir @@ -0,0 +1,18 @@ +// MIR for `::foo` after SimplifyCfg-elaborate-drops + +fn ::foo(_1: &Test, _2: &mut i32) -> &mut i32 { + debug self => _1; // in scope 0 at $DIR/retag.rs:+0:16: +0:21 + debug x => _2; // in scope 0 at $DIR/retag.rs:+0:23: +0:24 + let mut _0: &mut i32; // return place in scope 0 at $DIR/retag.rs:+0:42: +0:53 + let mut _3: &mut i32; // in scope 0 at $DIR/retag.rs:+1:9: +1:10 + + bb0: { + Retag([fn entry] _1); // scope 0 at $DIR/retag.rs:+0:16: +0:21 + Retag([fn entry] _2); // scope 0 at $DIR/retag.rs:+0:23: +0:24 + StorageLive(_3); // scope 0 at $DIR/retag.rs:+1:9: +1:10 + _3 = &mut (*_2); // scope 0 at $DIR/retag.rs:+1:9: +1:10 + _0 = &mut (*_3); // scope 0 at $DIR/retag.rs:+1:9: +1:10 + StorageDead(_3); // scope 0 at $DIR/retag.rs:+2:5: +2:6 + return; // scope 0 at $DIR/retag.rs:+2:6: +2:6 + } +} diff --git a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir similarity index 100% rename from tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.mir rename to tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir diff --git a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir new file mode 100644 index 00000000000..f32a84e4c79 --- /dev/null +++ b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir @@ -0,0 +1,15 @@ +// MIR for `::foo_shr` after SimplifyCfg-elaborate-drops + +fn ::foo_shr(_1: &Test, _2: &i32) -> &i32 { + debug self => _1; // in scope 0 at $DIR/retag.rs:+0:20: +0:25 + debug x => _2; // in scope 0 at $DIR/retag.rs:+0:27: +0:28 + let mut _0: &i32; // return place in scope 0 at $DIR/retag.rs:+0:42: +0:49 + + bb0: { + Retag([fn entry] _1); // scope 0 at $DIR/retag.rs:+0:20: +0:25 + Retag([fn entry] _2); // scope 0 at $DIR/retag.rs:+0:27: +0:28 + _0 = _2; // scope 0 at $DIR/retag.rs:+1:9: +1:10 + Retag(_0); // scope 0 at $DIR/retag.rs:+1:9: +1:10 + return; // scope 0 at $DIR/retag.rs:+2:6: +2:6 + } +} diff --git a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff new file mode 100644 index 00000000000..2159f9dd6cc --- /dev/null +++ b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff @@ -0,0 +1,36 @@ +- // MIR for `main` before SimplifyConstCondition-after-const-prop ++ // MIR for `main` after SimplifyConstCondition-after-const-prop + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/simplify_if.rs:+0:11: +0:11 + let mut _1: bool; // in scope 0 at $DIR/simplify_if.rs:+1:8: +1:13 + let _2: (); // in scope 0 at $DIR/simplify_if.rs:+2:9: +2:15 + + bb0: { + StorageLive(_1); // scope 0 at $DIR/simplify_if.rs:+1:8: +1:13 + _1 = const false; // scope 0 at $DIR/simplify_if.rs:+1:8: +1:13 +- switchInt(const false) -> [0: bb3, otherwise: bb1]; // scope 0 at $DIR/simplify_if.rs:+1:8: +1:13 ++ goto -> bb3; // scope 0 at $DIR/simplify_if.rs:+1:8: +1:13 + } + + bb1: { + _2 = noop() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/simplify_if.rs:+2:9: +2:15 + // mir::Constant + // + span: $DIR/simplify_if.rs:8:9: 8:13 + // + literal: Const { ty: fn() {noop}, val: Value() } + } + + bb2: { + goto -> bb4; // scope 0 at $DIR/simplify_if.rs:+1:5: +3:6 + } + + bb3: { + goto -> bb4; // scope 0 at $DIR/simplify_if.rs:+1:5: +3:6 + } + + bb4: { + StorageDead(_1); // scope 0 at $DIR/simplify_if.rs:+3:5: +3:6 + return; // scope 0 at $DIR/simplify_if.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff similarity index 100% rename from tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff rename to tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff diff --git a/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-abort.diff b/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-abort.diff new file mode 100644 index 00000000000..e45b3b9c4bb --- /dev/null +++ b/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-abort.diff @@ -0,0 +1,50 @@ +- // MIR for `foo` before SimplifyLocals-final ++ // MIR for `foo` after SimplifyLocals-final + + fn foo() -> () { + let mut _0: (); // return place in scope 0 at $DIR/simplify_locals_fixedpoint.rs:+0:13: +0:13 + let mut _1: (std::option::Option, std::option::Option); // in scope 0 at $DIR/simplify_locals_fixedpoint.rs:+1:30: +1:69 + let mut _2: std::option::Option; // in scope 0 at $DIR/simplify_locals_fixedpoint.rs:+1:31: +1:49 + let mut _3: std::option::Option; // in scope 0 at $DIR/simplify_locals_fixedpoint.rs:+1:51: +1:68 + let mut _4: isize; // in scope 0 at $DIR/simplify_locals_fixedpoint.rs:+1:22: +1:26 + let mut _5: isize; // in scope 0 at $DIR/simplify_locals_fixedpoint.rs:+1:13: +1:20 + scope 1 { + debug a => _6; // in scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:18: +1:19 + let _6: u8; // in scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:18: +1:19 + } + + bb0: { + StorageLive(_1); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:30: +1:69 + StorageLive(_2); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:31: +1:49 + _2 = Option::::None; // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:31: +1:49 + StorageLive(_3); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:51: +1:68 + _3 = Option::::None; // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:51: +1:68 + _1 = (move _2, move _3); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:30: +1:69 + StorageDead(_3); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:68: +1:69 + StorageDead(_2); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:68: +1:69 + _5 = discriminant((_1.0: std::option::Option)); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:12: +1:27 + switchInt(move _5) -> [1: bb1, otherwise: bb3]; // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:12: +1:27 + } + + bb1: { + _4 = discriminant((_1.1: std::option::Option)); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:12: +1:27 + switchInt(move _4) -> [0: bb2, otherwise: bb3]; // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:12: +1:27 + } + + bb2: { + StorageLive(_6); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:18: +1:19 + _6 = (((_1.0: std::option::Option) as Some).0: u8); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:18: +1:19 + StorageDead(_6); // scope 0 at $DIR/simplify_locals_fixedpoint.rs:+5:5: +5:6 + goto -> bb3; // scope 0 at $DIR/simplify_locals_fixedpoint.rs:+1:5: +5:6 + } + + bb3: { + drop(_1) -> [return: bb4, unwind unreachable]; // scope 0 at $DIR/simplify_locals_fixedpoint.rs:+6:1: +6:2 + } + + bb4: { + StorageDead(_1); // scope 0 at $DIR/simplify_locals_fixedpoint.rs:+6:1: +6:2 + return; // scope 0 at $DIR/simplify_locals_fixedpoint.rs:+6:2: +6:2 + } + } + diff --git a/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.diff b/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-unwind.diff similarity index 100% rename from tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.diff rename to tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-unwind.diff diff --git a/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-abort.diff b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-abort.diff new file mode 100644 index 00000000000..232f63aba11 --- /dev/null +++ b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-abort.diff @@ -0,0 +1,101 @@ +- // MIR for `main` before SimplifyLocals-before-const-prop ++ // MIR for `main` after SimplifyLocals-before-const-prop + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+0:11: +0:11 +- let mut _1: ((), ()); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:20: +1:28 +- let mut _2: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:21: +1:23 +- let mut _3: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:25: +1:27 +- let _4: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:5: +2:22 +- let mut _5: ((), ()); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:13: +2:21 +- let mut _6: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:14: +2:16 +- let mut _7: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:18: +2:20 +- let _8: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:5: +4:35 +- let mut _9: u8; // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:34 +- let mut _10: u8; // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:30 +- let mut _11: Temp; // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:28 ++ let _1: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:5: +2:22 ++ let mut _2: ((), ()); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:13: +2:21 ++ let mut _3: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:14: +2:16 ++ let mut _4: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:18: +2:20 ++ let _5: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:5: +4:35 ++ let mut _6: u8; // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:34 ++ let mut _7: u8; // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:30 ++ let mut _8: Temp; // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:28 + scope 1 { + } + + bb0: { +- StorageLive(_1); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:20: +1:28 +- StorageLive(_2); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:21: +1:23 +- _2 = (); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:21: +1:23 +- StorageLive(_3); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:25: +1:27 +- _3 = (); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:25: +1:27 +- _1 = (move _2, move _3); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:20: +1:28 +- StorageDead(_3); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:27: +1:28 +- StorageDead(_2); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:27: +1:28 +- StorageDead(_1); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:28: +1:29 +- StorageLive(_4); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:5: +2:22 +- StorageLive(_5); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:13: +2:21 +- StorageLive(_6); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:14: +2:16 +- _6 = (); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:14: +2:16 +- StorageLive(_7); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:18: +2:20 +- _7 = (); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:18: +2:20 +- _5 = (move _6, move _7); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:13: +2:21 +- StorageDead(_7); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:20: +2:21 +- StorageDead(_6); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:20: +2:21 +- _4 = use_zst(move _5) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:5: +2:22 ++ StorageLive(_1); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:5: +2:22 ++ StorageLive(_2); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:13: +2:21 ++ StorageLive(_3); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:14: +2:16 ++ _3 = (); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:14: +2:16 ++ StorageLive(_4); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:18: +2:20 ++ _4 = (); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:18: +2:20 ++ _2 = (move _3, move _4); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:13: +2:21 ++ StorageDead(_4); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:20: +2:21 ++ StorageDead(_3); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:20: +2:21 ++ _1 = use_zst(move _2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:5: +2:22 + // mir::Constant + // + span: $DIR/simplify_locals_removes_unused_consts.rs:16:5: 16:12 + // + literal: Const { ty: fn(((), ())) {use_zst}, val: Value() } + } + + bb1: { +- StorageDead(_5); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:21: +2:22 +- StorageDead(_4); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:22: +2:23 +- StorageLive(_8); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:5: +4:35 +- StorageLive(_9); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:34 +- StorageLive(_10); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:30 +- StorageLive(_11); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:28 +- _11 = Temp { x: const 40_u8 }; // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:28 +- _10 = (_11.0: u8); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:30 +- _9 = Add(move _10, const 2_u8); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:34 +- StorageDead(_10); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:33: +4:34 +- _8 = use_u8(move _9) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:5: +4:35 ++ StorageDead(_2); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:21: +2:22 ++ StorageDead(_1); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:22: +2:23 ++ StorageLive(_5); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:5: +4:35 ++ StorageLive(_6); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:34 ++ StorageLive(_7); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:30 ++ StorageLive(_8); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:28 ++ _8 = Temp { x: const 40_u8 }; // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:28 ++ _7 = (_8.0: u8); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:30 ++ _6 = Add(move _7, const 2_u8); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:34 ++ StorageDead(_7); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:33: +4:34 ++ _5 = use_u8(move _6) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:5: +4:35 + // mir::Constant + // + span: $DIR/simplify_locals_removes_unused_consts.rs:18:5: 18:11 + // + literal: Const { ty: fn(u8) {use_u8}, val: Value() } + } + + bb2: { +- StorageDead(_9); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:34: +4:35 +- StorageDead(_11); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:35: +4:36 ++ StorageDead(_6); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:34: +4:35 + StorageDead(_8); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:35: +4:36 ++ StorageDead(_5); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:35: +4:36 + _0 = const (); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+0:11: +5:2 + return; // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-unwind.diff similarity index 100% rename from tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.diff rename to tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-unwind.diff diff --git a/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff b/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff new file mode 100644 index 00000000000..f25b8fe64ff --- /dev/null +++ b/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff @@ -0,0 +1,33 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/simplify_match.rs:+0:11: +0:11 + let mut _1: bool; // in scope 0 at $DIR/simplify_match.rs:+1:11: +1:31 + let _2: bool; // in scope 0 at $DIR/simplify_match.rs:+1:17: +1:18 + scope 1 { + debug x => _2; // in scope 1 at $DIR/simplify_match.rs:+1:17: +1:18 + } + + bb0: { + _2 = const false; // scope 0 at $DIR/simplify_match.rs:+1:21: +1:26 +- switchInt(_2) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_match.rs:+1:5: +1:31 ++ switchInt(const false) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_match.rs:+1:5: +1:31 + } + + bb1: { + goto -> bb3; // scope 0 at $DIR/simplify_match.rs:+3:18: +3:20 + } + + bb2: { + _0 = noop() -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/simplify_match.rs:+2:17: +2:23 + // mir::Constant + // + span: $DIR/simplify_match.rs:8:17: 8:21 + // + literal: Const { ty: fn() {noop}, val: Value() } + } + + bb3: { + return; // scope 0 at $DIR/simplify_match.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/simplify_match.main.ConstProp.diff b/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff similarity index 100% rename from tests/mir-opt/simplify_match.main.ConstProp.diff rename to tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff diff --git a/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-abort.diff b/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-abort.diff new file mode 100644 index 00000000000..a53facea506 --- /dev/null +++ b/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-abort.diff @@ -0,0 +1,70 @@ +- // MIR for `main` before UnreachablePropagation ++ // MIR for `main` after UnreachablePropagation + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/unreachable.rs:+0:11: +0:11 + let mut _1: std::option::Option; // in scope 0 at $DIR/unreachable.rs:+1:23: +1:30 + let mut _2: isize; // in scope 0 at $DIR/unreachable.rs:+1:12: +1:20 + let _5: (); // in scope 0 at $DIR/unreachable.rs:+4:9: +8:10 + let mut _6: bool; // in scope 0 at $DIR/unreachable.rs:+4:12: +4:16 + let mut _7: !; // in scope 0 at $DIR/unreachable.rs:+10:9: +10:21 + scope 1 { + debug _x => _3; // in scope 1 at $DIR/unreachable.rs:+1:17: +1:19 + let _3: Empty; // in scope 1 at $DIR/unreachable.rs:+1:17: +1:19 + let mut _4: i32; // in scope 1 at $DIR/unreachable.rs:+2:13: +2:19 + scope 2 { + debug _y => _4; // in scope 2 at $DIR/unreachable.rs:+2:13: +2:19 + } + } + + bb0: { + StorageLive(_1); // scope 1 at $DIR/unreachable.rs:+1:23: +1:30 + _1 = empty() -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/unreachable.rs:+1:23: +1:30 + // mir::Constant + // + span: $DIR/unreachable.rs:10:23: 10:28 + // + literal: Const { ty: fn() -> Option {empty}, val: Value() } + } + + bb1: { + _2 = discriminant(_1); // scope 1 at $DIR/unreachable.rs:+1:12: +1:20 +- switchInt(move _2) -> [1: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable.rs:+1:12: +1:20 ++ switchInt(move _2) -> [1: bb2, otherwise: bb3]; // scope 1 at $DIR/unreachable.rs:+1:12: +1:20 + } + + bb2: { +- StorageLive(_3); // scope 1 at $DIR/unreachable.rs:+1:17: +1:19 +- _3 = move ((_1 as Some).0: Empty); // scope 1 at $DIR/unreachable.rs:+1:17: +1:19 +- StorageLive(_4); // scope 1 at $DIR/unreachable.rs:+2:13: +2:19 +- StorageLive(_5); // scope 2 at $DIR/unreachable.rs:+4:9: +8:10 +- StorageLive(_6); // scope 2 at $DIR/unreachable.rs:+4:12: +4:16 +- _6 = const true; // scope 2 at $DIR/unreachable.rs:+4:12: +4:16 +- switchInt(move _6) -> [0: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable.rs:+4:12: +4:16 ++ unreachable; // scope 2 at $DIR/unreachable.rs:+4:12: +4:16 + } + + bb3: { +- _4 = const 21_i32; // scope 2 at $DIR/unreachable.rs:+5:13: +5:20 +- _5 = const (); // scope 2 at $DIR/unreachable.rs:+4:17: +6:10 +- goto -> bb5; // scope 2 at $DIR/unreachable.rs:+4:9: +8:10 +- } +- +- bb4: { +- _4 = const 42_i32; // scope 2 at $DIR/unreachable.rs:+7:13: +7:20 +- _5 = const (); // scope 2 at $DIR/unreachable.rs:+6:16: +8:10 +- goto -> bb5; // scope 2 at $DIR/unreachable.rs:+4:9: +8:10 +- } +- +- bb5: { +- StorageDead(_6); // scope 2 at $DIR/unreachable.rs:+8:9: +8:10 +- StorageDead(_5); // scope 2 at $DIR/unreachable.rs:+8:9: +8:10 +- StorageLive(_7); // scope 2 at $DIR/unreachable.rs:+10:9: +10:21 +- unreachable; // scope 2 at $DIR/unreachable.rs:+10:15: +10:17 +- } +- +- bb6: { + _0 = const (); // scope 0 at $DIR/unreachable.rs:+11:6: +11:6 + StorageDead(_1); // scope 0 at $DIR/unreachable.rs:+12:1: +12:2 + return; // scope 0 at $DIR/unreachable.rs:+12:2: +12:2 + } + } + diff --git a/tests/mir-opt/unreachable.main.UnreachablePropagation.diff b/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-unwind.diff similarity index 100% rename from tests/mir-opt/unreachable.main.UnreachablePropagation.diff rename to tests/mir-opt/unreachable.main.UnreachablePropagation.panic-unwind.diff diff --git a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff new file mode 100644 index 00000000000..b0ca8ab933f --- /dev/null +++ b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff @@ -0,0 +1,71 @@ +- // MIR for `main` before UnreachablePropagation ++ // MIR for `main` after UnreachablePropagation + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/unreachable_diverging.rs:+0:11: +0:11 + let _1: bool; // in scope 0 at $DIR/unreachable_diverging.rs:+1:9: +1:10 + let mut _2: std::option::Option; // in scope 0 at $DIR/unreachable_diverging.rs:+2:25: +2:32 + let mut _3: isize; // in scope 0 at $DIR/unreachable_diverging.rs:+2:12: +2:22 + let _5: (); // in scope 0 at $DIR/unreachable_diverging.rs:+3:9: +5:10 + let mut _6: bool; // in scope 0 at $DIR/unreachable_diverging.rs:+3:12: +3:13 + let mut _7: !; // in scope 0 at $DIR/unreachable_diverging.rs:+6:9: +6:22 + scope 1 { + debug x => _1; // in scope 1 at $DIR/unreachable_diverging.rs:+1:9: +1:10 + scope 2 { + debug bomb => _4; // in scope 2 at $DIR/unreachable_diverging.rs:+2:17: +2:21 + let _4: Empty; // in scope 2 at $DIR/unreachable_diverging.rs:+2:17: +2:21 + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/unreachable_diverging.rs:+1:9: +1:10 + _1 = const true; // scope 0 at $DIR/unreachable_diverging.rs:+1:13: +1:17 + StorageLive(_2); // scope 2 at $DIR/unreachable_diverging.rs:+2:25: +2:32 + _2 = empty() -> [return: bb1, unwind unreachable]; // scope 2 at $DIR/unreachable_diverging.rs:+2:25: +2:32 + // mir::Constant + // + span: $DIR/unreachable_diverging.rs:15:25: 15:30 + // + literal: Const { ty: fn() -> Option {empty}, val: Value() } + } + + bb1: { + _3 = discriminant(_2); // scope 2 at $DIR/unreachable_diverging.rs:+2:12: +2:22 + switchInt(move _3) -> [1: bb2, otherwise: bb6]; // scope 2 at $DIR/unreachable_diverging.rs:+2:12: +2:22 + } + + bb2: { + StorageLive(_4); // scope 2 at $DIR/unreachable_diverging.rs:+2:17: +2:21 + _4 = move ((_2 as Some).0: Empty); // scope 2 at $DIR/unreachable_diverging.rs:+2:17: +2:21 + StorageLive(_5); // scope 2 at $DIR/unreachable_diverging.rs:+3:9: +5:10 + StorageLive(_6); // scope 2 at $DIR/unreachable_diverging.rs:+3:12: +3:13 + _6 = _1; // scope 2 at $DIR/unreachable_diverging.rs:+3:12: +3:13 + switchInt(move _6) -> [0: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable_diverging.rs:+3:12: +3:13 + } + + bb3: { + _5 = loop_forever() -> [return: bb5, unwind unreachable]; // scope 2 at $DIR/unreachable_diverging.rs:+4:13: +4:27 + // mir::Constant + // + span: $DIR/unreachable_diverging.rs:17:13: 17:25 + // + literal: Const { ty: fn() {loop_forever}, val: Value() } + } + + bb4: { +- _5 = const (); // scope 2 at $DIR/unreachable_diverging.rs:+5:10: +5:10 +- goto -> bb5; // scope 2 at $DIR/unreachable_diverging.rs:+3:9: +5:10 ++ unreachable; // scope 2 at $DIR/unreachable_diverging.rs:+3:9: +5:10 + } + + bb5: { +- StorageDead(_6); // scope 2 at $DIR/unreachable_diverging.rs:+5:9: +5:10 +- StorageDead(_5); // scope 2 at $DIR/unreachable_diverging.rs:+5:9: +5:10 +- StorageLive(_7); // scope 2 at $DIR/unreachable_diverging.rs:+6:9: +6:22 + unreachable; // scope 2 at $DIR/unreachable_diverging.rs:+6:15: +6:19 + } + + bb6: { + _0 = const (); // scope 1 at $DIR/unreachable_diverging.rs:+7:6: +7:6 + StorageDead(_1); // scope 0 at $DIR/unreachable_diverging.rs:+8:1: +8:2 + StorageDead(_2); // scope 0 at $DIR/unreachable_diverging.rs:+8:1: +8:2 + return; // scope 0 at $DIR/unreachable_diverging.rs:+8:2: +8:2 + } + } + diff --git a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff similarity index 100% rename from tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff rename to tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff diff --git a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-abort.mir new file mode 100644 index 00000000000..c12f3591881 --- /dev/null +++ b/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-abort.mir @@ -0,0 +1,52 @@ +// MIR for `while_loop` after PreCodegen + +fn while_loop(_1: bool) -> () { + debug c => _1; // in scope 0 at $DIR/while_storage.rs:+0:15: +0:16 + let mut _0: (); // return place in scope 0 at $DIR/while_storage.rs:+0:24: +0:24 + let mut _2: bool; // in scope 0 at $DIR/while_storage.rs:+1:11: +1:22 + let mut _3: bool; // in scope 0 at $DIR/while_storage.rs:+2:12: +2:23 + + bb0: { + goto -> bb1; // scope 0 at $DIR/while_storage.rs:+1:5: +5:6 + } + + bb1: { + StorageLive(_2); // scope 0 at $DIR/while_storage.rs:+1:11: +1:22 + _2 = get_bool(_1) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/while_storage.rs:+1:11: +1:22 + // mir::Constant + // + span: $DIR/while_storage.rs:11:11: 11:19 + // + literal: Const { ty: fn(bool) -> bool {get_bool}, val: Value() } + } + + bb2: { + switchInt(move _2) -> [0: bb7, otherwise: bb3]; // scope 0 at $DIR/while_storage.rs:+1:11: +1:22 + } + + bb3: { + StorageLive(_3); // scope 0 at $DIR/while_storage.rs:+2:12: +2:23 + _3 = get_bool(_1) -> [return: bb4, unwind unreachable]; // scope 0 at $DIR/while_storage.rs:+2:12: +2:23 + // mir::Constant + // + span: $DIR/while_storage.rs:12:12: 12:20 + // + literal: Const { ty: fn(bool) -> bool {get_bool}, val: Value() } + } + + bb4: { + switchInt(move _3) -> [0: bb5, otherwise: bb6]; // scope 0 at $DIR/while_storage.rs:+2:12: +2:23 + } + + bb5: { + StorageDead(_3); // scope 0 at $DIR/while_storage.rs:+4:9: +4:10 + StorageDead(_2); // scope 0 at $DIR/while_storage.rs:+5:5: +5:6 + goto -> bb1; // scope 0 at $DIR/while_storage.rs:+1:5: +5:6 + } + + bb6: { + StorageDead(_3); // scope 0 at $DIR/while_storage.rs:+4:9: +4:10 + goto -> bb7; // scope 0 at no-location + } + + bb7: { + StorageDead(_2); // scope 0 at $DIR/while_storage.rs:+5:5: +5:6 + return; // scope 0 at $DIR/while_storage.rs:+6:2: +6:2 + } +} diff --git a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.mir b/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-unwind.mir similarity index 100% rename from tests/mir-opt/while_storage.while_loop.PreCodegen.after.mir rename to tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-unwind.mir