summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mir-opt')
-rw-r--r--tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir2
-rw-r--r--tests/mir-opt/basic_assignment.main.ElaborateDrops.diff6
-rw-r--r--tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir6
-rw-r--r--tests/mir-opt/bool_compare.opt1.InstSimplify.diff3
-rw-r--r--tests/mir-opt/bool_compare.opt2.InstSimplify.diff3
-rw-r--r--tests/mir-opt/bool_compare.opt3.InstSimplify.diff3
-rw-r--r--tests/mir-opt/bool_compare.opt4.InstSimplify.diff3
-rw-r--r--tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir6
-rw-r--r--tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir6
-rw-r--r--tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir22
-rw-r--r--tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir102
-rw-r--r--tests/mir-opt/building/custom/debuginfo.numbered.built.after.mir11
-rw-r--r--tests/mir-opt/building/custom/debuginfo.pointee.built.after.mir10
-rw-r--r--tests/mir-opt/building/custom/debuginfo.rs71
-rw-r--r--tests/mir-opt/building/custom/debuginfo.structured.built.after.mir10
-rw-r--r--tests/mir-opt/building/custom/debuginfo.variant.built.after.mir10
-rw-r--r--tests/mir-opt/building/custom/debuginfo.variant_deref.built.after.mir11
-rw-r--r--tests/mir-opt/building/enum_cast.droppy.built.after.mir2
-rw-r--r--tests/mir-opt/building/logical_or_in_conditional.rs39
-rw-r--r--tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir186
-rw-r--r--tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir87
-rw-r--r--tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir2
-rw-r--r--tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir2
-rw-r--r--tests/mir-opt/building/match_false_edges.main.built.after.mir4
-rw-r--r--tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir6
-rw-r--r--tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir6
-rw-r--r--tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff2
-rw-r--r--tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff12
-rw-r--r--tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff6
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff6
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff6
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff6
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff6
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs3
-rw-r--r--tests/mir-opt/const_prop/boxes.rs2
-rw-r--r--tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff4
-rw-r--r--tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff4
-rw-r--r--tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff4
-rw-r--r--tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff4
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff4
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff4
-rw-r--r--tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff8
-rw-r--r--tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff8
-rw-r--r--tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff12
-rw-r--r--tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff12
-rw-r--r--tests/mir-opt/const_prop/large_array_index.rs1
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff8
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff4
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff4
-rw-r--r--tests/mir-opt/const_prop/repeat.rs1
-rw-r--r--tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff4
-rw-r--r--tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff4
-rw-r--r--tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir4
-rw-r--r--tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir4
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff12
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff12
-rw-r--r--tests/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot6
-rw-r--r--tests/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot13
-rw-r--r--tests/mir-opt/coverage_graphviz.rs20
-rw-r--r--tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-abort.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-unwind.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-abort.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-unwind.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/array_index.rs8
-rw-r--r--tests/mir-opt/dataflow-const-prop/boolean_identities.rs10
-rw-r--r--tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff33
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff119
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff123
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff119
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff123
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff111
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff115
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff111
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff115
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs17
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff63
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff63
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff (renamed from tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.diff)0
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff82
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff (renamed from tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.diff)0
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.64bit.diff26
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.rs22
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff (renamed from tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.diff)0
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff63
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff126
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff126
-rw-r--r--tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff10
-rw-r--r--tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-abort.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-unwind.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-abort.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-unwind.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/large_array_index.rs9
-rw-r--r--tests/mir-opt/dataflow-const-prop/mult_by_zero.rs10
-rw-r--r--tests/mir-opt/dataflow-const-prop/mult_by_zero.test.DataflowConstProp.diff18
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff76
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff76
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff72
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff72
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.rs49
-rw-r--r--tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-abort.diff43
-rw-r--r--tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-unwind.diff43
-rw-r--r--tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-abort.diff43
-rw-r--r--tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-unwind.diff43
-rw-r--r--tests/mir-opt/dataflow-const-prop/repeat.rs8
-rw-r--r--tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff77
-rw-r--r--tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff77
-rw-r--r--tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff77
-rw-r--r--tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff77
-rw-r--r--tests/mir-opt/dataflow-const-prop/slice_len.rs12
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff129
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff129
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.diff51
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.rs11
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.32bit.diff15
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.64bit.diff15
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.32bit.diff15
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.64bit.diff15
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.32bit.diff15
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.64bit.diff15
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff18
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff18
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.rs63
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff22
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff22
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff20
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff20
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff22
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff22
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.32bit.diff24
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.64bit.diff24
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.32bit.diff20
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.64bit.diff20
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.32bit.diff15
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.64bit.diff15
-rw-r--r--tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-abort.diff15
-rw-r--r--tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-unwind.diff15
-rw-r--r--tests/mir-opt/dead-store-elimination/call_arg_copy.rs26
-rw-r--r--tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff2
-rw-r--r--tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff2
-rw-r--r--tests/mir-opt/dont_inline_type_id.call.Inline.diff20
-rw-r--r--tests/mir-opt/dont_inline_type_id.rs15
-rw-r--r--tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff4
-rw-r--r--tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff4
-rw-r--r--tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff4
-rw-r--r--tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff4
-rw-r--r--tests/mir-opt/equal_true.opt.InstSimplify.diff3
-rw-r--r--tests/mir-opt/funky_arms.rs2
-rw-r--r--tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir2
-rw-r--r--tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir2
-rw-r--r--tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir2
-rw-r--r--tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir6
-rw-r--r--tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir10
-rw-r--r--tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff342
-rw-r--r--tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff342
-rw-r--r--tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff389
-rw-r--r--tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff389
-rw-r--r--tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff165
-rw-r--r--tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff165
-rw-r--r--tests/mir-opt/gvn.cast.GVN.panic-abort.diff501
-rw-r--r--tests/mir-opt/gvn.cast.GVN.panic-unwind.diff501
-rw-r--r--tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff191
-rw-r--r--tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff191
-rw-r--r--tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff198
-rw-r--r--tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff198
-rw-r--r--tests/mir-opt/gvn.references.GVN.panic-abort.diff105
-rw-r--r--tests/mir-opt/gvn.references.GVN.panic-unwind.diff113
-rw-r--r--tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff76
-rw-r--r--tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff76
-rw-r--r--tests/mir-opt/gvn.rs253
-rw-r--r--tests/mir-opt/gvn.slices.GVN.panic-abort.diff275
-rw-r--r--tests/mir-opt/gvn.slices.GVN.panic-unwind.diff275
-rw-r--r--tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff883
-rw-r--r--tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff883
-rw-r--r--tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff45
-rw-r--r--tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff45
-rw-r--r--tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff3
-rw-r--r--tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff6
-rw-r--r--tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff6
-rw-r--r--tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff12
-rw-r--r--tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff6
-rw-r--r--tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff6
-rw-r--r--tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff2
-rw-r--r--tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/inline_closure.foo.Inline.after.mir6
-rw-r--r--tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir6
-rw-r--r--tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir10
-rw-r--r--tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff3
-rw-r--r--tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff3
-rw-r--r--tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff4
-rw-r--r--tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff97
-rw-r--r--tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff70
-rw-r--r--tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir6
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff26
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-unwind.diff24
-rw-r--r--tests/mir-opt/inline/unsized_argument.caller.Inline.diff2
-rw-r--r--tests/mir-opt/inline_generically_if_sized.call.Inline.diff24
-rw-r--r--tests/mir-opt/inline_generically_if_sized.rs17
-rw-r--r--tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff8
-rw-r--r--tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff8
-rw-r--r--tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff10
-rw-r--r--tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff10
-rw-r--r--tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff6
-rw-r--r--tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff6
-rw-r--r--tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir4
-rw-r--r--tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir4
-rw-r--r--tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff8
-rw-r--r--tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff8
-rw-r--r--tests/mir-opt/issue_91633.bar.built.after.mir2
-rw-r--r--tests/mir-opt/issue_91633.foo.built.after.mir2
-rw-r--r--tests/mir-opt/issue_99325.main.built.after.32bit.mir (renamed from tests/mir-opt/issue_99325.main.built.after.mir)260
-rw-r--r--tests/mir-opt/issue_99325.main.built.after.64bit.mir276
-rw-r--r--tests/mir-opt/issue_99325.rs2
-rw-r--r--tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff6
-rw-r--r--tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff6
-rw-r--r--tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff6
-rw-r--r--tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff6
-rw-r--r--tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff1
-rw-r--r--tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff1
-rw-r--r--tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff6
-rw-r--r--tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff6
-rw-r--r--tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff10
-rw-r--r--tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff10
-rw-r--r--tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir2
-rw-r--r--tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff24
-rw-r--r--tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir2
-rw-r--r--tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir2
-rw-r--r--tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir2
-rw-r--r--tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir2
-rw-r--r--tests/mir-opt/not_equal_false.opt.InstSimplify.diff3
-rw-r--r--tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir2
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir135
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir30
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.rs1
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.rs1
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir14
-rw-r--r--tests/mir-opt/pre-codegen/intrinsics.rs1
-rw-r--r--tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir2
-rw-r--r--tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir6
-rw-r--r--tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir2
-rw-r--r--tests/mir-opt/pre-codegen/loops.rs1
-rw-r--r--tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir2
-rw-r--r--tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir34
-rw-r--r--tests/mir-opt/pre-codegen/mem_replace.rs2
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff4
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff4
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff4
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff4
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir6
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir8
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir2
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir6
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir6
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.rs1
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir4
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.rs1
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir206
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir49
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.rs2
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir3
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir3
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir47
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir47
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir2
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir2
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir6
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir8
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir2
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.rs2
-rw-r--r--tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir22
-rw-r--r--tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir22
-rw-r--r--tests/mir-opt/pre-codegen/spans.rs1
-rw-r--r--tests/mir-opt/pre-codegen/try_identity.rs1
-rw-r--r--tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff8
-rw-r--r--tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff8
-rw-r--r--tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-abort.mir86
-rw-r--r--tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir86
-rw-r--r--tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir2
-rw-r--r--tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-unwind.mir2
-rw-r--r--tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir4
-rw-r--r--tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir8
-rw-r--r--tests/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir2
-rw-r--r--tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff3
-rw-r--r--tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff3
-rw-r--r--tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff10
-rw-r--r--tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff5
-rw-r--r--tests/mir-opt/ssa_unreachable_116212.rs14
-rw-r--r--tests/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir2
294 files changed, 12126 insertions, 991 deletions
diff --git a/tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir b/tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir
index a59ffe97b..6c3128f8c 100644
--- a/tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir
+++ b/tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir
@@ -9,7 +9,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
_1 = const ();
- asm!("", options(MAY_UNWIND)) -> [return: bb1, unwind terminate];
+ asm!("", options(MAY_UNWIND)) -> [return: bb1, unwind terminate(abi)];
}
bb1: {
diff --git a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff
index 15269fb8f..f187f9597 100644
--- a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff
+++ b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff
@@ -47,7 +47,7 @@
bb2 (cleanup): {
_5 = move _6;
-- drop(_6) -> [return: bb6, unwind terminate];
+- drop(_6) -> [return: bb6, unwind terminate(cleanup)];
+ goto -> bb6;
}
@@ -71,12 +71,12 @@
}
bb6 (cleanup): {
-- drop(_5) -> [return: bb7, unwind terminate];
+- drop(_5) -> [return: bb7, unwind terminate(cleanup)];
+ goto -> bb7;
}
bb7 (cleanup): {
-- drop(_4) -> [return: bb8, unwind terminate];
+- drop(_4) -> [return: bb8, unwind terminate(cleanup)];
+ goto -> bb8;
}
diff --git a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir
index a9bc2e890..75070ffda 100644
--- a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir
@@ -51,7 +51,7 @@ fn main() -> () {
bb2 (cleanup): {
_5 = move _6;
- drop(_6) -> [return: bb6, unwind terminate];
+ drop(_6) -> [return: bb6, unwind terminate(cleanup)];
}
bb3: {
@@ -73,11 +73,11 @@ fn main() -> () {
}
bb6 (cleanup): {
- drop(_5) -> [return: bb7, unwind terminate];
+ drop(_5) -> [return: bb7, unwind terminate(cleanup)];
}
bb7 (cleanup): {
- drop(_4) -> [return: bb8, unwind terminate];
+ drop(_4) -> [return: bb8, unwind terminate(cleanup)];
}
bb8 (cleanup): {
diff --git a/tests/mir-opt/bool_compare.opt1.InstSimplify.diff b/tests/mir-opt/bool_compare.opt1.InstSimplify.diff
index 8d0011d50..657c11516 100644
--- a/tests/mir-opt/bool_compare.opt1.InstSimplify.diff
+++ b/tests/mir-opt/bool_compare.opt1.InstSimplify.diff
@@ -13,16 +13,17 @@
_3 = _1;
- _2 = Ne(move _3, const true);
+ _2 = Not(move _3);
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/bool_compare.opt2.InstSimplify.diff b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff
index 35f106870..bc8be62bd 100644
--- a/tests/mir-opt/bool_compare.opt2.InstSimplify.diff
+++ b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff
@@ -13,16 +13,17 @@
_3 = _1;
- _2 = Ne(const true, move _3);
+ _2 = Not(move _3);
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/bool_compare.opt3.InstSimplify.diff b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff
index ab15c30ca..034d5e440 100644
--- a/tests/mir-opt/bool_compare.opt3.InstSimplify.diff
+++ b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff
@@ -13,16 +13,17 @@
_3 = _1;
- _2 = Eq(move _3, const false);
+ _2 = Not(move _3);
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/bool_compare.opt4.InstSimplify.diff b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff
index 40fd1cfe1..d3096da6c 100644
--- a/tests/mir-opt/bool_compare.opt4.InstSimplify.diff
+++ b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff
@@ -13,16 +13,17 @@
_3 = _1;
- _2 = Eq(const false, move _3);
+ _2 = Not(move _3);
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
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
index d196b045a..1c7ef7f83 100644
--- a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir
+++ b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir
@@ -54,15 +54,15 @@ fn main() -> () {
}
bb6 (cleanup): {
- drop(_7) -> [return: bb7, unwind terminate];
+ drop(_7) -> [return: bb7, unwind terminate(cleanup)];
}
bb7 (cleanup): {
- drop(_1) -> [return: bb9, unwind terminate];
+ drop(_1) -> [return: bb9, unwind terminate(cleanup)];
}
bb8 (cleanup): {
- drop(_5) -> [return: bb9, unwind terminate];
+ drop(_5) -> [return: bb9, unwind terminate(cleanup)];
}
bb9 (cleanup): {
diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir
index a72d22a9c..4ad1c2de1 100644
--- a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir
+++ b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir
@@ -54,15 +54,15 @@ fn main() -> () {
}
bb6 (cleanup): {
- drop(_7) -> [return: bb7, unwind terminate];
+ drop(_7) -> [return: bb7, unwind terminate(cleanup)];
}
bb7 (cleanup): {
- drop(_1) -> [return: bb9, unwind terminate];
+ drop(_1) -> [return: bb9, unwind terminate(cleanup)];
}
bb8 (cleanup): {
- drop(_5) -> [return: bb9, unwind terminate];
+ drop(_5) -> [return: bb9, unwind terminate(cleanup)];
}
bb9 (cleanup): {
diff --git a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir
index 9be5b8509..98b1befc3 100644
--- a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir
+++ b/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir
@@ -9,7 +9,7 @@
storage_conflicts: BitMatrix(0x0) {},
} */
-fn a::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:11:14: 11:16]>, _2: &mut Context<'_>) -> Poll<()> {
+fn a::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>, _2: &mut Context<'_>) -> Poll<()> {
debug _task_context => _4;
let mut _0: std::task::Poll<()>;
let mut _3: ();
@@ -17,23 +17,31 @@ fn a::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:11:14: 11:16]>
let mut _5: u32;
bb0: {
- _5 = discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:11:14: 11:16])));
- switchInt(move _5) -> [0: bb1, 1: bb2, otherwise: bb3];
+ _5 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16})));
+ switchInt(move _5) -> [0: bb1, 1: bb4, otherwise: bb5];
}
bb1: {
_4 = move _2;
_3 = const ();
- _0 = Poll::<()>::Ready(move _3);
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:11:14: 11:16]))) = 1;
- return;
+ goto -> bb3;
}
bb2: {
- assert(const false, "`async fn` resumed after completion") -> [success: bb2, unwind unreachable];
+ _0 = Poll::<()>::Ready(move _3);
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}))) = 1;
+ return;
}
bb3: {
+ goto -> bb2;
+ }
+
+ bb4: {
+ assert(const false, "`async fn` resumed after completion") -> [success: bb4, unwind unreachable];
+ }
+
+ bb5: {
unreachable;
}
}
diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir
index 80ac92d59..15330b13c 100644
--- a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir
+++ b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir
@@ -2,7 +2,17 @@
/* generator_layout = GeneratorLayout {
field_tys: {
_0: GeneratorSavedTy {
- ty: impl std::future::Future<Output = ()>,
+ ty: Generator(
+ DefId(0:4 ~ async_await[ccf8]::a::{closure#0}),
+ [
+ std::future::ResumeTy,
+ (),
+ (),
+ GeneratorWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
+ (),
+ ],
+ Static,
+ ),
source_info: SourceInfo {
span: $DIR/async_await.rs:15:9: 15:14 (#8),
scope: scope[0],
@@ -10,7 +20,17 @@
ignore_for_traits: false,
},
_1: GeneratorSavedTy {
- ty: impl std::future::Future<Output = ()>,
+ ty: Generator(
+ DefId(0:4 ~ async_await[ccf8]::a::{closure#0}),
+ [
+ std::future::ResumeTy,
+ (),
+ (),
+ GeneratorWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
+ (),
+ ],
+ Static,
+ ),
source_info: SourceInfo {
span: $DIR/async_await.rs:16:9: 16:14 (#10),
scope: scope[0],
@@ -31,19 +51,19 @@
},
} */
-fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, _2: &mut Context<'_>) -> Poll<()> {
+fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, _2: &mut Context<'_>) -> Poll<()> {
debug _task_context => _38;
let mut _0: std::task::Poll<()>;
let _3: ();
- let mut _4: impl std::future::Future<Output = ()>;
- let mut _5: impl std::future::Future<Output = ()>;
- let mut _6: impl std::future::Future<Output = ()>;
+ let mut _4: {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _5: {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _6: {async fn body@$DIR/async_await.rs:11:14: 11:16};
let mut _7: ();
let _8: ();
let mut _9: std::task::Poll<()>;
- let mut _10: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
- let mut _11: &mut impl std::future::Future<Output = ()>;
- let mut _12: &mut impl std::future::Future<Output = ()>;
+ let mut _10: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>;
+ let mut _11: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _12: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
let mut _13: &mut std::task::Context<'_>;
let mut _14: &mut std::task::Context<'_>;
let mut _15: &mut std::task::Context<'_>;
@@ -51,14 +71,14 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
let mut _18: !;
let mut _19: &mut std::task::Context<'_>;
let mut _20: ();
- let mut _21: impl std::future::Future<Output = ()>;
- let mut _22: impl std::future::Future<Output = ()>;
- let mut _23: impl std::future::Future<Output = ()>;
+ let mut _21: {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _22: {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _23: {async fn body@$DIR/async_await.rs:11:14: 11:16};
let _24: ();
let mut _25: std::task::Poll<()>;
- let mut _26: std::pin::Pin<&mut impl std::future::Future<Output = ()>>;
- let mut _27: &mut impl std::future::Future<Output = ()>;
- let mut _28: &mut impl std::future::Future<Output = ()>;
+ let mut _26: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>;
+ let mut _27: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _28: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
let mut _29: &mut std::task::Context<'_>;
let mut _30: &mut std::task::Context<'_>;
let mut _31: &mut std::task::Context<'_>;
@@ -70,7 +90,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
let mut _38: &mut std::task::Context<'_>;
let mut _39: u32;
scope 1 {
- debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>);
+ debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
let _17: ();
scope 2 {
}
@@ -79,7 +99,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
}
scope 4 {
- debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>);
+ debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
let _33: ();
scope 5 {
}
@@ -89,8 +109,8 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
bb0: {
- _39 = discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])));
- switchInt(move _39) -> [0: bb1, 1: bb28, 3: bb26, 4: bb27, otherwise: bb29];
+ _39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})));
+ switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb30];
}
bb1: {
@@ -102,13 +122,13 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
bb2: {
- _4 = <impl Future<Output = ()> as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable];
+ _4 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable];
}
bb3: {
StorageDead(_5);
nop;
- (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>) = move _4;
+ (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}) = move _4;
goto -> bb4;
}
@@ -118,9 +138,9 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageLive(_10);
StorageLive(_11);
StorageLive(_12);
- _12 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>);
+ _12 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
_11 = &mut (*_12);
- _10 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _11) -> [return: bb5, unwind unreachable];
+ _10 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>::new_unchecked(move _11) -> [return: bb5, unwind unreachable];
}
bb5: {
@@ -136,7 +156,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb6: {
_13 = &mut (*_14);
StorageDead(_15);
- _9 = <impl Future<Output = ()> as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable];
+ _9 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable];
}
bb7: {
@@ -156,7 +176,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageLive(_20);
_20 = ();
_0 = Poll::<()>::Pending;
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 3;
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 3;
return;
}
@@ -173,7 +193,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
- goto -> bb12;
+ drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16})) -> [return: bb12, unwind unreachable];
}
bb11: {
@@ -198,13 +218,13 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
bb14: {
- _21 = <impl Future<Output = ()> as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable];
+ _21 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable];
}
bb15: {
StorageDead(_22);
nop;
- (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>) = move _21;
+ (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}) = move _21;
goto -> bb16;
}
@@ -214,9 +234,9 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageLive(_26);
StorageLive(_27);
StorageLive(_28);
- _28 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>);
+ _28 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
_27 = &mut (*_28);
- _26 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _27) -> [return: bb17, unwind unreachable];
+ _26 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>::new_unchecked(move _27) -> [return: bb17, unwind unreachable];
}
bb17: {
@@ -232,7 +252,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb18: {
_29 = &mut (*_30);
StorageDead(_31);
- _25 = <impl Future<Output = ()> as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable];
+ _25 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable];
}
bb19: {
@@ -252,7 +272,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageLive(_36);
_36 = ();
_0 = Poll::<()>::Pending;
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 4;
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 4;
return;
}
@@ -265,7 +285,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageDead(_28);
StorageDead(_25);
StorageDead(_24);
- goto -> bb23;
+ drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16})) -> [return: bb23, unwind unreachable];
}
bb22: {
@@ -283,16 +303,20 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb24: {
StorageDead(_21);
- goto -> bb25;
+ goto -> bb26;
}
bb25: {
_0 = Poll::<()>::Ready(move _37);
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 1;
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 1;
return;
}
bb26: {
+ goto -> bb25;
+ }
+
+ bb27: {
StorageLive(_3);
StorageLive(_4);
StorageLive(_19);
@@ -301,7 +325,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
goto -> bb11;
}
- bb27: {
+ bb28: {
StorageLive(_21);
StorageLive(_35);
StorageLive(_36);
@@ -309,11 +333,11 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
goto -> bb22;
}
- bb28: {
- assert(const false, "`async fn` resumed after completion") -> [success: bb28, unwind unreachable];
+ bb29: {
+ assert(const false, "`async fn` resumed after completion") -> [success: bb29, unwind unreachable];
}
- bb29: {
+ bb30: {
unreachable;
}
}
diff --git a/tests/mir-opt/building/custom/debuginfo.numbered.built.after.mir b/tests/mir-opt/building/custom/debuginfo.numbered.built.after.mir
new file mode 100644
index 000000000..d86392537
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.numbered.built.after.mir
@@ -0,0 +1,11 @@
+// MIR for `numbered` after built
+
+fn numbered(_1: (u32, i32)) -> () {
+ debug first => (_1.0: u32);
+ debug second => (_1.0: u32);
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/custom/debuginfo.pointee.built.after.mir b/tests/mir-opt/building/custom/debuginfo.pointee.built.after.mir
new file mode 100644
index 000000000..86cced6f8
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.pointee.built.after.mir
@@ -0,0 +1,10 @@
+// MIR for `pointee` after built
+
+fn pointee(_1: &mut Option<i32>) -> () {
+ debug foo => (((*_1) as variant#1).0: i32);
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/custom/debuginfo.rs b/tests/mir-opt/building/custom/debuginfo.rs
new file mode 100644
index 000000000..bfdc3d3ea
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.rs
@@ -0,0 +1,71 @@
+#![feature(custom_mir, core_intrinsics)]
+
+extern crate core;
+use core::intrinsics::mir::*;
+
+// EMIT_MIR debuginfo.pointee.built.after.mir
+#[custom_mir(dialect = "built")]
+fn pointee(opt: &mut Option<i32>) {
+ mir!(
+ debug foo => Field::<i32>(Variant(*opt, 1), 0);
+ {
+ Return()
+ }
+ )
+}
+
+// EMIT_MIR debuginfo.numbered.built.after.mir
+#[custom_mir(dialect = "analysis", phase = "post-cleanup")]
+fn numbered(i: (u32, i32)) {
+ mir!(
+ debug first => i.0;
+ debug second => i.0;
+ {
+ Return()
+ }
+ )
+}
+
+struct S { x: f32 }
+
+// EMIT_MIR debuginfo.structured.built.after.mir
+#[custom_mir(dialect = "analysis", phase = "post-cleanup")]
+fn structured(i: S) {
+ mir!(
+ debug x => i.x;
+ {
+ Return()
+ }
+ )
+}
+
+// EMIT_MIR debuginfo.variant.built.after.mir
+#[custom_mir(dialect = "built")]
+fn variant(opt: Option<i32>) {
+ mir!(
+ debug inner => Field::<i32>(Variant(opt, 1), 0);
+ {
+ Return()
+ }
+ )
+}
+
+// EMIT_MIR debuginfo.variant_deref.built.after.mir
+#[custom_mir(dialect = "built")]
+fn variant_deref(opt: Option<&i32>) {
+ mir!(
+ debug pointer => Field::<&i32>(Variant(opt, 1), 0);
+ debug deref => *Field::<&i32>(Variant(opt, 1), 0);
+ {
+ Return()
+ }
+ )
+}
+
+fn main() {
+ numbered((5, 6));
+ structured(S { x: 5. });
+ variant(Some(5));
+ variant_deref(Some(&5));
+ pointee(&mut Some(5));
+}
diff --git a/tests/mir-opt/building/custom/debuginfo.structured.built.after.mir b/tests/mir-opt/building/custom/debuginfo.structured.built.after.mir
new file mode 100644
index 000000000..d122b6bfe
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.structured.built.after.mir
@@ -0,0 +1,10 @@
+// MIR for `structured` after built
+
+fn structured(_1: S) -> () {
+ debug x => (_1.0: f32);
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/custom/debuginfo.variant.built.after.mir b/tests/mir-opt/building/custom/debuginfo.variant.built.after.mir
new file mode 100644
index 000000000..d173723fd
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.variant.built.after.mir
@@ -0,0 +1,10 @@
+// MIR for `variant` after built
+
+fn variant(_1: Option<i32>) -> () {
+ debug inner => ((_1 as variant#1).0: i32);
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/custom/debuginfo.variant_deref.built.after.mir b/tests/mir-opt/building/custom/debuginfo.variant_deref.built.after.mir
new file mode 100644
index 000000000..37d5d1b2d
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.variant_deref.built.after.mir
@@ -0,0 +1,11 @@
+// MIR for `variant_deref` after built
+
+fn variant_deref(_1: Option<&i32>) -> () {
+ debug pointer => ((_1 as variant#1).0: &i32);
+ debug deref => (*((_1 as variant#1).0: &i32));
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/enum_cast.droppy.built.after.mir b/tests/mir-opt/building/enum_cast.droppy.built.after.mir
index 1caf9e4a5..ea0edb610 100644
--- a/tests/mir-opt/building/enum_cast.droppy.built.after.mir
+++ b/tests/mir-opt/building/enum_cast.droppy.built.after.mir
@@ -62,7 +62,7 @@ fn droppy() -> () {
}
bb4 (cleanup): {
- drop(_2) -> [return: bb5, unwind terminate];
+ drop(_2) -> [return: bb5, unwind terminate(cleanup)];
}
bb5 (cleanup): {
diff --git a/tests/mir-opt/building/logical_or_in_conditional.rs b/tests/mir-opt/building/logical_or_in_conditional.rs
new file mode 100644
index 000000000..ae159f7e1
--- /dev/null
+++ b/tests/mir-opt/building/logical_or_in_conditional.rs
@@ -0,0 +1,39 @@
+// compile-flags: -Z validate-mir
+#![feature(let_chains)]
+struct Droppy(u8);
+impl Drop for Droppy {
+ fn drop(&mut self) {
+ println!("drop {}", self.0);
+ }
+}
+
+enum E {
+ A(u8),
+ B,
+}
+
+impl E {
+ fn f() -> Self {
+ Self::A(1)
+ }
+}
+
+fn always_true() -> bool {
+ true
+}
+
+// EMIT_MIR logical_or_in_conditional.test_or.built.after.mir
+fn test_or() {
+ if Droppy(0).0 > 0 || Droppy(1).0 > 1 {}
+}
+
+// EMIT_MIR logical_or_in_conditional.test_complex.built.after.mir
+fn test_complex() {
+ if let E::A(_) = E::f() && ((always_true() && Droppy(0).0 > 0) || Droppy(1).0 > 1) {}
+
+ if !always_true() && let E::B = E::f() {}
+}
+
+fn main() {
+ test_or();
+}
diff --git a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir
new file mode 100644
index 000000000..096aaec4a
--- /dev/null
+++ b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir
@@ -0,0 +1,186 @@
+// MIR for `test_complex` after built
+
+fn test_complex() -> () {
+ let mut _0: ();
+ let _1: ();
+ let mut _2: E;
+ let mut _3: isize;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: u8;
+ let mut _7: Droppy;
+ let mut _8: bool;
+ let mut _9: u8;
+ let mut _10: Droppy;
+ let mut _11: bool;
+ let mut _12: E;
+ let mut _13: isize;
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = E::f() -> [return: bb1, unwind: bb31];
+ }
+
+ bb1: {
+ FakeRead(ForMatchedPlace(None), _2);
+ _3 = discriminant(_2);
+ switchInt(move _3) -> [0: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ falseEdge -> [real: bb4, imaginary: bb3];
+ }
+
+ bb3: {
+ goto -> bb19;
+ }
+
+ bb4: {
+ StorageLive(_4);
+ _4 = always_true() -> [return: bb5, unwind: bb31];
+ }
+
+ bb5: {
+ switchInt(move _4) -> [0: bb7, otherwise: bb6];
+ }
+
+ bb6: {
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = Droppy(const 0_u8);
+ _6 = (_7.0: u8);
+ _5 = Gt(move _6, const 0_u8);
+ switchInt(move _5) -> [0: bb9, otherwise: bb8];
+ }
+
+ bb7: {
+ goto -> bb13;
+ }
+
+ bb8: {
+ drop(_7) -> [return: bb10, unwind: bb31];
+ }
+
+ bb9: {
+ goto -> bb11;
+ }
+
+ bb10: {
+ StorageDead(_7);
+ StorageDead(_6);
+ goto -> bb16;
+ }
+
+ bb11: {
+ drop(_7) -> [return: bb12, unwind: bb31];
+ }
+
+ bb12: {
+ StorageDead(_7);
+ StorageDead(_6);
+ goto -> bb13;
+ }
+
+ bb13: {
+ StorageLive(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = Droppy(const 1_u8);
+ _9 = (_10.0: u8);
+ _8 = Gt(move _9, const 1_u8);
+ switchInt(move _8) -> [0: bb15, otherwise: bb14];
+ }
+
+ bb14: {
+ drop(_10) -> [return: bb16, unwind: bb31];
+ }
+
+ bb15: {
+ goto -> bb17;
+ }
+
+ bb16: {
+ StorageDead(_10);
+ StorageDead(_9);
+ _1 = const ();
+ goto -> bb20;
+ }
+
+ bb17: {
+ drop(_10) -> [return: bb18, unwind: bb31];
+ }
+
+ bb18: {
+ StorageDead(_10);
+ StorageDead(_9);
+ goto -> bb19;
+ }
+
+ bb19: {
+ _1 = const ();
+ goto -> bb20;
+ }
+
+ bb20: {
+ StorageDead(_8);
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ StorageLive(_11);
+ _11 = always_true() -> [return: bb21, unwind: bb31];
+ }
+
+ bb21: {
+ switchInt(move _11) -> [0: bb23, otherwise: bb22];
+ }
+
+ bb22: {
+ goto -> bb29;
+ }
+
+ bb23: {
+ goto -> bb24;
+ }
+
+ bb24: {
+ StorageLive(_12);
+ _12 = E::f() -> [return: bb25, unwind: bb31];
+ }
+
+ bb25: {
+ FakeRead(ForMatchedPlace(None), _12);
+ _13 = discriminant(_12);
+ switchInt(move _13) -> [1: bb27, otherwise: bb26];
+ }
+
+ bb26: {
+ goto -> bb29;
+ }
+
+ bb27: {
+ falseEdge -> [real: bb28, imaginary: bb26];
+ }
+
+ bb28: {
+ _0 = const ();
+ goto -> bb30;
+ }
+
+ bb29: {
+ _0 = const ();
+ goto -> bb30;
+ }
+
+ bb30: {
+ StorageDead(_11);
+ StorageDead(_12);
+ return;
+ }
+
+ bb31 (cleanup): {
+ resume;
+ }
+}
diff --git a/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir b/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir
new file mode 100644
index 000000000..b84c17c21
--- /dev/null
+++ b/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir
@@ -0,0 +1,87 @@
+// MIR for `test_or` after built
+
+fn test_or() -> () {
+ let mut _0: ();
+ let mut _1: bool;
+ let mut _2: u8;
+ let mut _3: Droppy;
+ let mut _4: bool;
+ let mut _5: u8;
+ let mut _6: Droppy;
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = Droppy(const 0_u8);
+ _2 = (_3.0: u8);
+ _1 = Gt(move _2, const 0_u8);
+ switchInt(move _1) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ drop(_3) -> [return: bb3, unwind: bb12];
+ }
+
+ bb2: {
+ goto -> bb4;
+ }
+
+ bb3: {
+ StorageDead(_3);
+ StorageDead(_2);
+ goto -> bb8;
+ }
+
+ bb4: {
+ drop(_3) -> [return: bb5, unwind: bb12];
+ }
+
+ bb5: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = Droppy(const 1_u8);
+ _5 = (_6.0: u8);
+ _4 = Gt(move _5, const 1_u8);
+ switchInt(move _4) -> [0: bb7, otherwise: bb6];
+ }
+
+ bb6: {
+ drop(_6) -> [return: bb8, unwind: bb12];
+ }
+
+ bb7: {
+ goto -> bb9;
+ }
+
+ bb8: {
+ StorageDead(_6);
+ StorageDead(_5);
+ _0 = const ();
+ goto -> bb11;
+ }
+
+ bb9: {
+ drop(_6) -> [return: bb10, unwind: bb12];
+ }
+
+ bb10: {
+ StorageDead(_6);
+ StorageDead(_5);
+ _0 = const ();
+ goto -> bb11;
+ }
+
+ bb11: {
+ StorageDead(_4);
+ StorageDead(_1);
+ return;
+ }
+
+ bb12 (cleanup): {
+ resume;
+ }
+}
diff --git a/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir b/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir
index bd4cd4eb6..9f64a23f3 100644
--- a/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir
+++ b/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir
@@ -51,7 +51,7 @@ fn full_tested_match() -> () {
bb5: {
StorageLive(_6);
_6 = &((_2 as Some).0: i32);
- _4 = &shallow _2;
+ _4 = &fake _2;
StorageLive(_7);
_7 = guard() -> [return: bb6, unwind: bb12];
}
diff --git a/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir b/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir
index 595e3ab92..89f9bafb6 100644
--- a/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir
+++ b/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir
@@ -57,7 +57,7 @@ fn full_tested_match2() -> () {
bb5: {
StorageLive(_6);
_6 = &((_2 as Some).0: i32);
- _4 = &shallow _2;
+ _4 = &fake _2;
StorageLive(_7);
_7 = guard() -> [return: bb6, unwind: bb12];
}
diff --git a/tests/mir-opt/building/match_false_edges.main.built.after.mir b/tests/mir-opt/building/match_false_edges.main.built.after.mir
index 91fe2f90e..9a2d89c48 100644
--- a/tests/mir-opt/building/match_false_edges.main.built.after.mir
+++ b/tests/mir-opt/building/match_false_edges.main.built.after.mir
@@ -78,7 +78,7 @@ fn main() -> () {
bb8: {
StorageLive(_7);
_7 = &((_2 as Some).0: i32);
- _5 = &shallow _2;
+ _5 = &fake _2;
StorageLive(_8);
_8 = guard() -> [return: bb9, unwind: bb20];
}
@@ -120,7 +120,7 @@ fn main() -> () {
bb14: {
StorageLive(_11);
_11 = &((_2 as Some).0: i32);
- _5 = &shallow _2;
+ _5 = &fake _2;
StorageLive(_12);
StorageLive(_13);
_13 = (*_11);
diff --git a/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir b/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir
index fea1138ba..82424de03 100644
--- a/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir
+++ b/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir
@@ -89,15 +89,15 @@ fn move_out_by_subslice() -> () {
}
bb9 (cleanup): {
- drop(_1) -> [return: bb12, unwind terminate];
+ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
}
bb10 (cleanup): {
- drop(_7) -> [return: bb11, unwind terminate];
+ drop(_7) -> [return: bb11, unwind terminate(cleanup)];
}
bb11 (cleanup): {
- drop(_2) -> [return: bb12, unwind terminate];
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
diff --git a/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir b/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir
index 3def40a85..0872d1b6a 100644
--- a/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir
+++ b/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir
@@ -89,15 +89,15 @@ fn move_out_from_end() -> () {
}
bb9 (cleanup): {
- drop(_1) -> [return: bb12, unwind terminate];
+ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
}
bb10 (cleanup): {
- drop(_7) -> [return: bb11, unwind terminate];
+ drop(_7) -> [return: bb11, unwind terminate(cleanup)];
}
bb11 (cleanup): {
- drop(_2) -> [return: bb12, unwind terminate];
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff
index 1a4372afe..f2b87221f 100644
--- a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff
+++ b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff
@@ -63,7 +63,7 @@
}
bb4 (cleanup): {
- drop(_2) -> [return: bb5, unwind terminate];
+ drop(_2) -> [return: bb5, unwind terminate(cleanup)];
}
bb5 (cleanup): {
diff --git a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
index 255ec9481..ed47baa67 100644
--- a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
+++ b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
@@ -33,14 +33,22 @@
let _15: bool;
let _16: u32;
scope 6 {
- debug f => (bool, bool, u32){ .0 => _14, .1 => _15, .2 => _16, };
+- debug ((f: (bool, bool, u32)).0: bool) => _14;
+- debug ((f: (bool, bool, u32)).1: bool) => _15;
+- debug ((f: (bool, bool, u32)).2: u32) => _16;
++ debug ((f: (bool, bool, u32)).0: bool) => const true;
++ debug ((f: (bool, bool, u32)).1: bool) => const false;
++ debug ((f: (bool, bool, u32)).2: u32) => const 123_u32;
let _10: std::option::Option<u16>;
scope 7 {
debug o => _10;
let _17: u32;
let _18: u32;
scope 8 {
- debug p => Point{ .0 => _17, .1 => _18, };
+- debug ((p: Point).0: u32) => _17;
+- debug ((p: Point).1: u32) => _18;
++ debug ((p: Point).0: u32) => const 32_u32;
++ debug ((p: Point).1: u32) => const 32_u32;
let _11: u32;
scope 9 {
- debug a => _11;
diff --git a/tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff b/tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff
index d1dbc7089..1768298d5 100644
--- a/tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff
+++ b/tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff
@@ -43,31 +43,33 @@
}
bb3: {
-- StorageDead(_6);
- switchInt(move _5) -> [0: bb5, otherwise: bb4];
- }
-
- bb4: {
+- StorageDead(_6);
- _4 = const true;
- goto -> bb6;
- }
-
- bb5: {
+- StorageDead(_6);
- _4 = const false;
- goto -> bb6;
- }
-
- bb6: {
-- StorageDead(_5);
- switchInt(move _4) -> [0: bb8, otherwise: bb7];
- }
-
- bb7: {
+- StorageDead(_5);
- _3 = const true;
- goto -> bb9;
- }
-
- bb8: {
+- StorageDead(_5);
- _3 = const false;
- goto -> bb9;
- }
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
index 55c774d55..e443c8991 100644
--- 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
@@ -34,11 +34,11 @@
StorageLive(_5);
StorageLive(_6);
_6 = const 3_usize;
- _7 = const 3_usize;
+ _7 = Len((*_1));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
-+ _8 = const false;
-+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind unreachable];
++ _8 = Lt(const 3_usize, _7);
++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff
index dcab570ea..592f43f47 100644
--- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff
@@ -34,11 +34,11 @@
StorageLive(_5);
StorageLive(_6);
_6 = const 3_usize;
- _7 = const 3_usize;
+ _7 = Len((*_1));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
-+ _8 = const false;
-+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind continue];
++ _8 = Lt(const 3_usize, _7);
++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind continue];
}
bb1: {
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
index 55c774d55..e443c8991 100644
--- 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
@@ -34,11 +34,11 @@
StorageLive(_5);
StorageLive(_6);
_6 = const 3_usize;
- _7 = const 3_usize;
+ _7 = Len((*_1));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
-+ _8 = const false;
-+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind unreachable];
++ _8 = Lt(const 3_usize, _7);
++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff
index dcab570ea..592f43f47 100644
--- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff
@@ -34,11 +34,11 @@
StorageLive(_5);
StorageLive(_6);
_6 = const 3_usize;
- _7 = const 3_usize;
+ _7 = Len((*_1));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
-+ _8 = const false;
-+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind continue];
++ _8 = Lt(const 3_usize, _7);
++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind continue];
}
bb1: {
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs
index 7931c4f02..d6b1a93f3 100644
--- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs
@@ -1,8 +1,7 @@
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen
-
// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
// EMIT_MIR bad_op_unsafe_oob_for_slices.main.ConstProp.diff
#[allow(unconditional_panic)]
fn main() {
diff --git a/tests/mir-opt/const_prop/boxes.rs b/tests/mir-opt/const_prop/boxes.rs
index 9407759cb..78599174b 100644
--- a/tests/mir-opt/const_prop/boxes.rs
+++ b/tests/mir-opt/const_prop/boxes.rs
@@ -1,8 +1,6 @@
// unit-test: ConstProp
// compile-flags: -O
-// ignore-emscripten compiled with panic=abort by default
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// ignore-wasm64
#![feature(rustc_attrs, stmt_expr_attributes)]
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
index 6daef87dd..c2fd7f65f 100644
--- 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
@@ -24,5 +24,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc3 (size: 8, align: 4) {
++ 02 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff
index 125407bf2..21a31f9ab 100644
--- a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff
@@ -24,5 +24,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc3 (size: 8, align: 4) {
++ 02 00 00 00 00 __ __ __ │ .....░░░
}
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
index ca0ce2888..c0efc8730 100644
--- a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff
@@ -29,5 +29,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc3 (size: 2, align: 1) {
++ 03 00 │ ..
}
diff --git a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff
index d63fb9255..2aee6f164 100644
--- a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff
@@ -29,5 +29,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc3 (size: 2, align: 1) {
++ 03 00 │ ..
}
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
index 51e17cf69..7ba51ccdb 100644
--- 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
@@ -35,5 +35,9 @@
_0 = const ();
return;
}
++ }
++
++ alloc3 (size: 2, align: 1) {
++ 00 01 │ ..
}
diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
index 5ef201497..545b7f22f 100644
--- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
@@ -35,5 +35,9 @@
_0 = const ();
return;
}
++ }
++
++ alloc3 (size: 2, align: 1) {
++ 00 01 │ ..
}
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
index 170c01978..18341ba7d 100644
--- 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
@@ -18,5 +18,13 @@
StorageDead(_2);
return;
}
++ }
++
++ alloc8 (size: 2, align: 1) {
++ 00 00 │ ..
++ }
++
++ alloc7 (size: 2, align: 1) {
++ 00 00 │ ..
}
diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff
index 64227dfd7..50763c10f 100644
--- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff
@@ -18,5 +18,13 @@
StorageDead(_2);
return;
}
++ }
++
++ alloc8 (size: 2, align: 1) {
++ 00 00 │ ..
++ }
++
++ alloc7 (size: 2, align: 1) {
++ 00 00 │ ..
}
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
index e1f3f37b3..015180db8 100644
--- 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
@@ -23,5 +23,17 @@
StorageDead(_2);
return;
}
++ }
++
++ alloc12 (size: 2, align: 1) {
++ 01 02 │ ..
++ }
++
++ alloc11 (size: 2, align: 1) {
++ 01 02 │ ..
++ }
++
++ alloc8 (size: 2, align: 1) {
++ 01 02 │ ..
}
diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff
index aaa376a95..8e41705c1 100644
--- a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff
@@ -23,5 +23,17 @@
StorageDead(_2);
return;
}
++ }
++
++ alloc12 (size: 2, align: 1) {
++ 01 02 │ ..
++ }
++
++ alloc11 (size: 2, align: 1) {
++ 01 02 │ ..
++ }
++
++ alloc8 (size: 2, align: 1) {
++ 01 02 │ ..
}
diff --git a/tests/mir-opt/const_prop/large_array_index.rs b/tests/mir-opt/const_prop/large_array_index.rs
index 6c03fe9d9..d226bd546 100644
--- a/tests/mir-opt/const_prop/large_array_index.rs
+++ b/tests/mir-opt/const_prop/large_array_index.rs
@@ -1,6 +1,5 @@
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR large_array_index.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff
index 0f118c7f5..56a127ae3 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff
@@ -25,5 +25,13 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc7 (size: 8, align: 4) {
++ 2a 00 00 00 63 00 00 00 │ *...c...
++ }
++
++ alloc5 (size: 8, align: 4) {
++ 2a 00 00 00 2b 00 00 00 │ *...+...
}
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
index a85dcf9c7..a1b433716 100644
--- 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
@@ -46,5 +46,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc7 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
}
diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff
index 15ef0fa4d..2dc514194 100644
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff
@@ -46,5 +46,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc7 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
}
diff --git a/tests/mir-opt/const_prop/repeat.rs b/tests/mir-opt/const_prop/repeat.rs
index 21dba84af..fb8b825ee 100644
--- a/tests/mir-opt/const_prop/repeat.rs
+++ b/tests/mir-opt/const_prop/repeat.rs
@@ -1,6 +1,5 @@
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR repeat.main.ConstProp.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
index f3b30e0dc..6c9de4764 100644
--- 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
@@ -17,5 +17,9 @@
+ _0 = const 4_u32;
return;
}
++ }
++
++ alloc5 (size: 8, align: 4) {
++ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff
index 79f85fcef..0f079278c 100644
--- a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff
@@ -17,5 +17,9 @@
+ _0 = const 4_u32;
return;
}
++ }
++
++ alloc5 (size: 8, align: 4) {
++ 04 00 00 00 00 __ __ __ │ .....░░░
}
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
index c8f3f641a..c2488f394 100644
--- 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
@@ -14,3 +14,7 @@ fn add() -> u32 {
return;
}
}
+
+alloc5 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
+}
diff --git a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir
index 9a0646974..fa0b9c77e 100644
--- a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir
+++ b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir
@@ -14,3 +14,7 @@ fn add() -> u32 {
return;
}
}
+
+alloc5 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
+}
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
index 9e705695a..988ef7dd2 100644
--- 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
@@ -29,5 +29,17 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc9 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
++ }
++
++ alloc8 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
++ }
++
++ alloc6 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
}
diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff
index 882dd97cc..298446197 100644
--- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff
@@ -29,5 +29,17 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc9 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
++ }
++
++ alloc8 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
++ }
++
++ alloc6 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
}
diff --git a/tests/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot b/tests/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot
deleted file mode 100644
index 3b90aaeae..000000000
--- a/tests/mir-opt/coverage_graphviz.bar.InstrumentCoverage.0.dot
+++ /dev/null
@@ -1,6 +0,0 @@
-digraph Cov_0_4 {
- graph [fontname="Courier, monospace"];
- node [fontname="Courier, monospace"];
- edge [fontname="Courier, monospace"];
- bcb0__Cov_0_4 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb0</td></tr><tr><td align="left" balign="left"></td></tr><tr><td align="left" balign="left">Counter(bcb0) at 18:1-20:2<br align="left"/> 19:5-19:9: @0[0]: Coverage::Counter(0) for $DIR/coverage_graphviz.rs:18:1 - 20:2<br align="left"/> 20:2-20:2: @0.Return: return</td></tr><tr><td align="left" balign="left">bb0: Return</td></tr></table>>];
-}
diff --git a/tests/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot b/tests/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot
deleted file mode 100644
index 19c220e2e..000000000
--- a/tests/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot
+++ /dev/null
@@ -1,13 +0,0 @@
-digraph Cov_0_3 {
- graph [fontname="Courier, monospace"];
- node [fontname="Courier, monospace"];
- edge [fontname="Courier, monospace"];
- bcb3__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb3</td></tr><tr><td align="left" balign="left">Counter(bcb3) at 13:10-13:10<br align="left"/> 13:10-13:10: @5[0]: Coverage::Counter(1) for $DIR/coverage_graphviz.rs:13:10 - 13:11</td></tr><tr><td align="left" balign="left">bb5: Goto</td></tr></table>>];
- bcb2__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb2</td></tr><tr><td align="left" balign="left">Expression(bcb1:(bcb0 + bcb3) - bcb3) at 12:13-12:18<br align="left"/> 12:13-12:18: @4[0]: Coverage::Expression(2) = Expression(1) + Zero for $DIR/coverage_graphviz.rs:15:1 - 15:2<br align="left"/>Expression(bcb2:(bcb1:(bcb0 + bcb3) - bcb3) + 0) at 15:2-15:2<br align="left"/> 15:2-15:2: @4.Return: return</td></tr><tr><td align="left" balign="left">bb4: Return</td></tr></table>>];
- bcb1__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb1</td></tr><tr><td align="left" balign="left">Expression(bcb0 + bcb3) at 10:5-11:17<br align="left"/> 11:12-11:17: @2.Call: _2 = bar() -&gt; [return: bb3, unwind: bb6]</td></tr><tr><td align="left" balign="left">bb1: FalseUnwind<br align="left"/>bb2: Call</td></tr><tr><td align="left" balign="left">bb3: SwitchInt</td></tr></table>>];
- bcb0__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb0</td></tr><tr><td align="left" balign="left"></td></tr><tr><td align="left" balign="left">Counter(bcb0) at 9:1-9:11<br align="left"/> </td></tr><tr><td align="left" balign="left">bb0: Goto</td></tr></table>>];
- bcb3__Cov_0_3 -> bcb1__Cov_0_3 [label=<>];
- bcb1__Cov_0_3 -> bcb3__Cov_0_3 [label=<0>];
- bcb1__Cov_0_3 -> bcb2__Cov_0_3 [label=<otherwise>];
- bcb0__Cov_0_3 -> bcb1__Cov_0_3 [label=<>];
-}
diff --git a/tests/mir-opt/coverage_graphviz.rs b/tests/mir-opt/coverage_graphviz.rs
deleted file mode 100644
index 09403bb3a..000000000
--- a/tests/mir-opt/coverage_graphviz.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Test that `-C instrument-coverage` with `-Z dump-mir-graphviz` generates a graphviz (.dot file)
-// rendering of the `BasicCoverageBlock` coverage control flow graph, with counters and
-// expressions.
-
-// needs-profiler-support
-// compile-flags: -C instrument-coverage -Z dump-mir-graphviz
-// EMIT_MIR coverage_graphviz.main.InstrumentCoverage.0.dot
-// EMIT_MIR coverage_graphviz.bar.InstrumentCoverage.0.dot
-fn main() {
- loop {
- if bar() {
- break;
- }
- }
-}
-
-#[inline(never)]
-fn bar() -> bool {
- true
-}
diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..212ddc5b1
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-abort.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: [u32; 4];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
++ _4 = const 4_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..5c53d4f44
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: [u32; 4];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
++ _4 = const 4_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..212ddc5b1
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-abort.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: [u32; 4];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
++ _4 = const 4_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..5c53d4f44
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: [u32; 4];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
++ _4 = const 4_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/array_index.rs b/tests/mir-opt/dataflow-const-prop/array_index.rs
new file mode 100644
index 000000000..ddb3646ca
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/array_index.rs
@@ -0,0 +1,8 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// unit-test: DataflowConstProp
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
+// EMIT_MIR array_index.main.DataflowConstProp.diff
+fn main() {
+ let x: u32 = [0, 1, 2, 3][2];
+}
diff --git a/tests/mir-opt/dataflow-const-prop/boolean_identities.rs b/tests/mir-opt/dataflow-const-prop/boolean_identities.rs
new file mode 100644
index 000000000..9e911e85b
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/boolean_identities.rs
@@ -0,0 +1,10 @@
+// unit-test: DataflowConstProp
+
+// EMIT_MIR boolean_identities.test.DataflowConstProp.diff
+pub fn test(x: bool, y: bool) -> bool {
+ (y | true) & (x & false)
+}
+
+fn main() {
+ test(true, false);
+}
diff --git a/tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff
new file mode 100644
index 000000000..5440c38ce
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff
@@ -0,0 +1,33 @@
+- // MIR for `test` before DataflowConstProp
++ // MIR for `test` after DataflowConstProp
+
+ fn test(_1: bool, _2: bool) -> bool {
+ debug x => _1;
+ debug y => _2;
+ let mut _0: bool;
+ let mut _3: bool;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: bool;
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _2;
+- _3 = BitOr(move _4, const true);
++ _3 = const true;
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = _1;
+- _5 = BitAnd(move _6, const false);
++ _5 = const false;
+ StorageDead(_6);
+- _0 = BitAnd(move _3, move _5);
++ _0 = const false;
+ StorageDead(_5);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..b9b46f16a
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff
@@ -0,0 +1,119 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+- _7 = AlignOf([bool; 0]);
+- _6 = _7 as *mut [bool; 0] (Transmute);
++ _7 = const 1_usize;
++ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+- _5 = NonNull::<[bool; 0]> { pointer: _8 };
++ _8 = const {0x1 as *const [bool; 0]};
++ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
++ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+- _2 = Box::<[bool]>(_3, const std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+- _1 = A { foo: move _2 };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ alloc11 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
++ }
++
++ alloc10 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
++ }
++
++ alloc7 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..93b18f23e
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,123 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+- _7 = AlignOf([bool; 0]);
+- _6 = _7 as *mut [bool; 0] (Transmute);
++ _7 = const 1_usize;
++ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+- _5 = NonNull::<[bool; 0]> { pointer: _8 };
++ _8 = const {0x1 as *const [bool; 0]};
++ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
++ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+- _2 = Box::<[bool]>(_3, const std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+- _1 = A { foo: move _2 };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind: bb2];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb2 (cleanup): {
+ resume;
+ }
++ }
++
++ alloc11 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
++ }
++
++ alloc10 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
++ }
++
++ alloc7 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..3d3af6285
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff
@@ -0,0 +1,119 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+- _7 = AlignOf([bool; 0]);
+- _6 = _7 as *mut [bool; 0] (Transmute);
++ _7 = const 1_usize;
++ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+- _5 = NonNull::<[bool; 0]> { pointer: _8 };
++ _8 = const {0x1 as *const [bool; 0]};
++ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
++ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+- _2 = Box::<[bool]>(_3, const std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+- _1 = A { foo: move _2 };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ alloc11 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
++ }
++
++ alloc10 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
++ }
++
++ alloc7 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..1933f9baf
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,123 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+- _7 = AlignOf([bool; 0]);
+- _6 = _7 as *mut [bool; 0] (Transmute);
++ _7 = const 1_usize;
++ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer));
+- _5 = NonNull::<[bool; 0]> { pointer: _8 };
++ _8 = const {0x1 as *const [bool; 0]};
++ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
++ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+- _2 = Box::<[bool]>(_3, const std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+- _1 = A { foo: move _2 };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind: bb2];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb2 (cleanup): {
+ resume;
+ }
++ }
++
++ alloc11 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
++ }
++
++ alloc10 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
++ }
++
++ alloc7 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..7862c23da
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff
@@ -0,0 +1,111 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = const 1_usize;
+ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _8 = const {0x1 as *const [bool; 0]};
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+ }
+
+ alloc11 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ alloc10 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ alloc7 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..bd4150ebb
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,115 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = const 1_usize;
+ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _8 = const {0x1 as *const [bool; 0]};
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind: bb2];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb2 (cleanup): {
+ resume;
+ }
+ }
+
+ alloc11 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ alloc10 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ alloc7 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..312fc7b7a
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff
@@ -0,0 +1,111 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = const 1_usize;
+ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _8 = const {0x1 as *const [bool; 0]};
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+ }
+
+ alloc11 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ alloc10 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ alloc7 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..3227d8b84
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,115 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: A;
+ let mut _2: std::boxed::Box<[bool]>;
+ scope 1 {
+ debug a => _1;
+ }
+ scope 2 (inlined <Box<[bool]> as Default>::default) {
+ let _3: std::ptr::Unique<[bool]>;
+ let mut _4: std::ptr::Unique<[bool; 0]>;
+ scope 3 {
+ debug ptr => _3;
+ }
+ scope 4 (inlined Unique::<[bool; 0]>::dangling) {
+ let mut _5: std::ptr::NonNull<[bool; 0]>;
+ scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
+ let mut _7: usize;
+ scope 6 {
+ let _6: *mut [bool; 0];
+ scope 7 {
+ debug ptr => _6;
+ scope 11 (inlined NonNull::<[bool; 0]>::new_unchecked) {
+ debug ptr => _6;
+ let mut _8: *const [bool; 0];
+ scope 12 {
+ scope 13 (inlined NonNull::<T>::new_unchecked::runtime::<[bool; 0]>) {
+ debug ptr => _6;
+ scope 14 (inlined ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _9;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 8 (inlined align_of::<[bool; 0]>) {
+ }
+ scope 9 (inlined invalid_mut::<[bool; 0]>) {
+ debug addr => _7;
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = const 1_usize;
+ _6 = const {0x1 as *mut [bool; 0]};
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _8 = const {0x1 as *const [bool; 0]};
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
+ StorageDead(_5);
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind: bb2];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb2 (cleanup): {
+ resume;
+ }
+ }
+
+ alloc11 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ alloc10 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ alloc7 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs
new file mode 100644
index 000000000..dfeccd3eb
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs
@@ -0,0 +1,17 @@
+// unit-test: DataflowConstProp
+// compile-flags: -Zmir-enable-passes=+ConstProp,+Inline
+// ignore-debug assertions change the output MIR
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
+struct A {
+ foo: Box<[bool]>,
+}
+
+// EMIT_MIR default_boxed_slice.main.ConstProp.diff
+// EMIT_MIR default_boxed_slice.main.DataflowConstProp.diff
+fn main() {
+ // ConstProp will create a constant of type `Box<[bool]>`.
+ // Verify that `DataflowConstProp` does not ICE trying to dereference it directly.
+ let a: A = A { foo: Box::default() };
+}
diff --git a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..07ac5b72e
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff
@@ -0,0 +1,63 @@
+- // MIR for `constant` before DataflowConstProp
++ // MIR for `constant` after DataflowConstProp
+
+ fn constant() -> () {
+ let mut _0: ();
+ let _1: E;
+ let mut _3: isize;
+ scope 1 {
+ debug e => _1;
+ let _2: i32;
+ let _4: i32;
+ let _5: i32;
+ scope 2 {
+ debug x => _2;
+ }
+ scope 3 {
+ debug x => _4;
+ }
+ scope 4 {
+ debug x => _5;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const _;
+ StorageLive(_2);
+- _3 = discriminant(_1);
+- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2];
++ _3 = const 0_isize;
++ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_5);
+ _5 = ((_1 as V2).0: i32);
+ _2 = _5;
+ StorageDead(_5);
+ goto -> bb4;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_4);
+- _4 = ((_1 as V1).0: i32);
+- _2 = _4;
++ _4 = const 0_i32;
++ _2 = const 0_i32;
+ StorageDead(_4);
+ goto -> bb4;
+ }
+
+ bb4: {
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..07ac5b72e
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff
@@ -0,0 +1,63 @@
+- // MIR for `constant` before DataflowConstProp
++ // MIR for `constant` after DataflowConstProp
+
+ fn constant() -> () {
+ let mut _0: ();
+ let _1: E;
+ let mut _3: isize;
+ scope 1 {
+ debug e => _1;
+ let _2: i32;
+ let _4: i32;
+ let _5: i32;
+ scope 2 {
+ debug x => _2;
+ }
+ scope 3 {
+ debug x => _4;
+ }
+ scope 4 {
+ debug x => _5;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const _;
+ StorageLive(_2);
+- _3 = discriminant(_1);
+- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2];
++ _3 = const 0_isize;
++ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_5);
+ _5 = ((_1 as V2).0: i32);
+ _2 = _5;
+ StorageDead(_5);
+ goto -> bb4;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_4);
+- _4 = ((_1 as V1).0: i32);
+- _2 = _4;
++ _4 = const 0_i32;
++ _2 = const 0_i32;
+ StorageDead(_4);
+ goto -> bb4;
+ }
+
+ bb4: {
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff
index 775325c4d..775325c4d 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff
diff --git a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..775325c4d
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff
@@ -0,0 +1,82 @@
+- // MIR for `multiple` before DataflowConstProp
++ // MIR for `multiple` after DataflowConstProp
+
+ fn multiple(_1: bool, _2: u8) -> () {
+ debug x => _1;
+ debug i => _2;
+ let mut _0: ();
+ let _3: std::option::Option<u8>;
+ let mut _4: bool;
+ let mut _5: u8;
+ let mut _7: isize;
+ scope 1 {
+ debug e => _3;
+ let _6: u8;
+ let _8: u8;
+ scope 2 {
+ debug x => _6;
+ let _9: u8;
+ scope 4 {
+ debug y => _9;
+ }
+ }
+ scope 3 {
+ debug i => _8;
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ switchInt(move _4) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageLive(_5);
+ _5 = _2;
+ _3 = Option::<u8>::Some(move _5);
+ StorageDead(_5);
+ goto -> bb3;
+ }
+
+ bb2: {
+ _3 = Option::<u8>::None;
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_4);
+ StorageLive(_6);
+ _7 = discriminant(_3);
+ switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb5];
+ }
+
+ bb4: {
+ _6 = const 0_u8;
+ goto -> bb7;
+ }
+
+ bb5: {
+ unreachable;
+ }
+
+ bb6: {
+ StorageLive(_8);
+ _8 = ((_3 as Some).0: u8);
+ _6 = _8;
+ StorageDead(_8);
+ goto -> bb7;
+ }
+
+ bb7: {
+ StorageLive(_9);
+ _9 = _6;
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_6);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff
index 960e69ee9..960e69ee9 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff
diff --git a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..960e69ee9
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.64bit.diff
@@ -0,0 +1,26 @@
+- // MIR for `mutate_discriminant` before DataflowConstProp
++ // MIR for `mutate_discriminant` after DataflowConstProp
+
+ fn mutate_discriminant() -> u8 {
+ let mut _0: u8;
+ let mut _1: std::option::Option<NonZeroUsize>;
+ let mut _2: isize;
+
+ bb0: {
+ discriminant(_1) = 1;
+ (((_1 as variant#1).0: NonZeroUsize).0: usize) = const 0_usize;
+ _2 = discriminant(_1);
+ switchInt(_2) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _0 = const 1_u8;
+ return;
+ }
+
+ bb2: {
+ _0 = const 2_u8;
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/enum.rs b/tests/mir-opt/dataflow-const-prop/enum.rs
index 79a20d7ef..5a10e9e88 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.rs
+++ b/tests/mir-opt/dataflow-const-prop/enum.rs
@@ -1,9 +1,11 @@
// unit-test: DataflowConstProp
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
#![feature(custom_mir, core_intrinsics, rustc_attrs)]
use std::intrinsics::mir::*;
+#[derive(Copy, Clone)]
enum E {
V1(i32),
V2(i32)
@@ -15,6 +17,24 @@ fn simple() {
let x = match e { E::V1(x) => x, E::V2(x) => x };
}
+// EMIT_MIR enum.constant.DataflowConstProp.diff
+fn constant() {
+ const C: E = E::V1(0);
+ let e = C;
+ let x = match e { E::V1(x) => x, E::V2(x) => x };
+}
+
+// EMIT_MIR enum.statics.DataflowConstProp.diff
+fn statics() {
+ static C: E = E::V1(0);
+ let e = C;
+ let x = match e { E::V1(x) => x, E::V2(x) => x };
+
+ static RC: &E = &E::V2(4);
+ let e = RC;
+ let x = match e { E::V1(x) => x, E::V2(x) => x };
+}
+
#[rustc_layout_scalar_valid_range_start(1)]
#[rustc_nonnull_optimization_guaranteed]
struct NonZeroUsize(usize);
@@ -63,6 +83,8 @@ fn multiple(x: bool, i: u8) {
fn main() {
simple();
+ constant();
+ statics();
mutate_discriminant();
multiple(false, 5);
}
diff --git a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff
index 3946e7c7d..3946e7c7d 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff
diff --git a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..3946e7c7d
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff
@@ -0,0 +1,63 @@
+- // MIR for `simple` before DataflowConstProp
++ // MIR for `simple` after DataflowConstProp
+
+ fn simple() -> () {
+ let mut _0: ();
+ let _1: E;
+ let mut _3: isize;
+ scope 1 {
+ debug e => _1;
+ let _2: i32;
+ let _4: i32;
+ let _5: i32;
+ scope 2 {
+ debug x => _2;
+ }
+ scope 3 {
+ debug x => _4;
+ }
+ scope 4 {
+ debug x => _5;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = E::V1(const 0_i32);
+ StorageLive(_2);
+- _3 = discriminant(_1);
+- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2];
++ _3 = const 0_isize;
++ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_5);
+ _5 = ((_1 as V2).0: i32);
+ _2 = _5;
+ StorageDead(_5);
+ goto -> bb4;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_4);
+- _4 = ((_1 as V1).0: i32);
+- _2 = _4;
++ _4 = const 0_i32;
++ _2 = const 0_i32;
+ StorageDead(_4);
+ goto -> bb4;
+ }
+
+ bb4: {
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..ae8b44c95
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff
@@ -0,0 +1,126 @@
+- // MIR for `statics` before DataflowConstProp
++ // MIR for `statics` after DataflowConstProp
+
+ fn statics() -> () {
+ let mut _0: ();
+ let _1: E;
+ let mut _2: &E;
+ let mut _4: isize;
+ let mut _8: &&E;
+ let mut _10: isize;
+ scope 1 {
+ debug e => _1;
+ let _3: i32;
+ let _5: i32;
+ let _6: i32;
+ scope 2 {
+ debug x => _3;
+ let _7: &E;
+ scope 5 {
+ debug e => _7;
+ let _9: &i32;
+ let _11: &i32;
+ let _12: &i32;
+ scope 6 {
+ debug x => _9;
+ }
+ scope 7 {
+ debug x => _11;
+ }
+ scope 8 {
+ debug x => _12;
+ }
+ }
+ }
+ scope 3 {
+ debug x => _5;
+ }
+ scope 4 {
+ debug x => _6;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const {alloc1: &E};
+ _1 = (*_2);
+ StorageDead(_2);
+ StorageLive(_3);
+- _4 = discriminant(_1);
+- switchInt(move _4) -> [0: bb3, 1: bb1, otherwise: bb2];
++ _4 = const 0_isize;
++ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = ((_1 as V2).0: i32);
+ _3 = _6;
+ StorageDead(_6);
+ goto -> bb4;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_5);
+- _5 = ((_1 as V1).0: i32);
+- _3 = _5;
++ _5 = const 0_i32;
++ _3 = const 0_i32;
+ StorageDead(_5);
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = const {alloc2: &&E};
+ _7 = (*_8);
+ StorageDead(_8);
+ StorageLive(_9);
+ _10 = discriminant((*_7));
+ switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb2];
+ }
+
+ bb5: {
+ StorageLive(_12);
+ _12 = &(((*_7) as V2).0: i32);
+ _9 = &(*_12);
+ StorageDead(_12);
+ goto -> bb7;
+ }
+
+ bb6: {
+ StorageLive(_11);
+ _11 = &(((*_7) as V1).0: i32);
+ _9 = _11;
+ StorageDead(_11);
+ goto -> bb7;
+ }
+
+ bb7: {
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_7);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
+ alloc2 (static: RC, size: 4, align: 4) {
+ ╾─alloc14─╼ │ ╾──╼
+ }
+
+ alloc14 (size: 8, align: 4) {
+ 01 00 00 00 04 00 00 00 │ ........
+ }
+
+ alloc1 (static: statics::C, size: 8, align: 4) {
+ 00 00 00 00 00 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..63799b3ba
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff
@@ -0,0 +1,126 @@
+- // MIR for `statics` before DataflowConstProp
++ // MIR for `statics` after DataflowConstProp
+
+ fn statics() -> () {
+ let mut _0: ();
+ let _1: E;
+ let mut _2: &E;
+ let mut _4: isize;
+ let mut _8: &&E;
+ let mut _10: isize;
+ scope 1 {
+ debug e => _1;
+ let _3: i32;
+ let _5: i32;
+ let _6: i32;
+ scope 2 {
+ debug x => _3;
+ let _7: &E;
+ scope 5 {
+ debug e => _7;
+ let _9: &i32;
+ let _11: &i32;
+ let _12: &i32;
+ scope 6 {
+ debug x => _9;
+ }
+ scope 7 {
+ debug x => _11;
+ }
+ scope 8 {
+ debug x => _12;
+ }
+ }
+ }
+ scope 3 {
+ debug x => _5;
+ }
+ scope 4 {
+ debug x => _6;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const {alloc1: &E};
+ _1 = (*_2);
+ StorageDead(_2);
+ StorageLive(_3);
+- _4 = discriminant(_1);
+- switchInt(move _4) -> [0: bb3, 1: bb1, otherwise: bb2];
++ _4 = const 0_isize;
++ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = ((_1 as V2).0: i32);
+ _3 = _6;
+ StorageDead(_6);
+ goto -> bb4;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_5);
+- _5 = ((_1 as V1).0: i32);
+- _3 = _5;
++ _5 = const 0_i32;
++ _3 = const 0_i32;
+ StorageDead(_5);
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = const {alloc2: &&E};
+ _7 = (*_8);
+ StorageDead(_8);
+ StorageLive(_9);
+ _10 = discriminant((*_7));
+ switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb2];
+ }
+
+ bb5: {
+ StorageLive(_12);
+ _12 = &(((*_7) as V2).0: i32);
+ _9 = &(*_12);
+ StorageDead(_12);
+ goto -> bb7;
+ }
+
+ bb6: {
+ StorageLive(_11);
+ _11 = &(((*_7) as V1).0: i32);
+ _9 = _11;
+ StorageDead(_11);
+ goto -> bb7;
+ }
+
+ bb7: {
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_7);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
+ alloc2 (static: RC, size: 8, align: 8) {
+ ╾───────alloc14───────╼ │ ╾──────╼
+ }
+
+ alloc14 (size: 8, align: 4) {
+ 01 00 00 00 04 00 00 00 │ ........
+ }
+
+ alloc1 (static: statics::C, size: 8, align: 4) {
+ 00 00 00 00 00 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff
index 08b599f9f..355f28b03 100644
--- a/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff
@@ -39,19 +39,20 @@
StorageLive(_4);
- _4 = _1;
- _3 = Eq(move _4, const 1_i32);
+- switchInt(move _3) -> [0: bb2, otherwise: bb1];
+ _4 = const 1_i32;
+ _3 = const true;
- StorageDead(_4);
-- switchInt(move _3) -> [0: bb2, otherwise: bb1];
+ switchInt(const true) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_4);
_2 = const 2_i32;
goto -> bb3;
}
bb2: {
+ StorageDead(_4);
_2 = const 3_i32;
goto -> bb3;
}
@@ -70,20 +71,21 @@
StorageLive(_9);
- _9 = _1;
- _8 = Eq(move _9, const 1_i32);
+- switchInt(move _8) -> [0: bb5, otherwise: bb4];
+ _9 = const 1_i32;
+ _8 = const true;
- StorageDead(_9);
-- switchInt(move _8) -> [0: bb5, otherwise: bb4];
+ switchInt(const true) -> [0: bb5, otherwise: bb4];
}
bb4: {
+ StorageDead(_9);
- _7 = _1;
+ _7 = const 1_i32;
goto -> bb6;
}
bb5: {
+ StorageDead(_9);
StorageLive(_10);
_10 = _1;
_7 = Add(move _10, const 1_i32);
diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..6c612d467
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-abort.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u8;
+ let mut _2: [u8; 5000];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u8; 5000];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
++ _4 = const 5000_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..87024da26
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u8;
+ let mut _2: [u8; 5000];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u8; 5000];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
++ _4 = const 5000_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..6c612d467
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-abort.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u8;
+ let mut _2: [u8; 5000];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u8; 5000];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
++ _4 = const 5000_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..87024da26
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u8;
+ let mut _2: [u8; 5000];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_u8; 5000];
+ StorageLive(_3);
+ _3 = const 2_usize;
+- _4 = Len(_2);
+- _5 = Lt(_3, _4);
+- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
++ _4 = const 5000_usize;
++ _5 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = _2[_3];
++ _1 = _2[2 of 3];
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.rs b/tests/mir-opt/dataflow-const-prop/large_array_index.rs
new file mode 100644
index 000000000..af13c7d10
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/large_array_index.rs
@@ -0,0 +1,9 @@
+// unit-test: DataflowConstProp
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
+// EMIT_MIR large_array_index.main.DataflowConstProp.diff
+fn main() {
+ // check that we don't propagate this, because it's too large
+ let x: u8 = [0_u8; 5000][2];
+}
diff --git a/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs b/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs
new file mode 100644
index 000000000..dbea14804
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs
@@ -0,0 +1,10 @@
+// unit-test: DataflowConstProp
+
+// EMIT_MIR mult_by_zero.test.DataflowConstProp.diff
+fn test(x : i32) -> i32 {
+ x * 0
+}
+
+fn main() {
+ test(10);
+}
diff --git a/tests/mir-opt/dataflow-const-prop/mult_by_zero.test.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/mult_by_zero.test.DataflowConstProp.diff
new file mode 100644
index 000000000..91bc10a56
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/mult_by_zero.test.DataflowConstProp.diff
@@ -0,0 +1,18 @@
+- // MIR for `test` before DataflowConstProp
++ // MIR for `test` after DataflowConstProp
+
+ fn test(_1: i32) -> i32 {
+ debug x => _1;
+ let mut _0: i32;
+ let mut _2: i32;
+
+ bb0: {
+ StorageLive(_2);
+ _2 = _1;
+- _0 = Mul(move _2, const 0_i32);
++ _0 = const 0_i32;
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff
new file mode 100644
index 000000000..c61414b65
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff
@@ -0,0 +1,76 @@
+- // MIR for `concrete` before DataflowConstProp
++ // MIR for `concrete` after DataflowConstProp
+
+ fn concrete() -> () {
+ let mut _0: ();
+ let _1: usize;
+ let mut _2: usize;
+ let mut _4: usize;
+ let mut _6: usize;
+ let mut _8: usize;
+ scope 1 {
+ debug x => _1;
+ let _3: usize;
+ scope 2 {
+ debug y => _3;
+ let _5: usize;
+ scope 3 {
+ debug z0 => _5;
+ let _7: usize;
+ scope 4 {
+ debug z1 => _7;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = OffsetOf(Alpha, [0]);
+- _1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable];
++ _2 = const 4_usize;
++ _1 = must_use::<usize>(const 4_usize) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = OffsetOf(Alpha, [1]);
+- _3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable];
++ _4 = const 0_usize;
++ _3 = must_use::<usize>(const 0_usize) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = OffsetOf(Alpha, [2, 0]);
+- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind unreachable];
++ _6 = const 2_usize;
++ _5 = must_use::<usize>(const 2_usize) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+- _8 = OffsetOf(Alpha, [2, 1]);
+- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind unreachable];
++ _8 = const 3_usize;
++ _7 = must_use::<usize>(const 3_usize) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_8);
+ _0 = const ();
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff
new file mode 100644
index 000000000..0c3939a34
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff
@@ -0,0 +1,76 @@
+- // MIR for `concrete` before DataflowConstProp
++ // MIR for `concrete` after DataflowConstProp
+
+ fn concrete() -> () {
+ let mut _0: ();
+ let _1: usize;
+ let mut _2: usize;
+ let mut _4: usize;
+ let mut _6: usize;
+ let mut _8: usize;
+ scope 1 {
+ debug x => _1;
+ let _3: usize;
+ scope 2 {
+ debug y => _3;
+ let _5: usize;
+ scope 3 {
+ debug z0 => _5;
+ let _7: usize;
+ scope 4 {
+ debug z1 => _7;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = OffsetOf(Alpha, [0]);
+- _1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue];
++ _2 = const 4_usize;
++ _1 = must_use::<usize>(const 4_usize) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = OffsetOf(Alpha, [1]);
+- _3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue];
++ _4 = const 0_usize;
++ _3 = must_use::<usize>(const 0_usize) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = OffsetOf(Alpha, [2, 0]);
+- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue];
++ _6 = const 2_usize;
++ _5 = must_use::<usize>(const 2_usize) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+- _8 = OffsetOf(Alpha, [2, 1]);
+- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue];
++ _8 = const 3_usize;
++ _7 = must_use::<usize>(const 3_usize) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_8);
+ _0 = const ();
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff
new file mode 100644
index 000000000..d54d46870
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff
@@ -0,0 +1,72 @@
+- // MIR for `generic` before DataflowConstProp
++ // MIR for `generic` after DataflowConstProp
+
+ fn generic() -> () {
+ let mut _0: ();
+ let _1: usize;
+ let mut _2: usize;
+ let mut _4: usize;
+ let mut _6: usize;
+ let mut _8: usize;
+ scope 1 {
+ debug gx => _1;
+ let _3: usize;
+ scope 2 {
+ debug gy => _3;
+ let _5: usize;
+ scope 3 {
+ debug dx => _5;
+ let _7: usize;
+ scope 4 {
+ debug dy => _7;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = OffsetOf(Gamma<T>, [0]);
+ _1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = OffsetOf(Gamma<T>, [1]);
+ _3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = OffsetOf(Delta<T>, [1]);
+- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind unreachable];
++ _6 = const 0_usize;
++ _5 = must_use::<usize>(const 0_usize) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+- _8 = OffsetOf(Delta<T>, [2]);
+- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind unreachable];
++ _8 = const 2_usize;
++ _7 = must_use::<usize>(const 2_usize) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_8);
+ _0 = const ();
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff
new file mode 100644
index 000000000..6032a2274
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff
@@ -0,0 +1,72 @@
+- // MIR for `generic` before DataflowConstProp
++ // MIR for `generic` after DataflowConstProp
+
+ fn generic() -> () {
+ let mut _0: ();
+ let _1: usize;
+ let mut _2: usize;
+ let mut _4: usize;
+ let mut _6: usize;
+ let mut _8: usize;
+ scope 1 {
+ debug gx => _1;
+ let _3: usize;
+ scope 2 {
+ debug gy => _3;
+ let _5: usize;
+ scope 3 {
+ debug dx => _5;
+ let _7: usize;
+ scope 4 {
+ debug dy => _7;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = OffsetOf(Gamma<T>, [0]);
+ _1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = OffsetOf(Gamma<T>, [1]);
+ _3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = OffsetOf(Delta<T>, [1]);
+- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue];
++ _6 = const 0_usize;
++ _5 = must_use::<usize>(const 0_usize) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+- _8 = OffsetOf(Delta<T>, [2]);
+- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue];
++ _8 = const 2_usize;
++ _7 = must_use::<usize>(const 2_usize) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_8);
+ _0 = const ();
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.rs b/tests/mir-opt/dataflow-const-prop/offset_of.rs
new file mode 100644
index 000000000..ccc90790e
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.rs
@@ -0,0 +1,49 @@
+// unit-test: DataflowConstProp
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
+#![feature(offset_of)]
+
+use std::marker::PhantomData;
+use std::mem::offset_of;
+
+struct Alpha {
+ x: u8,
+ y: u16,
+ z: Beta,
+}
+
+struct Beta(u8, u8);
+
+struct Gamma<T> {
+ x: u8,
+ y: u16,
+ _t: T,
+}
+
+#[repr(C)]
+struct Delta<T> {
+ _phantom: PhantomData<T>,
+ x: u8,
+ y: u16,
+}
+
+// EMIT_MIR offset_of.concrete.DataflowConstProp.diff
+fn concrete() {
+ let x = offset_of!(Alpha, x);
+ let y = offset_of!(Alpha, y);
+ let z0 = offset_of!(Alpha, z.0);
+ let z1 = offset_of!(Alpha, z.1);
+}
+
+// EMIT_MIR offset_of.generic.DataflowConstProp.diff
+fn generic<T>() {
+ let gx = offset_of!(Gamma<T>, x);
+ let gy = offset_of!(Gamma<T>, y);
+ let dx = offset_of!(Delta<T>, x);
+ let dy = offset_of!(Delta<T>, y);
+}
+
+fn main() {
+ concrete();
+ generic::<()>();
+}
diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..a18ef6c9d
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-abort.diff
@@ -0,0 +1,43 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: u32;
+ let mut _3: [u32; 8];
+ let _4: usize;
+ let mut _5: usize;
+ let mut _6: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 42_u32; 8];
+ StorageLive(_4);
+ _4 = const 2_usize;
+- _5 = Len(_3);
+- _6 = Lt(_4, _5);
+- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable];
++ _5 = const 8_usize;
++ _6 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _2 = _3[_4];
++ _2 = _3[2 of 3];
+ _1 = Add(move _2, const 0_u32);
+ StorageDead(_2);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..3356ef98b
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,43 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: u32;
+ let mut _3: [u32; 8];
+ let _4: usize;
+ let mut _5: usize;
+ let mut _6: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 42_u32; 8];
+ StorageLive(_4);
+ _4 = const 2_usize;
+- _5 = Len(_3);
+- _6 = Lt(_4, _5);
+- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue];
++ _5 = const 8_usize;
++ _6 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _2 = _3[_4];
++ _2 = _3[2 of 3];
+ _1 = Add(move _2, const 0_u32);
+ StorageDead(_2);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..a18ef6c9d
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-abort.diff
@@ -0,0 +1,43 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: u32;
+ let mut _3: [u32; 8];
+ let _4: usize;
+ let mut _5: usize;
+ let mut _6: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 42_u32; 8];
+ StorageLive(_4);
+ _4 = const 2_usize;
+- _5 = Len(_3);
+- _6 = Lt(_4, _5);
+- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable];
++ _5 = const 8_usize;
++ _6 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _2 = _3[_4];
++ _2 = _3[2 of 3];
+ _1 = Add(move _2, const 0_u32);
+ StorageDead(_2);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..3356ef98b
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,43 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: u32;
+ let mut _3: [u32; 8];
+ let _4: usize;
+ let mut _5: usize;
+ let mut _6: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 42_u32; 8];
+ StorageLive(_4);
+ _4 = const 2_usize;
+- _5 = Len(_3);
+- _6 = Lt(_4, _5);
+- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue];
++ _5 = const 8_usize;
++ _6 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _2 = _3[_4];
++ _2 = _3[2 of 3];
+ _1 = Add(move _2, const 0_u32);
+ StorageDead(_2);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/repeat.rs b/tests/mir-opt/dataflow-const-prop/repeat.rs
new file mode 100644
index 000000000..9fa353e44
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/repeat.rs
@@ -0,0 +1,8 @@
+// unit-test: DataflowConstProp
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
+// EMIT_MIR repeat.main.DataflowConstProp.diff
+fn main() {
+ let x: u32 = [42; 8][2] + 0;
+}
diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..e99b413f7
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff
@@ -0,0 +1,77 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: &[u32];
+ let mut _3: &[u32; 3];
+ let _4: &[u32; 3];
+ let _5: [u32; 3];
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: bool;
+ let mut _10: &[u32];
+ let _11: usize;
+ let mut _12: usize;
+ let mut _13: bool;
+ let mut _14: &[u32; 3];
+ scope 1 {
+ debug local => _1;
+ let _9: u32;
+ scope 2 {
+ debug constant => _9;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _14 = const _;
+ _4 = _14;
+ _3 = _4;
+ _2 = move _3 as &[u32] (PointerCoercion(Unsize));
+ StorageDead(_3);
+ StorageLive(_6);
+ _6 = const 1_usize;
+- _7 = Len((*_2));
+- _8 = Lt(_6, _7);
+- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
++ _7 = const 3_usize;
++ _8 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = (*_2)[_6];
++ _1 = (*_2)[1 of 2];
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = const _;
+ StorageLive(_11);
+ _11 = const 1_usize;
+- _12 = Len((*_10));
+- _13 = Lt(_11, _12);
+- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind unreachable];
++ _12 = const 3_usize;
++ _13 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- _9 = (*_10)[_11];
++ _9 = (*_10)[1 of 2];
+ StorageDead(_11);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..759a793fb
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,77 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: &[u32];
+ let mut _3: &[u32; 3];
+ let _4: &[u32; 3];
+ let _5: [u32; 3];
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: bool;
+ let mut _10: &[u32];
+ let _11: usize;
+ let mut _12: usize;
+ let mut _13: bool;
+ let mut _14: &[u32; 3];
+ scope 1 {
+ debug local => _1;
+ let _9: u32;
+ scope 2 {
+ debug constant => _9;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _14 = const _;
+ _4 = _14;
+ _3 = _4;
+ _2 = move _3 as &[u32] (PointerCoercion(Unsize));
+ StorageDead(_3);
+ StorageLive(_6);
+ _6 = const 1_usize;
+- _7 = Len((*_2));
+- _8 = Lt(_6, _7);
+- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
++ _7 = const 3_usize;
++ _8 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = (*_2)[_6];
++ _1 = (*_2)[1 of 2];
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = const _;
+ StorageLive(_11);
+ _11 = const 1_usize;
+- _12 = Len((*_10));
+- _13 = Lt(_11, _12);
+- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind continue];
++ _12 = const 3_usize;
++ _13 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind continue];
+ }
+
+ bb2: {
+- _9 = (*_10)[_11];
++ _9 = (*_10)[1 of 2];
+ StorageDead(_11);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..e99b413f7
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff
@@ -0,0 +1,77 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: &[u32];
+ let mut _3: &[u32; 3];
+ let _4: &[u32; 3];
+ let _5: [u32; 3];
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: bool;
+ let mut _10: &[u32];
+ let _11: usize;
+ let mut _12: usize;
+ let mut _13: bool;
+ let mut _14: &[u32; 3];
+ scope 1 {
+ debug local => _1;
+ let _9: u32;
+ scope 2 {
+ debug constant => _9;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _14 = const _;
+ _4 = _14;
+ _3 = _4;
+ _2 = move _3 as &[u32] (PointerCoercion(Unsize));
+ StorageDead(_3);
+ StorageLive(_6);
+ _6 = const 1_usize;
+- _7 = Len((*_2));
+- _8 = Lt(_6, _7);
+- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
++ _7 = const 3_usize;
++ _8 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = (*_2)[_6];
++ _1 = (*_2)[1 of 2];
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = const _;
+ StorageLive(_11);
+ _11 = const 1_usize;
+- _12 = Len((*_10));
+- _13 = Lt(_11, _12);
+- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind unreachable];
++ _12 = const 3_usize;
++ _13 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- _9 = (*_10)[_11];
++ _9 = (*_10)[1 of 2];
+ StorageDead(_11);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..759a793fb
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,77 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: &[u32];
+ let mut _3: &[u32; 3];
+ let _4: &[u32; 3];
+ let _5: [u32; 3];
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: bool;
+ let mut _10: &[u32];
+ let _11: usize;
+ let mut _12: usize;
+ let mut _13: bool;
+ let mut _14: &[u32; 3];
+ scope 1 {
+ debug local => _1;
+ let _9: u32;
+ scope 2 {
+ debug constant => _9;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _14 = const _;
+ _4 = _14;
+ _3 = _4;
+ _2 = move _3 as &[u32] (PointerCoercion(Unsize));
+ StorageDead(_3);
+ StorageLive(_6);
+ _6 = const 1_usize;
+- _7 = Len((*_2));
+- _8 = Lt(_6, _7);
+- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
++ _7 = const 3_usize;
++ _8 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = (*_2)[_6];
++ _1 = (*_2)[1 of 2];
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = const _;
+ StorageLive(_11);
+ _11 = const 1_usize;
+- _12 = Len((*_10));
+- _13 = Lt(_11, _12);
+- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind continue];
++ _12 = const 3_usize;
++ _13 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind continue];
+ }
+
+ bb2: {
+- _9 = (*_10)[_11];
++ _9 = (*_10)[1 of 2];
+ StorageDead(_11);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.rs b/tests/mir-opt/dataflow-const-prop/slice_len.rs
new file mode 100644
index 000000000..41367e484
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/slice_len.rs
@@ -0,0 +1,12 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// unit-test: DataflowConstProp
+// compile-flags: -Zmir-enable-passes=+InstSimplify
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
+// EMIT_MIR slice_len.main.DataflowConstProp.diff
+fn main() {
+ let local = (&[1u32, 2, 3] as &[u32])[1];
+
+ const SLICE: &[u32] = &[1, 2, 3];
+ let constant = SLICE[1];
+}
diff --git a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..2de6ba307
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff
@@ -0,0 +1,129 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: S;
+ let mut _3: i32;
+ let mut _5: i32;
+ let mut _6: i32;
+ let mut _11: BigStruct;
+ let mut _16: &&BigStruct;
+ let mut _17: &BigStruct;
+ let mut _18: &BigStruct;
+ let mut _19: &BigStruct;
+ let mut _20: &BigStruct;
+ let mut _21: &BigStruct;
+ scope 1 {
+ debug s => _1;
+ let _2: i32;
+ scope 2 {
+ debug a => _2;
+ let _4: i32;
+ scope 3 {
+ debug b => _4;
+ let _7: S;
+ let _8: u8;
+ let _9: f32;
+ let _10: S;
+ scope 4 {
+ debug a => _7;
+ debug b => _8;
+ debug c => _9;
+ debug d => _10;
+ let _12: S;
+ let _13: u8;
+ let _14: f32;
+ let _15: S;
+ scope 5 {
+ debug a => _12;
+ debug b => _13;
+ debug c => _14;
+ debug d => _15;
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = S(const 1_i32);
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = (_1.0: i32);
+- _2 = Add(move _3, const 2_i32);
++ _3 = const 1_i32;
++ _2 = const 3_i32;
+ StorageDead(_3);
+ (_1.0: i32) = const 3_i32;
+ StorageLive(_4);
+ StorageLive(_5);
+- _5 = _2;
++ _5 = const 3_i32;
+ StorageLive(_6);
+- _6 = (_1.0: i32);
+- _4 = Add(move _5, move _6);
++ _6 = const 3_i32;
++ _4 = const 6_i32;
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_11);
+ _11 = const _;
+ StorageLive(_7);
+- _7 = (_11.0: S);
++ _7 = const S(1_i32);
+ StorageLive(_8);
+- _8 = (_11.1: u8);
++ _8 = const 5_u8;
+ StorageLive(_9);
+- _9 = (_11.2: f32);
++ _9 = const 7f32;
+ StorageLive(_10);
+- _10 = (_11.3: S);
++ _10 = const S(13_i32);
+ StorageDead(_11);
+ StorageLive(_16);
+ _16 = const {alloc1: &&BigStruct};
+ _17 = deref_copy (*_16);
+ StorageLive(_12);
+ _18 = deref_copy (*_16);
+- _12 = ((*_18).0: S);
++ _12 = const S(1_i32);
+ StorageLive(_13);
+ _19 = deref_copy (*_16);
+- _13 = ((*_19).1: u8);
++ _13 = const 5_u8;
+ StorageLive(_14);
+ _20 = deref_copy (*_16);
+- _14 = ((*_20).2: f32);
++ _14 = const 7f32;
+ StorageLive(_15);
+ _21 = deref_copy (*_16);
+- _15 = ((*_21).3: S);
++ _15 = const S(13_i32);
+ StorageDead(_16);
+ _0 = const ();
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
+ alloc1 (static: STAT, size: 4, align: 4) {
+ ╾─alloc15─╼ │ ╾──╼
+ }
+
+ alloc15 (size: 16, align: 4) {
+ 01 00 00 00 00 00 e0 40 0d 00 00 00 05 __ __ __ │ .......@.....░░░
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..71a28f216
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff
@@ -0,0 +1,129 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: S;
+ let mut _3: i32;
+ let mut _5: i32;
+ let mut _6: i32;
+ let mut _11: BigStruct;
+ let mut _16: &&BigStruct;
+ let mut _17: &BigStruct;
+ let mut _18: &BigStruct;
+ let mut _19: &BigStruct;
+ let mut _20: &BigStruct;
+ let mut _21: &BigStruct;
+ scope 1 {
+ debug s => _1;
+ let _2: i32;
+ scope 2 {
+ debug a => _2;
+ let _4: i32;
+ scope 3 {
+ debug b => _4;
+ let _7: S;
+ let _8: u8;
+ let _9: f32;
+ let _10: S;
+ scope 4 {
+ debug a => _7;
+ debug b => _8;
+ debug c => _9;
+ debug d => _10;
+ let _12: S;
+ let _13: u8;
+ let _14: f32;
+ let _15: S;
+ scope 5 {
+ debug a => _12;
+ debug b => _13;
+ debug c => _14;
+ debug d => _15;
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = S(const 1_i32);
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = (_1.0: i32);
+- _2 = Add(move _3, const 2_i32);
++ _3 = const 1_i32;
++ _2 = const 3_i32;
+ StorageDead(_3);
+ (_1.0: i32) = const 3_i32;
+ StorageLive(_4);
+ StorageLive(_5);
+- _5 = _2;
++ _5 = const 3_i32;
+ StorageLive(_6);
+- _6 = (_1.0: i32);
+- _4 = Add(move _5, move _6);
++ _6 = const 3_i32;
++ _4 = const 6_i32;
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_11);
+ _11 = const _;
+ StorageLive(_7);
+- _7 = (_11.0: S);
++ _7 = const S(1_i32);
+ StorageLive(_8);
+- _8 = (_11.1: u8);
++ _8 = const 5_u8;
+ StorageLive(_9);
+- _9 = (_11.2: f32);
++ _9 = const 7f32;
+ StorageLive(_10);
+- _10 = (_11.3: S);
++ _10 = const S(13_i32);
+ StorageDead(_11);
+ StorageLive(_16);
+ _16 = const {alloc1: &&BigStruct};
+ _17 = deref_copy (*_16);
+ StorageLive(_12);
+ _18 = deref_copy (*_16);
+- _12 = ((*_18).0: S);
++ _12 = const S(1_i32);
+ StorageLive(_13);
+ _19 = deref_copy (*_16);
+- _13 = ((*_19).1: u8);
++ _13 = const 5_u8;
+ StorageLive(_14);
+ _20 = deref_copy (*_16);
+- _14 = ((*_20).2: f32);
++ _14 = const 7f32;
+ StorageLive(_15);
+ _21 = deref_copy (*_16);
+- _15 = ((*_21).3: S);
++ _15 = const S(13_i32);
+ StorageDead(_16);
+ _0 = const ();
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
+ alloc1 (static: STAT, size: 8, align: 8) {
+ ╾───────alloc15───────╼ │ ╾──────╼
+ }
+
+ alloc15 (size: 16, align: 4) {
+ 01 00 00 00 00 00 e0 40 0d 00 00 00 05 __ __ __ │ .......@.....░░░
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.diff
deleted file mode 100644
index 914bc8ac4..000000000
--- a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.diff
+++ /dev/null
@@ -1,51 +0,0 @@
-- // MIR for `main` before DataflowConstProp
-+ // MIR for `main` after DataflowConstProp
-
- fn main() -> () {
- let mut _0: ();
- let mut _1: S;
- let mut _3: i32;
- let mut _5: i32;
- let mut _6: i32;
- scope 1 {
- debug s => _1;
- let _2: i32;
- scope 2 {
- debug a => _2;
- let _4: i32;
- scope 3 {
- debug b => _4;
- }
- }
- }
-
- bb0: {
- StorageLive(_1);
- _1 = S(const 1_i32);
- StorageLive(_2);
- StorageLive(_3);
-- _3 = (_1.0: i32);
-- _2 = Add(move _3, const 2_i32);
-+ _3 = const 1_i32;
-+ _2 = const 3_i32;
- StorageDead(_3);
- (_1.0: i32) = const 3_i32;
- StorageLive(_4);
- StorageLive(_5);
-- _5 = _2;
-+ _5 = const 3_i32;
- StorageLive(_6);
-- _6 = (_1.0: i32);
-- _4 = Add(move _5, move _6);
-+ _6 = const 3_i32;
-+ _4 = const 6_i32;
- StorageDead(_6);
- StorageDead(_5);
- _0 = const ();
- StorageDead(_4);
- StorageDead(_2);
- StorageDead(_1);
- return;
- }
- }
-
diff --git a/tests/mir-opt/dataflow-const-prop/struct.rs b/tests/mir-opt/dataflow-const-prop/struct.rs
index 841b279e0..e92a1676d 100644
--- a/tests/mir-opt/dataflow-const-prop/struct.rs
+++ b/tests/mir-opt/dataflow-const-prop/struct.rs
@@ -1,11 +1,22 @@
// unit-test: DataflowConstProp
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+#[derive(Copy, Clone)]
struct S(i32);
+#[derive(Copy, Clone)]
+struct BigStruct(S, u8, f32, S);
+
// EMIT_MIR struct.main.DataflowConstProp.diff
fn main() {
let mut s = S(1);
let a = s.0 + 2;
s.0 = 3;
let b = a + s.0;
+
+ const VAL: BigStruct = BigStruct(S(1), 5, 7., S(13));
+ let BigStruct(a, b, c, d) = VAL;
+
+ static STAT: &BigStruct = &BigStruct(S(1), 5, 7., S(13));
+ let BigStruct(a, b, c, d) = *STAT;
}
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..52f096ac0
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.32bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `from_char` before DataflowConstProp
++ // MIR for `from_char` after DataflowConstProp
+
+ fn from_char() -> i32 {
+ let mut _0: i32;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const 'R' as i32 (Transmute);
++ _0 = const 82_i32;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..52f096ac0
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.from_char.DataflowConstProp.64bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `from_char` before DataflowConstProp
++ // MIR for `from_char` after DataflowConstProp
+
+ fn from_char() -> i32 {
+ let mut _0: i32;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const 'R' as i32 (Transmute);
++ _0 = const 82_i32;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..3972eb209
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.32bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `invalid_bool` before DataflowConstProp
++ // MIR for `invalid_bool` after DataflowConstProp
+
+ fn invalid_bool() -> bool {
+ let mut _0: bool;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const -1_i8 as bool (Transmute);
++ _0 = const {transmute(0xff): bool};
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..3972eb209
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.invalid_bool.DataflowConstProp.64bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `invalid_bool` before DataflowConstProp
++ // MIR for `invalid_bool` after DataflowConstProp
+
+ fn invalid_bool() -> bool {
+ let mut _0: bool;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const -1_i8 as bool (Transmute);
++ _0 = const {transmute(0xff): bool};
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..837dabde4
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.32bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `invalid_char` before DataflowConstProp
++ // MIR for `invalid_char` after DataflowConstProp
+
+ fn invalid_char() -> char {
+ let mut _0: char;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const _ as char (Transmute);
++ _0 = const {transmute(0x7fffffff): char};
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..837dabde4
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.invalid_char.DataflowConstProp.64bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `invalid_char` before DataflowConstProp
++ // MIR for `invalid_char` after DataflowConstProp
+
+ fn invalid_char() -> char {
+ let mut _0: char;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const _ as char (Transmute);
++ _0 = const {transmute(0x7fffffff): char};
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..6091e169e
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff
@@ -0,0 +1,18 @@
+- // MIR for `less_as_i8` before DataflowConstProp
++ // MIR for `less_as_i8` after DataflowConstProp
+
+ fn less_as_i8() -> i8 {
+ let mut _0: i8;
+ let mut _1: std::cmp::Ordering;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = Less;
+ _0 = move _1 as i8 (Transmute);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..6091e169e
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff
@@ -0,0 +1,18 @@
+- // MIR for `less_as_i8` before DataflowConstProp
++ // MIR for `less_as_i8` after DataflowConstProp
+
+ fn less_as_i8() -> i8 {
+ let mut _0: i8;
+ let mut _1: std::cmp::Ordering;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = Less;
+ _0 = move _1 as i8 (Transmute);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.rs b/tests/mir-opt/dataflow-const-prop/transmute.rs
new file mode 100644
index 000000000..c25e33ab0
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.rs
@@ -0,0 +1,63 @@
+// unit-test: DataflowConstProp
+// compile-flags: -O --crate-type=lib
+// ignore-endian-big
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
+use std::mem::transmute;
+
+// EMIT_MIR transmute.less_as_i8.DataflowConstProp.diff
+pub fn less_as_i8() -> i8 {
+ unsafe { transmute(std::cmp::Ordering::Less) }
+}
+
+// EMIT_MIR transmute.from_char.DataflowConstProp.diff
+pub fn from_char() -> i32 {
+ unsafe { transmute('R') }
+}
+
+// EMIT_MIR transmute.valid_char.DataflowConstProp.diff
+pub fn valid_char() -> char {
+ unsafe { transmute(0x52_u32) }
+}
+
+// EMIT_MIR transmute.invalid_char.DataflowConstProp.diff
+pub unsafe fn invalid_char() -> char {
+ unsafe { transmute(i32::MAX) }
+}
+
+// EMIT_MIR transmute.invalid_bool.DataflowConstProp.diff
+pub unsafe fn invalid_bool() -> bool {
+ unsafe { transmute(-1_i8) }
+}
+
+// EMIT_MIR transmute.undef_union_as_integer.DataflowConstProp.diff
+pub unsafe fn undef_union_as_integer() -> u32 {
+ union Union32 { value: u32, unit: () }
+ unsafe { transmute(Union32 { unit: () }) }
+}
+
+// EMIT_MIR transmute.unreachable_direct.DataflowConstProp.diff
+pub unsafe fn unreachable_direct() -> ! {
+ let x: Never = unsafe { transmute(()) };
+ match x {}
+}
+
+// EMIT_MIR transmute.unreachable_ref.DataflowConstProp.diff
+pub unsafe fn unreachable_ref() -> ! {
+ let x: &Never = unsafe { transmute(1_usize) };
+ match *x {}
+}
+
+// EMIT_MIR transmute.unreachable_mut.DataflowConstProp.diff
+pub unsafe fn unreachable_mut() -> ! {
+ let x: &mut Never = unsafe { transmute(1_usize) };
+ match *x {}
+}
+
+// EMIT_MIR transmute.unreachable_box.DataflowConstProp.diff
+pub unsafe fn unreachable_box() -> ! {
+ let x: Box<Never> = unsafe { transmute(1_usize) };
+ match *x {}
+}
+
+enum Never {}
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..fc0634b1f
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff
@@ -0,0 +1,22 @@
+- // MIR for `undef_union_as_integer` before DataflowConstProp
++ // MIR for `undef_union_as_integer` after DataflowConstProp
+
+ fn undef_union_as_integer() -> u32 {
+ let mut _0: u32;
+ let mut _1: undef_union_as_integer::Union32;
+ let mut _2: ();
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = ();
+ _1 = Union32 { value: move _2 };
+ StorageDead(_2);
+ _0 = move _1 as u32 (Transmute);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..fc0634b1f
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff
@@ -0,0 +1,22 @@
+- // MIR for `undef_union_as_integer` before DataflowConstProp
++ // MIR for `undef_union_as_integer` after DataflowConstProp
+
+ fn undef_union_as_integer() -> u32 {
+ let mut _0: u32;
+ let mut _1: undef_union_as_integer::Union32;
+ let mut _2: ();
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = ();
+ _1 = Union32 { value: move _2 };
+ StorageDead(_2);
+ _0 = move _1 as u32 (Transmute);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..d0c298ba2
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff
@@ -0,0 +1,20 @@
+- // MIR for `unreachable_box` before DataflowConstProp
++ // MIR for `unreachable_box` after DataflowConstProp
+
+ fn unreachable_box() -> ! {
+ let mut _0: !;
+ let _1: std::boxed::Box<Never>;
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
++ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global);
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..d0c298ba2
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff
@@ -0,0 +1,20 @@
+- // MIR for `unreachable_box` before DataflowConstProp
++ // MIR for `unreachable_box` after DataflowConstProp
+
+ fn unreachable_box() -> ! {
+ let mut _0: !;
+ let _1: std::boxed::Box<Never>;
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
++ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global);
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..acbb5cd1b
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff
@@ -0,0 +1,22 @@
+- // MIR for `unreachable_direct` before DataflowConstProp
++ // MIR for `unreachable_direct` after DataflowConstProp
+
+ fn unreachable_direct() -> ! {
+ let mut _0: !;
+ let _1: Never;
+ let mut _2: ();
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = ();
+ _1 = move _2 as Never (Transmute);
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..acbb5cd1b
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff
@@ -0,0 +1,22 @@
+- // MIR for `unreachable_direct` before DataflowConstProp
++ // MIR for `unreachable_direct` after DataflowConstProp
+
+ fn unreachable_direct() -> ! {
+ let mut _0: !;
+ let _1: Never;
+ let mut _2: ();
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = ();
+ _1 = move _2 as Never (Transmute);
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..2ffaeea72
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.32bit.diff
@@ -0,0 +1,24 @@
+- // MIR for `unreachable_mut` before DataflowConstProp
++ // MIR for `unreachable_mut` after DataflowConstProp
+
+ fn unreachable_mut() -> ! {
+ let mut _0: !;
+ let _1: &mut Never;
+ let mut _2: &mut Never;
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = const 1_usize as &mut Never (Transmute);
++ _2 = const {0x1 as &mut Never};
+ _1 = &mut (*_2);
+ StorageDead(_2);
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..2ffaeea72
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_mut.DataflowConstProp.64bit.diff
@@ -0,0 +1,24 @@
+- // MIR for `unreachable_mut` before DataflowConstProp
++ // MIR for `unreachable_mut` after DataflowConstProp
+
+ fn unreachable_mut() -> ! {
+ let mut _0: !;
+ let _1: &mut Never;
+ let mut _2: &mut Never;
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = const 1_usize as &mut Never (Transmute);
++ _2 = const {0x1 as &mut Never};
+ _1 = &mut (*_2);
+ StorageDead(_2);
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..31fcaafc5
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.32bit.diff
@@ -0,0 +1,20 @@
+- // MIR for `unreachable_ref` before DataflowConstProp
++ // MIR for `unreachable_ref` after DataflowConstProp
+
+ fn unreachable_ref() -> ! {
+ let mut _0: !;
+ let _1: &Never;
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = const 1_usize as &Never (Transmute);
++ _1 = const {0x1 as &Never};
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..31fcaafc5
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_ref.DataflowConstProp.64bit.diff
@@ -0,0 +1,20 @@
+- // MIR for `unreachable_ref` before DataflowConstProp
++ // MIR for `unreachable_ref` after DataflowConstProp
+
+ fn unreachable_ref() -> ! {
+ let mut _0: !;
+ let _1: &Never;
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = const 1_usize as &Never (Transmute);
++ _1 = const {0x1 as &Never};
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..402ef754a
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.32bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `valid_char` before DataflowConstProp
++ // MIR for `valid_char` after DataflowConstProp
+
+ fn valid_char() -> char {
+ let mut _0: char;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const 82_u32 as char (Transmute);
++ _0 = const 'R';
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..402ef754a
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.valid_char.DataflowConstProp.64bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `valid_char` before DataflowConstProp
++ // MIR for `valid_char` after DataflowConstProp
+
+ fn valid_char() -> char {
+ let mut _0: char;
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const 82_u32 as char (Transmute);
++ _0 = const 'R';
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-abort.diff b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-abort.diff
new file mode 100644
index 000000000..dc0f90734
--- /dev/null
+++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-abort.diff
@@ -0,0 +1,15 @@
+- // MIR for `move_packed` before DeadStoreElimination
++ // MIR for `move_packed` after DeadStoreElimination
+
+ fn move_packed(_1: Packed) -> () {
+ let mut _0: ();
+
+ bb0: {
+ _0 = use_both(const 0_i32, (_1.1: i32)) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-unwind.diff b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-unwind.diff
new file mode 100644
index 000000000..86ef026ec
--- /dev/null
+++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination.panic-unwind.diff
@@ -0,0 +1,15 @@
+- // MIR for `move_packed` before DeadStoreElimination
++ // MIR for `move_packed` after DeadStoreElimination
+
+ fn move_packed(_1: Packed) -> () {
+ let mut _0: ();
+
+ bb0: {
+ _0 = use_both(const 0_i32, (_1.1: i32)) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs
index 41f91fc13..f09cdee14 100644
--- a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs
+++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs
@@ -2,6 +2,12 @@
// unit-test: DeadStoreElimination
// compile-flags: -Zmir-enable-passes=+CopyProp
+#![feature(core_intrinsics)]
+#![feature(custom_mir)]
+#![allow(internal_features)]
+
+use std::intrinsics::mir::*;
+
#[inline(never)]
fn use_both(_: i32, _: i32) {}
@@ -10,6 +16,26 @@ fn move_simple(x: i32) {
use_both(x, x);
}
+#[repr(packed)]
+struct Packed {
+ x: u8,
+ y: i32,
+}
+
+// EMIT_MIR call_arg_copy.move_packed.DeadStoreElimination.diff
+#[custom_mir(dialect = "analysis")]
+fn move_packed(packed: Packed) {
+ mir!(
+ {
+ Call(RET = use_both(0, packed.y), ret)
+ }
+ ret = {
+ Return()
+ }
+ )
+}
+
fn main() {
move_simple(1);
+ move_packed(Packed { x: 0, y: 1 });
}
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
index 024d9bc7f..8ac6acd0e 100644
--- a/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff
+++ b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff
@@ -28,7 +28,7 @@
}
bb4 (cleanup): {
- drop(_2) -> [return: bb5, unwind terminate];
+ drop(_2) -> [return: bb5, unwind terminate(cleanup)];
}
bb5 (cleanup): {
diff --git a/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff
index 2ada087b4..aa9fcb505 100644
--- a/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff
+++ b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff
@@ -28,7 +28,7 @@
}
bb4 (cleanup): {
- drop(_2) -> [return: bb5, unwind terminate];
+ drop(_2) -> [return: bb5, unwind terminate(cleanup)];
}
bb5 (cleanup): {
diff --git a/tests/mir-opt/dont_inline_type_id.call.Inline.diff b/tests/mir-opt/dont_inline_type_id.call.Inline.diff
new file mode 100644
index 000000000..80cfe07b0
--- /dev/null
+++ b/tests/mir-opt/dont_inline_type_id.call.Inline.diff
@@ -0,0 +1,20 @@
+- // MIR for `call` before Inline
++ // MIR for `call` after Inline
+
+ fn call(_1: &T) -> TypeId {
+ debug s => _1;
+ let mut _0: std::any::TypeId;
+ let mut _2: &T;
+
+ bb0: {
+ StorageLive(_2);
+ _2 = &(*_1);
+ _0 = <T as Any>::type_id(move _2) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dont_inline_type_id.rs b/tests/mir-opt/dont_inline_type_id.rs
new file mode 100644
index 000000000..d8a566360
--- /dev/null
+++ b/tests/mir-opt/dont_inline_type_id.rs
@@ -0,0 +1,15 @@
+// unit-test: Inline
+// compile-flags: --crate-type=lib -C panic=abort
+
+use std::any::Any;
+use std::any::TypeId;
+
+struct A<T: ?Sized + 'static> {
+ a: i32,
+ b: T,
+}
+
+// EMIT_MIR dont_inline_type_id.call.Inline.diff
+pub fn call<T: ?Sized + 'static>(s: &T) -> TypeId {
+ s.type_id()
+}
diff --git a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff
index 9d9a7a1e4..ec5f5c1f1 100644
--- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff
+++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff
@@ -64,5 +64,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc15 (size: 8, align: 4) {
++ 02 00 00 00 05 20 00 00 │ ..... ..
}
diff --git a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff
index 9d9a7a1e4..9bf8637ec 100644
--- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff
+++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff
@@ -64,5 +64,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc15 (size: 16, align: 8) {
++ 02 00 00 00 00 00 00 00 05 20 00 00 00 00 00 00 │ ......... ......
}
diff --git a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff
index 4306f38b8..7dc6d21a9 100644
--- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff
+++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff
@@ -64,5 +64,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc14 (size: 8, align: 4) {
++ 05 20 00 00 01 00 00 00 │ . ......
}
diff --git a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff
index 4306f38b8..0b000876a 100644
--- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff
+++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff
@@ -64,5 +64,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc14 (size: 16, align: 8) {
++ 05 20 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ . ..............
}
diff --git a/tests/mir-opt/equal_true.opt.InstSimplify.diff b/tests/mir-opt/equal_true.opt.InstSimplify.diff
index 7b38862e4..88a51000c 100644
--- a/tests/mir-opt/equal_true.opt.InstSimplify.diff
+++ b/tests/mir-opt/equal_true.opt.InstSimplify.diff
@@ -13,16 +13,17 @@
_3 = _1;
- _2 = Eq(move _3, const true);
+ _2 = move _3;
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
_0 = const 0_i32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
_0 = const 1_i32;
goto -> bb3;
}
diff --git a/tests/mir-opt/funky_arms.rs b/tests/mir-opt/funky_arms.rs
index 6b4f4c805..79fd9457c 100644
--- a/tests/mir-opt/funky_arms.rs
+++ b/tests/mir-opt/funky_arms.rs
@@ -9,7 +9,7 @@ use core::num::flt2dec;
use std::fmt::{Formatter, Result};
// EMIT_MIR funky_arms.float_to_exponential_common.ConstProp.diff
-fn float_to_exponential_common<T>(fmt: &mut Formatter<'_>, num: &T, upper: bool) -> Result
+pub fn float_to_exponential_common<T>(fmt: &mut Formatter<'_>, num: &T, upper: bool) -> Result
where
T: flt2dec::DecodableFloat,
{
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
index 958078b97..d8bea1420 100644
--- 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
@@ -21,7 +21,7 @@
},
} */
-fn main::{closure#0}(_1: *mut [generator@$DIR/generator_drop_cleanup.rs:10:15: 10:17]) -> () {
+fn main::{closure#0}(_1: *mut {generator@$DIR/generator_drop_cleanup.rs:10:15: 10:17}) -> () {
let mut _0: ();
let mut _2: ();
let _3: std::string::String;
diff --git a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir
index 7e050e585..d8b27eda8 100644
--- a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir
+++ b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir
@@ -21,7 +21,7 @@
},
} */
-fn main::{closure#0}(_1: *mut [generator@$DIR/generator_drop_cleanup.rs:10:15: 10:17]) -> () {
+fn main::{closure#0}(_1: *mut {generator@$DIR/generator_drop_cleanup.rs:10:15: 10:17}) -> () {
let mut _0: ();
let mut _2: ();
let _3: std::string::String;
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
index 25c656b3a..4587282de 100644
--- 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
@@ -1,6 +1,6 @@
// MIR for `main::{closure#0}` before StateTransform
-fn main::{closure#0}(_1: [generator@$DIR/generator_storage_dead_unwind.rs:22:16: 22:18], _2: ()) -> ()
+fn main::{closure#0}(_1: {generator@$DIR/generator_storage_dead_unwind.rs:22:16: 22:18}, _2: ()) -> ()
yields ()
{
let mut _0: ();
diff --git a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir
index 6a4c5436f..38026f65b 100644
--- a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir
+++ b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir
@@ -1,6 +1,6 @@
// MIR for `main::{closure#0}` before StateTransform
-fn main::{closure#0}(_1: [generator@$DIR/generator_storage_dead_unwind.rs:22:16: 22:18], _2: ()) -> ()
+fn main::{closure#0}(_1: {generator@$DIR/generator_storage_dead_unwind.rs:22:16: 22:18}, _2: ()) -> ()
yields ()
{
let mut _0: ();
@@ -104,7 +104,7 @@ yields ()
bb13 (cleanup): {
StorageDead(_3);
- drop(_1) -> [return: bb14, unwind terminate];
+ drop(_1) -> [return: bb14, unwind terminate(cleanup)];
}
bb14 (cleanup): {
@@ -113,6 +113,6 @@ yields ()
bb15 (cleanup): {
StorageDead(_3);
- drop(_1) -> [return: bb14, unwind terminate];
+ drop(_1) -> [return: bb14, unwind terminate(cleanup)];
}
}
diff --git a/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir b/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir
index 13d703b90..ac7549f93 100644
--- a/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir
+++ b/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir
@@ -21,7 +21,7 @@
},
} */
-fn main::{closure#0}(_1: Pin<&mut [generator@$DIR/generator_tiny.rs:19:16: 19:24]>, _2: u8) -> GeneratorState<(), ()> {
+fn main::{closure#0}(_1: Pin<&mut {generator@$DIR/generator_tiny.rs:19:16: 19:24}>, _2: u8) -> GeneratorState<(), ()> {
debug _x => _10;
let mut _0: std::ops::GeneratorState<(), ()>;
let _3: HasDrop;
@@ -34,18 +34,18 @@ fn main::{closure#0}(_1: Pin<&mut [generator@$DIR/generator_tiny.rs:19:16: 19:24
let _10: u8;
let mut _11: u32;
scope 1 {
- debug _d => (((*(_1.0: &mut [generator@$DIR/generator_tiny.rs:19:16: 19:24])) as variant#3).0: HasDrop);
+ debug _d => (((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24})) as variant#3).0: HasDrop);
}
bb0: {
- _11 = discriminant((*(_1.0: &mut [generator@$DIR/generator_tiny.rs:19:16: 19:24])));
+ _11 = discriminant((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24})));
switchInt(move _11) -> [0: bb1, 3: bb5, otherwise: bb6];
}
bb1: {
_10 = move _2;
nop;
- (((*(_1.0: &mut [generator@$DIR/generator_tiny.rs:19:16: 19:24])) as variant#3).0: HasDrop) = HasDrop;
+ (((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24})) as variant#3).0: HasDrop) = HasDrop;
StorageLive(_4);
goto -> bb2;
}
@@ -55,7 +55,7 @@ fn main::{closure#0}(_1: Pin<&mut [generator@$DIR/generator_tiny.rs:19:16: 19:24
StorageLive(_7);
_7 = ();
_0 = GeneratorState::<(), ()>::Yielded(move _7);
- discriminant((*(_1.0: &mut [generator@$DIR/generator_tiny.rs:19:16: 19:24]))) = 3;
+ discriminant((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24}))) = 3;
return;
}
diff --git a/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff b/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff
new file mode 100644
index 000000000..3f5173c18
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff
@@ -0,0 +1,342 @@
+- // MIR for `arithmetic` before GVN
++ // MIR for `arithmetic` after GVN
+
+ fn arithmetic(_1: u64) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: u64;
+ let mut _4: u64;
+ let _5: ();
+ let mut _6: u64;
+ let mut _7: u64;
+ let _8: ();
+ let mut _9: u64;
+ let mut _10: u64;
+ let _11: ();
+ let mut _12: u64;
+ let mut _13: u64;
+ let _14: ();
+ let mut _15: u64;
+ let mut _16: u64;
+ let mut _17: bool;
+ let _18: ();
+ let mut _19: u64;
+ let mut _20: u64;
+ let mut _21: bool;
+ let _22: ();
+ let mut _23: u64;
+ let mut _24: u64;
+ let mut _25: bool;
+ let _26: ();
+ let mut _27: u64;
+ let mut _28: u64;
+ let mut _29: bool;
+ let _30: ();
+ let mut _31: u64;
+ let mut _32: u64;
+ let mut _33: bool;
+ let _34: ();
+ let mut _35: u64;
+ let mut _36: u64;
+ let mut _37: bool;
+ let _38: ();
+ let mut _39: u64;
+ let mut _40: u64;
+ let mut _41: bool;
+ let _42: ();
+ let mut _43: u64;
+ let mut _44: u64;
+ let mut _45: bool;
+ let _46: ();
+ let mut _47: u64;
+ let mut _48: u64;
+ let _49: ();
+ let mut _50: u64;
+ let mut _51: u64;
+ let _52: ();
+ let mut _53: u64;
+ let mut _54: u64;
+ let _55: ();
+ let mut _56: u64;
+ let mut _57: u64;
+ let _58: ();
+ let mut _59: u64;
+ let mut _60: u64;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _3 = Add(move _4, const 0_u64);
+- StorageDead(_4);
++ _3 = Add(_1, const 0_u64);
+ _2 = opaque::<u64>(move _3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_5);
+ StorageLive(_6);
+- StorageLive(_7);
+- _7 = _1;
+- _6 = Sub(move _7, const 0_u64);
+- StorageDead(_7);
++ _6 = Sub(_1, const 0_u64);
+ _5 = opaque::<u64>(move _6) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_8);
+ StorageLive(_9);
+- StorageLive(_10);
+- _10 = _1;
+- _9 = Mul(move _10, const 0_u64);
+- StorageDead(_10);
++ _9 = Mul(_1, const 0_u64);
+ _8 = opaque::<u64>(move _9) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_11);
+ StorageLive(_12);
+- StorageLive(_13);
+- _13 = _1;
+- _12 = Mul(move _13, const 1_u64);
+- StorageDead(_13);
++ _12 = Mul(_1, const 1_u64);
+ _11 = opaque::<u64>(move _12) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_14);
+ StorageLive(_15);
+- StorageLive(_16);
+- _16 = _1;
+ _17 = Eq(const 0_u64, const 0_u64);
+- assert(!move _17, "attempt to divide `{}` by zero", _16) -> [success: bb5, unwind unreachable];
++ assert(!_17, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind unreachable];
+ }
+
+ bb5: {
+- _15 = Div(move _16, const 0_u64);
+- StorageDead(_16);
++ _15 = Div(_1, const 0_u64);
+ _14 = opaque::<u64>(move _15) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_18);
+ StorageLive(_19);
+- StorageLive(_20);
+- _20 = _1;
+ _21 = Eq(const 1_u64, const 0_u64);
+- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb7, unwind unreachable];
++ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind unreachable];
+ }
+
+ bb7: {
+- _19 = Div(move _20, const 1_u64);
+- StorageDead(_20);
++ _19 = Div(_1, const 1_u64);
+ _18 = opaque::<u64>(move _19) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+ StorageDead(_19);
+ StorageDead(_18);
+ StorageLive(_22);
+ StorageLive(_23);
+- StorageLive(_24);
+- _24 = _1;
+- _25 = Eq(_24, const 0_u64);
+- assert(!move _25, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb9, unwind unreachable];
++ _25 = Eq(_1, const 0_u64);
++ assert(!_25, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb9, unwind unreachable];
+ }
+
+ bb9: {
+- _23 = Div(const 0_u64, move _24);
+- StorageDead(_24);
++ _23 = Div(const 0_u64, _1);
+ _22 = opaque::<u64>(move _23) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_26);
+ StorageLive(_27);
+- StorageLive(_28);
+- _28 = _1;
+- _29 = Eq(_28, const 0_u64);
+- assert(!move _29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind unreachable];
++ assert(!_25, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind unreachable];
+ }
+
+ bb11: {
+- _27 = Div(const 1_u64, move _28);
+- StorageDead(_28);
++ _27 = Div(const 1_u64, _1);
+ _26 = opaque::<u64>(move _27) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+ StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- _33 = Eq(const 0_u64, const 0_u64);
+- assert(!move _33, "attempt to calculate the remainder of `{}` with a divisor of zero", _32) -> [success: bb13, unwind unreachable];
++ assert(!_17, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind unreachable];
+ }
+
+ bb13: {
+- _31 = Rem(move _32, const 0_u64);
+- StorageDead(_32);
++ _31 = Rem(_1, const 0_u64);
+ _30 = opaque::<u64>(move _31) -> [return: bb14, unwind unreachable];
+ }
+
+ bb14: {
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_34);
+ StorageLive(_35);
+- StorageLive(_36);
+- _36 = _1;
+- _37 = Eq(const 1_u64, const 0_u64);
+- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb15, unwind unreachable];
++ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind unreachable];
+ }
+
+ bb15: {
+- _35 = Rem(move _36, const 1_u64);
+- StorageDead(_36);
++ _35 = Rem(_1, const 1_u64);
+ _34 = opaque::<u64>(move _35) -> [return: bb16, unwind unreachable];
+ }
+
+ bb16: {
+ StorageDead(_35);
+ StorageDead(_34);
+ StorageLive(_38);
+ StorageLive(_39);
+- StorageLive(_40);
+- _40 = _1;
+- _41 = Eq(_40, const 0_u64);
+- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind unreachable];
++ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind unreachable];
+ }
+
+ bb17: {
+- _39 = Rem(const 0_u64, move _40);
+- StorageDead(_40);
++ _39 = Rem(const 0_u64, _1);
+ _38 = opaque::<u64>(move _39) -> [return: bb18, unwind unreachable];
+ }
+
+ bb18: {
+ StorageDead(_39);
+ StorageDead(_38);
+ StorageLive(_42);
+ StorageLive(_43);
+- StorageLive(_44);
+- _44 = _1;
+- _45 = Eq(_44, const 0_u64);
+- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind unreachable];
++ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind unreachable];
+ }
+
+ bb19: {
+- _43 = Rem(const 1_u64, move _44);
+- StorageDead(_44);
++ _43 = Rem(const 1_u64, _1);
+ _42 = opaque::<u64>(move _43) -> [return: bb20, unwind unreachable];
+ }
+
+ bb20: {
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_46);
+ StorageLive(_47);
+- StorageLive(_48);
+- _48 = _1;
+- _47 = BitAnd(move _48, const 0_u64);
+- StorageDead(_48);
++ _47 = BitAnd(_1, const 0_u64);
+ _46 = opaque::<u64>(move _47) -> [return: bb21, unwind unreachable];
+ }
+
+ bb21: {
+ StorageDead(_47);
+ StorageDead(_46);
+ StorageLive(_49);
+ StorageLive(_50);
+- StorageLive(_51);
+- _51 = _1;
+- _50 = BitOr(move _51, const 0_u64);
+- StorageDead(_51);
++ _50 = BitOr(_1, const 0_u64);
+ _49 = opaque::<u64>(move _50) -> [return: bb22, unwind unreachable];
+ }
+
+ bb22: {
+ StorageDead(_50);
+ StorageDead(_49);
+ StorageLive(_52);
+ StorageLive(_53);
+- StorageLive(_54);
+- _54 = _1;
+- _53 = BitXor(move _54, const 0_u64);
+- StorageDead(_54);
++ _53 = BitXor(_1, const 0_u64);
+ _52 = opaque::<u64>(move _53) -> [return: bb23, unwind unreachable];
+ }
+
+ bb23: {
+ StorageDead(_53);
+ StorageDead(_52);
+ StorageLive(_55);
+ StorageLive(_56);
+- StorageLive(_57);
+- _57 = _1;
+- _56 = Shr(move _57, const 0_i32);
+- StorageDead(_57);
++ _56 = Shr(_1, const 0_i32);
+ _55 = opaque::<u64>(move _56) -> [return: bb24, unwind unreachable];
+ }
+
+ bb24: {
+ StorageDead(_56);
+ StorageDead(_55);
+ StorageLive(_58);
+ StorageLive(_59);
+- StorageLive(_60);
+- _60 = _1;
+- _59 = Shl(move _60, const 0_i32);
+- StorageDead(_60);
++ _59 = Shl(_1, const 0_i32);
+ _58 = opaque::<u64>(move _59) -> [return: bb25, unwind unreachable];
+ }
+
+ bb25: {
+ StorageDead(_59);
+ StorageDead(_58);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff b/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff
new file mode 100644
index 000000000..38da21d91
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff
@@ -0,0 +1,342 @@
+- // MIR for `arithmetic` before GVN
++ // MIR for `arithmetic` after GVN
+
+ fn arithmetic(_1: u64) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: u64;
+ let mut _4: u64;
+ let _5: ();
+ let mut _6: u64;
+ let mut _7: u64;
+ let _8: ();
+ let mut _9: u64;
+ let mut _10: u64;
+ let _11: ();
+ let mut _12: u64;
+ let mut _13: u64;
+ let _14: ();
+ let mut _15: u64;
+ let mut _16: u64;
+ let mut _17: bool;
+ let _18: ();
+ let mut _19: u64;
+ let mut _20: u64;
+ let mut _21: bool;
+ let _22: ();
+ let mut _23: u64;
+ let mut _24: u64;
+ let mut _25: bool;
+ let _26: ();
+ let mut _27: u64;
+ let mut _28: u64;
+ let mut _29: bool;
+ let _30: ();
+ let mut _31: u64;
+ let mut _32: u64;
+ let mut _33: bool;
+ let _34: ();
+ let mut _35: u64;
+ let mut _36: u64;
+ let mut _37: bool;
+ let _38: ();
+ let mut _39: u64;
+ let mut _40: u64;
+ let mut _41: bool;
+ let _42: ();
+ let mut _43: u64;
+ let mut _44: u64;
+ let mut _45: bool;
+ let _46: ();
+ let mut _47: u64;
+ let mut _48: u64;
+ let _49: ();
+ let mut _50: u64;
+ let mut _51: u64;
+ let _52: ();
+ let mut _53: u64;
+ let mut _54: u64;
+ let _55: ();
+ let mut _56: u64;
+ let mut _57: u64;
+ let _58: ();
+ let mut _59: u64;
+ let mut _60: u64;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _3 = Add(move _4, const 0_u64);
+- StorageDead(_4);
++ _3 = Add(_1, const 0_u64);
+ _2 = opaque::<u64>(move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_5);
+ StorageLive(_6);
+- StorageLive(_7);
+- _7 = _1;
+- _6 = Sub(move _7, const 0_u64);
+- StorageDead(_7);
++ _6 = Sub(_1, const 0_u64);
+ _5 = opaque::<u64>(move _6) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_8);
+ StorageLive(_9);
+- StorageLive(_10);
+- _10 = _1;
+- _9 = Mul(move _10, const 0_u64);
+- StorageDead(_10);
++ _9 = Mul(_1, const 0_u64);
+ _8 = opaque::<u64>(move _9) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_11);
+ StorageLive(_12);
+- StorageLive(_13);
+- _13 = _1;
+- _12 = Mul(move _13, const 1_u64);
+- StorageDead(_13);
++ _12 = Mul(_1, const 1_u64);
+ _11 = opaque::<u64>(move _12) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_14);
+ StorageLive(_15);
+- StorageLive(_16);
+- _16 = _1;
+ _17 = Eq(const 0_u64, const 0_u64);
+- assert(!move _17, "attempt to divide `{}` by zero", _16) -> [success: bb5, unwind continue];
++ assert(!_17, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind continue];
+ }
+
+ bb5: {
+- _15 = Div(move _16, const 0_u64);
+- StorageDead(_16);
++ _15 = Div(_1, const 0_u64);
+ _14 = opaque::<u64>(move _15) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_18);
+ StorageLive(_19);
+- StorageLive(_20);
+- _20 = _1;
+ _21 = Eq(const 1_u64, const 0_u64);
+- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb7, unwind continue];
++ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind continue];
+ }
+
+ bb7: {
+- _19 = Div(move _20, const 1_u64);
+- StorageDead(_20);
++ _19 = Div(_1, const 1_u64);
+ _18 = opaque::<u64>(move _19) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+ StorageDead(_19);
+ StorageDead(_18);
+ StorageLive(_22);
+ StorageLive(_23);
+- StorageLive(_24);
+- _24 = _1;
+- _25 = Eq(_24, const 0_u64);
+- assert(!move _25, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb9, unwind continue];
++ _25 = Eq(_1, const 0_u64);
++ assert(!_25, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb9, unwind continue];
+ }
+
+ bb9: {
+- _23 = Div(const 0_u64, move _24);
+- StorageDead(_24);
++ _23 = Div(const 0_u64, _1);
+ _22 = opaque::<u64>(move _23) -> [return: bb10, unwind continue];
+ }
+
+ bb10: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_26);
+ StorageLive(_27);
+- StorageLive(_28);
+- _28 = _1;
+- _29 = Eq(_28, const 0_u64);
+- assert(!move _29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind continue];
++ assert(!_25, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind continue];
+ }
+
+ bb11: {
+- _27 = Div(const 1_u64, move _28);
+- StorageDead(_28);
++ _27 = Div(const 1_u64, _1);
+ _26 = opaque::<u64>(move _27) -> [return: bb12, unwind continue];
+ }
+
+ bb12: {
+ StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- _33 = Eq(const 0_u64, const 0_u64);
+- assert(!move _33, "attempt to calculate the remainder of `{}` with a divisor of zero", _32) -> [success: bb13, unwind continue];
++ assert(!_17, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind continue];
+ }
+
+ bb13: {
+- _31 = Rem(move _32, const 0_u64);
+- StorageDead(_32);
++ _31 = Rem(_1, const 0_u64);
+ _30 = opaque::<u64>(move _31) -> [return: bb14, unwind continue];
+ }
+
+ bb14: {
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_34);
+ StorageLive(_35);
+- StorageLive(_36);
+- _36 = _1;
+- _37 = Eq(const 1_u64, const 0_u64);
+- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb15, unwind continue];
++ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind continue];
+ }
+
+ bb15: {
+- _35 = Rem(move _36, const 1_u64);
+- StorageDead(_36);
++ _35 = Rem(_1, const 1_u64);
+ _34 = opaque::<u64>(move _35) -> [return: bb16, unwind continue];
+ }
+
+ bb16: {
+ StorageDead(_35);
+ StorageDead(_34);
+ StorageLive(_38);
+ StorageLive(_39);
+- StorageLive(_40);
+- _40 = _1;
+- _41 = Eq(_40, const 0_u64);
+- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind continue];
++ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind continue];
+ }
+
+ bb17: {
+- _39 = Rem(const 0_u64, move _40);
+- StorageDead(_40);
++ _39 = Rem(const 0_u64, _1);
+ _38 = opaque::<u64>(move _39) -> [return: bb18, unwind continue];
+ }
+
+ bb18: {
+ StorageDead(_39);
+ StorageDead(_38);
+ StorageLive(_42);
+ StorageLive(_43);
+- StorageLive(_44);
+- _44 = _1;
+- _45 = Eq(_44, const 0_u64);
+- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind continue];
++ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind continue];
+ }
+
+ bb19: {
+- _43 = Rem(const 1_u64, move _44);
+- StorageDead(_44);
++ _43 = Rem(const 1_u64, _1);
+ _42 = opaque::<u64>(move _43) -> [return: bb20, unwind continue];
+ }
+
+ bb20: {
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_46);
+ StorageLive(_47);
+- StorageLive(_48);
+- _48 = _1;
+- _47 = BitAnd(move _48, const 0_u64);
+- StorageDead(_48);
++ _47 = BitAnd(_1, const 0_u64);
+ _46 = opaque::<u64>(move _47) -> [return: bb21, unwind continue];
+ }
+
+ bb21: {
+ StorageDead(_47);
+ StorageDead(_46);
+ StorageLive(_49);
+ StorageLive(_50);
+- StorageLive(_51);
+- _51 = _1;
+- _50 = BitOr(move _51, const 0_u64);
+- StorageDead(_51);
++ _50 = BitOr(_1, const 0_u64);
+ _49 = opaque::<u64>(move _50) -> [return: bb22, unwind continue];
+ }
+
+ bb22: {
+ StorageDead(_50);
+ StorageDead(_49);
+ StorageLive(_52);
+ StorageLive(_53);
+- StorageLive(_54);
+- _54 = _1;
+- _53 = BitXor(move _54, const 0_u64);
+- StorageDead(_54);
++ _53 = BitXor(_1, const 0_u64);
+ _52 = opaque::<u64>(move _53) -> [return: bb23, unwind continue];
+ }
+
+ bb23: {
+ StorageDead(_53);
+ StorageDead(_52);
+ StorageLive(_55);
+ StorageLive(_56);
+- StorageLive(_57);
+- _57 = _1;
+- _56 = Shr(move _57, const 0_i32);
+- StorageDead(_57);
++ _56 = Shr(_1, const 0_i32);
+ _55 = opaque::<u64>(move _56) -> [return: bb24, unwind continue];
+ }
+
+ bb24: {
+ StorageDead(_56);
+ StorageDead(_55);
+ StorageLive(_58);
+ StorageLive(_59);
+- StorageLive(_60);
+- _60 = _1;
+- _59 = Shl(move _60, const 0_i32);
+- StorageDead(_60);
++ _59 = Shl(_1, const 0_i32);
+ _58 = opaque::<u64>(move _59) -> [return: bb25, unwind continue];
+ }
+
+ bb25: {
+ StorageDead(_59);
+ StorageDead(_58);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff
new file mode 100644
index 000000000..0c342799e
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff
@@ -0,0 +1,389 @@
+- // MIR for `arithmetic_checked` before GVN
++ // MIR for `arithmetic_checked` after GVN
+
+ fn arithmetic_checked(_1: u64) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: u64;
+ let mut _4: u64;
+ let mut _5: (u64, bool);
+ let _6: ();
+ let mut _7: u64;
+ let mut _8: u64;
+ let mut _9: (u64, bool);
+ let _10: ();
+ let mut _11: u64;
+ let mut _12: u64;
+ let mut _13: (u64, bool);
+ let _14: ();
+ let mut _15: u64;
+ let mut _16: u64;
+ let mut _17: (u64, bool);
+ let _18: ();
+ let mut _19: u64;
+ let mut _20: u64;
+ let mut _21: bool;
+ let _22: ();
+ let mut _23: u64;
+ let mut _24: u64;
+ let mut _25: bool;
+ let _26: ();
+ let mut _27: u64;
+ let mut _28: u64;
+ let mut _29: bool;
+ let _30: ();
+ let mut _31: u64;
+ let mut _32: u64;
+ let mut _33: bool;
+ let _34: ();
+ let mut _35: u64;
+ let mut _36: u64;
+ let mut _37: bool;
+ let _38: ();
+ let mut _39: u64;
+ let mut _40: u64;
+ let mut _41: bool;
+ let _42: ();
+ let mut _43: u64;
+ let mut _44: u64;
+ let mut _45: bool;
+ let _46: ();
+ let mut _47: u64;
+ let mut _48: u64;
+ let mut _49: bool;
+ let _50: ();
+ let mut _51: u64;
+ let mut _52: u64;
+ let _53: ();
+ let mut _54: u64;
+ let mut _55: u64;
+ let _56: ();
+ let mut _57: u64;
+ let mut _58: u64;
+ let _59: ();
+ let mut _60: u64;
+ let mut _61: u64;
+ let mut _62: u32;
+ let mut _63: bool;
+ let _64: ();
+ let mut _65: u64;
+ let mut _66: u64;
+ let mut _67: u32;
+ let mut _68: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _5 = CheckedAdd(_4, const 0_u64);
+- assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, const 0_u64) -> [success: bb1, unwind unreachable];
++ _5 = CheckedAdd(_1, const 0_u64);
++ assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", _1, const 0_u64) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _3 = move (_5.0: u64);
+- StorageDead(_4);
+ _2 = opaque::<u64>(move _3) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_6);
+ StorageLive(_7);
+- StorageLive(_8);
+- _8 = _1;
+- _9 = CheckedSub(_8, const 0_u64);
+- assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", move _8, const 0_u64) -> [success: bb3, unwind unreachable];
++ _9 = CheckedSub(_1, const 0_u64);
++ assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", _1, const 0_u64) -> [success: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ _7 = move (_9.0: u64);
+- StorageDead(_8);
+ _6 = opaque::<u64>(move _7) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_10);
+ StorageLive(_11);
+- StorageLive(_12);
+- _12 = _1;
+- _13 = CheckedMul(_12, const 0_u64);
+- assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", move _12, const 0_u64) -> [success: bb5, unwind unreachable];
++ _13 = CheckedMul(_1, const 0_u64);
++ assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", _1, const 0_u64) -> [success: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ _11 = move (_13.0: u64);
+- StorageDead(_12);
+ _10 = opaque::<u64>(move _11) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_14);
+ StorageLive(_15);
+- StorageLive(_16);
+- _16 = _1;
+- _17 = CheckedMul(_16, const 1_u64);
+- assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", move _16, const 1_u64) -> [success: bb7, unwind unreachable];
++ _17 = CheckedMul(_1, const 1_u64);
++ assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", _1, const 1_u64) -> [success: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ _15 = move (_17.0: u64);
+- StorageDead(_16);
+ _14 = opaque::<u64>(move _15) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_18);
+ StorageLive(_19);
+- StorageLive(_20);
+- _20 = _1;
+ _21 = Eq(const 0_u64, const 0_u64);
+- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb9, unwind unreachable];
++ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb9, unwind unreachable];
+ }
+
+ bb9: {
+- _19 = Div(move _20, const 0_u64);
+- StorageDead(_20);
++ _19 = Div(_1, const 0_u64);
+ _18 = opaque::<u64>(move _19) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+ StorageDead(_19);
+ StorageDead(_18);
+ StorageLive(_22);
+ StorageLive(_23);
+- StorageLive(_24);
+- _24 = _1;
+ _25 = Eq(const 1_u64, const 0_u64);
+- assert(!move _25, "attempt to divide `{}` by zero", _24) -> [success: bb11, unwind unreachable];
++ assert(!_25, "attempt to divide `{}` by zero", _1) -> [success: bb11, unwind unreachable];
+ }
+
+ bb11: {
+- _23 = Div(move _24, const 1_u64);
+- StorageDead(_24);
++ _23 = Div(_1, const 1_u64);
+ _22 = opaque::<u64>(move _23) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_26);
+ StorageLive(_27);
+- StorageLive(_28);
+- _28 = _1;
+- _29 = Eq(_28, const 0_u64);
+- assert(!move _29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind unreachable];
++ _29 = Eq(_1, const 0_u64);
++ assert(!_29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind unreachable];
+ }
+
+ bb13: {
+- _27 = Div(const 0_u64, move _28);
+- StorageDead(_28);
++ _27 = Div(const 0_u64, _1);
+ _26 = opaque::<u64>(move _27) -> [return: bb14, unwind unreachable];
+ }
+
+ bb14: {
+ StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- _33 = Eq(_32, const 0_u64);
+- assert(!move _33, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind unreachable];
++ assert(!_29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind unreachable];
+ }
+
+ bb15: {
+- _31 = Div(const 1_u64, move _32);
+- StorageDead(_32);
++ _31 = Div(const 1_u64, _1);
+ _30 = opaque::<u64>(move _31) -> [return: bb16, unwind unreachable];
+ }
+
+ bb16: {
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_34);
+ StorageLive(_35);
+- StorageLive(_36);
+- _36 = _1;
+- _37 = Eq(const 0_u64, const 0_u64);
+- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb17, unwind unreachable];
++ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb17, unwind unreachable];
+ }
+
+ bb17: {
+- _35 = Rem(move _36, const 0_u64);
+- StorageDead(_36);
++ _35 = Rem(_1, const 0_u64);
+ _34 = opaque::<u64>(move _35) -> [return: bb18, unwind unreachable];
+ }
+
+ bb18: {
+ StorageDead(_35);
+ StorageDead(_34);
+ StorageLive(_38);
+ StorageLive(_39);
+- StorageLive(_40);
+- _40 = _1;
+- _41 = Eq(const 1_u64, const 0_u64);
+- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", _40) -> [success: bb19, unwind unreachable];
++ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb19, unwind unreachable];
+ }
+
+ bb19: {
+- _39 = Rem(move _40, const 1_u64);
+- StorageDead(_40);
++ _39 = Rem(_1, const 1_u64);
+ _38 = opaque::<u64>(move _39) -> [return: bb20, unwind unreachable];
+ }
+
+ bb20: {
+ StorageDead(_39);
+ StorageDead(_38);
+ StorageLive(_42);
+ StorageLive(_43);
+- StorageLive(_44);
+- _44 = _1;
+- _45 = Eq(_44, const 0_u64);
+- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind unreachable];
++ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind unreachable];
+ }
+
+ bb21: {
+- _43 = Rem(const 0_u64, move _44);
+- StorageDead(_44);
++ _43 = Rem(const 0_u64, _1);
+ _42 = opaque::<u64>(move _43) -> [return: bb22, unwind unreachable];
+ }
+
+ bb22: {
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_46);
+ StorageLive(_47);
+- StorageLive(_48);
+- _48 = _1;
+- _49 = Eq(_48, const 0_u64);
+- assert(!move _49, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind unreachable];
++ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind unreachable];
+ }
+
+ bb23: {
+- _47 = Rem(const 1_u64, move _48);
+- StorageDead(_48);
++ _47 = Rem(const 1_u64, _1);
+ _46 = opaque::<u64>(move _47) -> [return: bb24, unwind unreachable];
+ }
+
+ bb24: {
+ StorageDead(_47);
+ StorageDead(_46);
+ StorageLive(_50);
+ StorageLive(_51);
+- StorageLive(_52);
+- _52 = _1;
+- _51 = BitAnd(move _52, const 0_u64);
+- StorageDead(_52);
++ _51 = BitAnd(_1, const 0_u64);
+ _50 = opaque::<u64>(move _51) -> [return: bb25, unwind unreachable];
+ }
+
+ bb25: {
+ StorageDead(_51);
+ StorageDead(_50);
+ StorageLive(_53);
+ StorageLive(_54);
+- StorageLive(_55);
+- _55 = _1;
+- _54 = BitOr(move _55, const 0_u64);
+- StorageDead(_55);
++ _54 = BitOr(_1, const 0_u64);
+ _53 = opaque::<u64>(move _54) -> [return: bb26, unwind unreachable];
+ }
+
+ bb26: {
+ StorageDead(_54);
+ StorageDead(_53);
+ StorageLive(_56);
+ StorageLive(_57);
+- StorageLive(_58);
+- _58 = _1;
+- _57 = BitXor(move _58, const 0_u64);
+- StorageDead(_58);
++ _57 = BitXor(_1, const 0_u64);
+ _56 = opaque::<u64>(move _57) -> [return: bb27, unwind unreachable];
+ }
+
+ bb27: {
+ StorageDead(_57);
+ StorageDead(_56);
+ StorageLive(_59);
+ StorageLive(_60);
+- StorageLive(_61);
+- _61 = _1;
+ _62 = const 0_i32 as u32 (IntToInt);
+- _63 = Lt(move _62, const 64_u32);
+- assert(move _63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind unreachable];
++ _63 = Lt(_62, const 64_u32);
++ assert(_63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind unreachable];
+ }
+
+ bb28: {
+- _60 = Shr(move _61, const 0_i32);
+- StorageDead(_61);
++ _60 = Shr(_1, const 0_i32);
+ _59 = opaque::<u64>(move _60) -> [return: bb29, unwind unreachable];
+ }
+
+ bb29: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_64);
+ StorageLive(_65);
+- StorageLive(_66);
+- _66 = _1;
+- _67 = const 0_i32 as u32 (IntToInt);
+- _68 = Lt(move _67, const 64_u32);
+- assert(move _68, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind unreachable];
++ assert(_63, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind unreachable];
+ }
+
+ bb30: {
+- _65 = Shl(move _66, const 0_i32);
+- StorageDead(_66);
++ _65 = Shl(_1, const 0_i32);
+ _64 = opaque::<u64>(move _65) -> [return: bb31, unwind unreachable];
+ }
+
+ bb31: {
+ StorageDead(_65);
+ StorageDead(_64);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff
new file mode 100644
index 000000000..7813c29b9
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff
@@ -0,0 +1,389 @@
+- // MIR for `arithmetic_checked` before GVN
++ // MIR for `arithmetic_checked` after GVN
+
+ fn arithmetic_checked(_1: u64) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: u64;
+ let mut _4: u64;
+ let mut _5: (u64, bool);
+ let _6: ();
+ let mut _7: u64;
+ let mut _8: u64;
+ let mut _9: (u64, bool);
+ let _10: ();
+ let mut _11: u64;
+ let mut _12: u64;
+ let mut _13: (u64, bool);
+ let _14: ();
+ let mut _15: u64;
+ let mut _16: u64;
+ let mut _17: (u64, bool);
+ let _18: ();
+ let mut _19: u64;
+ let mut _20: u64;
+ let mut _21: bool;
+ let _22: ();
+ let mut _23: u64;
+ let mut _24: u64;
+ let mut _25: bool;
+ let _26: ();
+ let mut _27: u64;
+ let mut _28: u64;
+ let mut _29: bool;
+ let _30: ();
+ let mut _31: u64;
+ let mut _32: u64;
+ let mut _33: bool;
+ let _34: ();
+ let mut _35: u64;
+ let mut _36: u64;
+ let mut _37: bool;
+ let _38: ();
+ let mut _39: u64;
+ let mut _40: u64;
+ let mut _41: bool;
+ let _42: ();
+ let mut _43: u64;
+ let mut _44: u64;
+ let mut _45: bool;
+ let _46: ();
+ let mut _47: u64;
+ let mut _48: u64;
+ let mut _49: bool;
+ let _50: ();
+ let mut _51: u64;
+ let mut _52: u64;
+ let _53: ();
+ let mut _54: u64;
+ let mut _55: u64;
+ let _56: ();
+ let mut _57: u64;
+ let mut _58: u64;
+ let _59: ();
+ let mut _60: u64;
+ let mut _61: u64;
+ let mut _62: u32;
+ let mut _63: bool;
+ let _64: ();
+ let mut _65: u64;
+ let mut _66: u64;
+ let mut _67: u32;
+ let mut _68: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _5 = CheckedAdd(_4, const 0_u64);
+- assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, const 0_u64) -> [success: bb1, unwind continue];
++ _5 = CheckedAdd(_1, const 0_u64);
++ assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", _1, const 0_u64) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+ _3 = move (_5.0: u64);
+- StorageDead(_4);
+ _2 = opaque::<u64>(move _3) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_6);
+ StorageLive(_7);
+- StorageLive(_8);
+- _8 = _1;
+- _9 = CheckedSub(_8, const 0_u64);
+- assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", move _8, const 0_u64) -> [success: bb3, unwind continue];
++ _9 = CheckedSub(_1, const 0_u64);
++ assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", _1, const 0_u64) -> [success: bb3, unwind continue];
+ }
+
+ bb3: {
+ _7 = move (_9.0: u64);
+- StorageDead(_8);
+ _6 = opaque::<u64>(move _7) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_10);
+ StorageLive(_11);
+- StorageLive(_12);
+- _12 = _1;
+- _13 = CheckedMul(_12, const 0_u64);
+- assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", move _12, const 0_u64) -> [success: bb5, unwind continue];
++ _13 = CheckedMul(_1, const 0_u64);
++ assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", _1, const 0_u64) -> [success: bb5, unwind continue];
+ }
+
+ bb5: {
+ _11 = move (_13.0: u64);
+- StorageDead(_12);
+ _10 = opaque::<u64>(move _11) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_14);
+ StorageLive(_15);
+- StorageLive(_16);
+- _16 = _1;
+- _17 = CheckedMul(_16, const 1_u64);
+- assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", move _16, const 1_u64) -> [success: bb7, unwind continue];
++ _17 = CheckedMul(_1, const 1_u64);
++ assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", _1, const 1_u64) -> [success: bb7, unwind continue];
+ }
+
+ bb7: {
+ _15 = move (_17.0: u64);
+- StorageDead(_16);
+ _14 = opaque::<u64>(move _15) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_18);
+ StorageLive(_19);
+- StorageLive(_20);
+- _20 = _1;
+ _21 = Eq(const 0_u64, const 0_u64);
+- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb9, unwind continue];
++ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb9, unwind continue];
+ }
+
+ bb9: {
+- _19 = Div(move _20, const 0_u64);
+- StorageDead(_20);
++ _19 = Div(_1, const 0_u64);
+ _18 = opaque::<u64>(move _19) -> [return: bb10, unwind continue];
+ }
+
+ bb10: {
+ StorageDead(_19);
+ StorageDead(_18);
+ StorageLive(_22);
+ StorageLive(_23);
+- StorageLive(_24);
+- _24 = _1;
+ _25 = Eq(const 1_u64, const 0_u64);
+- assert(!move _25, "attempt to divide `{}` by zero", _24) -> [success: bb11, unwind continue];
++ assert(!_25, "attempt to divide `{}` by zero", _1) -> [success: bb11, unwind continue];
+ }
+
+ bb11: {
+- _23 = Div(move _24, const 1_u64);
+- StorageDead(_24);
++ _23 = Div(_1, const 1_u64);
+ _22 = opaque::<u64>(move _23) -> [return: bb12, unwind continue];
+ }
+
+ bb12: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_26);
+ StorageLive(_27);
+- StorageLive(_28);
+- _28 = _1;
+- _29 = Eq(_28, const 0_u64);
+- assert(!move _29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind continue];
++ _29 = Eq(_1, const 0_u64);
++ assert(!_29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind continue];
+ }
+
+ bb13: {
+- _27 = Div(const 0_u64, move _28);
+- StorageDead(_28);
++ _27 = Div(const 0_u64, _1);
+ _26 = opaque::<u64>(move _27) -> [return: bb14, unwind continue];
+ }
+
+ bb14: {
+ StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- _33 = Eq(_32, const 0_u64);
+- assert(!move _33, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind continue];
++ assert(!_29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind continue];
+ }
+
+ bb15: {
+- _31 = Div(const 1_u64, move _32);
+- StorageDead(_32);
++ _31 = Div(const 1_u64, _1);
+ _30 = opaque::<u64>(move _31) -> [return: bb16, unwind continue];
+ }
+
+ bb16: {
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_34);
+ StorageLive(_35);
+- StorageLive(_36);
+- _36 = _1;
+- _37 = Eq(const 0_u64, const 0_u64);
+- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb17, unwind continue];
++ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb17, unwind continue];
+ }
+
+ bb17: {
+- _35 = Rem(move _36, const 0_u64);
+- StorageDead(_36);
++ _35 = Rem(_1, const 0_u64);
+ _34 = opaque::<u64>(move _35) -> [return: bb18, unwind continue];
+ }
+
+ bb18: {
+ StorageDead(_35);
+ StorageDead(_34);
+ StorageLive(_38);
+ StorageLive(_39);
+- StorageLive(_40);
+- _40 = _1;
+- _41 = Eq(const 1_u64, const 0_u64);
+- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", _40) -> [success: bb19, unwind continue];
++ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb19, unwind continue];
+ }
+
+ bb19: {
+- _39 = Rem(move _40, const 1_u64);
+- StorageDead(_40);
++ _39 = Rem(_1, const 1_u64);
+ _38 = opaque::<u64>(move _39) -> [return: bb20, unwind continue];
+ }
+
+ bb20: {
+ StorageDead(_39);
+ StorageDead(_38);
+ StorageLive(_42);
+ StorageLive(_43);
+- StorageLive(_44);
+- _44 = _1;
+- _45 = Eq(_44, const 0_u64);
+- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind continue];
++ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind continue];
+ }
+
+ bb21: {
+- _43 = Rem(const 0_u64, move _44);
+- StorageDead(_44);
++ _43 = Rem(const 0_u64, _1);
+ _42 = opaque::<u64>(move _43) -> [return: bb22, unwind continue];
+ }
+
+ bb22: {
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_46);
+ StorageLive(_47);
+- StorageLive(_48);
+- _48 = _1;
+- _49 = Eq(_48, const 0_u64);
+- assert(!move _49, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind continue];
++ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind continue];
+ }
+
+ bb23: {
+- _47 = Rem(const 1_u64, move _48);
+- StorageDead(_48);
++ _47 = Rem(const 1_u64, _1);
+ _46 = opaque::<u64>(move _47) -> [return: bb24, unwind continue];
+ }
+
+ bb24: {
+ StorageDead(_47);
+ StorageDead(_46);
+ StorageLive(_50);
+ StorageLive(_51);
+- StorageLive(_52);
+- _52 = _1;
+- _51 = BitAnd(move _52, const 0_u64);
+- StorageDead(_52);
++ _51 = BitAnd(_1, const 0_u64);
+ _50 = opaque::<u64>(move _51) -> [return: bb25, unwind continue];
+ }
+
+ bb25: {
+ StorageDead(_51);
+ StorageDead(_50);
+ StorageLive(_53);
+ StorageLive(_54);
+- StorageLive(_55);
+- _55 = _1;
+- _54 = BitOr(move _55, const 0_u64);
+- StorageDead(_55);
++ _54 = BitOr(_1, const 0_u64);
+ _53 = opaque::<u64>(move _54) -> [return: bb26, unwind continue];
+ }
+
+ bb26: {
+ StorageDead(_54);
+ StorageDead(_53);
+ StorageLive(_56);
+ StorageLive(_57);
+- StorageLive(_58);
+- _58 = _1;
+- _57 = BitXor(move _58, const 0_u64);
+- StorageDead(_58);
++ _57 = BitXor(_1, const 0_u64);
+ _56 = opaque::<u64>(move _57) -> [return: bb27, unwind continue];
+ }
+
+ bb27: {
+ StorageDead(_57);
+ StorageDead(_56);
+ StorageLive(_59);
+ StorageLive(_60);
+- StorageLive(_61);
+- _61 = _1;
+ _62 = const 0_i32 as u32 (IntToInt);
+- _63 = Lt(move _62, const 64_u32);
+- assert(move _63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind continue];
++ _63 = Lt(_62, const 64_u32);
++ assert(_63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind continue];
+ }
+
+ bb28: {
+- _60 = Shr(move _61, const 0_i32);
+- StorageDead(_61);
++ _60 = Shr(_1, const 0_i32);
+ _59 = opaque::<u64>(move _60) -> [return: bb29, unwind continue];
+ }
+
+ bb29: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_64);
+ StorageLive(_65);
+- StorageLive(_66);
+- _66 = _1;
+- _67 = const 0_i32 as u32 (IntToInt);
+- _68 = Lt(move _67, const 64_u32);
+- assert(move _68, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind continue];
++ assert(_63, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind continue];
+ }
+
+ bb30: {
+- _65 = Shl(move _66, const 0_i32);
+- StorageDead(_66);
++ _65 = Shl(_1, const 0_i32);
+ _64 = opaque::<u64>(move _65) -> [return: bb31, unwind continue];
+ }
+
+ bb31: {
+ StorageDead(_65);
+ StorageDead(_64);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff
new file mode 100644
index 000000000..7d5ac8353
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff
@@ -0,0 +1,165 @@
+- // MIR for `arithmetic_float` before GVN
++ // MIR for `arithmetic_float` after GVN
+
+ fn arithmetic_float(_1: f64) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: f64;
+ let mut _4: f64;
+ let _5: ();
+ let mut _6: f64;
+ let mut _7: f64;
+ let _8: ();
+ let mut _9: f64;
+ let mut _10: f64;
+ let _11: ();
+ let mut _12: f64;
+ let mut _13: f64;
+ let _14: ();
+ let mut _15: f64;
+ let mut _16: f64;
+ let _17: ();
+ let mut _18: f64;
+ let mut _19: f64;
+ let _20: ();
+ let mut _21: f64;
+ let mut _22: f64;
+ let _23: ();
+ let mut _24: bool;
+ let mut _25: f64;
+ let mut _26: f64;
+ let _27: ();
+ let mut _28: bool;
+ let mut _29: f64;
+ let mut _30: f64;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _3 = Add(move _4, const 0f64);
+- StorageDead(_4);
++ _3 = Add(_1, const 0f64);
+ _2 = opaque::<f64>(move _3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_5);
+ StorageLive(_6);
+- StorageLive(_7);
+- _7 = _1;
+- _6 = Sub(move _7, const 0f64);
+- StorageDead(_7);
++ _6 = Sub(_1, const 0f64);
+ _5 = opaque::<f64>(move _6) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_8);
+ StorageLive(_9);
+- StorageLive(_10);
+- _10 = _1;
+- _9 = Mul(move _10, const 0f64);
+- StorageDead(_10);
++ _9 = Mul(_1, const 0f64);
+ _8 = opaque::<f64>(move _9) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_11);
+ StorageLive(_12);
+- StorageLive(_13);
+- _13 = _1;
+- _12 = Div(move _13, const 0f64);
+- StorageDead(_13);
++ _12 = Div(_1, const 0f64);
+ _11 = opaque::<f64>(move _12) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_14);
+ StorageLive(_15);
+- StorageLive(_16);
+- _16 = _1;
+- _15 = Div(const 0f64, move _16);
+- StorageDead(_16);
++ _15 = Div(const 0f64, _1);
+ _14 = opaque::<f64>(move _15) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_17);
+ StorageLive(_18);
+- StorageLive(_19);
+- _19 = _1;
+- _18 = Rem(move _19, const 0f64);
+- StorageDead(_19);
++ _18 = Rem(_1, const 0f64);
+ _17 = opaque::<f64>(move _18) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_18);
+ StorageDead(_17);
+ StorageLive(_20);
+ StorageLive(_21);
+- StorageLive(_22);
+- _22 = _1;
+- _21 = Rem(const 0f64, move _22);
+- StorageDead(_22);
++ _21 = Rem(const 0f64, _1);
+ _20 = opaque::<f64>(move _21) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageLive(_23);
+ StorageLive(_24);
+- StorageLive(_25);
+- _25 = _1;
+- StorageLive(_26);
+- _26 = _1;
+- _24 = Eq(move _25, move _26);
+- StorageDead(_26);
+- StorageDead(_25);
++ _24 = Eq(_1, _1);
+ _23 = opaque::<bool>(move _24) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageLive(_27);
+ StorageLive(_28);
+- StorageLive(_29);
+- _29 = _1;
+- StorageLive(_30);
+- _30 = _1;
+- _28 = Ne(move _29, move _30);
+- StorageDead(_30);
+- StorageDead(_29);
++ _28 = Ne(_1, _1);
+ _27 = opaque::<bool>(move _28) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ StorageDead(_28);
+ StorageDead(_27);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff
new file mode 100644
index 000000000..36c26dc66
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff
@@ -0,0 +1,165 @@
+- // MIR for `arithmetic_float` before GVN
++ // MIR for `arithmetic_float` after GVN
+
+ fn arithmetic_float(_1: f64) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: f64;
+ let mut _4: f64;
+ let _5: ();
+ let mut _6: f64;
+ let mut _7: f64;
+ let _8: ();
+ let mut _9: f64;
+ let mut _10: f64;
+ let _11: ();
+ let mut _12: f64;
+ let mut _13: f64;
+ let _14: ();
+ let mut _15: f64;
+ let mut _16: f64;
+ let _17: ();
+ let mut _18: f64;
+ let mut _19: f64;
+ let _20: ();
+ let mut _21: f64;
+ let mut _22: f64;
+ let _23: ();
+ let mut _24: bool;
+ let mut _25: f64;
+ let mut _26: f64;
+ let _27: ();
+ let mut _28: bool;
+ let mut _29: f64;
+ let mut _30: f64;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _3 = Add(move _4, const 0f64);
+- StorageDead(_4);
++ _3 = Add(_1, const 0f64);
+ _2 = opaque::<f64>(move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_5);
+ StorageLive(_6);
+- StorageLive(_7);
+- _7 = _1;
+- _6 = Sub(move _7, const 0f64);
+- StorageDead(_7);
++ _6 = Sub(_1, const 0f64);
+ _5 = opaque::<f64>(move _6) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_8);
+ StorageLive(_9);
+- StorageLive(_10);
+- _10 = _1;
+- _9 = Mul(move _10, const 0f64);
+- StorageDead(_10);
++ _9 = Mul(_1, const 0f64);
+ _8 = opaque::<f64>(move _9) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_11);
+ StorageLive(_12);
+- StorageLive(_13);
+- _13 = _1;
+- _12 = Div(move _13, const 0f64);
+- StorageDead(_13);
++ _12 = Div(_1, const 0f64);
+ _11 = opaque::<f64>(move _12) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_14);
+ StorageLive(_15);
+- StorageLive(_16);
+- _16 = _1;
+- _15 = Div(const 0f64, move _16);
+- StorageDead(_16);
++ _15 = Div(const 0f64, _1);
+ _14 = opaque::<f64>(move _15) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_17);
+ StorageLive(_18);
+- StorageLive(_19);
+- _19 = _1;
+- _18 = Rem(move _19, const 0f64);
+- StorageDead(_19);
++ _18 = Rem(_1, const 0f64);
+ _17 = opaque::<f64>(move _18) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_18);
+ StorageDead(_17);
+ StorageLive(_20);
+ StorageLive(_21);
+- StorageLive(_22);
+- _22 = _1;
+- _21 = Rem(const 0f64, move _22);
+- StorageDead(_22);
++ _21 = Rem(const 0f64, _1);
+ _20 = opaque::<f64>(move _21) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageLive(_23);
+ StorageLive(_24);
+- StorageLive(_25);
+- _25 = _1;
+- StorageLive(_26);
+- _26 = _1;
+- _24 = Eq(move _25, move _26);
+- StorageDead(_26);
+- StorageDead(_25);
++ _24 = Eq(_1, _1);
+ _23 = opaque::<bool>(move _24) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageLive(_27);
+ StorageLive(_28);
+- StorageLive(_29);
+- _29 = _1;
+- StorageLive(_30);
+- _30 = _1;
+- _28 = Ne(move _29, move _30);
+- StorageDead(_30);
+- StorageDead(_29);
++ _28 = Ne(_1, _1);
+ _27 = opaque::<bool>(move _28) -> [return: bb9, unwind continue];
+ }
+
+ bb9: {
+ StorageDead(_28);
+ StorageDead(_27);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.cast.GVN.panic-abort.diff b/tests/mir-opt/gvn.cast.GVN.panic-abort.diff
new file mode 100644
index 000000000..513fe60b6
--- /dev/null
+++ b/tests/mir-opt/gvn.cast.GVN.panic-abort.diff
@@ -0,0 +1,501 @@
+- // MIR for `cast` before GVN
++ // MIR for `cast` after GVN
+
+ fn cast() -> () {
+ let mut _0: ();
+ let _1: i64;
+ let _4: ();
+ let mut _5: u8;
+ let mut _6: i64;
+ let _7: ();
+ let mut _8: u16;
+ let mut _9: i64;
+ let _10: ();
+ let mut _11: u32;
+ let mut _12: i64;
+ let _13: ();
+ let mut _14: u64;
+ let mut _15: i64;
+ let _16: ();
+ let mut _17: i8;
+ let mut _18: i64;
+ let _19: ();
+ let mut _20: i16;
+ let mut _21: i64;
+ let _22: ();
+ let mut _23: i32;
+ let mut _24: i64;
+ let _25: ();
+ let mut _26: i64;
+ let _27: ();
+ let mut _28: f32;
+ let mut _29: i64;
+ let _30: ();
+ let mut _31: f64;
+ let mut _32: i64;
+ let _33: ();
+ let mut _34: u8;
+ let mut _35: u64;
+ let _36: ();
+ let mut _37: u16;
+ let mut _38: u64;
+ let _39: ();
+ let mut _40: u32;
+ let mut _41: u64;
+ let _42: ();
+ let mut _43: u64;
+ let _44: ();
+ let mut _45: i8;
+ let mut _46: u64;
+ let _47: ();
+ let mut _48: i16;
+ let mut _49: u64;
+ let _50: ();
+ let mut _51: i32;
+ let mut _52: u64;
+ let _53: ();
+ let mut _54: i64;
+ let mut _55: u64;
+ let _56: ();
+ let mut _57: f32;
+ let mut _58: u64;
+ let _59: ();
+ let mut _60: f64;
+ let mut _61: u64;
+ let _62: ();
+ let mut _63: u8;
+ let mut _64: f64;
+ let _65: ();
+ let mut _66: u16;
+ let mut _67: f64;
+ let _68: ();
+ let mut _69: u32;
+ let mut _70: f64;
+ let _71: ();
+ let mut _72: u64;
+ let mut _73: f64;
+ let _74: ();
+ let mut _75: i8;
+ let mut _76: f64;
+ let _77: ();
+ let mut _78: i16;
+ let mut _79: f64;
+ let _80: ();
+ let mut _81: i32;
+ let mut _82: f64;
+ let _83: ();
+ let mut _84: i64;
+ let mut _85: f64;
+ let _86: ();
+ let mut _87: f32;
+ let mut _88: f64;
+ let _89: ();
+ let mut _90: f64;
+ scope 1 {
+ debug i => _1;
+ let _2: u64;
+ scope 2 {
+ debug u => _2;
+ let _3: f64;
+ scope 3 {
+ debug f => _3;
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
+ _1 = const 1_i64;
+- StorageLive(_2);
+ _2 = const 1_u64;
+- StorageLive(_3);
+ _3 = const 1f64;
+ StorageLive(_4);
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = _1;
+- _5 = move _6 as u8 (IntToInt);
+- StorageDead(_6);
++ _5 = const 1_i64 as u8 (IntToInt);
+ _4 = opaque::<u8>(move _5) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_7);
+ StorageLive(_8);
+- StorageLive(_9);
+- _9 = _1;
+- _8 = move _9 as u16 (IntToInt);
+- StorageDead(_9);
++ _8 = const 1_i64 as u16 (IntToInt);
+ _7 = opaque::<u16>(move _8) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_10);
+ StorageLive(_11);
+- StorageLive(_12);
+- _12 = _1;
+- _11 = move _12 as u32 (IntToInt);
+- StorageDead(_12);
++ _11 = const 1_i64 as u32 (IntToInt);
+ _10 = opaque::<u32>(move _11) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_13);
+ StorageLive(_14);
+- StorageLive(_15);
+- _15 = _1;
+- _14 = move _15 as u64 (IntToInt);
+- StorageDead(_15);
++ _14 = const 1_i64 as u64 (IntToInt);
+ _13 = opaque::<u64>(move _14) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageLive(_16);
+ StorageLive(_17);
+- StorageLive(_18);
+- _18 = _1;
+- _17 = move _18 as i8 (IntToInt);
+- StorageDead(_18);
++ _17 = const 1_i64 as i8 (IntToInt);
+ _16 = opaque::<i8>(move _17) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_19);
+ StorageLive(_20);
+- StorageLive(_21);
+- _21 = _1;
+- _20 = move _21 as i16 (IntToInt);
+- StorageDead(_21);
++ _20 = const 1_i64 as i16 (IntToInt);
+ _19 = opaque::<i16>(move _20) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_20);
+ StorageDead(_19);
+ StorageLive(_22);
+ StorageLive(_23);
+- StorageLive(_24);
+- _24 = _1;
+- _23 = move _24 as i32 (IntToInt);
+- StorageDead(_24);
++ _23 = const 1_i64 as i32 (IntToInt);
+ _22 = opaque::<i32>(move _23) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_25);
+- StorageLive(_26);
+- _26 = _1;
+- _25 = opaque::<i64>(move _26) -> [return: bb8, unwind unreachable];
++ _25 = opaque::<i64>(const 1_i64) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+- StorageDead(_26);
+ StorageDead(_25);
+ StorageLive(_27);
+ StorageLive(_28);
+- StorageLive(_29);
+- _29 = _1;
+- _28 = move _29 as f32 (IntToFloat);
+- StorageDead(_29);
++ _28 = const 1_i64 as f32 (IntToFloat);
+ _27 = opaque::<f32>(move _28) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageLive(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- _31 = move _32 as f64 (IntToFloat);
+- StorageDead(_32);
++ _31 = const 1_i64 as f64 (IntToFloat);
+ _30 = opaque::<f64>(move _31) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_33);
+ StorageLive(_34);
+- StorageLive(_35);
+- _35 = _2;
+- _34 = move _35 as u8 (IntToInt);
+- StorageDead(_35);
++ _34 = const 1_u64 as u8 (IntToInt);
+ _33 = opaque::<u8>(move _34) -> [return: bb11, unwind unreachable];
+ }
+
+ bb11: {
+ StorageDead(_34);
+ StorageDead(_33);
+ StorageLive(_36);
+ StorageLive(_37);
+- StorageLive(_38);
+- _38 = _2;
+- _37 = move _38 as u16 (IntToInt);
+- StorageDead(_38);
++ _37 = const 1_u64 as u16 (IntToInt);
+ _36 = opaque::<u16>(move _37) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+ StorageDead(_37);
+ StorageDead(_36);
+ StorageLive(_39);
+ StorageLive(_40);
+- StorageLive(_41);
+- _41 = _2;
+- _40 = move _41 as u32 (IntToInt);
+- StorageDead(_41);
++ _40 = const 1_u64 as u32 (IntToInt);
+ _39 = opaque::<u32>(move _40) -> [return: bb13, unwind unreachable];
+ }
+
+ bb13: {
+ StorageDead(_40);
+ StorageDead(_39);
+ StorageLive(_42);
+- StorageLive(_43);
+- _43 = _2;
+- _42 = opaque::<u64>(move _43) -> [return: bb14, unwind unreachable];
++ _42 = opaque::<u64>(const 1_u64) -> [return: bb14, unwind unreachable];
+ }
+
+ bb14: {
+- StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_44);
+ StorageLive(_45);
+- StorageLive(_46);
+- _46 = _2;
+- _45 = move _46 as i8 (IntToInt);
+- StorageDead(_46);
++ _45 = const 1_u64 as i8 (IntToInt);
+ _44 = opaque::<i8>(move _45) -> [return: bb15, unwind unreachable];
+ }
+
+ bb15: {
+ StorageDead(_45);
+ StorageDead(_44);
+ StorageLive(_47);
+ StorageLive(_48);
+- StorageLive(_49);
+- _49 = _2;
+- _48 = move _49 as i16 (IntToInt);
+- StorageDead(_49);
++ _48 = const 1_u64 as i16 (IntToInt);
+ _47 = opaque::<i16>(move _48) -> [return: bb16, unwind unreachable];
+ }
+
+ bb16: {
+ StorageDead(_48);
+ StorageDead(_47);
+ StorageLive(_50);
+ StorageLive(_51);
+- StorageLive(_52);
+- _52 = _2;
+- _51 = move _52 as i32 (IntToInt);
+- StorageDead(_52);
++ _51 = const 1_u64 as i32 (IntToInt);
+ _50 = opaque::<i32>(move _51) -> [return: bb17, unwind unreachable];
+ }
+
+ bb17: {
+ StorageDead(_51);
+ StorageDead(_50);
+ StorageLive(_53);
+ StorageLive(_54);
+- StorageLive(_55);
+- _55 = _2;
+- _54 = move _55 as i64 (IntToInt);
+- StorageDead(_55);
++ _54 = const 1_u64 as i64 (IntToInt);
+ _53 = opaque::<i64>(move _54) -> [return: bb18, unwind unreachable];
+ }
+
+ bb18: {
+ StorageDead(_54);
+ StorageDead(_53);
+ StorageLive(_56);
+ StorageLive(_57);
+- StorageLive(_58);
+- _58 = _2;
+- _57 = move _58 as f32 (IntToFloat);
+- StorageDead(_58);
++ _57 = const 1_u64 as f32 (IntToFloat);
+ _56 = opaque::<f32>(move _57) -> [return: bb19, unwind unreachable];
+ }
+
+ bb19: {
+ StorageDead(_57);
+ StorageDead(_56);
+ StorageLive(_59);
+ StorageLive(_60);
+- StorageLive(_61);
+- _61 = _2;
+- _60 = move _61 as f64 (IntToFloat);
+- StorageDead(_61);
++ _60 = const 1_u64 as f64 (IntToFloat);
+ _59 = opaque::<f64>(move _60) -> [return: bb20, unwind unreachable];
+ }
+
+ bb20: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_62);
+ StorageLive(_63);
+- StorageLive(_64);
+- _64 = _3;
+- _63 = move _64 as u8 (FloatToInt);
+- StorageDead(_64);
++ _63 = const 1f64 as u8 (FloatToInt);
+ _62 = opaque::<u8>(move _63) -> [return: bb21, unwind unreachable];
+ }
+
+ bb21: {
+ StorageDead(_63);
+ StorageDead(_62);
+ StorageLive(_65);
+ StorageLive(_66);
+- StorageLive(_67);
+- _67 = _3;
+- _66 = move _67 as u16 (FloatToInt);
+- StorageDead(_67);
++ _66 = const 1f64 as u16 (FloatToInt);
+ _65 = opaque::<u16>(move _66) -> [return: bb22, unwind unreachable];
+ }
+
+ bb22: {
+ StorageDead(_66);
+ StorageDead(_65);
+ StorageLive(_68);
+ StorageLive(_69);
+- StorageLive(_70);
+- _70 = _3;
+- _69 = move _70 as u32 (FloatToInt);
+- StorageDead(_70);
++ _69 = const 1f64 as u32 (FloatToInt);
+ _68 = opaque::<u32>(move _69) -> [return: bb23, unwind unreachable];
+ }
+
+ bb23: {
+ StorageDead(_69);
+ StorageDead(_68);
+ StorageLive(_71);
+ StorageLive(_72);
+- StorageLive(_73);
+- _73 = _3;
+- _72 = move _73 as u64 (FloatToInt);
+- StorageDead(_73);
++ _72 = const 1f64 as u64 (FloatToInt);
+ _71 = opaque::<u64>(move _72) -> [return: bb24, unwind unreachable];
+ }
+
+ bb24: {
+ StorageDead(_72);
+ StorageDead(_71);
+ StorageLive(_74);
+ StorageLive(_75);
+- StorageLive(_76);
+- _76 = _3;
+- _75 = move _76 as i8 (FloatToInt);
+- StorageDead(_76);
++ _75 = const 1f64 as i8 (FloatToInt);
+ _74 = opaque::<i8>(move _75) -> [return: bb25, unwind unreachable];
+ }
+
+ bb25: {
+ StorageDead(_75);
+ StorageDead(_74);
+ StorageLive(_77);
+ StorageLive(_78);
+- StorageLive(_79);
+- _79 = _3;
+- _78 = move _79 as i16 (FloatToInt);
+- StorageDead(_79);
++ _78 = const 1f64 as i16 (FloatToInt);
+ _77 = opaque::<i16>(move _78) -> [return: bb26, unwind unreachable];
+ }
+
+ bb26: {
+ StorageDead(_78);
+ StorageDead(_77);
+ StorageLive(_80);
+ StorageLive(_81);
+- StorageLive(_82);
+- _82 = _3;
+- _81 = move _82 as i32 (FloatToInt);
+- StorageDead(_82);
++ _81 = const 1f64 as i32 (FloatToInt);
+ _80 = opaque::<i32>(move _81) -> [return: bb27, unwind unreachable];
+ }
+
+ bb27: {
+ StorageDead(_81);
+ StorageDead(_80);
+ StorageLive(_83);
+ StorageLive(_84);
+- StorageLive(_85);
+- _85 = _3;
+- _84 = move _85 as i64 (FloatToInt);
+- StorageDead(_85);
++ _84 = const 1f64 as i64 (FloatToInt);
+ _83 = opaque::<i64>(move _84) -> [return: bb28, unwind unreachable];
+ }
+
+ bb28: {
+ StorageDead(_84);
+ StorageDead(_83);
+ StorageLive(_86);
+ StorageLive(_87);
+- StorageLive(_88);
+- _88 = _3;
+- _87 = move _88 as f32 (FloatToFloat);
+- StorageDead(_88);
++ _87 = const 1f64 as f32 (FloatToFloat);
+ _86 = opaque::<f32>(move _87) -> [return: bb29, unwind unreachable];
+ }
+
+ bb29: {
+ StorageDead(_87);
+ StorageDead(_86);
+ StorageLive(_89);
+- StorageLive(_90);
+- _90 = _3;
+- _89 = opaque::<f64>(move _90) -> [return: bb30, unwind unreachable];
++ _89 = opaque::<f64>(const 1f64) -> [return: bb30, unwind unreachable];
+ }
+
+ bb30: {
+- StorageDead(_90);
+ StorageDead(_89);
+ _0 = const ();
+- StorageDead(_3);
+- StorageDead(_2);
+- StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff b/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff
new file mode 100644
index 000000000..33192ed8d
--- /dev/null
+++ b/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff
@@ -0,0 +1,501 @@
+- // MIR for `cast` before GVN
++ // MIR for `cast` after GVN
+
+ fn cast() -> () {
+ let mut _0: ();
+ let _1: i64;
+ let _4: ();
+ let mut _5: u8;
+ let mut _6: i64;
+ let _7: ();
+ let mut _8: u16;
+ let mut _9: i64;
+ let _10: ();
+ let mut _11: u32;
+ let mut _12: i64;
+ let _13: ();
+ let mut _14: u64;
+ let mut _15: i64;
+ let _16: ();
+ let mut _17: i8;
+ let mut _18: i64;
+ let _19: ();
+ let mut _20: i16;
+ let mut _21: i64;
+ let _22: ();
+ let mut _23: i32;
+ let mut _24: i64;
+ let _25: ();
+ let mut _26: i64;
+ let _27: ();
+ let mut _28: f32;
+ let mut _29: i64;
+ let _30: ();
+ let mut _31: f64;
+ let mut _32: i64;
+ let _33: ();
+ let mut _34: u8;
+ let mut _35: u64;
+ let _36: ();
+ let mut _37: u16;
+ let mut _38: u64;
+ let _39: ();
+ let mut _40: u32;
+ let mut _41: u64;
+ let _42: ();
+ let mut _43: u64;
+ let _44: ();
+ let mut _45: i8;
+ let mut _46: u64;
+ let _47: ();
+ let mut _48: i16;
+ let mut _49: u64;
+ let _50: ();
+ let mut _51: i32;
+ let mut _52: u64;
+ let _53: ();
+ let mut _54: i64;
+ let mut _55: u64;
+ let _56: ();
+ let mut _57: f32;
+ let mut _58: u64;
+ let _59: ();
+ let mut _60: f64;
+ let mut _61: u64;
+ let _62: ();
+ let mut _63: u8;
+ let mut _64: f64;
+ let _65: ();
+ let mut _66: u16;
+ let mut _67: f64;
+ let _68: ();
+ let mut _69: u32;
+ let mut _70: f64;
+ let _71: ();
+ let mut _72: u64;
+ let mut _73: f64;
+ let _74: ();
+ let mut _75: i8;
+ let mut _76: f64;
+ let _77: ();
+ let mut _78: i16;
+ let mut _79: f64;
+ let _80: ();
+ let mut _81: i32;
+ let mut _82: f64;
+ let _83: ();
+ let mut _84: i64;
+ let mut _85: f64;
+ let _86: ();
+ let mut _87: f32;
+ let mut _88: f64;
+ let _89: ();
+ let mut _90: f64;
+ scope 1 {
+ debug i => _1;
+ let _2: u64;
+ scope 2 {
+ debug u => _2;
+ let _3: f64;
+ scope 3 {
+ debug f => _3;
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
+ _1 = const 1_i64;
+- StorageLive(_2);
+ _2 = const 1_u64;
+- StorageLive(_3);
+ _3 = const 1f64;
+ StorageLive(_4);
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = _1;
+- _5 = move _6 as u8 (IntToInt);
+- StorageDead(_6);
++ _5 = const 1_i64 as u8 (IntToInt);
+ _4 = opaque::<u8>(move _5) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_7);
+ StorageLive(_8);
+- StorageLive(_9);
+- _9 = _1;
+- _8 = move _9 as u16 (IntToInt);
+- StorageDead(_9);
++ _8 = const 1_i64 as u16 (IntToInt);
+ _7 = opaque::<u16>(move _8) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_10);
+ StorageLive(_11);
+- StorageLive(_12);
+- _12 = _1;
+- _11 = move _12 as u32 (IntToInt);
+- StorageDead(_12);
++ _11 = const 1_i64 as u32 (IntToInt);
+ _10 = opaque::<u32>(move _11) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_13);
+ StorageLive(_14);
+- StorageLive(_15);
+- _15 = _1;
+- _14 = move _15 as u64 (IntToInt);
+- StorageDead(_15);
++ _14 = const 1_i64 as u64 (IntToInt);
+ _13 = opaque::<u64>(move _14) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageLive(_16);
+ StorageLive(_17);
+- StorageLive(_18);
+- _18 = _1;
+- _17 = move _18 as i8 (IntToInt);
+- StorageDead(_18);
++ _17 = const 1_i64 as i8 (IntToInt);
+ _16 = opaque::<i8>(move _17) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_19);
+ StorageLive(_20);
+- StorageLive(_21);
+- _21 = _1;
+- _20 = move _21 as i16 (IntToInt);
+- StorageDead(_21);
++ _20 = const 1_i64 as i16 (IntToInt);
+ _19 = opaque::<i16>(move _20) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_20);
+ StorageDead(_19);
+ StorageLive(_22);
+ StorageLive(_23);
+- StorageLive(_24);
+- _24 = _1;
+- _23 = move _24 as i32 (IntToInt);
+- StorageDead(_24);
++ _23 = const 1_i64 as i32 (IntToInt);
+ _22 = opaque::<i32>(move _23) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_25);
+- StorageLive(_26);
+- _26 = _1;
+- _25 = opaque::<i64>(move _26) -> [return: bb8, unwind continue];
++ _25 = opaque::<i64>(const 1_i64) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+- StorageDead(_26);
+ StorageDead(_25);
+ StorageLive(_27);
+ StorageLive(_28);
+- StorageLive(_29);
+- _29 = _1;
+- _28 = move _29 as f32 (IntToFloat);
+- StorageDead(_29);
++ _28 = const 1_i64 as f32 (IntToFloat);
+ _27 = opaque::<f32>(move _28) -> [return: bb9, unwind continue];
+ }
+
+ bb9: {
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageLive(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- _31 = move _32 as f64 (IntToFloat);
+- StorageDead(_32);
++ _31 = const 1_i64 as f64 (IntToFloat);
+ _30 = opaque::<f64>(move _31) -> [return: bb10, unwind continue];
+ }
+
+ bb10: {
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_33);
+ StorageLive(_34);
+- StorageLive(_35);
+- _35 = _2;
+- _34 = move _35 as u8 (IntToInt);
+- StorageDead(_35);
++ _34 = const 1_u64 as u8 (IntToInt);
+ _33 = opaque::<u8>(move _34) -> [return: bb11, unwind continue];
+ }
+
+ bb11: {
+ StorageDead(_34);
+ StorageDead(_33);
+ StorageLive(_36);
+ StorageLive(_37);
+- StorageLive(_38);
+- _38 = _2;
+- _37 = move _38 as u16 (IntToInt);
+- StorageDead(_38);
++ _37 = const 1_u64 as u16 (IntToInt);
+ _36 = opaque::<u16>(move _37) -> [return: bb12, unwind continue];
+ }
+
+ bb12: {
+ StorageDead(_37);
+ StorageDead(_36);
+ StorageLive(_39);
+ StorageLive(_40);
+- StorageLive(_41);
+- _41 = _2;
+- _40 = move _41 as u32 (IntToInt);
+- StorageDead(_41);
++ _40 = const 1_u64 as u32 (IntToInt);
+ _39 = opaque::<u32>(move _40) -> [return: bb13, unwind continue];
+ }
+
+ bb13: {
+ StorageDead(_40);
+ StorageDead(_39);
+ StorageLive(_42);
+- StorageLive(_43);
+- _43 = _2;
+- _42 = opaque::<u64>(move _43) -> [return: bb14, unwind continue];
++ _42 = opaque::<u64>(const 1_u64) -> [return: bb14, unwind continue];
+ }
+
+ bb14: {
+- StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_44);
+ StorageLive(_45);
+- StorageLive(_46);
+- _46 = _2;
+- _45 = move _46 as i8 (IntToInt);
+- StorageDead(_46);
++ _45 = const 1_u64 as i8 (IntToInt);
+ _44 = opaque::<i8>(move _45) -> [return: bb15, unwind continue];
+ }
+
+ bb15: {
+ StorageDead(_45);
+ StorageDead(_44);
+ StorageLive(_47);
+ StorageLive(_48);
+- StorageLive(_49);
+- _49 = _2;
+- _48 = move _49 as i16 (IntToInt);
+- StorageDead(_49);
++ _48 = const 1_u64 as i16 (IntToInt);
+ _47 = opaque::<i16>(move _48) -> [return: bb16, unwind continue];
+ }
+
+ bb16: {
+ StorageDead(_48);
+ StorageDead(_47);
+ StorageLive(_50);
+ StorageLive(_51);
+- StorageLive(_52);
+- _52 = _2;
+- _51 = move _52 as i32 (IntToInt);
+- StorageDead(_52);
++ _51 = const 1_u64 as i32 (IntToInt);
+ _50 = opaque::<i32>(move _51) -> [return: bb17, unwind continue];
+ }
+
+ bb17: {
+ StorageDead(_51);
+ StorageDead(_50);
+ StorageLive(_53);
+ StorageLive(_54);
+- StorageLive(_55);
+- _55 = _2;
+- _54 = move _55 as i64 (IntToInt);
+- StorageDead(_55);
++ _54 = const 1_u64 as i64 (IntToInt);
+ _53 = opaque::<i64>(move _54) -> [return: bb18, unwind continue];
+ }
+
+ bb18: {
+ StorageDead(_54);
+ StorageDead(_53);
+ StorageLive(_56);
+ StorageLive(_57);
+- StorageLive(_58);
+- _58 = _2;
+- _57 = move _58 as f32 (IntToFloat);
+- StorageDead(_58);
++ _57 = const 1_u64 as f32 (IntToFloat);
+ _56 = opaque::<f32>(move _57) -> [return: bb19, unwind continue];
+ }
+
+ bb19: {
+ StorageDead(_57);
+ StorageDead(_56);
+ StorageLive(_59);
+ StorageLive(_60);
+- StorageLive(_61);
+- _61 = _2;
+- _60 = move _61 as f64 (IntToFloat);
+- StorageDead(_61);
++ _60 = const 1_u64 as f64 (IntToFloat);
+ _59 = opaque::<f64>(move _60) -> [return: bb20, unwind continue];
+ }
+
+ bb20: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_62);
+ StorageLive(_63);
+- StorageLive(_64);
+- _64 = _3;
+- _63 = move _64 as u8 (FloatToInt);
+- StorageDead(_64);
++ _63 = const 1f64 as u8 (FloatToInt);
+ _62 = opaque::<u8>(move _63) -> [return: bb21, unwind continue];
+ }
+
+ bb21: {
+ StorageDead(_63);
+ StorageDead(_62);
+ StorageLive(_65);
+ StorageLive(_66);
+- StorageLive(_67);
+- _67 = _3;
+- _66 = move _67 as u16 (FloatToInt);
+- StorageDead(_67);
++ _66 = const 1f64 as u16 (FloatToInt);
+ _65 = opaque::<u16>(move _66) -> [return: bb22, unwind continue];
+ }
+
+ bb22: {
+ StorageDead(_66);
+ StorageDead(_65);
+ StorageLive(_68);
+ StorageLive(_69);
+- StorageLive(_70);
+- _70 = _3;
+- _69 = move _70 as u32 (FloatToInt);
+- StorageDead(_70);
++ _69 = const 1f64 as u32 (FloatToInt);
+ _68 = opaque::<u32>(move _69) -> [return: bb23, unwind continue];
+ }
+
+ bb23: {
+ StorageDead(_69);
+ StorageDead(_68);
+ StorageLive(_71);
+ StorageLive(_72);
+- StorageLive(_73);
+- _73 = _3;
+- _72 = move _73 as u64 (FloatToInt);
+- StorageDead(_73);
++ _72 = const 1f64 as u64 (FloatToInt);
+ _71 = opaque::<u64>(move _72) -> [return: bb24, unwind continue];
+ }
+
+ bb24: {
+ StorageDead(_72);
+ StorageDead(_71);
+ StorageLive(_74);
+ StorageLive(_75);
+- StorageLive(_76);
+- _76 = _3;
+- _75 = move _76 as i8 (FloatToInt);
+- StorageDead(_76);
++ _75 = const 1f64 as i8 (FloatToInt);
+ _74 = opaque::<i8>(move _75) -> [return: bb25, unwind continue];
+ }
+
+ bb25: {
+ StorageDead(_75);
+ StorageDead(_74);
+ StorageLive(_77);
+ StorageLive(_78);
+- StorageLive(_79);
+- _79 = _3;
+- _78 = move _79 as i16 (FloatToInt);
+- StorageDead(_79);
++ _78 = const 1f64 as i16 (FloatToInt);
+ _77 = opaque::<i16>(move _78) -> [return: bb26, unwind continue];
+ }
+
+ bb26: {
+ StorageDead(_78);
+ StorageDead(_77);
+ StorageLive(_80);
+ StorageLive(_81);
+- StorageLive(_82);
+- _82 = _3;
+- _81 = move _82 as i32 (FloatToInt);
+- StorageDead(_82);
++ _81 = const 1f64 as i32 (FloatToInt);
+ _80 = opaque::<i32>(move _81) -> [return: bb27, unwind continue];
+ }
+
+ bb27: {
+ StorageDead(_81);
+ StorageDead(_80);
+ StorageLive(_83);
+ StorageLive(_84);
+- StorageLive(_85);
+- _85 = _3;
+- _84 = move _85 as i64 (FloatToInt);
+- StorageDead(_85);
++ _84 = const 1f64 as i64 (FloatToInt);
+ _83 = opaque::<i64>(move _84) -> [return: bb28, unwind continue];
+ }
+
+ bb28: {
+ StorageDead(_84);
+ StorageDead(_83);
+ StorageLive(_86);
+ StorageLive(_87);
+- StorageLive(_88);
+- _88 = _3;
+- _87 = move _88 as f32 (FloatToFloat);
+- StorageDead(_88);
++ _87 = const 1f64 as f32 (FloatToFloat);
+ _86 = opaque::<f32>(move _87) -> [return: bb29, unwind continue];
+ }
+
+ bb29: {
+ StorageDead(_87);
+ StorageDead(_86);
+ StorageLive(_89);
+- StorageLive(_90);
+- _90 = _3;
+- _89 = opaque::<f64>(move _90) -> [return: bb30, unwind continue];
++ _89 = opaque::<f64>(const 1f64) -> [return: bb30, unwind continue];
+ }
+
+ bb30: {
+- StorageDead(_90);
+ StorageDead(_89);
+ _0 = const ();
+- StorageDead(_3);
+- StorageDead(_2);
+- StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff b/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff
new file mode 100644
index 000000000..ee320cf67
--- /dev/null
+++ b/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff
@@ -0,0 +1,191 @@
+- // MIR for `dereferences` before GVN
++ // MIR for `dereferences` after GVN
+
+ fn dereferences(_1: &mut u32, _2: &impl Copy, _3: &S<u32>) -> () {
+ debug t => _1;
+ debug u => _2;
+ debug s => _3;
+ let mut _0: ();
+ let _4: ();
+ let mut _5: u32;
+ let _6: ();
+ let mut _7: u32;
+ let _8: *const u32;
+ let _9: ();
+ let mut _10: u32;
+ let _11: ();
+ let mut _12: u32;
+ let _14: ();
+ let mut _15: u32;
+ let _16: ();
+ let mut _17: u32;
+ let _19: ();
+ let mut _20: u32;
+ let _21: ();
+ let mut _22: u32;
+ let _23: ();
+ let mut _24: &u32;
+ let _25: ();
+ let mut _26: impl Copy;
+ let _27: ();
+ let mut _28: impl Copy;
+ let _29: ();
+ let mut _30: u32;
+ let _31: ();
+ let mut _32: u32;
+ scope 1 {
+ debug z => _8;
+ let _13: *mut u32;
+ scope 2 {
+ }
+ scope 3 {
+ }
+ scope 4 {
+ debug z => _13;
+ let _18: &u32;
+ scope 5 {
+ }
+ scope 6 {
+ }
+ scope 7 {
+ debug z => _18;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = (*_1);
+ _4 = opaque::<u32>(move _5) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = (*_1);
+ _6 = opaque::<u32>(move _7) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_8);
+ _8 = &raw const (*_1);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = (*_8);
+ _9 = opaque::<u32>(move _10) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = (*_8);
+ _11 = opaque::<u32>(move _12) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_13);
+ _13 = &raw mut (*_1);
+ StorageLive(_14);
+ StorageLive(_15);
+ _15 = (*_13);
+ _14 = opaque::<u32>(move _15) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = (*_13);
+ _16 = opaque::<u32>(move _17) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_18);
+ _18 = &(*_1);
+ StorageLive(_19);
+- StorageLive(_20);
+ _20 = (*_18);
+- _19 = opaque::<u32>(move _20) -> [return: bb7, unwind unreachable];
++ _19 = opaque::<u32>(_20) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+- StorageDead(_20);
+ StorageDead(_19);
+ StorageLive(_21);
+- StorageLive(_22);
+- _22 = (*_18);
+- _21 = opaque::<u32>(move _22) -> [return: bb8, unwind unreachable];
++ _21 = opaque::<u32>(_20) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+- StorageDead(_22);
+ StorageDead(_21);
+ StorageLive(_23);
+ StorageLive(_24);
+ _24 = &(*_18);
+ _23 = opaque::<&u32>(move _24) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageLive(_25);
+ StorageLive(_26);
+ _26 = (*_2);
+ _25 = opaque::<impl Copy>(move _26) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+ StorageDead(_26);
+ StorageDead(_25);
+ StorageLive(_27);
+ StorageLive(_28);
+ _28 = (*_2);
+ _27 = opaque::<impl Copy>(move _28) -> [return: bb11, unwind unreachable];
+ }
+
+ bb11: {
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageLive(_29);
+- StorageLive(_30);
+ _30 = ((*_3).0: u32);
+- _29 = opaque::<u32>(move _30) -> [return: bb12, unwind unreachable];
++ _29 = opaque::<u32>(_30) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+- StorageDead(_30);
+ StorageDead(_29);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = ((*_3).0: u32);
+- _31 = opaque::<u32>(move _32) -> [return: bb13, unwind unreachable];
++ _31 = opaque::<u32>(_30) -> [return: bb13, unwind unreachable];
+ }
+
+ bb13: {
+- StorageDead(_32);
+ StorageDead(_31);
+ _0 = const ();
+ StorageDead(_18);
+ StorageDead(_13);
+ StorageDead(_8);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff b/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff
new file mode 100644
index 000000000..f627b4d59
--- /dev/null
+++ b/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff
@@ -0,0 +1,191 @@
+- // MIR for `dereferences` before GVN
++ // MIR for `dereferences` after GVN
+
+ fn dereferences(_1: &mut u32, _2: &impl Copy, _3: &S<u32>) -> () {
+ debug t => _1;
+ debug u => _2;
+ debug s => _3;
+ let mut _0: ();
+ let _4: ();
+ let mut _5: u32;
+ let _6: ();
+ let mut _7: u32;
+ let _8: *const u32;
+ let _9: ();
+ let mut _10: u32;
+ let _11: ();
+ let mut _12: u32;
+ let _14: ();
+ let mut _15: u32;
+ let _16: ();
+ let mut _17: u32;
+ let _19: ();
+ let mut _20: u32;
+ let _21: ();
+ let mut _22: u32;
+ let _23: ();
+ let mut _24: &u32;
+ let _25: ();
+ let mut _26: impl Copy;
+ let _27: ();
+ let mut _28: impl Copy;
+ let _29: ();
+ let mut _30: u32;
+ let _31: ();
+ let mut _32: u32;
+ scope 1 {
+ debug z => _8;
+ let _13: *mut u32;
+ scope 2 {
+ }
+ scope 3 {
+ }
+ scope 4 {
+ debug z => _13;
+ let _18: &u32;
+ scope 5 {
+ }
+ scope 6 {
+ }
+ scope 7 {
+ debug z => _18;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = (*_1);
+ _4 = opaque::<u32>(move _5) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = (*_1);
+ _6 = opaque::<u32>(move _7) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_8);
+ _8 = &raw const (*_1);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = (*_8);
+ _9 = opaque::<u32>(move _10) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = (*_8);
+ _11 = opaque::<u32>(move _12) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_13);
+ _13 = &raw mut (*_1);
+ StorageLive(_14);
+ StorageLive(_15);
+ _15 = (*_13);
+ _14 = opaque::<u32>(move _15) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = (*_13);
+ _16 = opaque::<u32>(move _17) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_18);
+ _18 = &(*_1);
+ StorageLive(_19);
+- StorageLive(_20);
+ _20 = (*_18);
+- _19 = opaque::<u32>(move _20) -> [return: bb7, unwind continue];
++ _19 = opaque::<u32>(_20) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+- StorageDead(_20);
+ StorageDead(_19);
+ StorageLive(_21);
+- StorageLive(_22);
+- _22 = (*_18);
+- _21 = opaque::<u32>(move _22) -> [return: bb8, unwind continue];
++ _21 = opaque::<u32>(_20) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+- StorageDead(_22);
+ StorageDead(_21);
+ StorageLive(_23);
+ StorageLive(_24);
+ _24 = &(*_18);
+ _23 = opaque::<&u32>(move _24) -> [return: bb9, unwind continue];
+ }
+
+ bb9: {
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageLive(_25);
+ StorageLive(_26);
+ _26 = (*_2);
+ _25 = opaque::<impl Copy>(move _26) -> [return: bb10, unwind continue];
+ }
+
+ bb10: {
+ StorageDead(_26);
+ StorageDead(_25);
+ StorageLive(_27);
+ StorageLive(_28);
+ _28 = (*_2);
+ _27 = opaque::<impl Copy>(move _28) -> [return: bb11, unwind continue];
+ }
+
+ bb11: {
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageLive(_29);
+- StorageLive(_30);
+ _30 = ((*_3).0: u32);
+- _29 = opaque::<u32>(move _30) -> [return: bb12, unwind continue];
++ _29 = opaque::<u32>(_30) -> [return: bb12, unwind continue];
+ }
+
+ bb12: {
+- StorageDead(_30);
+ StorageDead(_29);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = ((*_3).0: u32);
+- _31 = opaque::<u32>(move _32) -> [return: bb13, unwind continue];
++ _31 = opaque::<u32>(_30) -> [return: bb13, unwind continue];
+ }
+
+ bb13: {
+- StorageDead(_32);
+ StorageDead(_31);
+ _0 = const ();
+ StorageDead(_18);
+ StorageDead(_13);
+ StorageDead(_8);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff b/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff
new file mode 100644
index 000000000..0a6690028
--- /dev/null
+++ b/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff
@@ -0,0 +1,198 @@
+- // MIR for `multiple_branches` before GVN
++ // MIR for `multiple_branches` after GVN
+
+ fn multiple_branches(_1: bool, _2: u8, _3: u8) -> () {
+ debug t => _1;
+ debug x => _2;
+ debug y => _3;
+ let mut _0: ();
+ let _4: ();
+ let mut _5: bool;
+ let _6: ();
+ let mut _7: u8;
+ let mut _8: u8;
+ let mut _9: u8;
+ let _10: ();
+ let mut _11: u8;
+ let mut _12: u8;
+ let mut _13: u8;
+ let _14: ();
+ let mut _15: u8;
+ let mut _16: u8;
+ let mut _17: u8;
+ let _18: ();
+ let mut _19: u8;
+ let mut _20: u8;
+ let mut _21: u8;
+ let _22: ();
+ let mut _23: u8;
+ let mut _24: u8;
+ let mut _25: u8;
+ let mut _26: bool;
+ let _27: ();
+ let mut _28: u8;
+ let mut _29: u8;
+ let mut _30: u8;
+ let _31: ();
+ let mut _32: u8;
+ let mut _33: u8;
+ let mut _34: u8;
+
+ bb0: {
+- StorageLive(_4);
+- StorageLive(_5);
+- _5 = _1;
+- switchInt(move _5) -> [0: bb4, otherwise: bb1];
++ switchInt(_1) -> [0: bb4, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageLive(_6);
+- StorageLive(_7);
+- StorageLive(_8);
+- _8 = _2;
+- StorageLive(_9);
+- _9 = _3;
+- _7 = Add(move _8, move _9);
+- StorageDead(_9);
+- StorageDead(_8);
+- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind unreachable];
++ _7 = Add(_2, _3);
++ _6 = opaque::<u8>(_7) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_10);
+- StorageLive(_11);
+- StorageLive(_12);
+- _12 = _2;
+- StorageLive(_13);
+- _13 = _3;
+- _11 = Add(move _12, move _13);
+- StorageDead(_13);
+- StorageDead(_12);
+- _10 = opaque::<u8>(move _11) -> [return: bb3, unwind unreachable];
++ _10 = opaque::<u8>(_7) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+- StorageDead(_11);
+ StorageDead(_10);
+- _4 = const ();
+ goto -> bb7;
+ }
+
+ bb4: {
+ StorageLive(_14);
+- StorageLive(_15);
+- StorageLive(_16);
+- _16 = _2;
+- StorageLive(_17);
+- _17 = _3;
+- _15 = Add(move _16, move _17);
+- StorageDead(_17);
+- StorageDead(_16);
+- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind unreachable];
++ _15 = Add(_2, _3);
++ _14 = opaque::<u8>(_15) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+- StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_18);
+- StorageLive(_19);
+- StorageLive(_20);
+- _20 = _2;
+- StorageLive(_21);
+- _21 = _3;
+- _19 = Add(move _20, move _21);
+- StorageDead(_21);
+- StorageDead(_20);
+- _18 = opaque::<u8>(move _19) -> [return: bb6, unwind unreachable];
++ _18 = opaque::<u8>(_15) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+- StorageDead(_19);
+ StorageDead(_18);
+- _4 = const ();
+ goto -> bb7;
+ }
+
+ bb7: {
+- StorageDead(_5);
+- StorageDead(_4);
+ StorageLive(_22);
+- StorageLive(_23);
+- StorageLive(_24);
+- _24 = _2;
+- StorageLive(_25);
+- _25 = _3;
+- _23 = Add(move _24, move _25);
+- StorageDead(_25);
+- StorageDead(_24);
+- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind unreachable];
++ _23 = Add(_2, _3);
++ _22 = opaque::<u8>(_23) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+- StorageDead(_23);
+ StorageDead(_22);
+- StorageLive(_26);
+- _26 = _1;
+- switchInt(move _26) -> [0: bb11, otherwise: bb9];
++ switchInt(_1) -> [0: bb11, otherwise: bb9];
+ }
+
+ bb9: {
+ StorageLive(_27);
+- StorageLive(_28);
+- StorageLive(_29);
+- _29 = _2;
+- StorageLive(_30);
+- _30 = _3;
+- _28 = Add(move _29, move _30);
+- StorageDead(_30);
+- StorageDead(_29);
+- _27 = opaque::<u8>(move _28) -> [return: bb10, unwind unreachable];
++ _27 = opaque::<u8>(_23) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+- StorageDead(_28);
+ StorageDead(_27);
+ _0 = const ();
+ goto -> bb13;
+ }
+
+ bb11: {
+ StorageLive(_31);
+- StorageLive(_32);
+- StorageLive(_33);
+- _33 = _2;
+- StorageLive(_34);
+- _34 = _3;
+- _32 = Add(move _33, move _34);
+- StorageDead(_34);
+- StorageDead(_33);
+- _31 = opaque::<u8>(move _32) -> [return: bb12, unwind unreachable];
++ _31 = opaque::<u8>(_23) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+- StorageDead(_32);
+ StorageDead(_31);
+ _0 = const ();
+ goto -> bb13;
+ }
+
+ bb13: {
+- StorageDead(_26);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff b/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff
new file mode 100644
index 000000000..0199f2720
--- /dev/null
+++ b/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff
@@ -0,0 +1,198 @@
+- // MIR for `multiple_branches` before GVN
++ // MIR for `multiple_branches` after GVN
+
+ fn multiple_branches(_1: bool, _2: u8, _3: u8) -> () {
+ debug t => _1;
+ debug x => _2;
+ debug y => _3;
+ let mut _0: ();
+ let _4: ();
+ let mut _5: bool;
+ let _6: ();
+ let mut _7: u8;
+ let mut _8: u8;
+ let mut _9: u8;
+ let _10: ();
+ let mut _11: u8;
+ let mut _12: u8;
+ let mut _13: u8;
+ let _14: ();
+ let mut _15: u8;
+ let mut _16: u8;
+ let mut _17: u8;
+ let _18: ();
+ let mut _19: u8;
+ let mut _20: u8;
+ let mut _21: u8;
+ let _22: ();
+ let mut _23: u8;
+ let mut _24: u8;
+ let mut _25: u8;
+ let mut _26: bool;
+ let _27: ();
+ let mut _28: u8;
+ let mut _29: u8;
+ let mut _30: u8;
+ let _31: ();
+ let mut _32: u8;
+ let mut _33: u8;
+ let mut _34: u8;
+
+ bb0: {
+- StorageLive(_4);
+- StorageLive(_5);
+- _5 = _1;
+- switchInt(move _5) -> [0: bb4, otherwise: bb1];
++ switchInt(_1) -> [0: bb4, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageLive(_6);
+- StorageLive(_7);
+- StorageLive(_8);
+- _8 = _2;
+- StorageLive(_9);
+- _9 = _3;
+- _7 = Add(move _8, move _9);
+- StorageDead(_9);
+- StorageDead(_8);
+- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind continue];
++ _7 = Add(_2, _3);
++ _6 = opaque::<u8>(_7) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+- StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_10);
+- StorageLive(_11);
+- StorageLive(_12);
+- _12 = _2;
+- StorageLive(_13);
+- _13 = _3;
+- _11 = Add(move _12, move _13);
+- StorageDead(_13);
+- StorageDead(_12);
+- _10 = opaque::<u8>(move _11) -> [return: bb3, unwind continue];
++ _10 = opaque::<u8>(_7) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+- StorageDead(_11);
+ StorageDead(_10);
+- _4 = const ();
+ goto -> bb7;
+ }
+
+ bb4: {
+ StorageLive(_14);
+- StorageLive(_15);
+- StorageLive(_16);
+- _16 = _2;
+- StorageLive(_17);
+- _17 = _3;
+- _15 = Add(move _16, move _17);
+- StorageDead(_17);
+- StorageDead(_16);
+- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind continue];
++ _15 = Add(_2, _3);
++ _14 = opaque::<u8>(_15) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+- StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_18);
+- StorageLive(_19);
+- StorageLive(_20);
+- _20 = _2;
+- StorageLive(_21);
+- _21 = _3;
+- _19 = Add(move _20, move _21);
+- StorageDead(_21);
+- StorageDead(_20);
+- _18 = opaque::<u8>(move _19) -> [return: bb6, unwind continue];
++ _18 = opaque::<u8>(_15) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+- StorageDead(_19);
+ StorageDead(_18);
+- _4 = const ();
+ goto -> bb7;
+ }
+
+ bb7: {
+- StorageDead(_5);
+- StorageDead(_4);
+ StorageLive(_22);
+- StorageLive(_23);
+- StorageLive(_24);
+- _24 = _2;
+- StorageLive(_25);
+- _25 = _3;
+- _23 = Add(move _24, move _25);
+- StorageDead(_25);
+- StorageDead(_24);
+- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind continue];
++ _23 = Add(_2, _3);
++ _22 = opaque::<u8>(_23) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+- StorageDead(_23);
+ StorageDead(_22);
+- StorageLive(_26);
+- _26 = _1;
+- switchInt(move _26) -> [0: bb11, otherwise: bb9];
++ switchInt(_1) -> [0: bb11, otherwise: bb9];
+ }
+
+ bb9: {
+ StorageLive(_27);
+- StorageLive(_28);
+- StorageLive(_29);
+- _29 = _2;
+- StorageLive(_30);
+- _30 = _3;
+- _28 = Add(move _29, move _30);
+- StorageDead(_30);
+- StorageDead(_29);
+- _27 = opaque::<u8>(move _28) -> [return: bb10, unwind continue];
++ _27 = opaque::<u8>(_23) -> [return: bb10, unwind continue];
+ }
+
+ bb10: {
+- StorageDead(_28);
+ StorageDead(_27);
+ _0 = const ();
+ goto -> bb13;
+ }
+
+ bb11: {
+ StorageLive(_31);
+- StorageLive(_32);
+- StorageLive(_33);
+- _33 = _2;
+- StorageLive(_34);
+- _34 = _3;
+- _32 = Add(move _33, move _34);
+- StorageDead(_34);
+- StorageDead(_33);
+- _31 = opaque::<u8>(move _32) -> [return: bb12, unwind continue];
++ _31 = opaque::<u8>(_23) -> [return: bb12, unwind continue];
+ }
+
+ bb12: {
+- StorageDead(_32);
+ StorageDead(_31);
+ _0 = const ();
+ goto -> bb13;
+ }
+
+ bb13: {
+- StorageDead(_26);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.references.GVN.panic-abort.diff b/tests/mir-opt/gvn.references.GVN.panic-abort.diff
new file mode 100644
index 000000000..b7ad4ab1f
--- /dev/null
+++ b/tests/mir-opt/gvn.references.GVN.panic-abort.diff
@@ -0,0 +1,105 @@
+- // MIR for `references` before GVN
++ // MIR for `references` after GVN
+
+ fn references(_1: impl Sized) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: &impl Sized;
+ let _4: ();
+ let mut _5: &impl Sized;
+ let _6: ();
+ let mut _7: &mut impl Sized;
+ let _8: ();
+ let mut _9: &mut impl Sized;
+ let _10: ();
+ let mut _11: *const impl Sized;
+ let _12: ();
+ let mut _13: *const impl Sized;
+ let _14: ();
+ let mut _15: *mut impl Sized;
+ let _16: ();
+ let mut _17: *mut impl Sized;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &_1;
+ _2 = opaque::<&impl Sized>(move _3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = &_1;
+ _4 = opaque::<&impl Sized>(move _5) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &mut _1;
+ _6 = opaque::<&mut impl Sized>(move _7) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = &mut _1;
+ _8 = opaque::<&mut impl Sized>(move _9) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = &raw const _1;
+ _10 = opaque::<*const impl Sized>(move _11) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = &raw const _1;
+ _12 = opaque::<*const impl Sized>(move _13) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageLive(_14);
+ StorageLive(_15);
+ _15 = &raw mut _1;
+ _14 = opaque::<*mut impl Sized>(move _15) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = &raw mut _1;
+ _16 = opaque::<*mut impl Sized>(move _17) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+ StorageDead(_17);
+ StorageDead(_16);
+ _0 = const ();
+ drop(_1) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.references.GVN.panic-unwind.diff b/tests/mir-opt/gvn.references.GVN.panic-unwind.diff
new file mode 100644
index 000000000..08ed4c629
--- /dev/null
+++ b/tests/mir-opt/gvn.references.GVN.panic-unwind.diff
@@ -0,0 +1,113 @@
+- // MIR for `references` before GVN
++ // MIR for `references` after GVN
+
+ fn references(_1: impl Sized) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: &impl Sized;
+ let _4: ();
+ let mut _5: &impl Sized;
+ let _6: ();
+ let mut _7: &mut impl Sized;
+ let _8: ();
+ let mut _9: &mut impl Sized;
+ let _10: ();
+ let mut _11: *const impl Sized;
+ let _12: ();
+ let mut _13: *const impl Sized;
+ let _14: ();
+ let mut _15: *mut impl Sized;
+ let _16: ();
+ let mut _17: *mut impl Sized;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &_1;
+ _2 = opaque::<&impl Sized>(move _3) -> [return: bb1, unwind: bb10];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = &_1;
+ _4 = opaque::<&impl Sized>(move _5) -> [return: bb2, unwind: bb10];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &mut _1;
+ _6 = opaque::<&mut impl Sized>(move _7) -> [return: bb3, unwind: bb10];
+ }
+
+ bb3: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = &mut _1;
+ _8 = opaque::<&mut impl Sized>(move _9) -> [return: bb4, unwind: bb10];
+ }
+
+ bb4: {
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = &raw const _1;
+ _10 = opaque::<*const impl Sized>(move _11) -> [return: bb5, unwind: bb10];
+ }
+
+ bb5: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = &raw const _1;
+ _12 = opaque::<*const impl Sized>(move _13) -> [return: bb6, unwind: bb10];
+ }
+
+ bb6: {
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageLive(_14);
+ StorageLive(_15);
+ _15 = &raw mut _1;
+ _14 = opaque::<*mut impl Sized>(move _15) -> [return: bb7, unwind: bb10];
+ }
+
+ bb7: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = &raw mut _1;
+ _16 = opaque::<*mut impl Sized>(move _17) -> [return: bb8, unwind: bb10];
+ }
+
+ bb8: {
+ StorageDead(_17);
+ StorageDead(_16);
+ _0 = const ();
+ drop(_1) -> [return: bb9, unwind: bb11];
+ }
+
+ bb9: {
+ return;
+ }
+
+ bb10 (cleanup): {
+ drop(_1) -> [return: bb11, unwind terminate(cleanup)];
+ }
+
+ bb11 (cleanup): {
+ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff b/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff
new file mode 100644
index 000000000..4c29523d6
--- /dev/null
+++ b/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff
@@ -0,0 +1,76 @@
+- // MIR for `repeated_index` before GVN
++ // MIR for `repeated_index` after GVN
+
+ fn repeated_index(_1: T, _2: usize) -> () {
+ debug x => _1;
+ debug idx => _2;
+ let mut _0: ();
+ let _3: [T; N];
+ let mut _4: T;
+ let _5: ();
+ let mut _6: T;
+ let _7: usize;
+ let mut _8: usize;
+ let mut _9: bool;
+ let _10: ();
+ let mut _11: T;
+ let _12: usize;
+ let mut _13: usize;
+ let mut _14: bool;
+ scope 1 {
+ debug a => _3;
+ }
+
+ bb0: {
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _3 = [move _4; N];
+- StorageDead(_4);
++ _3 = [_1; N];
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = const 0_usize;
+ _8 = Len(_3);
+- _9 = Lt(_7, _8);
+- assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb1, unwind unreachable];
++ _9 = Lt(const 0_usize, _8);
++ assert(move _9, "index out of bounds: the length is {} but the index is {}", _8, const 0_usize) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _6 = _3[_7];
+ _5 = opaque::<T>(move _6) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = _2;
+- _13 = Len(_3);
+- _14 = Lt(_12, _13);
+- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, _12) -> [success: bb3, unwind unreachable];
++ _14 = Lt(_2, _8);
++ assert(move _14, "index out of bounds: the length is {} but the index is {}", _8, _2) -> [success: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ _11 = _3[_12];
+ _10 = opaque::<T>(move _11) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_11);
+ StorageDead(_12);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff b/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff
new file mode 100644
index 000000000..e44f54cf3
--- /dev/null
+++ b/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff
@@ -0,0 +1,76 @@
+- // MIR for `repeated_index` before GVN
++ // MIR for `repeated_index` after GVN
+
+ fn repeated_index(_1: T, _2: usize) -> () {
+ debug x => _1;
+ debug idx => _2;
+ let mut _0: ();
+ let _3: [T; N];
+ let mut _4: T;
+ let _5: ();
+ let mut _6: T;
+ let _7: usize;
+ let mut _8: usize;
+ let mut _9: bool;
+ let _10: ();
+ let mut _11: T;
+ let _12: usize;
+ let mut _13: usize;
+ let mut _14: bool;
+ scope 1 {
+ debug a => _3;
+ }
+
+ bb0: {
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- _3 = [move _4; N];
+- StorageDead(_4);
++ _3 = [_1; N];
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = const 0_usize;
+ _8 = Len(_3);
+- _9 = Lt(_7, _8);
+- assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb1, unwind continue];
++ _9 = Lt(const 0_usize, _8);
++ assert(move _9, "index out of bounds: the length is {} but the index is {}", _8, const 0_usize) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+ _6 = _3[_7];
+ _5 = opaque::<T>(move _6) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = _2;
+- _13 = Len(_3);
+- _14 = Lt(_12, _13);
+- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, _12) -> [success: bb3, unwind continue];
++ _14 = Lt(_2, _8);
++ assert(move _14, "index out of bounds: the length is {} but the index is {}", _8, _2) -> [success: bb3, unwind continue];
+ }
+
+ bb3: {
+ _11 = _3[_12];
+ _10 = opaque::<T>(move _11) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_11);
+ StorageDead(_12);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.rs b/tests/mir-opt/gvn.rs
new file mode 100644
index 000000000..a85e2ae36
--- /dev/null
+++ b/tests/mir-opt/gvn.rs
@@ -0,0 +1,253 @@
+// unit-test: GVN
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
+#![feature(raw_ref_op)]
+#![feature(rustc_attrs)]
+#![allow(unconditional_panic)]
+
+struct S<T>(T);
+
+fn subexpression_elimination(x: u64, y: u64, mut z: u64) {
+ opaque(x + y);
+ opaque(x * y);
+ opaque(x - y);
+ opaque(x / y);
+ opaque(x % y);
+ opaque(x & y);
+ opaque(x | y);
+ opaque(x ^ y);
+ opaque(x << y);
+ opaque(x >> y);
+ opaque(x as u32);
+ opaque(x as f32);
+ opaque(S(x));
+ opaque(S(x).0);
+
+ // Those are duplicates to substitute somehow.
+ opaque((x + y) + z);
+ opaque((x * y) + z);
+ opaque((x - y) + z);
+ opaque((x / y) + z);
+ opaque((x % y) + z);
+ opaque((x & y) + z);
+ opaque((x | y) + z);
+ opaque((x ^ y) + z);
+ opaque((x << y) + z);
+ opaque((x >> y) + z);
+ opaque(S(x));
+ opaque(S(x).0);
+
+ // We can substitute through an immutable reference too.
+ let a = &z;
+ opaque(*a + x);
+ opaque(*a + x);
+
+ // But not through a mutable reference or a pointer.
+ let b = &mut z;
+ opaque(*b + x);
+ opaque(*b + x);
+ unsafe {
+ let c = &raw const z;
+ opaque(*c + x);
+ opaque(*c + x);
+ let d = &raw mut z;
+ opaque(*d + x);
+ opaque(*d + x);
+ }
+
+ // We can substitute again, but not with the earlier computations.
+ // Important: `e` is not `a`!
+ let e = &z;
+ opaque(*e + x);
+ opaque(*e + x);
+
+}
+
+fn wrap_unwrap<T: Copy>(x: T) -> T {
+ match Some(x) {
+ Some(y) => y,
+ None => panic!(),
+ }
+}
+
+fn repeated_index<T: Copy, const N: usize>(x: T, idx: usize) {
+ let a = [x; N];
+ opaque(a[0]);
+ opaque(a[idx]);
+}
+
+fn arithmetic(x: u64) {
+ opaque(x + 0);
+ opaque(x - 0);
+ opaque(x * 0);
+ opaque(x * 1);
+ opaque(x / 0);
+ opaque(x / 1);
+ opaque(0 / x);
+ opaque(1 / x);
+ opaque(x % 0);
+ opaque(x % 1);
+ opaque(0 % x);
+ opaque(1 % x);
+ opaque(x & 0);
+ opaque(x | 0);
+ opaque(x ^ 0);
+ opaque(x >> 0);
+ opaque(x << 0);
+}
+
+#[rustc_inherit_overflow_checks]
+fn arithmetic_checked(x: u64) {
+ opaque(x + 0);
+ opaque(x - 0);
+ opaque(x * 0);
+ opaque(x * 1);
+ opaque(x / 0);
+ opaque(x / 1);
+ opaque(0 / x);
+ opaque(1 / x);
+ opaque(x % 0);
+ opaque(x % 1);
+ opaque(0 % x);
+ opaque(1 % x);
+ opaque(x & 0);
+ opaque(x | 0);
+ opaque(x ^ 0);
+ opaque(x >> 0);
+ opaque(x << 0);
+}
+
+fn arithmetic_float(x: f64) {
+ opaque(x + 0.);
+ opaque(x - 0.);
+ opaque(x * 0.);
+ opaque(x / 0.);
+ opaque(0. / x);
+ opaque(x % 0.);
+ opaque(0. % x);
+ // Those are not simplifiable to `true`/`false`, thanks to NaNs.
+ opaque(x == x);
+ opaque(x != x);
+}
+
+fn cast() {
+ let i = 1_i64;
+ let u = 1_u64;
+ let f = 1_f64;
+ opaque(i as u8);
+ opaque(i as u16);
+ opaque(i as u32);
+ opaque(i as u64);
+ opaque(i as i8);
+ opaque(i as i16);
+ opaque(i as i32);
+ opaque(i as i64);
+ opaque(i as f32);
+ opaque(i as f64);
+ opaque(u as u8);
+ opaque(u as u16);
+ opaque(u as u32);
+ opaque(u as u64);
+ opaque(u as i8);
+ opaque(u as i16);
+ opaque(u as i32);
+ opaque(u as i64);
+ opaque(u as f32);
+ opaque(u as f64);
+ opaque(f as u8);
+ opaque(f as u16);
+ opaque(f as u32);
+ opaque(f as u64);
+ opaque(f as i8);
+ opaque(f as i16);
+ opaque(f as i32);
+ opaque(f as i64);
+ opaque(f as f32);
+ opaque(f as f64);
+}
+
+fn multiple_branches(t: bool, x: u8, y: u8) {
+ if t {
+ opaque(x + y); // a
+ opaque(x + y); // should reuse a
+ } else {
+ opaque(x + y); // b
+ opaque(x + y); // shoud reuse b
+ }
+ opaque(x + y); // c
+ if t {
+ opaque(x + y); // should reuse c
+ } else {
+ opaque(x + y); // should reuse c
+ }
+}
+
+fn references(mut x: impl Sized) {
+ opaque(&x);
+ opaque(&x); // should not reuse a
+ opaque(&mut x);
+ opaque(&mut x); // should not reuse a
+ opaque(&raw const x);
+ opaque(&raw const x); // should not reuse a
+ opaque(&raw mut x);
+ opaque(&raw mut x); // should not reuse a
+}
+
+fn dereferences(t: &mut u32, u: &impl Copy, s: &S<u32>) {
+ opaque(*t);
+ opaque(*t); // this cannot reuse a, as x is &mut.
+ let z = &raw const *t;
+ unsafe { opaque(*z) };
+ unsafe { opaque(*z) }; // this cannot reuse a, as x is *const.
+ let z = &raw mut *t;
+ unsafe { opaque(*z) };
+ unsafe { opaque(*z) }; // this cannot reuse a, as x is *mut.
+ let z = &*t;
+ opaque(*z);
+ opaque(*z); // this can reuse, as `z` is immutable ref, Freeze and Copy.
+ opaque(&*z); // but not for a reborrow.
+ opaque(*u);
+ opaque(*u); // this cannot reuse, as `z` is not Freeze.
+ opaque(s.0);
+ opaque(s.0); // *s is not Copy, by (*s).0 is, so we can reuse.
+}
+
+fn slices() {
+ let s = "my favourite slice"; // This is a `Const::Slice` in MIR.
+ opaque(s);
+ let t = s; // This should be the same pointer, so cannot be a `Const::Slice`.
+ opaque(t);
+ assert_eq!(s.as_ptr(), t.as_ptr());
+ let u = unsafe { std::mem::transmute::<&str, &[u8]>(s) };
+ opaque(u);
+ assert_eq!(s.as_ptr(), u.as_ptr());
+}
+
+fn main() {
+ subexpression_elimination(2, 4, 5);
+ wrap_unwrap(5);
+ repeated_index::<u32, 7>(5, 3);
+ arithmetic(5);
+ arithmetic_checked(5);
+ arithmetic_float(5.);
+ cast();
+ multiple_branches(true, 5, 9);
+ references(5);
+ dereferences(&mut 5, &6, &S(7));
+ slices();
+}
+
+#[inline(never)]
+fn opaque(_: impl Sized) {}
+
+// EMIT_MIR gvn.subexpression_elimination.GVN.diff
+// EMIT_MIR gvn.wrap_unwrap.GVN.diff
+// EMIT_MIR gvn.repeated_index.GVN.diff
+// EMIT_MIR gvn.arithmetic.GVN.diff
+// EMIT_MIR gvn.arithmetic_checked.GVN.diff
+// EMIT_MIR gvn.arithmetic_float.GVN.diff
+// EMIT_MIR gvn.cast.GVN.diff
+// EMIT_MIR gvn.multiple_branches.GVN.diff
+// EMIT_MIR gvn.references.GVN.diff
+// EMIT_MIR gvn.dereferences.GVN.diff
+// EMIT_MIR gvn.slices.GVN.diff
diff --git a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff
new file mode 100644
index 000000000..de3d28d05
--- /dev/null
+++ b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff
@@ -0,0 +1,275 @@
+- // MIR for `slices` before GVN
++ // MIR for `slices` after GVN
+
+ fn slices() -> () {
+ let mut _0: ();
+ let _1: &str;
+ let _2: ();
+ let mut _3: &str;
+ let _5: ();
+ let mut _6: &str;
+ let _7: ();
+ let mut _8: (&*const u8, &*const u8);
+ let mut _9: &*const u8;
+ let _10: *const u8;
+ let mut _11: &str;
+ let mut _12: &*const u8;
+ let _13: *const u8;
+ let mut _14: &str;
+ let mut _17: bool;
+ let mut _18: *const u8;
+ let mut _19: *const u8;
+ let mut _20: !;
+ let _22: !;
+ let mut _23: core::panicking::AssertKind;
+ let mut _24: &*const u8;
+ let _25: &*const u8;
+ let mut _26: &*const u8;
+ let _27: &*const u8;
+ let mut _28: std::option::Option<std::fmt::Arguments<'_>>;
+ let mut _30: &str;
+ let _31: ();
+ let mut _32: &[u8];
+ let _33: ();
+ let mut _34: (&*const u8, &*const u8);
+ let mut _35: &*const u8;
+ let _36: *const u8;
+ let mut _37: &str;
+ let mut _38: &*const u8;
+ let _39: *const u8;
+ let mut _40: &[u8];
+ let mut _43: bool;
+ let mut _44: *const u8;
+ let mut _45: *const u8;
+ let mut _46: !;
+ let _48: !;
+ let mut _49: core::panicking::AssertKind;
+ let mut _50: &*const u8;
+ let _51: &*const u8;
+ let mut _52: &*const u8;
+ let _53: &*const u8;
+ let mut _54: std::option::Option<std::fmt::Arguments<'_>>;
+ scope 1 {
+ debug s => _1;
+ let _4: &str;
+ scope 2 {
+ debug t => _4;
+ let _15: &*const u8;
+ let _16: &*const u8;
+ let _29: &[u8];
+ scope 3 {
+ debug left_val => _15;
+ debug right_val => _16;
+ let _21: core::panicking::AssertKind;
+ scope 4 {
+ debug kind => _21;
+ }
+ }
+ scope 5 {
+ debug u => _29;
+ let _41: &*const u8;
+ let _42: &*const u8;
+ scope 7 {
+ debug left_val => _41;
+ debug right_val => _42;
+ let _47: core::panicking::AssertKind;
+ scope 8 {
+ debug kind => _47;
+ }
+ }
+ }
+ scope 6 {
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
+ _1 = const "my favourite slice";
+ StorageLive(_2);
+- StorageLive(_3);
+- _3 = _1;
+- _2 = opaque::<&str>(move _3) -> [return: bb1, unwind unreachable];
++ _2 = opaque::<&str>(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = _4;
+- _5 = opaque::<&str>(move _6) -> [return: bb2, unwind unreachable];
++ _5 = opaque::<&str>(_1) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- StorageDead(_6);
+ StorageDead(_5);
+- StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = &(*_1);
+ _10 = core::str::<impl str>::as_ptr(move _11) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_11);
+ _9 = &_10;
+ StorageLive(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+ _14 = &(*_4);
+ _13 = core::str::<impl str>::as_ptr(move _14) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_14);
+ _12 = &_13;
+ _8 = (move _9, move _12);
+ StorageDead(_12);
+ StorageDead(_9);
+ StorageLive(_15);
+ _15 = (_8.0: &*const u8);
+ StorageLive(_16);
+ _16 = (_8.1: &*const u8);
+ StorageLive(_17);
+ StorageLive(_18);
+ _18 = (*_15);
+ StorageLive(_19);
+ _19 = (*_16);
+ _17 = Eq(move _18, move _19);
+ switchInt(move _17) -> [0: bb6, otherwise: bb5];
+ }
+
+ bb5: {
+ StorageDead(_19);
+ StorageDead(_18);
+- _7 = const ();
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageDead(_15);
+ StorageDead(_13);
+ StorageDead(_10);
+ StorageDead(_8);
+- StorageDead(_7);
+- StorageLive(_29);
+ StorageLive(_30);
+ _30 = &(*_1);
+ _29 = move _30 as &[u8] (Transmute);
+ StorageDead(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _29;
+- _31 = opaque::<&[u8]>(move _32) -> [return: bb7, unwind unreachable];
++ _31 = opaque::<&[u8]>(_29) -> [return: bb7, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_19);
+ StorageDead(_18);
+- StorageLive(_21);
+ _21 = core::panicking::AssertKind::Eq;
+ StorageLive(_22);
+- StorageLive(_23);
+- _23 = move _21;
+ StorageLive(_24);
+ StorageLive(_25);
+ _25 = &(*_15);
+ _24 = &(*_25);
+ StorageLive(_26);
+ StorageLive(_27);
+ _27 = &(*_16);
+ _26 = &(*_27);
+ StorageLive(_28);
+ _28 = Option::<Arguments<'_>>::None;
+- _22 = core::panicking::assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind unreachable;
++ _22 = core::panicking::assert_failed::<*const u8, *const u8>(_21, move _24, move _26, move _28) -> unwind unreachable;
+ }
+
+ bb7: {
+- StorageDead(_32);
+ StorageDead(_31);
+- StorageLive(_33);
+ StorageLive(_34);
+ StorageLive(_35);
+ StorageLive(_36);
+ StorageLive(_37);
+ _37 = &(*_1);
+ _36 = core::str::<impl str>::as_ptr(move _37) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+ StorageDead(_37);
+ _35 = &_36;
+ StorageLive(_38);
+ StorageLive(_39);
+ StorageLive(_40);
+ _40 = &(*_29);
+ _39 = core::slice::<impl [u8]>::as_ptr(move _40) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ StorageDead(_40);
+ _38 = &_39;
+ _34 = (move _35, move _38);
+ StorageDead(_38);
+ StorageDead(_35);
+ StorageLive(_41);
+ _41 = (_34.0: &*const u8);
+ StorageLive(_42);
+ _42 = (_34.1: &*const u8);
+ StorageLive(_43);
+ StorageLive(_44);
+ _44 = (*_41);
+ StorageLive(_45);
+ _45 = (*_42);
+ _43 = Eq(move _44, move _45);
+ switchInt(move _43) -> [0: bb11, otherwise: bb10];
+ }
+
+ bb10: {
+ StorageDead(_45);
+ StorageDead(_44);
+- _33 = const ();
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageDead(_41);
+ StorageDead(_39);
+ StorageDead(_36);
+ StorageDead(_34);
+- StorageDead(_33);
+ _0 = const ();
+- StorageDead(_29);
+ StorageDead(_4);
+- StorageDead(_1);
+ return;
+ }
+
+ bb11: {
+ StorageDead(_45);
+ StorageDead(_44);
+- StorageLive(_47);
+ _47 = core::panicking::AssertKind::Eq;
+ StorageLive(_48);
+- StorageLive(_49);
+- _49 = move _47;
+ StorageLive(_50);
+ StorageLive(_51);
+ _51 = &(*_41);
+ _50 = &(*_51);
+ StorageLive(_52);
+ StorageLive(_53);
+ _53 = &(*_42);
+ _52 = &(*_53);
+ StorageLive(_54);
+ _54 = Option::<Arguments<'_>>::None;
+- _48 = core::panicking::assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind unreachable;
++ _48 = core::panicking::assert_failed::<*const u8, *const u8>(_47, move _50, move _52, move _54) -> unwind unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff
new file mode 100644
index 000000000..f22bb2543
--- /dev/null
+++ b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff
@@ -0,0 +1,275 @@
+- // MIR for `slices` before GVN
++ // MIR for `slices` after GVN
+
+ fn slices() -> () {
+ let mut _0: ();
+ let _1: &str;
+ let _2: ();
+ let mut _3: &str;
+ let _5: ();
+ let mut _6: &str;
+ let _7: ();
+ let mut _8: (&*const u8, &*const u8);
+ let mut _9: &*const u8;
+ let _10: *const u8;
+ let mut _11: &str;
+ let mut _12: &*const u8;
+ let _13: *const u8;
+ let mut _14: &str;
+ let mut _17: bool;
+ let mut _18: *const u8;
+ let mut _19: *const u8;
+ let mut _20: !;
+ let _22: !;
+ let mut _23: core::panicking::AssertKind;
+ let mut _24: &*const u8;
+ let _25: &*const u8;
+ let mut _26: &*const u8;
+ let _27: &*const u8;
+ let mut _28: std::option::Option<std::fmt::Arguments<'_>>;
+ let mut _30: &str;
+ let _31: ();
+ let mut _32: &[u8];
+ let _33: ();
+ let mut _34: (&*const u8, &*const u8);
+ let mut _35: &*const u8;
+ let _36: *const u8;
+ let mut _37: &str;
+ let mut _38: &*const u8;
+ let _39: *const u8;
+ let mut _40: &[u8];
+ let mut _43: bool;
+ let mut _44: *const u8;
+ let mut _45: *const u8;
+ let mut _46: !;
+ let _48: !;
+ let mut _49: core::panicking::AssertKind;
+ let mut _50: &*const u8;
+ let _51: &*const u8;
+ let mut _52: &*const u8;
+ let _53: &*const u8;
+ let mut _54: std::option::Option<std::fmt::Arguments<'_>>;
+ scope 1 {
+ debug s => _1;
+ let _4: &str;
+ scope 2 {
+ debug t => _4;
+ let _15: &*const u8;
+ let _16: &*const u8;
+ let _29: &[u8];
+ scope 3 {
+ debug left_val => _15;
+ debug right_val => _16;
+ let _21: core::panicking::AssertKind;
+ scope 4 {
+ debug kind => _21;
+ }
+ }
+ scope 5 {
+ debug u => _29;
+ let _41: &*const u8;
+ let _42: &*const u8;
+ scope 7 {
+ debug left_val => _41;
+ debug right_val => _42;
+ let _47: core::panicking::AssertKind;
+ scope 8 {
+ debug kind => _47;
+ }
+ }
+ }
+ scope 6 {
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
+ _1 = const "my favourite slice";
+ StorageLive(_2);
+- StorageLive(_3);
+- _3 = _1;
+- _2 = opaque::<&str>(move _3) -> [return: bb1, unwind continue];
++ _2 = opaque::<&str>(_1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = _4;
+- _5 = opaque::<&str>(move _6) -> [return: bb2, unwind continue];
++ _5 = opaque::<&str>(_1) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+- StorageDead(_6);
+ StorageDead(_5);
+- StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = &(*_1);
+ _10 = core::str::<impl str>::as_ptr(move _11) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_11);
+ _9 = &_10;
+ StorageLive(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+ _14 = &(*_4);
+ _13 = core::str::<impl str>::as_ptr(move _14) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_14);
+ _12 = &_13;
+ _8 = (move _9, move _12);
+ StorageDead(_12);
+ StorageDead(_9);
+ StorageLive(_15);
+ _15 = (_8.0: &*const u8);
+ StorageLive(_16);
+ _16 = (_8.1: &*const u8);
+ StorageLive(_17);
+ StorageLive(_18);
+ _18 = (*_15);
+ StorageLive(_19);
+ _19 = (*_16);
+ _17 = Eq(move _18, move _19);
+ switchInt(move _17) -> [0: bb6, otherwise: bb5];
+ }
+
+ bb5: {
+ StorageDead(_19);
+ StorageDead(_18);
+- _7 = const ();
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageDead(_15);
+ StorageDead(_13);
+ StorageDead(_10);
+ StorageDead(_8);
+- StorageDead(_7);
+- StorageLive(_29);
+ StorageLive(_30);
+ _30 = &(*_1);
+ _29 = move _30 as &[u8] (Transmute);
+ StorageDead(_30);
+ StorageLive(_31);
+- StorageLive(_32);
+- _32 = _29;
+- _31 = opaque::<&[u8]>(move _32) -> [return: bb7, unwind continue];
++ _31 = opaque::<&[u8]>(_29) -> [return: bb7, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_19);
+ StorageDead(_18);
+- StorageLive(_21);
+ _21 = core::panicking::AssertKind::Eq;
+ StorageLive(_22);
+- StorageLive(_23);
+- _23 = move _21;
+ StorageLive(_24);
+ StorageLive(_25);
+ _25 = &(*_15);
+ _24 = &(*_25);
+ StorageLive(_26);
+ StorageLive(_27);
+ _27 = &(*_16);
+ _26 = &(*_27);
+ StorageLive(_28);
+ _28 = Option::<Arguments<'_>>::None;
+- _22 = core::panicking::assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind continue;
++ _22 = core::panicking::assert_failed::<*const u8, *const u8>(_21, move _24, move _26, move _28) -> unwind continue;
+ }
+
+ bb7: {
+- StorageDead(_32);
+ StorageDead(_31);
+- StorageLive(_33);
+ StorageLive(_34);
+ StorageLive(_35);
+ StorageLive(_36);
+ StorageLive(_37);
+ _37 = &(*_1);
+ _36 = core::str::<impl str>::as_ptr(move _37) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+ StorageDead(_37);
+ _35 = &_36;
+ StorageLive(_38);
+ StorageLive(_39);
+ StorageLive(_40);
+ _40 = &(*_29);
+ _39 = core::slice::<impl [u8]>::as_ptr(move _40) -> [return: bb9, unwind continue];
+ }
+
+ bb9: {
+ StorageDead(_40);
+ _38 = &_39;
+ _34 = (move _35, move _38);
+ StorageDead(_38);
+ StorageDead(_35);
+ StorageLive(_41);
+ _41 = (_34.0: &*const u8);
+ StorageLive(_42);
+ _42 = (_34.1: &*const u8);
+ StorageLive(_43);
+ StorageLive(_44);
+ _44 = (*_41);
+ StorageLive(_45);
+ _45 = (*_42);
+ _43 = Eq(move _44, move _45);
+ switchInt(move _43) -> [0: bb11, otherwise: bb10];
+ }
+
+ bb10: {
+ StorageDead(_45);
+ StorageDead(_44);
+- _33 = const ();
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageDead(_41);
+ StorageDead(_39);
+ StorageDead(_36);
+ StorageDead(_34);
+- StorageDead(_33);
+ _0 = const ();
+- StorageDead(_29);
+ StorageDead(_4);
+- StorageDead(_1);
+ return;
+ }
+
+ bb11: {
+ StorageDead(_45);
+ StorageDead(_44);
+- StorageLive(_47);
+ _47 = core::panicking::AssertKind::Eq;
+ StorageLive(_48);
+- StorageLive(_49);
+- _49 = move _47;
+ StorageLive(_50);
+ StorageLive(_51);
+ _51 = &(*_41);
+ _50 = &(*_51);
+ StorageLive(_52);
+ StorageLive(_53);
+ _53 = &(*_42);
+ _52 = &(*_53);
+ StorageLive(_54);
+ _54 = Option::<Arguments<'_>>::None;
+- _48 = core::panicking::assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind continue;
++ _48 = core::panicking::assert_failed::<*const u8, *const u8>(_47, move _50, move _52, move _54) -> unwind continue;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff
new file mode 100644
index 000000000..bf866e2f4
--- /dev/null
+++ b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff
@@ -0,0 +1,883 @@
+- // MIR for `subexpression_elimination` before GVN
++ // MIR for `subexpression_elimination` after GVN
+
+ fn subexpression_elimination(_1: u64, _2: u64, _3: u64) -> () {
+ debug x => _1;
+ debug y => _2;
+ debug z => _3;
+ let mut _0: ();
+ let _4: ();
+ let mut _5: u64;
+ let mut _6: u64;
+ let mut _7: u64;
+ let _8: ();
+ let mut _9: u64;
+ let mut _10: u64;
+ let mut _11: u64;
+ let _12: ();
+ let mut _13: u64;
+ let mut _14: u64;
+ let mut _15: u64;
+ let _16: ();
+ let mut _17: u64;
+ let mut _18: u64;
+ let mut _19: u64;
+ let mut _20: bool;
+ let _21: ();
+ let mut _22: u64;
+ let mut _23: u64;
+ let mut _24: u64;
+ let mut _25: bool;
+ let _26: ();
+ let mut _27: u64;
+ let mut _28: u64;
+ let mut _29: u64;
+ let _30: ();
+ let mut _31: u64;
+ let mut _32: u64;
+ let mut _33: u64;
+ let _34: ();
+ let mut _35: u64;
+ let mut _36: u64;
+ let mut _37: u64;
+ let _38: ();
+ let mut _39: u64;
+ let mut _40: u64;
+ let mut _41: u64;
+ let _42: ();
+ let mut _43: u64;
+ let mut _44: u64;
+ let mut _45: u64;
+ let _46: ();
+ let mut _47: u32;
+ let mut _48: u64;
+ let _49: ();
+ let mut _50: f32;
+ let mut _51: u64;
+ let _52: ();
+ let mut _53: S<u64>;
+ let mut _54: u64;
+ let _55: ();
+ let mut _56: u64;
+ let mut _57: S<u64>;
+ let mut _58: u64;
+ let _59: ();
+ let mut _60: u64;
+ let mut _61: u64;
+ let mut _62: u64;
+ let mut _63: u64;
+ let mut _64: u64;
+ let _65: ();
+ let mut _66: u64;
+ let mut _67: u64;
+ let mut _68: u64;
+ let mut _69: u64;
+ let mut _70: u64;
+ let _71: ();
+ let mut _72: u64;
+ let mut _73: u64;
+ let mut _74: u64;
+ let mut _75: u64;
+ let mut _76: u64;
+ let _77: ();
+ let mut _78: u64;
+ let mut _79: u64;
+ let mut _80: u64;
+ let mut _81: u64;
+ let mut _82: bool;
+ let mut _83: u64;
+ let _84: ();
+ let mut _85: u64;
+ let mut _86: u64;
+ let mut _87: u64;
+ let mut _88: u64;
+ let mut _89: bool;
+ let mut _90: u64;
+ let _91: ();
+ let mut _92: u64;
+ let mut _93: u64;
+ let mut _94: u64;
+ let mut _95: u64;
+ let mut _96: u64;
+ let _97: ();
+ let mut _98: u64;
+ let mut _99: u64;
+ let mut _100: u64;
+ let mut _101: u64;
+ let mut _102: u64;
+ let _103: ();
+ let mut _104: u64;
+ let mut _105: u64;
+ let mut _106: u64;
+ let mut _107: u64;
+ let mut _108: u64;
+ let _109: ();
+ let mut _110: u64;
+ let mut _111: u64;
+ let mut _112: u64;
+ let mut _113: u64;
+ let mut _114: u64;
+ let _115: ();
+ let mut _116: u64;
+ let mut _117: u64;
+ let mut _118: u64;
+ let mut _119: u64;
+ let mut _120: u64;
+ let _121: ();
+ let mut _122: S<u64>;
+ let mut _123: u64;
+ let _124: ();
+ let mut _125: u64;
+ let mut _126: S<u64>;
+ let mut _127: u64;
+ let _128: &u64;
+ let _129: ();
+ let mut _130: u64;
+ let mut _131: u64;
+ let mut _132: u64;
+ let _133: ();
+ let mut _134: u64;
+ let mut _135: u64;
+ let mut _136: u64;
+ let _138: ();
+ let mut _139: u64;
+ let mut _140: u64;
+ let mut _141: u64;
+ let _142: ();
+ let mut _143: u64;
+ let mut _144: u64;
+ let mut _145: u64;
+ let _146: ();
+ let _148: ();
+ let mut _149: u64;
+ let mut _150: u64;
+ let mut _151: u64;
+ let _152: ();
+ let mut _153: u64;
+ let mut _154: u64;
+ let mut _155: u64;
+ let _157: ();
+ let mut _158: u64;
+ let mut _159: u64;
+ let mut _160: u64;
+ let _161: ();
+ let mut _162: u64;
+ let mut _163: u64;
+ let mut _164: u64;
+ let _166: ();
+ let mut _167: u64;
+ let mut _168: u64;
+ let mut _169: u64;
+ let _170: ();
+ let mut _171: u64;
+ let mut _172: u64;
+ let mut _173: u64;
+ scope 1 {
+ debug a => _128;
+ let _137: &mut u64;
+ scope 2 {
+ debug b => _137;
+ let _165: &u64;
+ scope 3 {
+ let _147: *const u64;
+ scope 4 {
+ debug c => _147;
+ let _156: *mut u64;
+ scope 5 {
+ debug d => _156;
+ }
+ }
+ }
+ scope 6 {
+ debug e => _165;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+- StorageLive(_5);
+- StorageLive(_6);
+- _6 = _1;
+- StorageLive(_7);
+- _7 = _2;
+- _5 = Add(move _6, move _7);
+- StorageDead(_7);
+- StorageDead(_6);
+- _4 = opaque::<u64>(move _5) -> [return: bb1, unwind unreachable];
++ _5 = Add(_1, _2);
++ _4 = opaque::<u64>(_5) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_8);
+- StorageLive(_9);
+- StorageLive(_10);
+- _10 = _1;
+- StorageLive(_11);
+- _11 = _2;
+- _9 = Mul(move _10, move _11);
+- StorageDead(_11);
+- StorageDead(_10);
+- _8 = opaque::<u64>(move _9) -> [return: bb2, unwind unreachable];
++ _9 = Mul(_1, _2);
++ _8 = opaque::<u64>(_9) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_12);
+- StorageLive(_13);
+- StorageLive(_14);
+- _14 = _1;
+- StorageLive(_15);
+- _15 = _2;
+- _13 = Sub(move _14, move _15);
+- StorageDead(_15);
+- StorageDead(_14);
+- _12 = opaque::<u64>(move _13) -> [return: bb3, unwind unreachable];
++ _13 = Sub(_1, _2);
++ _12 = opaque::<u64>(_13) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+- StorageDead(_13);
+ StorageDead(_12);
+ StorageLive(_16);
+- StorageLive(_17);
+- StorageLive(_18);
+- _18 = _1;
+- StorageLive(_19);
+- _19 = _2;
+- _20 = Eq(_19, const 0_u64);
+- assert(!move _20, "attempt to divide `{}` by zero", _18) -> [success: bb4, unwind unreachable];
++ _20 = Eq(_2, const 0_u64);
++ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb4, unwind unreachable];
+ }
+
+ bb4: {
+- _17 = Div(move _18, move _19);
+- StorageDead(_19);
+- StorageDead(_18);
+- _16 = opaque::<u64>(move _17) -> [return: bb5, unwind unreachable];
++ _17 = Div(_1, _2);
++ _16 = opaque::<u64>(_17) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+- StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_21);
+- StorageLive(_22);
+- StorageLive(_23);
+- _23 = _1;
+- StorageLive(_24);
+- _24 = _2;
+- _25 = Eq(_24, const 0_u64);
+- assert(!move _25, "attempt to calculate the remainder of `{}` with a divisor of zero", _23) -> [success: bb6, unwind unreachable];
++ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb6, unwind unreachable];
+ }
+
+ bb6: {
+- _22 = Rem(move _23, move _24);
+- StorageDead(_24);
+- StorageDead(_23);
+- _21 = opaque::<u64>(move _22) -> [return: bb7, unwind unreachable];
++ _22 = Rem(_1, _2);
++ _21 = opaque::<u64>(_22) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+- StorageDead(_22);
+ StorageDead(_21);
+ StorageLive(_26);
+- StorageLive(_27);
+- StorageLive(_28);
+- _28 = _1;
+- StorageLive(_29);
+- _29 = _2;
+- _27 = BitAnd(move _28, move _29);
+- StorageDead(_29);
+- StorageDead(_28);
+- _26 = opaque::<u64>(move _27) -> [return: bb8, unwind unreachable];
++ _27 = BitAnd(_1, _2);
++ _26 = opaque::<u64>(_27) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+- StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_30);
+- StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- StorageLive(_33);
+- _33 = _2;
+- _31 = BitOr(move _32, move _33);
+- StorageDead(_33);
+- StorageDead(_32);
+- _30 = opaque::<u64>(move _31) -> [return: bb9, unwind unreachable];
++ _31 = BitOr(_1, _2);
++ _30 = opaque::<u64>(_31) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+- StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_34);
+- StorageLive(_35);
+- StorageLive(_36);
+- _36 = _1;
+- StorageLive(_37);
+- _37 = _2;
+- _35 = BitXor(move _36, move _37);
+- StorageDead(_37);
+- StorageDead(_36);
+- _34 = opaque::<u64>(move _35) -> [return: bb10, unwind unreachable];
++ _35 = BitXor(_1, _2);
++ _34 = opaque::<u64>(_35) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+- StorageDead(_35);
+ StorageDead(_34);
+ StorageLive(_38);
+- StorageLive(_39);
+- StorageLive(_40);
+- _40 = _1;
+- StorageLive(_41);
+- _41 = _2;
+- _39 = Shl(move _40, move _41);
+- StorageDead(_41);
+- StorageDead(_40);
+- _38 = opaque::<u64>(move _39) -> [return: bb11, unwind unreachable];
++ _39 = Shl(_1, _2);
++ _38 = opaque::<u64>(_39) -> [return: bb11, unwind unreachable];
+ }
+
+ bb11: {
+- StorageDead(_39);
+ StorageDead(_38);
+ StorageLive(_42);
+- StorageLive(_43);
+- StorageLive(_44);
+- _44 = _1;
+- StorageLive(_45);
+- _45 = _2;
+- _43 = Shr(move _44, move _45);
+- StorageDead(_45);
+- StorageDead(_44);
+- _42 = opaque::<u64>(move _43) -> [return: bb12, unwind unreachable];
++ _43 = Shr(_1, _2);
++ _42 = opaque::<u64>(_43) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+- StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_46);
+ StorageLive(_47);
+- StorageLive(_48);
+- _48 = _1;
+- _47 = move _48 as u32 (IntToInt);
+- StorageDead(_48);
++ _47 = _1 as u32 (IntToInt);
+ _46 = opaque::<u32>(move _47) -> [return: bb13, unwind unreachable];
+ }
+
+ bb13: {
+ StorageDead(_47);
+ StorageDead(_46);
+ StorageLive(_49);
+ StorageLive(_50);
+- StorageLive(_51);
+- _51 = _1;
+- _50 = move _51 as f32 (IntToFloat);
+- StorageDead(_51);
++ _50 = _1 as f32 (IntToFloat);
+ _49 = opaque::<f32>(move _50) -> [return: bb14, unwind unreachable];
+ }
+
+ bb14: {
+ StorageDead(_50);
+ StorageDead(_49);
+ StorageLive(_52);
+- StorageLive(_53);
+- StorageLive(_54);
+- _54 = _1;
+- _53 = S::<u64>(move _54);
+- StorageDead(_54);
+- _52 = opaque::<S<u64>>(move _53) -> [return: bb15, unwind unreachable];
++ _53 = S::<u64>(_1);
++ _52 = opaque::<S<u64>>(_53) -> [return: bb15, unwind unreachable];
+ }
+
+ bb15: {
+- StorageDead(_53);
+ StorageDead(_52);
+ StorageLive(_55);
+- StorageLive(_56);
+- StorageLive(_57);
+- StorageLive(_58);
+- _58 = _1;
+- _57 = S::<u64>(move _58);
+- StorageDead(_58);
+- _56 = (_57.0: u64);
+- _55 = opaque::<u64>(move _56) -> [return: bb16, unwind unreachable];
++ _56 = (_53.0: u64);
++ _55 = opaque::<u64>(_56) -> [return: bb16, unwind unreachable];
+ }
+
+ bb16: {
+- StorageDead(_56);
+- StorageDead(_57);
+ StorageDead(_55);
+ StorageLive(_59);
+ StorageLive(_60);
+- StorageLive(_61);
+- StorageLive(_62);
+- _62 = _1;
+- StorageLive(_63);
+- _63 = _2;
+- _61 = Add(move _62, move _63);
+- StorageDead(_63);
+- StorageDead(_62);
+ StorageLive(_64);
+ _64 = _3;
+- _60 = Add(move _61, move _64);
++ _60 = Add(_5, move _64);
+ StorageDead(_64);
+- StorageDead(_61);
+ _59 = opaque::<u64>(move _60) -> [return: bb17, unwind unreachable];
+ }
+
+ bb17: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_65);
+ StorageLive(_66);
+- StorageLive(_67);
+- StorageLive(_68);
+- _68 = _1;
+- StorageLive(_69);
+- _69 = _2;
+- _67 = Mul(move _68, move _69);
+- StorageDead(_69);
+- StorageDead(_68);
+ StorageLive(_70);
+ _70 = _3;
+- _66 = Add(move _67, move _70);
++ _66 = Add(_9, move _70);
+ StorageDead(_70);
+- StorageDead(_67);
+ _65 = opaque::<u64>(move _66) -> [return: bb18, unwind unreachable];
+ }
+
+ bb18: {
+ StorageDead(_66);
+ StorageDead(_65);
+ StorageLive(_71);
+ StorageLive(_72);
+- StorageLive(_73);
+- StorageLive(_74);
+- _74 = _1;
+- StorageLive(_75);
+- _75 = _2;
+- _73 = Sub(move _74, move _75);
+- StorageDead(_75);
+- StorageDead(_74);
+ StorageLive(_76);
+ _76 = _3;
+- _72 = Add(move _73, move _76);
++ _72 = Add(_13, move _76);
+ StorageDead(_76);
+- StorageDead(_73);
+ _71 = opaque::<u64>(move _72) -> [return: bb19, unwind unreachable];
+ }
+
+ bb19: {
+ StorageDead(_72);
+ StorageDead(_71);
+ StorageLive(_77);
+ StorageLive(_78);
+- StorageLive(_79);
+- StorageLive(_80);
+- _80 = _1;
+- StorageLive(_81);
+- _81 = _2;
+- _82 = Eq(_81, const 0_u64);
+- assert(!move _82, "attempt to divide `{}` by zero", _80) -> [success: bb20, unwind unreachable];
++ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb20, unwind unreachable];
+ }
+
+ bb20: {
+- _79 = Div(move _80, move _81);
+- StorageDead(_81);
+- StorageDead(_80);
+ StorageLive(_83);
+ _83 = _3;
+- _78 = Add(move _79, move _83);
++ _78 = Add(_17, move _83);
+ StorageDead(_83);
+- StorageDead(_79);
+ _77 = opaque::<u64>(move _78) -> [return: bb21, unwind unreachable];
+ }
+
+ bb21: {
+ StorageDead(_78);
+ StorageDead(_77);
+ StorageLive(_84);
+ StorageLive(_85);
+- StorageLive(_86);
+- StorageLive(_87);
+- _87 = _1;
+- StorageLive(_88);
+- _88 = _2;
+- _89 = Eq(_88, const 0_u64);
+- assert(!move _89, "attempt to calculate the remainder of `{}` with a divisor of zero", _87) -> [success: bb22, unwind unreachable];
++ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb22, unwind unreachable];
+ }
+
+ bb22: {
+- _86 = Rem(move _87, move _88);
+- StorageDead(_88);
+- StorageDead(_87);
+ StorageLive(_90);
+ _90 = _3;
+- _85 = Add(move _86, move _90);
++ _85 = Add(_22, move _90);
+ StorageDead(_90);
+- StorageDead(_86);
+ _84 = opaque::<u64>(move _85) -> [return: bb23, unwind unreachable];
+ }
+
+ bb23: {
+ StorageDead(_85);
+ StorageDead(_84);
+ StorageLive(_91);
+ StorageLive(_92);
+- StorageLive(_93);
+- StorageLive(_94);
+- _94 = _1;
+- StorageLive(_95);
+- _95 = _2;
+- _93 = BitAnd(move _94, move _95);
+- StorageDead(_95);
+- StorageDead(_94);
+ StorageLive(_96);
+ _96 = _3;
+- _92 = Add(move _93, move _96);
++ _92 = Add(_27, move _96);
+ StorageDead(_96);
+- StorageDead(_93);
+ _91 = opaque::<u64>(move _92) -> [return: bb24, unwind unreachable];
+ }
+
+ bb24: {
+ StorageDead(_92);
+ StorageDead(_91);
+ StorageLive(_97);
+ StorageLive(_98);
+- StorageLive(_99);
+- StorageLive(_100);
+- _100 = _1;
+- StorageLive(_101);
+- _101 = _2;
+- _99 = BitOr(move _100, move _101);
+- StorageDead(_101);
+- StorageDead(_100);
+ StorageLive(_102);
+ _102 = _3;
+- _98 = Add(move _99, move _102);
++ _98 = Add(_31, move _102);
+ StorageDead(_102);
+- StorageDead(_99);
+ _97 = opaque::<u64>(move _98) -> [return: bb25, unwind unreachable];
+ }
+
+ bb25: {
+ StorageDead(_98);
+ StorageDead(_97);
+ StorageLive(_103);
+ StorageLive(_104);
+- StorageLive(_105);
+- StorageLive(_106);
+- _106 = _1;
+- StorageLive(_107);
+- _107 = _2;
+- _105 = BitXor(move _106, move _107);
+- StorageDead(_107);
+- StorageDead(_106);
+ StorageLive(_108);
+ _108 = _3;
+- _104 = Add(move _105, move _108);
++ _104 = Add(_35, move _108);
+ StorageDead(_108);
+- StorageDead(_105);
+ _103 = opaque::<u64>(move _104) -> [return: bb26, unwind unreachable];
+ }
+
+ bb26: {
+ StorageDead(_104);
+ StorageDead(_103);
+ StorageLive(_109);
+ StorageLive(_110);
+- StorageLive(_111);
+- StorageLive(_112);
+- _112 = _1;
+- StorageLive(_113);
+- _113 = _2;
+- _111 = Shl(move _112, move _113);
+- StorageDead(_113);
+- StorageDead(_112);
+ StorageLive(_114);
+ _114 = _3;
+- _110 = Add(move _111, move _114);
++ _110 = Add(_39, move _114);
+ StorageDead(_114);
+- StorageDead(_111);
+ _109 = opaque::<u64>(move _110) -> [return: bb27, unwind unreachable];
+ }
+
+ bb27: {
+ StorageDead(_110);
+ StorageDead(_109);
+ StorageLive(_115);
+ StorageLive(_116);
+- StorageLive(_117);
+- StorageLive(_118);
+- _118 = _1;
+- StorageLive(_119);
+- _119 = _2;
+- _117 = Shr(move _118, move _119);
+- StorageDead(_119);
+- StorageDead(_118);
+ StorageLive(_120);
+ _120 = _3;
+- _116 = Add(move _117, move _120);
++ _116 = Add(_43, move _120);
+ StorageDead(_120);
+- StorageDead(_117);
+ _115 = opaque::<u64>(move _116) -> [return: bb28, unwind unreachable];
+ }
+
+ bb28: {
+ StorageDead(_116);
+ StorageDead(_115);
+ StorageLive(_121);
+- StorageLive(_122);
+- StorageLive(_123);
+- _123 = _1;
+- _122 = S::<u64>(move _123);
+- StorageDead(_123);
+- _121 = opaque::<S<u64>>(move _122) -> [return: bb29, unwind unreachable];
++ _121 = opaque::<S<u64>>(_53) -> [return: bb29, unwind unreachable];
+ }
+
+ bb29: {
+- StorageDead(_122);
+ StorageDead(_121);
+ StorageLive(_124);
+- StorageLive(_125);
+- StorageLive(_126);
+- StorageLive(_127);
+- _127 = _1;
+- _126 = S::<u64>(move _127);
+- StorageDead(_127);
+- _125 = (_126.0: u64);
+- _124 = opaque::<u64>(move _125) -> [return: bb30, unwind unreachable];
++ _124 = opaque::<u64>(_56) -> [return: bb30, unwind unreachable];
+ }
+
+ bb30: {
+- StorageDead(_125);
+- StorageDead(_126);
+ StorageDead(_124);
+ StorageLive(_128);
+ _128 = &_3;
+ StorageLive(_129);
+- StorageLive(_130);
+- StorageLive(_131);
+ _131 = (*_128);
+- StorageLive(_132);
+- _132 = _1;
+- _130 = Add(move _131, move _132);
+- StorageDead(_132);
+- StorageDead(_131);
+- _129 = opaque::<u64>(move _130) -> [return: bb31, unwind unreachable];
++ _130 = Add(_131, _1);
++ _129 = opaque::<u64>(_130) -> [return: bb31, unwind unreachable];
+ }
+
+ bb31: {
+- StorageDead(_130);
+ StorageDead(_129);
+ StorageLive(_133);
+- StorageLive(_134);
+- StorageLive(_135);
+- _135 = (*_128);
+- StorageLive(_136);
+- _136 = _1;
+- _134 = Add(move _135, move _136);
+- StorageDead(_136);
+- StorageDead(_135);
+- _133 = opaque::<u64>(move _134) -> [return: bb32, unwind unreachable];
++ _133 = opaque::<u64>(_130) -> [return: bb32, unwind unreachable];
+ }
+
+ bb32: {
+- StorageDead(_134);
+ StorageDead(_133);
+ StorageLive(_137);
+ _137 = &mut _3;
+ StorageLive(_138);
+ StorageLive(_139);
+ StorageLive(_140);
+ _140 = (*_137);
+- StorageLive(_141);
+- _141 = _1;
+- _139 = Add(move _140, move _141);
+- StorageDead(_141);
++ _139 = Add(move _140, _1);
+ StorageDead(_140);
+ _138 = opaque::<u64>(move _139) -> [return: bb33, unwind unreachable];
+ }
+
+ bb33: {
+ StorageDead(_139);
+ StorageDead(_138);
+ StorageLive(_142);
+ StorageLive(_143);
+ StorageLive(_144);
+ _144 = (*_137);
+- StorageLive(_145);
+- _145 = _1;
+- _143 = Add(move _144, move _145);
+- StorageDead(_145);
++ _143 = Add(move _144, _1);
+ StorageDead(_144);
+ _142 = opaque::<u64>(move _143) -> [return: bb34, unwind unreachable];
+ }
+
+ bb34: {
+ StorageDead(_143);
+ StorageDead(_142);
+- StorageLive(_146);
+ StorageLive(_147);
+ _147 = &raw const _3;
+ StorageLive(_148);
+ StorageLive(_149);
+ StorageLive(_150);
+ _150 = (*_147);
+- StorageLive(_151);
+- _151 = _1;
+- _149 = Add(move _150, move _151);
+- StorageDead(_151);
++ _149 = Add(move _150, _1);
+ StorageDead(_150);
+ _148 = opaque::<u64>(move _149) -> [return: bb35, unwind unreachable];
+ }
+
+ bb35: {
+ StorageDead(_149);
+ StorageDead(_148);
+ StorageLive(_152);
+ StorageLive(_153);
+ StorageLive(_154);
+ _154 = (*_147);
+- StorageLive(_155);
+- _155 = _1;
+- _153 = Add(move _154, move _155);
+- StorageDead(_155);
++ _153 = Add(move _154, _1);
+ StorageDead(_154);
+ _152 = opaque::<u64>(move _153) -> [return: bb36, unwind unreachable];
+ }
+
+ bb36: {
+ StorageDead(_153);
+ StorageDead(_152);
+ StorageLive(_156);
+ _156 = &raw mut _3;
+ StorageLive(_157);
+ StorageLive(_158);
+ StorageLive(_159);
+ _159 = (*_156);
+- StorageLive(_160);
+- _160 = _1;
+- _158 = Add(move _159, move _160);
+- StorageDead(_160);
++ _158 = Add(move _159, _1);
+ StorageDead(_159);
+ _157 = opaque::<u64>(move _158) -> [return: bb37, unwind unreachable];
+ }
+
+ bb37: {
+ StorageDead(_158);
+ StorageDead(_157);
+ StorageLive(_161);
+ StorageLive(_162);
+ StorageLive(_163);
+ _163 = (*_156);
+- StorageLive(_164);
+- _164 = _1;
+- _162 = Add(move _163, move _164);
+- StorageDead(_164);
++ _162 = Add(move _163, _1);
+ StorageDead(_163);
+ _161 = opaque::<u64>(move _162) -> [return: bb38, unwind unreachable];
+ }
+
+ bb38: {
+ StorageDead(_162);
+ StorageDead(_161);
+- _146 = const ();
+ StorageDead(_156);
+ StorageDead(_147);
+- StorageDead(_146);
+ StorageLive(_165);
+ _165 = &_3;
+ StorageLive(_166);
+- StorageLive(_167);
+- StorageLive(_168);
+ _168 = (*_165);
+- StorageLive(_169);
+- _169 = _1;
+- _167 = Add(move _168, move _169);
+- StorageDead(_169);
+- StorageDead(_168);
+- _166 = opaque::<u64>(move _167) -> [return: bb39, unwind unreachable];
++ _167 = Add(_168, _1);
++ _166 = opaque::<u64>(_167) -> [return: bb39, unwind unreachable];
+ }
+
+ bb39: {
+- StorageDead(_167);
+ StorageDead(_166);
+ StorageLive(_170);
+- StorageLive(_171);
+- StorageLive(_172);
+- _172 = (*_165);
+- StorageLive(_173);
+- _173 = _1;
+- _171 = Add(move _172, move _173);
+- StorageDead(_173);
+- StorageDead(_172);
+- _170 = opaque::<u64>(move _171) -> [return: bb40, unwind unreachable];
++ _170 = opaque::<u64>(_167) -> [return: bb40, unwind unreachable];
+ }
+
+ bb40: {
+- StorageDead(_171);
+ StorageDead(_170);
+ _0 = const ();
+ StorageDead(_165);
+ StorageDead(_137);
+ StorageDead(_128);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff
new file mode 100644
index 000000000..68b052907
--- /dev/null
+++ b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff
@@ -0,0 +1,883 @@
+- // MIR for `subexpression_elimination` before GVN
++ // MIR for `subexpression_elimination` after GVN
+
+ fn subexpression_elimination(_1: u64, _2: u64, _3: u64) -> () {
+ debug x => _1;
+ debug y => _2;
+ debug z => _3;
+ let mut _0: ();
+ let _4: ();
+ let mut _5: u64;
+ let mut _6: u64;
+ let mut _7: u64;
+ let _8: ();
+ let mut _9: u64;
+ let mut _10: u64;
+ let mut _11: u64;
+ let _12: ();
+ let mut _13: u64;
+ let mut _14: u64;
+ let mut _15: u64;
+ let _16: ();
+ let mut _17: u64;
+ let mut _18: u64;
+ let mut _19: u64;
+ let mut _20: bool;
+ let _21: ();
+ let mut _22: u64;
+ let mut _23: u64;
+ let mut _24: u64;
+ let mut _25: bool;
+ let _26: ();
+ let mut _27: u64;
+ let mut _28: u64;
+ let mut _29: u64;
+ let _30: ();
+ let mut _31: u64;
+ let mut _32: u64;
+ let mut _33: u64;
+ let _34: ();
+ let mut _35: u64;
+ let mut _36: u64;
+ let mut _37: u64;
+ let _38: ();
+ let mut _39: u64;
+ let mut _40: u64;
+ let mut _41: u64;
+ let _42: ();
+ let mut _43: u64;
+ let mut _44: u64;
+ let mut _45: u64;
+ let _46: ();
+ let mut _47: u32;
+ let mut _48: u64;
+ let _49: ();
+ let mut _50: f32;
+ let mut _51: u64;
+ let _52: ();
+ let mut _53: S<u64>;
+ let mut _54: u64;
+ let _55: ();
+ let mut _56: u64;
+ let mut _57: S<u64>;
+ let mut _58: u64;
+ let _59: ();
+ let mut _60: u64;
+ let mut _61: u64;
+ let mut _62: u64;
+ let mut _63: u64;
+ let mut _64: u64;
+ let _65: ();
+ let mut _66: u64;
+ let mut _67: u64;
+ let mut _68: u64;
+ let mut _69: u64;
+ let mut _70: u64;
+ let _71: ();
+ let mut _72: u64;
+ let mut _73: u64;
+ let mut _74: u64;
+ let mut _75: u64;
+ let mut _76: u64;
+ let _77: ();
+ let mut _78: u64;
+ let mut _79: u64;
+ let mut _80: u64;
+ let mut _81: u64;
+ let mut _82: bool;
+ let mut _83: u64;
+ let _84: ();
+ let mut _85: u64;
+ let mut _86: u64;
+ let mut _87: u64;
+ let mut _88: u64;
+ let mut _89: bool;
+ let mut _90: u64;
+ let _91: ();
+ let mut _92: u64;
+ let mut _93: u64;
+ let mut _94: u64;
+ let mut _95: u64;
+ let mut _96: u64;
+ let _97: ();
+ let mut _98: u64;
+ let mut _99: u64;
+ let mut _100: u64;
+ let mut _101: u64;
+ let mut _102: u64;
+ let _103: ();
+ let mut _104: u64;
+ let mut _105: u64;
+ let mut _106: u64;
+ let mut _107: u64;
+ let mut _108: u64;
+ let _109: ();
+ let mut _110: u64;
+ let mut _111: u64;
+ let mut _112: u64;
+ let mut _113: u64;
+ let mut _114: u64;
+ let _115: ();
+ let mut _116: u64;
+ let mut _117: u64;
+ let mut _118: u64;
+ let mut _119: u64;
+ let mut _120: u64;
+ let _121: ();
+ let mut _122: S<u64>;
+ let mut _123: u64;
+ let _124: ();
+ let mut _125: u64;
+ let mut _126: S<u64>;
+ let mut _127: u64;
+ let _128: &u64;
+ let _129: ();
+ let mut _130: u64;
+ let mut _131: u64;
+ let mut _132: u64;
+ let _133: ();
+ let mut _134: u64;
+ let mut _135: u64;
+ let mut _136: u64;
+ let _138: ();
+ let mut _139: u64;
+ let mut _140: u64;
+ let mut _141: u64;
+ let _142: ();
+ let mut _143: u64;
+ let mut _144: u64;
+ let mut _145: u64;
+ let _146: ();
+ let _148: ();
+ let mut _149: u64;
+ let mut _150: u64;
+ let mut _151: u64;
+ let _152: ();
+ let mut _153: u64;
+ let mut _154: u64;
+ let mut _155: u64;
+ let _157: ();
+ let mut _158: u64;
+ let mut _159: u64;
+ let mut _160: u64;
+ let _161: ();
+ let mut _162: u64;
+ let mut _163: u64;
+ let mut _164: u64;
+ let _166: ();
+ let mut _167: u64;
+ let mut _168: u64;
+ let mut _169: u64;
+ let _170: ();
+ let mut _171: u64;
+ let mut _172: u64;
+ let mut _173: u64;
+ scope 1 {
+ debug a => _128;
+ let _137: &mut u64;
+ scope 2 {
+ debug b => _137;
+ let _165: &u64;
+ scope 3 {
+ let _147: *const u64;
+ scope 4 {
+ debug c => _147;
+ let _156: *mut u64;
+ scope 5 {
+ debug d => _156;
+ }
+ }
+ }
+ scope 6 {
+ debug e => _165;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+- StorageLive(_5);
+- StorageLive(_6);
+- _6 = _1;
+- StorageLive(_7);
+- _7 = _2;
+- _5 = Add(move _6, move _7);
+- StorageDead(_7);
+- StorageDead(_6);
+- _4 = opaque::<u64>(move _5) -> [return: bb1, unwind continue];
++ _5 = Add(_1, _2);
++ _4 = opaque::<u64>(_5) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_8);
+- StorageLive(_9);
+- StorageLive(_10);
+- _10 = _1;
+- StorageLive(_11);
+- _11 = _2;
+- _9 = Mul(move _10, move _11);
+- StorageDead(_11);
+- StorageDead(_10);
+- _8 = opaque::<u64>(move _9) -> [return: bb2, unwind continue];
++ _9 = Mul(_1, _2);
++ _8 = opaque::<u64>(_9) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+- StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_12);
+- StorageLive(_13);
+- StorageLive(_14);
+- _14 = _1;
+- StorageLive(_15);
+- _15 = _2;
+- _13 = Sub(move _14, move _15);
+- StorageDead(_15);
+- StorageDead(_14);
+- _12 = opaque::<u64>(move _13) -> [return: bb3, unwind continue];
++ _13 = Sub(_1, _2);
++ _12 = opaque::<u64>(_13) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+- StorageDead(_13);
+ StorageDead(_12);
+ StorageLive(_16);
+- StorageLive(_17);
+- StorageLive(_18);
+- _18 = _1;
+- StorageLive(_19);
+- _19 = _2;
+- _20 = Eq(_19, const 0_u64);
+- assert(!move _20, "attempt to divide `{}` by zero", _18) -> [success: bb4, unwind continue];
++ _20 = Eq(_2, const 0_u64);
++ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb4, unwind continue];
+ }
+
+ bb4: {
+- _17 = Div(move _18, move _19);
+- StorageDead(_19);
+- StorageDead(_18);
+- _16 = opaque::<u64>(move _17) -> [return: bb5, unwind continue];
++ _17 = Div(_1, _2);
++ _16 = opaque::<u64>(_17) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+- StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_21);
+- StorageLive(_22);
+- StorageLive(_23);
+- _23 = _1;
+- StorageLive(_24);
+- _24 = _2;
+- _25 = Eq(_24, const 0_u64);
+- assert(!move _25, "attempt to calculate the remainder of `{}` with a divisor of zero", _23) -> [success: bb6, unwind continue];
++ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb6, unwind continue];
+ }
+
+ bb6: {
+- _22 = Rem(move _23, move _24);
+- StorageDead(_24);
+- StorageDead(_23);
+- _21 = opaque::<u64>(move _22) -> [return: bb7, unwind continue];
++ _22 = Rem(_1, _2);
++ _21 = opaque::<u64>(_22) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+- StorageDead(_22);
+ StorageDead(_21);
+ StorageLive(_26);
+- StorageLive(_27);
+- StorageLive(_28);
+- _28 = _1;
+- StorageLive(_29);
+- _29 = _2;
+- _27 = BitAnd(move _28, move _29);
+- StorageDead(_29);
+- StorageDead(_28);
+- _26 = opaque::<u64>(move _27) -> [return: bb8, unwind continue];
++ _27 = BitAnd(_1, _2);
++ _26 = opaque::<u64>(_27) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+- StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_30);
+- StorageLive(_31);
+- StorageLive(_32);
+- _32 = _1;
+- StorageLive(_33);
+- _33 = _2;
+- _31 = BitOr(move _32, move _33);
+- StorageDead(_33);
+- StorageDead(_32);
+- _30 = opaque::<u64>(move _31) -> [return: bb9, unwind continue];
++ _31 = BitOr(_1, _2);
++ _30 = opaque::<u64>(_31) -> [return: bb9, unwind continue];
+ }
+
+ bb9: {
+- StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_34);
+- StorageLive(_35);
+- StorageLive(_36);
+- _36 = _1;
+- StorageLive(_37);
+- _37 = _2;
+- _35 = BitXor(move _36, move _37);
+- StorageDead(_37);
+- StorageDead(_36);
+- _34 = opaque::<u64>(move _35) -> [return: bb10, unwind continue];
++ _35 = BitXor(_1, _2);
++ _34 = opaque::<u64>(_35) -> [return: bb10, unwind continue];
+ }
+
+ bb10: {
+- StorageDead(_35);
+ StorageDead(_34);
+ StorageLive(_38);
+- StorageLive(_39);
+- StorageLive(_40);
+- _40 = _1;
+- StorageLive(_41);
+- _41 = _2;
+- _39 = Shl(move _40, move _41);
+- StorageDead(_41);
+- StorageDead(_40);
+- _38 = opaque::<u64>(move _39) -> [return: bb11, unwind continue];
++ _39 = Shl(_1, _2);
++ _38 = opaque::<u64>(_39) -> [return: bb11, unwind continue];
+ }
+
+ bb11: {
+- StorageDead(_39);
+ StorageDead(_38);
+ StorageLive(_42);
+- StorageLive(_43);
+- StorageLive(_44);
+- _44 = _1;
+- StorageLive(_45);
+- _45 = _2;
+- _43 = Shr(move _44, move _45);
+- StorageDead(_45);
+- StorageDead(_44);
+- _42 = opaque::<u64>(move _43) -> [return: bb12, unwind continue];
++ _43 = Shr(_1, _2);
++ _42 = opaque::<u64>(_43) -> [return: bb12, unwind continue];
+ }
+
+ bb12: {
+- StorageDead(_43);
+ StorageDead(_42);
+ StorageLive(_46);
+ StorageLive(_47);
+- StorageLive(_48);
+- _48 = _1;
+- _47 = move _48 as u32 (IntToInt);
+- StorageDead(_48);
++ _47 = _1 as u32 (IntToInt);
+ _46 = opaque::<u32>(move _47) -> [return: bb13, unwind continue];
+ }
+
+ bb13: {
+ StorageDead(_47);
+ StorageDead(_46);
+ StorageLive(_49);
+ StorageLive(_50);
+- StorageLive(_51);
+- _51 = _1;
+- _50 = move _51 as f32 (IntToFloat);
+- StorageDead(_51);
++ _50 = _1 as f32 (IntToFloat);
+ _49 = opaque::<f32>(move _50) -> [return: bb14, unwind continue];
+ }
+
+ bb14: {
+ StorageDead(_50);
+ StorageDead(_49);
+ StorageLive(_52);
+- StorageLive(_53);
+- StorageLive(_54);
+- _54 = _1;
+- _53 = S::<u64>(move _54);
+- StorageDead(_54);
+- _52 = opaque::<S<u64>>(move _53) -> [return: bb15, unwind continue];
++ _53 = S::<u64>(_1);
++ _52 = opaque::<S<u64>>(_53) -> [return: bb15, unwind continue];
+ }
+
+ bb15: {
+- StorageDead(_53);
+ StorageDead(_52);
+ StorageLive(_55);
+- StorageLive(_56);
+- StorageLive(_57);
+- StorageLive(_58);
+- _58 = _1;
+- _57 = S::<u64>(move _58);
+- StorageDead(_58);
+- _56 = (_57.0: u64);
+- _55 = opaque::<u64>(move _56) -> [return: bb16, unwind continue];
++ _56 = (_53.0: u64);
++ _55 = opaque::<u64>(_56) -> [return: bb16, unwind continue];
+ }
+
+ bb16: {
+- StorageDead(_56);
+- StorageDead(_57);
+ StorageDead(_55);
+ StorageLive(_59);
+ StorageLive(_60);
+- StorageLive(_61);
+- StorageLive(_62);
+- _62 = _1;
+- StorageLive(_63);
+- _63 = _2;
+- _61 = Add(move _62, move _63);
+- StorageDead(_63);
+- StorageDead(_62);
+ StorageLive(_64);
+ _64 = _3;
+- _60 = Add(move _61, move _64);
++ _60 = Add(_5, move _64);
+ StorageDead(_64);
+- StorageDead(_61);
+ _59 = opaque::<u64>(move _60) -> [return: bb17, unwind continue];
+ }
+
+ bb17: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_65);
+ StorageLive(_66);
+- StorageLive(_67);
+- StorageLive(_68);
+- _68 = _1;
+- StorageLive(_69);
+- _69 = _2;
+- _67 = Mul(move _68, move _69);
+- StorageDead(_69);
+- StorageDead(_68);
+ StorageLive(_70);
+ _70 = _3;
+- _66 = Add(move _67, move _70);
++ _66 = Add(_9, move _70);
+ StorageDead(_70);
+- StorageDead(_67);
+ _65 = opaque::<u64>(move _66) -> [return: bb18, unwind continue];
+ }
+
+ bb18: {
+ StorageDead(_66);
+ StorageDead(_65);
+ StorageLive(_71);
+ StorageLive(_72);
+- StorageLive(_73);
+- StorageLive(_74);
+- _74 = _1;
+- StorageLive(_75);
+- _75 = _2;
+- _73 = Sub(move _74, move _75);
+- StorageDead(_75);
+- StorageDead(_74);
+ StorageLive(_76);
+ _76 = _3;
+- _72 = Add(move _73, move _76);
++ _72 = Add(_13, move _76);
+ StorageDead(_76);
+- StorageDead(_73);
+ _71 = opaque::<u64>(move _72) -> [return: bb19, unwind continue];
+ }
+
+ bb19: {
+ StorageDead(_72);
+ StorageDead(_71);
+ StorageLive(_77);
+ StorageLive(_78);
+- StorageLive(_79);
+- StorageLive(_80);
+- _80 = _1;
+- StorageLive(_81);
+- _81 = _2;
+- _82 = Eq(_81, const 0_u64);
+- assert(!move _82, "attempt to divide `{}` by zero", _80) -> [success: bb20, unwind continue];
++ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb20, unwind continue];
+ }
+
+ bb20: {
+- _79 = Div(move _80, move _81);
+- StorageDead(_81);
+- StorageDead(_80);
+ StorageLive(_83);
+ _83 = _3;
+- _78 = Add(move _79, move _83);
++ _78 = Add(_17, move _83);
+ StorageDead(_83);
+- StorageDead(_79);
+ _77 = opaque::<u64>(move _78) -> [return: bb21, unwind continue];
+ }
+
+ bb21: {
+ StorageDead(_78);
+ StorageDead(_77);
+ StorageLive(_84);
+ StorageLive(_85);
+- StorageLive(_86);
+- StorageLive(_87);
+- _87 = _1;
+- StorageLive(_88);
+- _88 = _2;
+- _89 = Eq(_88, const 0_u64);
+- assert(!move _89, "attempt to calculate the remainder of `{}` with a divisor of zero", _87) -> [success: bb22, unwind continue];
++ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb22, unwind continue];
+ }
+
+ bb22: {
+- _86 = Rem(move _87, move _88);
+- StorageDead(_88);
+- StorageDead(_87);
+ StorageLive(_90);
+ _90 = _3;
+- _85 = Add(move _86, move _90);
++ _85 = Add(_22, move _90);
+ StorageDead(_90);
+- StorageDead(_86);
+ _84 = opaque::<u64>(move _85) -> [return: bb23, unwind continue];
+ }
+
+ bb23: {
+ StorageDead(_85);
+ StorageDead(_84);
+ StorageLive(_91);
+ StorageLive(_92);
+- StorageLive(_93);
+- StorageLive(_94);
+- _94 = _1;
+- StorageLive(_95);
+- _95 = _2;
+- _93 = BitAnd(move _94, move _95);
+- StorageDead(_95);
+- StorageDead(_94);
+ StorageLive(_96);
+ _96 = _3;
+- _92 = Add(move _93, move _96);
++ _92 = Add(_27, move _96);
+ StorageDead(_96);
+- StorageDead(_93);
+ _91 = opaque::<u64>(move _92) -> [return: bb24, unwind continue];
+ }
+
+ bb24: {
+ StorageDead(_92);
+ StorageDead(_91);
+ StorageLive(_97);
+ StorageLive(_98);
+- StorageLive(_99);
+- StorageLive(_100);
+- _100 = _1;
+- StorageLive(_101);
+- _101 = _2;
+- _99 = BitOr(move _100, move _101);
+- StorageDead(_101);
+- StorageDead(_100);
+ StorageLive(_102);
+ _102 = _3;
+- _98 = Add(move _99, move _102);
++ _98 = Add(_31, move _102);
+ StorageDead(_102);
+- StorageDead(_99);
+ _97 = opaque::<u64>(move _98) -> [return: bb25, unwind continue];
+ }
+
+ bb25: {
+ StorageDead(_98);
+ StorageDead(_97);
+ StorageLive(_103);
+ StorageLive(_104);
+- StorageLive(_105);
+- StorageLive(_106);
+- _106 = _1;
+- StorageLive(_107);
+- _107 = _2;
+- _105 = BitXor(move _106, move _107);
+- StorageDead(_107);
+- StorageDead(_106);
+ StorageLive(_108);
+ _108 = _3;
+- _104 = Add(move _105, move _108);
++ _104 = Add(_35, move _108);
+ StorageDead(_108);
+- StorageDead(_105);
+ _103 = opaque::<u64>(move _104) -> [return: bb26, unwind continue];
+ }
+
+ bb26: {
+ StorageDead(_104);
+ StorageDead(_103);
+ StorageLive(_109);
+ StorageLive(_110);
+- StorageLive(_111);
+- StorageLive(_112);
+- _112 = _1;
+- StorageLive(_113);
+- _113 = _2;
+- _111 = Shl(move _112, move _113);
+- StorageDead(_113);
+- StorageDead(_112);
+ StorageLive(_114);
+ _114 = _3;
+- _110 = Add(move _111, move _114);
++ _110 = Add(_39, move _114);
+ StorageDead(_114);
+- StorageDead(_111);
+ _109 = opaque::<u64>(move _110) -> [return: bb27, unwind continue];
+ }
+
+ bb27: {
+ StorageDead(_110);
+ StorageDead(_109);
+ StorageLive(_115);
+ StorageLive(_116);
+- StorageLive(_117);
+- StorageLive(_118);
+- _118 = _1;
+- StorageLive(_119);
+- _119 = _2;
+- _117 = Shr(move _118, move _119);
+- StorageDead(_119);
+- StorageDead(_118);
+ StorageLive(_120);
+ _120 = _3;
+- _116 = Add(move _117, move _120);
++ _116 = Add(_43, move _120);
+ StorageDead(_120);
+- StorageDead(_117);
+ _115 = opaque::<u64>(move _116) -> [return: bb28, unwind continue];
+ }
+
+ bb28: {
+ StorageDead(_116);
+ StorageDead(_115);
+ StorageLive(_121);
+- StorageLive(_122);
+- StorageLive(_123);
+- _123 = _1;
+- _122 = S::<u64>(move _123);
+- StorageDead(_123);
+- _121 = opaque::<S<u64>>(move _122) -> [return: bb29, unwind continue];
++ _121 = opaque::<S<u64>>(_53) -> [return: bb29, unwind continue];
+ }
+
+ bb29: {
+- StorageDead(_122);
+ StorageDead(_121);
+ StorageLive(_124);
+- StorageLive(_125);
+- StorageLive(_126);
+- StorageLive(_127);
+- _127 = _1;
+- _126 = S::<u64>(move _127);
+- StorageDead(_127);
+- _125 = (_126.0: u64);
+- _124 = opaque::<u64>(move _125) -> [return: bb30, unwind continue];
++ _124 = opaque::<u64>(_56) -> [return: bb30, unwind continue];
+ }
+
+ bb30: {
+- StorageDead(_125);
+- StorageDead(_126);
+ StorageDead(_124);
+ StorageLive(_128);
+ _128 = &_3;
+ StorageLive(_129);
+- StorageLive(_130);
+- StorageLive(_131);
+ _131 = (*_128);
+- StorageLive(_132);
+- _132 = _1;
+- _130 = Add(move _131, move _132);
+- StorageDead(_132);
+- StorageDead(_131);
+- _129 = opaque::<u64>(move _130) -> [return: bb31, unwind continue];
++ _130 = Add(_131, _1);
++ _129 = opaque::<u64>(_130) -> [return: bb31, unwind continue];
+ }
+
+ bb31: {
+- StorageDead(_130);
+ StorageDead(_129);
+ StorageLive(_133);
+- StorageLive(_134);
+- StorageLive(_135);
+- _135 = (*_128);
+- StorageLive(_136);
+- _136 = _1;
+- _134 = Add(move _135, move _136);
+- StorageDead(_136);
+- StorageDead(_135);
+- _133 = opaque::<u64>(move _134) -> [return: bb32, unwind continue];
++ _133 = opaque::<u64>(_130) -> [return: bb32, unwind continue];
+ }
+
+ bb32: {
+- StorageDead(_134);
+ StorageDead(_133);
+ StorageLive(_137);
+ _137 = &mut _3;
+ StorageLive(_138);
+ StorageLive(_139);
+ StorageLive(_140);
+ _140 = (*_137);
+- StorageLive(_141);
+- _141 = _1;
+- _139 = Add(move _140, move _141);
+- StorageDead(_141);
++ _139 = Add(move _140, _1);
+ StorageDead(_140);
+ _138 = opaque::<u64>(move _139) -> [return: bb33, unwind continue];
+ }
+
+ bb33: {
+ StorageDead(_139);
+ StorageDead(_138);
+ StorageLive(_142);
+ StorageLive(_143);
+ StorageLive(_144);
+ _144 = (*_137);
+- StorageLive(_145);
+- _145 = _1;
+- _143 = Add(move _144, move _145);
+- StorageDead(_145);
++ _143 = Add(move _144, _1);
+ StorageDead(_144);
+ _142 = opaque::<u64>(move _143) -> [return: bb34, unwind continue];
+ }
+
+ bb34: {
+ StorageDead(_143);
+ StorageDead(_142);
+- StorageLive(_146);
+ StorageLive(_147);
+ _147 = &raw const _3;
+ StorageLive(_148);
+ StorageLive(_149);
+ StorageLive(_150);
+ _150 = (*_147);
+- StorageLive(_151);
+- _151 = _1;
+- _149 = Add(move _150, move _151);
+- StorageDead(_151);
++ _149 = Add(move _150, _1);
+ StorageDead(_150);
+ _148 = opaque::<u64>(move _149) -> [return: bb35, unwind continue];
+ }
+
+ bb35: {
+ StorageDead(_149);
+ StorageDead(_148);
+ StorageLive(_152);
+ StorageLive(_153);
+ StorageLive(_154);
+ _154 = (*_147);
+- StorageLive(_155);
+- _155 = _1;
+- _153 = Add(move _154, move _155);
+- StorageDead(_155);
++ _153 = Add(move _154, _1);
+ StorageDead(_154);
+ _152 = opaque::<u64>(move _153) -> [return: bb36, unwind continue];
+ }
+
+ bb36: {
+ StorageDead(_153);
+ StorageDead(_152);
+ StorageLive(_156);
+ _156 = &raw mut _3;
+ StorageLive(_157);
+ StorageLive(_158);
+ StorageLive(_159);
+ _159 = (*_156);
+- StorageLive(_160);
+- _160 = _1;
+- _158 = Add(move _159, move _160);
+- StorageDead(_160);
++ _158 = Add(move _159, _1);
+ StorageDead(_159);
+ _157 = opaque::<u64>(move _158) -> [return: bb37, unwind continue];
+ }
+
+ bb37: {
+ StorageDead(_158);
+ StorageDead(_157);
+ StorageLive(_161);
+ StorageLive(_162);
+ StorageLive(_163);
+ _163 = (*_156);
+- StorageLive(_164);
+- _164 = _1;
+- _162 = Add(move _163, move _164);
+- StorageDead(_164);
++ _162 = Add(move _163, _1);
+ StorageDead(_163);
+ _161 = opaque::<u64>(move _162) -> [return: bb38, unwind continue];
+ }
+
+ bb38: {
+ StorageDead(_162);
+ StorageDead(_161);
+- _146 = const ();
+ StorageDead(_156);
+ StorageDead(_147);
+- StorageDead(_146);
+ StorageLive(_165);
+ _165 = &_3;
+ StorageLive(_166);
+- StorageLive(_167);
+- StorageLive(_168);
+ _168 = (*_165);
+- StorageLive(_169);
+- _169 = _1;
+- _167 = Add(move _168, move _169);
+- StorageDead(_169);
+- StorageDead(_168);
+- _166 = opaque::<u64>(move _167) -> [return: bb39, unwind continue];
++ _167 = Add(_168, _1);
++ _166 = opaque::<u64>(_167) -> [return: bb39, unwind continue];
+ }
+
+ bb39: {
+- StorageDead(_167);
+ StorageDead(_166);
+ StorageLive(_170);
+- StorageLive(_171);
+- StorageLive(_172);
+- _172 = (*_165);
+- StorageLive(_173);
+- _173 = _1;
+- _171 = Add(move _172, move _173);
+- StorageDead(_173);
+- StorageDead(_172);
+- _170 = opaque::<u64>(move _171) -> [return: bb40, unwind continue];
++ _170 = opaque::<u64>(_167) -> [return: bb40, unwind continue];
+ }
+
+ bb40: {
+- StorageDead(_171);
+ StorageDead(_170);
+ _0 = const ();
+ StorageDead(_165);
+ StorageDead(_137);
+ StorageDead(_128);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff
new file mode 100644
index 000000000..f33845502
--- /dev/null
+++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff
@@ -0,0 +1,45 @@
+- // MIR for `wrap_unwrap` before GVN
++ // MIR for `wrap_unwrap` after GVN
+
+ fn wrap_unwrap(_1: T) -> T {
+ debug x => _1;
+ let mut _0: T;
+ let mut _2: std::option::Option<T>;
+ let mut _3: T;
+ let mut _4: isize;
+ let _5: T;
+ let mut _6: !;
+ scope 1 {
+ debug y => _5;
+ }
+
+ bb0: {
+ StorageLive(_2);
+- StorageLive(_3);
+- _3 = _1;
+- _2 = Option::<T>::Some(move _3);
+- StorageDead(_3);
++ _2 = Option::<T>::Some(_1);
+ _4 = discriminant(_2);
+ switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+- StorageLive(_5);
+ _5 = ((_2 as Some).0: T);
+ _0 = _5;
+- StorageDead(_5);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff
new file mode 100644
index 000000000..edc05f99f
--- /dev/null
+++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff
@@ -0,0 +1,45 @@
+- // MIR for `wrap_unwrap` before GVN
++ // MIR for `wrap_unwrap` after GVN
+
+ fn wrap_unwrap(_1: T) -> T {
+ debug x => _1;
+ let mut _0: T;
+ let mut _2: std::option::Option<T>;
+ let mut _3: T;
+ let mut _4: isize;
+ let _5: T;
+ let mut _6: !;
+ scope 1 {
+ debug y => _5;
+ }
+
+ bb0: {
+ StorageLive(_2);
+- StorageLive(_3);
+- _3 = _1;
+- _2 = Option::<T>::Some(move _3);
+- StorageDead(_3);
++ _2 = Option::<T>::Some(_1);
+ _4 = discriminant(_2);
+ switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = begin_panic::<&str>(const "explicit panic") -> unwind continue;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+- StorageLive(_5);
+ _5 = ((_2 as Some).0: T);
+ _0 = _5;
+- StorageDead(_5);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff
index 8483b89f8..153195860 100644
--- a/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff
@@ -12,16 +12,17 @@
StorageLive(_3);
_3 = _1;
_2 = Eq(move _3, const -42f32);
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
_0 = const 0_i32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
_0 = const 1_i32;
goto -> bb3;
}
diff --git a/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff
index 837841b00..fedbd6cdd 100644
--- a/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff
@@ -12,21 +12,19 @@
StorageLive(_3);
_3 = _1;
- _2 = Eq(move _3, const 'x');
-- StorageDead(_3);
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ nop;
-+ nop;
+ switchInt(move _3) -> [120: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff
index 3cbf91299..9c38d8fe0 100644
--- a/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff
@@ -12,21 +12,19 @@
StorageLive(_3);
_3 = _1;
- _2 = Eq(move _3, const 42_i8);
-- StorageDead(_3);
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ nop;
-+ nop;
+ switchInt(move _3) -> [42: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff
index 8d6f3b224..8c85ce785 100644
--- a/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff
@@ -14,40 +14,36 @@
StorageLive(_3);
_3 = _1;
- _2 = Eq(move _3, const 42_u32);
-- StorageDead(_3);
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ nop;
-+ nop;
+ switchInt(move _3) -> [42: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb6;
}
bb2: {
-+ StorageDead(_3);
+ StorageDead(_3);
StorageLive(_4);
StorageLive(_5);
_5 = _1;
- _4 = Ne(move _5, const 21_u32);
-- StorageDead(_5);
- switchInt(move _4) -> [0: bb4, otherwise: bb3];
+ nop;
-+ nop;
+ switchInt(move _5) -> [21: bb4, otherwise: bb3];
}
bb3: {
-+ StorageDead(_5);
+ StorageDead(_5);
_0 = const 1_u32;
goto -> bb5;
}
bb4: {
-+ StorageDead(_5);
+ StorageDead(_5);
_0 = const 2_u32;
goto -> bb5;
}
diff --git a/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff
index e2566b13c..876ed61e9 100644
--- a/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff
@@ -12,21 +12,19 @@
StorageLive(_3);
_3 = _1;
- _2 = Eq(move _3, const -42_i32);
-- StorageDead(_3);
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ nop;
-+ nop;
+ switchInt(move _3) -> [4294967254: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff
index dc8da5b44..ed3eb47dd 100644
--- a/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff
@@ -12,21 +12,19 @@
StorageLive(_3);
_3 = _1;
- _2 = Eq(move _3, const 42_u32);
-- StorageDead(_3);
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ nop;
-+ nop;
+ switchInt(move _3) -> [42: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
-+ StorageDead(_3);
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
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
index 503dc5beb..aa9429c46 100644
--- a/tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff
@@ -17,7 +17,7 @@
StorageLive(_1);
- _1 = foo() -> [return: bb1, unwind unreachable];
+ StorageLive(_2);
-+ asm!("", options(MAY_UNWIND)) -> [return: bb2, unwind terminate];
++ asm!("", options(MAY_UNWIND)) -> [return: bb2, unwind terminate(abi)];
}
bb1: {
diff --git a/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff
index 684211b53..ea9c360aa 100644
--- a/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff
@@ -32,7 +32,7 @@
+ }
+
+ bb3 (cleanup): {
-+ drop(_2) -> [return: bb4, unwind terminate];
++ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
+ }
+
+ bb4 (cleanup): {
diff --git a/tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff b/tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff
index f3a6ee22c..b7fea4f2e 100644
--- a/tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff
@@ -30,7 +30,7 @@
}
bb3 (cleanup): {
- drop(_1) -> [return: bb4, unwind terminate];
+ drop(_1) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
diff --git a/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff b/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff
index ad801fd28..1fd1014ba 100644
--- a/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff
@@ -36,7 +36,7 @@
+ }
+
+ bb3 (cleanup): {
-+ drop(_2) -> [return: bb4, unwind terminate];
++ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
+ }
+
+ bb4 (cleanup): {
diff --git a/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff
index 99dc64115..e8299db47 100644
--- a/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff
@@ -36,7 +36,7 @@
+ }
+
+ bb3 (cleanup): {
-+ drop(_2) -> [return: bb4, unwind terminate];
++ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
+ }
+
+ bb4 (cleanup): {
diff --git a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff
index ef85e075e..b82961c28 100644
--- a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff
@@ -27,7 +27,7 @@
}
bb3 (cleanup): {
- drop(_1) -> [return: bb4, unwind terminate];
+ drop(_1) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
diff --git a/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff
index 5df730a99..47fd0ed07 100644
--- a/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff
@@ -30,7 +30,7 @@
}
bb3 (cleanup): {
- drop(_1) -> [return: bb4, unwind terminate];
+ drop(_1) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
diff --git a/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir b/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir
index 9384064c5..8a60f4b1b 100644
--- a/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir
+++ b/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir
@@ -4,8 +4,8 @@ fn foo(_1: T, _2: i32) -> i32 {
debug _t => _1;
debug q => _2;
let mut _0: i32;
- let _3: [closure@foo<T>::{closure#0}];
- let mut _4: &[closure@foo<T>::{closure#0}];
+ let _3: {closure@foo<T>::{closure#0}};
+ let mut _4: &{closure@foo<T>::{closure#0}};
let mut _5: (i32, i32);
let mut _6: i32;
let mut _7: i32;
@@ -21,7 +21,7 @@ fn foo(_1: T, _2: i32) -> i32 {
bb0: {
StorageLive(_3);
- _3 = [closure@foo::<T>::{closure#0}];
+ _3 = {closure@foo::<T>::{closure#0}};
StorageLive(_4);
_4 = &_3;
StorageLive(_5);
diff --git a/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir b/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir
index 17676638a..6e77a9bc5 100644
--- a/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir
+++ b/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir
@@ -4,8 +4,8 @@ fn foo(_1: T, _2: &i32) -> i32 {
debug _t => _1;
debug q => _2;
let mut _0: i32;
- let _3: [closure@foo<T>::{closure#0}];
- let mut _4: &[closure@foo<T>::{closure#0}];
+ let _3: {closure@foo<T>::{closure#0}};
+ let mut _4: &{closure@foo<T>::{closure#0}};
let mut _5: (&i32, &i32);
let mut _6: &i32;
let mut _7: &i32;
@@ -24,7 +24,7 @@ fn foo(_1: T, _2: &i32) -> i32 {
bb0: {
StorageLive(_3);
- _3 = [closure@foo::<T>::{closure#0}];
+ _3 = {closure@foo::<T>::{closure#0}};
StorageLive(_4);
_4 = &_3;
StorageLive(_5);
diff --git a/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir b/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir
index b8178d201..721fac27d 100644
--- a/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir
+++ b/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir
@@ -4,10 +4,10 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
debug t => _1;
debug q => _2;
let mut _0: (i32, T);
- let _3: [closure@foo<T>::{closure#0}];
+ let _3: {closure@foo<T>::{closure#0}};
let mut _4: &i32;
let mut _5: &T;
- let mut _6: &[closure@foo<T>::{closure#0}];
+ let mut _6: &{closure@foo<T>::{closure#0}};
let mut _7: (i32,);
let mut _8: i32;
let mut _9: i32;
@@ -30,7 +30,7 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
_4 = &_2;
StorageLive(_5);
_5 = &_1;
- _3 = [closure@foo::<T>::{closure#0}] { q: move _4, t: move _5 };
+ _3 = {closure@foo::<T>::{closure#0}} { q: move _4, t: move _5 };
StorageDead(_5);
StorageDead(_4);
StorageLive(_6);
@@ -42,10 +42,10 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
StorageLive(_9);
_9 = move (_7.0: i32);
StorageLive(_11);
- _10 = deref_copy ((*_6).0: &i32);
+ _10 = ((*_6).0: &i32);
_11 = (*_10);
StorageLive(_13);
- _12 = deref_copy ((*_6).1: &T);
+ _12 = ((*_6).1: &T);
_13 = (*_12);
_0 = (move _11, move _13);
StorageDead(_13);
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
index 9db0d385d..d675695eb 100644
--- a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff
@@ -18,11 +18,11 @@
StorageLive(_3);
_3 = _1;
_2 = Gt(move _3, const 0_i32);
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
StorageLive(_4);
_4 = _1;
_0 = move _4 as u32 (IntToInt);
@@ -32,6 +32,7 @@
}
bb2: {
+ StorageDead(_3);
StorageLive(_6);
- _6 = panic() -> unwind unreachable;
+ StorageLive(_7);
diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff
index 5663b4624..114261611 100644
--- a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff
@@ -18,11 +18,11 @@
StorageLive(_3);
_3 = _1;
_2 = Gt(move _3, const 0_i32);
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
StorageLive(_4);
_4 = _1;
_0 = move _4 as u32 (IntToInt);
@@ -32,6 +32,7 @@
}
bb2: {
+ StorageDead(_3);
StorageLive(_6);
- _6 = panic() -> unwind continue;
+ StorageLive(_7);
diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
index 073ddeff7..9f8c5806c 100644
--- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
@@ -54,11 +54,11 @@
+ }
+
+ bb4 (cleanup): {
-+ drop(_4) -> [return: bb5, unwind terminate];
++ drop(_4) -> [return: bb5, unwind terminate(cleanup)];
+ }
+
+ bb5 (cleanup): {
-+ drop(_2) -> [return: bb6, unwind terminate];
++ drop(_2) -> [return: bb6, unwind terminate(cleanup)];
+ }
+
+ bb6 (cleanup): {
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
index e05c605a4..6779003b6 100644
--- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff
@@ -4,30 +4,28 @@
fn main() -> () {
let mut _0: ();
let _1: std::ops::GeneratorState<i32, bool>;
- let mut _2: std::pin::Pin<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>;
- let mut _3: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
- let mut _4: [generator@$DIR/inline_generator.rs:16:5: 16:8];
+ let mut _2: std::pin::Pin<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>;
+ let mut _3: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
+ let mut _4: {generator@$DIR/inline_generator.rs:16:5: 16:8};
+ let mut _5: bool;
scope 1 {
debug _r => _1;
}
+ scope 2 (inlined g) {
+ }
-+ scope 3 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>::new) {
++ scope 3 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new) {
+ debug pointer => _3;
+ scope 4 {
-+ scope 5 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>::new_unchecked) {
++ scope 5 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new_unchecked) {
+ debug pointer => _3;
+ }
+ }
+ }
+ scope 6 (inlined g::{closure#0}) {
+ debug a => _5;
-+ let mut _6: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
++ let mut _6: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
+ let mut _7: u32;
+ let mut _8: i32;
-+ let mut _9: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
-+ let mut _10: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
+ }
bb0: {
@@ -36,71 +34,74 @@
StorageLive(_3);
StorageLive(_4);
- _4 = g() -> [return: bb1, unwind unreachable];
-- }
--
-- bb1: {
-+ _4 = [generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)];
- _3 = &mut _4;
-- _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>::new(move _3) -> [return: bb2, unwind unreachable];
-- }
--
-- bb2: {
-+ _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]> { pointer: move _3 };
- StorageDead(_3);
-- _1 = <[generator@$DIR/inline_generator.rs:16:5: 16:8] as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind unreachable];
++ _4 = {generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)};
++ _3 = &mut _4;
++ _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}> { pointer: move _3 };
++ StorageDead(_3);
+ StorageLive(_5);
+ _5 = const false;
-+ _6 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8]);
++ _6 = (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
+ _7 = discriminant((*_6));
-+ switchInt(move _7) -> [0: bb2, 1: bb6, 3: bb7, otherwise: bb8];
++ switchInt(move _7) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9];
}
-- bb3: {
-+ bb1: {
+ bb1: {
+- _3 = &mut _4;
+- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind unreachable];
+ StorageDead(_5);
- StorageDead(_2);
- StorageDead(_4);
- _0 = const ();
- StorageDead(_1);
- return;
-+ }
-+
-+ bb2: {
++ StorageDead(_2);
++ drop(_4) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- StorageDead(_3);
+- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind unreachable];
++ StorageDead(_4);
++ _0 = const ();
++ StorageDead(_1);
++ return;
+ }
+
+ bb3: {
+- StorageDead(_2);
+- drop(_4) -> [return: bb4, unwind unreachable];
+ StorageLive(_8);
-+ switchInt(_5) -> [0: bb3, otherwise: bb4];
-+ }
-+
-+ bb3: {
++ switchInt(_5) -> [0: bb4, otherwise: bb5];
+ }
+
+ bb4: {
+- StorageDead(_4);
+- _0 = const ();
+- StorageDead(_1);
+- return;
+ _8 = const 13_i32;
-+ goto -> bb5;
++ goto -> bb6;
+ }
+
-+ bb4: {
++ bb5: {
+ _8 = const 7_i32;
-+ goto -> bb5;
++ goto -> bb6;
+ }
+
-+ bb5: {
++ bb6: {
+ _1 = GeneratorState::<i32, bool>::Yielded(move _8);
-+ _9 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8]);
-+ discriminant((*_9)) = 3;
++ discriminant((*_6)) = 3;
+ goto -> bb1;
+ }
+
-+ bb6: {
-+ assert(const false, "generator resumed after completion") -> [success: bb6, unwind unreachable];
++ bb7: {
++ assert(const false, "generator resumed after completion") -> [success: bb7, unwind unreachable];
+ }
+
-+ bb7: {
++ bb8: {
+ StorageLive(_8);
+ StorageDead(_8);
+ _1 = GeneratorState::<i32, bool>::Complete(_5);
-+ _10 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8]);
-+ discriminant((*_10)) = 1;
++ discriminant((*_6)) = 1;
+ goto -> bb1;
+ }
+
-+ bb8: {
++ bb9: {
+ unreachable;
}
}
diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff
index fedcf0423..31744be99 100644
--- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff
@@ -4,30 +4,28 @@
fn main() -> () {
let mut _0: ();
let _1: std::ops::GeneratorState<i32, bool>;
- let mut _2: std::pin::Pin<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>;
- let mut _3: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
- let mut _4: [generator@$DIR/inline_generator.rs:16:5: 16:8];
+ let mut _2: std::pin::Pin<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>;
+ let mut _3: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
+ let mut _4: {generator@$DIR/inline_generator.rs:16:5: 16:8};
+ let mut _5: bool;
scope 1 {
debug _r => _1;
}
+ scope 2 (inlined g) {
+ }
-+ scope 3 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>::new) {
++ scope 3 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new) {
+ debug pointer => _3;
+ scope 4 {
-+ scope 5 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>::new_unchecked) {
++ scope 5 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new_unchecked) {
+ debug pointer => _3;
+ }
+ }
+ }
+ scope 6 (inlined g::{closure#0}) {
+ debug a => _5;
-+ let mut _6: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
++ let mut _6: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
+ let mut _7: u32;
+ let mut _8: i32;
-+ let mut _9: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
-+ let mut _10: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8];
+ }
bb0: {
@@ -39,73 +37,83 @@
- }
-
- bb1: {
-+ _4 = [generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)];
++ _4 = {generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)};
_3 = &mut _4;
-- _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]>::new(move _3) -> [return: bb2, unwind: bb4];
+- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind: bb5];
- }
-
- bb2: {
-+ _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:16:5: 16:8]> { pointer: move _3 };
++ _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}> { pointer: move _3 };
StorageDead(_3);
-- _1 = <[generator@$DIR/inline_generator.rs:16:5: 16:8] as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb4];
+- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb5];
+ StorageLive(_5);
+ _5 = const false;
-+ _6 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8]);
++ _6 = (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
+ _7 = discriminant((*_6));
-+ switchInt(move _7) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9];
++ switchInt(move _7) -> [0: bb5, 1: bb9, 3: bb10, otherwise: bb11];
}
- bb3: {
+ bb1: {
+ StorageDead(_5);
StorageDead(_2);
+- drop(_4) -> [return: bb4, unwind: bb6];
++ drop(_4) -> [return: bb2, unwind: bb4];
+ }
+
+- bb4: {
++ bb2: {
StorageDead(_4);
_0 = const ();
StorageDead(_1);
return;
}
-- bb4 (cleanup): {
-+ bb2 (cleanup): {
+- bb5 (cleanup): {
+- drop(_4) -> [return: bb6, unwind terminate(cleanup)];
++ bb3 (cleanup): {
++ drop(_4) -> [return: bb4, unwind terminate(cleanup)];
+ }
+
+- bb6 (cleanup): {
++ bb4 (cleanup): {
resume;
+ }
+
-+ bb3: {
++ bb5: {
+ StorageLive(_8);
-+ switchInt(_5) -> [0: bb4, otherwise: bb5];
++ switchInt(_5) -> [0: bb6, otherwise: bb7];
+ }
+
-+ bb4: {
++ bb6: {
+ _8 = const 13_i32;
-+ goto -> bb6;
++ goto -> bb8;
+ }
+
-+ bb5: {
++ bb7: {
+ _8 = const 7_i32;
-+ goto -> bb6;
++ goto -> bb8;
+ }
+
-+ bb6: {
++ bb8: {
+ _1 = GeneratorState::<i32, bool>::Yielded(move _8);
-+ _9 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8]);
-+ discriminant((*_9)) = 3;
++ discriminant((*_6)) = 3;
+ goto -> bb1;
+ }
+
-+ bb7: {
-+ assert(const false, "generator resumed after completion") -> [success: bb7, unwind: bb2];
++ bb9: {
++ assert(const false, "generator resumed after completion") -> [success: bb9, unwind: bb3];
+ }
+
-+ bb8: {
++ bb10: {
+ StorageLive(_8);
+ StorageDead(_8);
+ _1 = GeneratorState::<i32, bool>::Complete(_5);
-+ _10 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:16:5: 16:8]);
-+ discriminant((*_10)) = 1;
++ discriminant((*_6)) = 1;
+ goto -> bb1;
+ }
+
-+ bb9: {
++ bb11: {
+ unreachable;
}
}
diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff
index 54c33aac9..675292f06 100644
--- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff
@@ -155,7 +155,7 @@
- StorageDead(_1);
- return;
+ bb3 (cleanup): {
-+ drop(_2) -> [return: bb2, unwind terminate];
++ drop(_2) -> [return: bb2, unwind terminate(cleanup)];
}
- bb4 (cleanup): {
diff --git a/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir b/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir
index ef91f5040..4d170c41f 100644
--- a/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir
+++ b/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir
@@ -2,8 +2,8 @@
fn main() -> () {
let mut _0: ();
- let _1: [closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16];
- let mut _2: &[closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16];
+ let _1: {closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16};
+ let mut _2: &{closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16};
let mut _3: ((),);
let mut _4: ();
let mut _5: ();
@@ -19,7 +19,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
- _1 = [closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16];
+ _1 = {closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16};
StorageLive(_2);
_2 = &_1;
StorageLive(_3);
diff --git a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff
index b750330df..5a946712e 100644
--- a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff
@@ -37,7 +37,7 @@
}
bb4 (cleanup): {
- drop(_1) -> [return: bb5, unwind terminate];
+ drop(_1) -> [return: bb5, unwind terminate(cleanup)];
}
bb5 (cleanup): {
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
index c94dd2556..b532b133a 100644
--- a/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff
+++ b/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff
@@ -15,28 +15,44 @@
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = hide_foo() -> [return: bb1, unwind unreachable];
+ _4 = hide_foo() -> [return: bb1, unwind: bb6];
}
bb1: {
_3 = &_4;
StorageLive(_5);
_5 = ();
-- _2 = <impl Fn() as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind unreachable];
-+ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind unreachable];
+- _2 = <impl Fn() as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb5];
++ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb5];
}
bb2: {
StorageDead(_5);
StorageDead(_3);
+ drop(_4) -> [return: bb3, unwind: bb6];
+ }
+
+ bb3: {
StorageDead(_4);
StorageDead(_2);
_0 = const ();
- drop(_1) -> [return: bb3, unwind unreachable];
+ drop(_1) -> [return: bb4, unwind: bb7];
}
- bb3: {
+ bb4: {
return;
}
+
+ bb5 (cleanup): {
+ drop(_4) -> [return: bb6, unwind terminate(cleanup)];
+ }
+
+ bb6 (cleanup): {
+ drop(_1) -> [return: bb7, unwind terminate(cleanup)];
+ }
+
+ bb7 (cleanup): {
+ resume;
+ }
}
diff --git a/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-unwind.diff b/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-unwind.diff
index 7765e491d..bcebcf297 100644
--- a/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-unwind.diff
+++ b/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-unwind.diff
@@ -15,35 +15,43 @@
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = hide_foo() -> [return: bb1, unwind: bb4];
+ _4 = hide_foo() -> [return: bb1, unwind: bb6];
}
bb1: {
_3 = &_4;
StorageLive(_5);
_5 = ();
-- _2 = <impl Fn() as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb4];
-+ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb4];
+- _2 = <impl Fn() as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb5];
++ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb5];
}
bb2: {
StorageDead(_5);
StorageDead(_3);
+ drop(_4) -> [return: bb3, unwind: bb6];
+ }
+
+ bb3: {
StorageDead(_4);
StorageDead(_2);
_0 = const ();
- drop(_1) -> [return: bb3, unwind: bb5];
+ drop(_1) -> [return: bb4, unwind continue];
}
- bb3: {
+ bb4: {
return;
}
- bb4 (cleanup): {
- drop(_1) -> [return: bb5, unwind terminate];
+ bb5 (cleanup): {
+ drop(_4) -> [return: bb6, unwind terminate(cleanup)];
}
- bb5 (cleanup): {
+ bb6 (cleanup): {
+ drop(_1) -> [return: bb7, unwind terminate(cleanup)];
+ }
+
+ bb7 (cleanup): {
resume;
}
}
diff --git a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
index 6ee6a0ffe..ab81f7071 100644
--- a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
+++ b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
@@ -40,7 +40,7 @@
bb4 (cleanup): {
_8 = &mut _3;
- _9 = <Box<[i32]> as Drop>::drop(move _8) -> [return: bb1, unwind terminate];
+ _9 = <Box<[i32]> as Drop>::drop(move _8) -> [return: bb1, unwind terminate(cleanup)];
}
}
diff --git a/tests/mir-opt/inline_generically_if_sized.call.Inline.diff b/tests/mir-opt/inline_generically_if_sized.call.Inline.diff
new file mode 100644
index 000000000..0cf4565dc
--- /dev/null
+++ b/tests/mir-opt/inline_generically_if_sized.call.Inline.diff
@@ -0,0 +1,24 @@
+- // MIR for `call` before Inline
++ // MIR for `call` after Inline
+
+ fn call(_1: &T) -> i32 {
+ debug s => _1;
+ let mut _0: i32;
+ let mut _2: &T;
++ scope 1 (inlined <T as Foo>::bar) {
++ debug self => _2;
++ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = &(*_1);
+- _0 = <T as Foo>::bar(move _2) -> [return: bb1, unwind unreachable];
+- }
+-
+- bb1: {
++ _0 = const 0_i32;
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline_generically_if_sized.rs b/tests/mir-opt/inline_generically_if_sized.rs
new file mode 100644
index 000000000..1acfff7a5
--- /dev/null
+++ b/tests/mir-opt/inline_generically_if_sized.rs
@@ -0,0 +1,17 @@
+// unit-test: Inline
+// compile-flags: --crate-type=lib -C panic=abort
+
+trait Foo {
+ fn bar(&self) -> i32;
+}
+
+impl<T> Foo for T {
+ fn bar(&self) -> i32 {
+ 0
+ }
+}
+
+// EMIT_MIR inline_generically_if_sized.call.Inline.diff
+pub fn call<T>(s: &T) -> i32 {
+ s.bar()
+}
diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff
index 11501907b..4469270a9 100644
--- a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff
+++ b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff
@@ -40,17 +40,17 @@
}
bb3 (cleanup): {
-- drop(_3) -> [return: bb5, unwind terminate];
+- drop(_3) -> [return: bb5, unwind terminate(cleanup)];
+ goto -> bb5;
}
bb4 (cleanup): {
-- drop(_4) -> [return: bb5, unwind terminate];
+- drop(_4) -> [return: bb5, unwind terminate(cleanup)];
+ goto -> bb5;
}
bb5 (cleanup): {
-- drop(_2) -> [return: bb6, unwind terminate];
+- drop(_2) -> [return: bb6, unwind terminate(cleanup)];
+ goto -> bb8;
}
@@ -59,7 +59,7 @@
+ }
+
+ bb7 (cleanup): {
-+ drop(_2) -> [return: bb6, unwind terminate];
++ drop(_2) -> [return: bb6, unwind terminate(cleanup)];
+ }
+
+ bb8 (cleanup): {
diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff
index 11501907b..4469270a9 100644
--- a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff
+++ b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff
@@ -40,17 +40,17 @@
}
bb3 (cleanup): {
-- drop(_3) -> [return: bb5, unwind terminate];
+- drop(_3) -> [return: bb5, unwind terminate(cleanup)];
+ goto -> bb5;
}
bb4 (cleanup): {
-- drop(_4) -> [return: bb5, unwind terminate];
+- drop(_4) -> [return: bb5, unwind terminate(cleanup)];
+ goto -> bb5;
}
bb5 (cleanup): {
-- drop(_2) -> [return: bb6, unwind terminate];
+- drop(_2) -> [return: bb6, unwind terminate(cleanup)];
+ goto -> bb8;
}
@@ -59,7 +59,7 @@
+ }
+
+ bb7 (cleanup): {
-+ drop(_2) -> [return: bb6, unwind terminate];
++ drop(_2) -> [return: bb6, unwind terminate(cleanup)];
+ }
+
+ bb8 (cleanup): {
diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff
index 65f4806aa..78184f6ae 100644
--- a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff
+++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff
@@ -47,7 +47,7 @@
bb3 (cleanup): {
_2 = move _5;
-- drop(_5) -> [return: bb8, unwind terminate];
+- drop(_5) -> [return: bb8, unwind terminate(cleanup)];
+ goto -> bb8;
}
@@ -70,17 +70,17 @@
}
bb7 (cleanup): {
-- drop(_4) -> [return: bb8, unwind terminate];
+- drop(_4) -> [return: bb8, unwind terminate(cleanup)];
+ goto -> bb8;
}
bb8 (cleanup): {
-- drop(_2) -> [return: bb9, unwind terminate];
+- drop(_2) -> [return: bb9, unwind terminate(cleanup)];
+ goto -> bb9;
}
bb9 (cleanup): {
-- drop(_1) -> [return: bb10, unwind terminate];
+- drop(_1) -> [return: bb10, unwind terminate(cleanup)];
+ goto -> bb12;
}
@@ -89,7 +89,7 @@
+ }
+
+ bb11 (cleanup): {
-+ drop(_1) -> [return: bb10, unwind terminate];
++ drop(_1) -> [return: bb10, unwind terminate(cleanup)];
+ }
+
+ bb12 (cleanup): {
diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff
index 4845fc732..688887c3c 100644
--- a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff
+++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff
@@ -47,7 +47,7 @@
bb3 (cleanup): {
_2 = move _5;
-- drop(_5) -> [return: bb8, unwind terminate];
+- drop(_5) -> [return: bb8, unwind terminate(cleanup)];
+ goto -> bb8;
}
@@ -70,17 +70,17 @@
}
bb7 (cleanup): {
-- drop(_4) -> [return: bb8, unwind terminate];
+- drop(_4) -> [return: bb8, unwind terminate(cleanup)];
+ goto -> bb8;
}
bb8 (cleanup): {
-- drop(_2) -> [return: bb9, unwind terminate];
+- drop(_2) -> [return: bb9, unwind terminate(cleanup)];
+ goto -> bb9;
}
bb9 (cleanup): {
-- drop(_1) -> [return: bb10, unwind terminate];
+- drop(_1) -> [return: bb10, unwind terminate(cleanup)];
+ goto -> bb12;
}
@@ -89,7 +89,7 @@
+ }
+
+ bb11 (cleanup): {
-+ drop(_1) -> [return: bb10, unwind terminate];
++ drop(_1) -> [return: bb10, unwind terminate(cleanup)];
+ }
+
+ bb12 (cleanup): {
diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff
index aca7fe95c..b57fe348c 100644
--- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff
+++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff
@@ -58,7 +58,7 @@
+ _8 = const true;
+ _9 = const true;
_1 = move _3;
-- drop(_3) -> [return: bb11, unwind terminate];
+- drop(_3) -> [return: bb11, unwind terminate(cleanup)];
+ goto -> bb11;
}
@@ -102,7 +102,7 @@
}
bb11 (cleanup): {
-- drop(_1) -> [return: bb12, unwind terminate];
+- drop(_1) -> [return: bb12, unwind terminate(cleanup)];
+ goto -> bb12;
}
@@ -124,7 +124,7 @@
+ }
+
+ bb16 (cleanup): {
-+ drop(_1) -> [return: bb12, unwind terminate];
++ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
+ bb17: {
diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff
index 60ce9cd8a..2156850e3 100644
--- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff
+++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff
@@ -58,7 +58,7 @@
+ _8 = const true;
+ _9 = const true;
_1 = move _3;
-- drop(_3) -> [return: bb11, unwind terminate];
+- drop(_3) -> [return: bb11, unwind terminate(cleanup)];
+ goto -> bb11;
}
@@ -102,7 +102,7 @@
}
bb11 (cleanup): {
-- drop(_1) -> [return: bb12, unwind terminate];
+- drop(_1) -> [return: bb12, unwind terminate(cleanup)];
+ goto -> bb12;
}
@@ -124,7 +124,7 @@
+ }
+
+ bb16 (cleanup): {
-+ drop(_1) -> [return: bb12, unwind terminate];
++ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
+ bb17: {
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
index ae0beffae..734629678 100644
--- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir
+++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir
@@ -100,11 +100,11 @@ fn test() -> Option<Box<u32>> {
}
bb11 (cleanup): {
- drop(_1) -> [return: bb13, unwind terminate];
+ drop(_1) -> [return: bb13, unwind terminate(cleanup)];
}
bb12 (cleanup): {
- drop(_5) -> [return: bb13, unwind terminate];
+ drop(_5) -> [return: bb13, unwind terminate(cleanup)];
}
bb13 (cleanup): {
diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir
index 7ecdc428e..8264e2cab 100644
--- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir
+++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir
@@ -100,11 +100,11 @@ fn test() -> Option<Box<u32>> {
}
bb11 (cleanup): {
- drop(_1) -> [return: bb13, unwind terminate];
+ drop(_1) -> [return: bb13, unwind terminate(cleanup)];
}
bb12 (cleanup): {
- drop(_5) -> [return: bb13, unwind terminate];
+ drop(_5) -> [return: bb13, unwind terminate(cleanup)];
}
bb13 (cleanup): {
diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff
index f61632728..9d8f272ab 100644
--- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff
+++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff
@@ -33,12 +33,10 @@
_3 = &_4;
_2 = move _3 as &[T] (PointerCoercion(Unsize));
StorageDead(_3);
- _8 = Len((*_2));
+ _8 = const 3_usize;
_9 = const 3_usize;
-- _10 = Eq(move _8, const 3_usize);
-- switchInt(move _10) -> [0: bb1, otherwise: bb2];
-+ nop;
-+ switchInt(move _8) -> [3: bb2, otherwise: bb1];
+ _10 = const true;
+ goto -> bb2;
}
bb1: {
diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff
index f6c337be1..738b0b1b3 100644
--- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff
+++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff
@@ -33,12 +33,10 @@
_3 = &_4;
_2 = move _3 as &[T] (PointerCoercion(Unsize));
StorageDead(_3);
- _8 = Len((*_2));
+ _8 = const 3_usize;
_9 = const 3_usize;
-- _10 = Eq(move _8, const 3_usize);
-- switchInt(move _10) -> [0: bb1, otherwise: bb2];
-+ nop;
-+ switchInt(move _8) -> [3: bb2, otherwise: bb1];
+ _10 = const true;
+ goto -> bb2;
}
bb1: {
diff --git a/tests/mir-opt/issue_91633.bar.built.after.mir b/tests/mir-opt/issue_91633.bar.built.after.mir
index 92f52e138..cce1a1fd2 100644
--- a/tests/mir-opt/issue_91633.bar.built.after.mir
+++ b/tests/mir-opt/issue_91633.bar.built.after.mir
@@ -28,7 +28,7 @@ fn bar(_1: Box<[T]>) -> () {
}
bb3 (cleanup): {
- drop(_1) -> [return: bb4, unwind terminate];
+ drop(_1) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
diff --git a/tests/mir-opt/issue_91633.foo.built.after.mir b/tests/mir-opt/issue_91633.foo.built.after.mir
index 4529c58a1..a66769f0d 100644
--- a/tests/mir-opt/issue_91633.foo.built.after.mir
+++ b/tests/mir-opt/issue_91633.foo.built.after.mir
@@ -45,7 +45,7 @@ fn foo(_1: Box<[T]>) -> T {
}
bb5 (cleanup): {
- drop(_1) -> [return: bb6, unwind terminate];
+ drop(_1) -> [return: bb6, unwind terminate(cleanup)];
}
bb6 (cleanup): {
diff --git a/tests/mir-opt/issue_99325.main.built.after.mir b/tests/mir-opt/issue_99325.main.built.after.32bit.mir
index aef89c7f9..132b71335 100644
--- a/tests/mir-opt/issue_99325.main.built.after.mir
+++ b/tests/mir-opt/issue_99325.main.built.after.32bit.mir
@@ -1,8 +1,8 @@
// MIR for `main` after built
| User Type Annotations
-| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [Const { ty: &'static [u8; 4], kind: Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)]) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:10:16: 10:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
-| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [Const { ty: &'static [u8; 4], kind: UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] } }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:11:16: 11:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
+| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:12:16: 12:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
+| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] }: &ReStatic [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:13:16: 13:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
|
fn main() -> () {
let mut _0: ();
@@ -16,51 +16,49 @@ fn main() -> () {
let _8: &&[u8];
let _9: &&[u8; 4];
let mut _10: bool;
- let mut _11: bool;
- let mut _12: &&[u8];
- let mut _13: &&[u8; 4];
- let mut _14: !;
- let _16: !;
- let mut _17: core::panicking::AssertKind;
- let mut _18: &&[u8];
- let _19: &&[u8];
- let mut _20: &&[u8; 4];
- let _21: &&[u8; 4];
- let mut _22: std::option::Option<std::fmt::Arguments<'_>>;
- let _23: ();
- let mut _24: (&&[u8], &&[u8; 4]);
- let mut _25: &&[u8];
- let _26: &[u8];
- let mut _27: &&[u8; 4];
- let _28: &[u8; 4];
- let _29: &&[u8];
- let _30: &&[u8; 4];
- let mut _31: bool;
- let mut _32: bool;
- let mut _33: &&[u8];
- let mut _34: &&[u8; 4];
- let mut _35: !;
- let _37: !;
- let mut _38: core::panicking::AssertKind;
- let mut _39: &&[u8];
- let _40: &&[u8];
- let mut _41: &&[u8; 4];
- let _42: &&[u8; 4];
- let mut _43: std::option::Option<std::fmt::Arguments<'_>>;
+ let mut _11: &&[u8];
+ let mut _12: &&[u8; 4];
+ let mut _13: !;
+ let _15: !;
+ let mut _16: core::panicking::AssertKind;
+ let mut _17: &&[u8];
+ let _18: &&[u8];
+ let mut _19: &&[u8; 4];
+ let _20: &&[u8; 4];
+ let mut _21: std::option::Option<std::fmt::Arguments<'_>>;
+ let _22: ();
+ let mut _23: (&&[u8], &&[u8; 4]);
+ let mut _24: &&[u8];
+ let _25: &[u8];
+ let mut _26: &&[u8; 4];
+ let _27: &[u8; 4];
+ let _28: &&[u8];
+ let _29: &&[u8; 4];
+ let mut _30: bool;
+ let mut _31: &&[u8];
+ let mut _32: &&[u8; 4];
+ let mut _33: !;
+ let _35: !;
+ let mut _36: core::panicking::AssertKind;
+ let mut _37: &&[u8];
+ let _38: &&[u8];
+ let mut _39: &&[u8; 4];
+ let _40: &&[u8; 4];
+ let mut _41: std::option::Option<std::fmt::Arguments<'_>>;
scope 1 {
debug left_val => _8;
debug right_val => _9;
- let _15: core::panicking::AssertKind;
+ let _14: core::panicking::AssertKind;
scope 2 {
- debug kind => _15;
+ debug kind => _14;
}
}
scope 3 {
- debug left_val => _29;
- debug right_val => _30;
- let _36: core::panicking::AssertKind;
+ debug left_val => _28;
+ debug right_val => _29;
+ let _34: core::panicking::AssertKind;
scope 4 {
- debug kind => _36;
+ debug kind => _34;
}
}
@@ -69,7 +67,7 @@ fn main() -> () {
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb19];
+ _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb21];
}
bb1: {
@@ -90,179 +88,185 @@ fn main() -> () {
_9 = (_2.1: &&[u8; 4]);
StorageLive(_10);
StorageLive(_11);
+ _11 = &(*_8);
StorageLive(_12);
- _12 = &(*_8);
- StorageLive(_13);
- _13 = &(*_9);
- _11 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _12, move _13) -> [return: bb2, unwind: bb19];
+ _12 = &(*_9);
+ _10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb2, unwind: bb21];
}
bb2: {
- StorageDead(_13);
- StorageDead(_12);
- _10 = Not(move _11);
- StorageDead(_11);
switchInt(move _10) -> [0: bb4, otherwise: bb3];
}
bb3: {
+ StorageDead(_12);
+ StorageDead(_11);
+ goto -> bb8;
+ }
+
+ bb4: {
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_14);
+ _14 = core::panicking::AssertKind::Eq;
+ FakeRead(ForLet(None), _14);
StorageLive(_15);
- _15 = core::panicking::AssertKind::Eq;
- FakeRead(ForLet(None), _15);
StorageLive(_16);
+ _16 = move _14;
StorageLive(_17);
- _17 = move _15;
StorageLive(_18);
+ _18 = &(*_8);
+ _17 = &(*_18);
StorageLive(_19);
- _19 = &(*_8);
- _18 = &(*_19);
StorageLive(_20);
+ _20 = &(*_9);
+ _19 = &(*_20);
StorageLive(_21);
- _21 = &(*_9);
- _20 = &(*_21);
- StorageLive(_22);
- _22 = Option::<Arguments<'_>>::None;
- _16 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _17, move _18, move _20, move _22) -> bb19;
- }
-
- bb4: {
- goto -> bb7;
+ _21 = Option::<Arguments<'_>>::None;
+ _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> bb21;
}
- bb5: {
- StorageDead(_22);
- StorageDead(_20);
- StorageDead(_18);
- StorageDead(_17);
+ bb6: {
StorageDead(_21);
StorageDead(_19);
+ StorageDead(_17);
StorageDead(_16);
+ StorageDead(_20);
+ StorageDead(_18);
StorageDead(_15);
+ StorageDead(_14);
unreachable;
}
- bb6: {
- goto -> bb8;
+ bb7: {
+ goto -> bb9;
}
- bb7: {
+ bb8: {
_1 = const ();
- goto -> bb8;
+ goto -> bb9;
}
- bb8: {
+ bb9: {
StorageDead(_10);
StorageDead(_9);
StorageDead(_8);
- goto -> bb9;
+ goto -> bb10;
}
- bb9: {
+ bb10: {
StorageDead(_7);
StorageDead(_6);
StorageDead(_4);
StorageDead(_2);
StorageDead(_1);
+ StorageLive(_22);
StorageLive(_23);
StorageLive(_24);
StorageLive(_25);
- StorageLive(_26);
- _26 = function_with_bytes::<&*b"AAAA">() -> [return: bb10, unwind: bb19];
+ _25 = function_with_bytes::<&*b"AAAA">() -> [return: bb11, unwind: bb21];
}
- bb10: {
- _25 = &_26;
+ bb11: {
+ _24 = &_25;
+ StorageLive(_26);
StorageLive(_27);
+ _27 = const b"AAAA";
+ _26 = &_27;
+ _23 = (move _24, move _26);
+ StorageDead(_26);
+ StorageDead(_24);
+ FakeRead(ForMatchedPlace(None), _23);
StorageLive(_28);
- _28 = const b"AAAA";
- _27 = &_28;
- _24 = (move _25, move _27);
- StorageDead(_27);
- StorageDead(_25);
- FakeRead(ForMatchedPlace(None), _24);
+ _28 = (_23.0: &&[u8]);
StorageLive(_29);
- _29 = (_24.0: &&[u8]);
+ _29 = (_23.1: &&[u8; 4]);
StorageLive(_30);
- _30 = (_24.1: &&[u8; 4]);
StorageLive(_31);
+ _31 = &(*_28);
StorageLive(_32);
- StorageLive(_33);
- _33 = &(*_29);
- StorageLive(_34);
- _34 = &(*_30);
- _32 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _33, move _34) -> [return: bb11, unwind: bb19];
+ _32 = &(*_29);
+ _30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb12, unwind: bb21];
}
- bb11: {
- StorageDead(_34);
- StorageDead(_33);
- _31 = Not(move _32);
+ bb12: {
+ switchInt(move _30) -> [0: bb14, otherwise: bb13];
+ }
+
+ bb13: {
StorageDead(_32);
- switchInt(move _31) -> [0: bb13, otherwise: bb12];
+ StorageDead(_31);
+ goto -> bb18;
}
- bb12: {
+ bb14: {
+ goto -> bb15;
+ }
+
+ bb15: {
+ StorageDead(_32);
+ StorageDead(_31);
+ StorageLive(_34);
+ _34 = core::panicking::AssertKind::Eq;
+ FakeRead(ForLet(None), _34);
+ StorageLive(_35);
StorageLive(_36);
- _36 = core::panicking::AssertKind::Eq;
- FakeRead(ForLet(None), _36);
+ _36 = move _34;
StorageLive(_37);
StorageLive(_38);
- _38 = move _36;
+ _38 = &(*_28);
+ _37 = &(*_38);
StorageLive(_39);
StorageLive(_40);
_40 = &(*_29);
_39 = &(*_40);
StorageLive(_41);
- StorageLive(_42);
- _42 = &(*_30);
- _41 = &(*_42);
- StorageLive(_43);
- _43 = Option::<Arguments<'_>>::None;
- _37 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _38, move _39, move _41, move _43) -> bb19;
- }
-
- bb13: {
- goto -> bb16;
+ _41 = Option::<Arguments<'_>>::None;
+ _35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> bb21;
}
- bb14: {
- StorageDead(_43);
+ bb16: {
StorageDead(_41);
StorageDead(_39);
- StorageDead(_38);
- StorageDead(_42);
- StorageDead(_40);
StorageDead(_37);
StorageDead(_36);
+ StorageDead(_40);
+ StorageDead(_38);
+ StorageDead(_35);
+ StorageDead(_34);
unreachable;
}
- bb15: {
- goto -> bb17;
+ bb17: {
+ goto -> bb19;
}
- bb16: {
- _23 = const ();
- goto -> bb17;
+ bb18: {
+ _22 = const ();
+ goto -> bb19;
}
- bb17: {
- StorageDead(_31);
+ bb19: {
StorageDead(_30);
StorageDead(_29);
- goto -> bb18;
+ StorageDead(_28);
+ goto -> bb20;
}
- bb18: {
- StorageDead(_28);
- StorageDead(_26);
- StorageDead(_24);
+ bb20: {
+ StorageDead(_27);
+ StorageDead(_25);
StorageDead(_23);
+ StorageDead(_22);
_0 = const ();
return;
}
- bb19 (cleanup): {
+ bb21 (cleanup): {
resume;
}
}
diff --git a/tests/mir-opt/issue_99325.main.built.after.64bit.mir b/tests/mir-opt/issue_99325.main.built.after.64bit.mir
new file mode 100644
index 000000000..132b71335
--- /dev/null
+++ b/tests/mir-opt/issue_99325.main.built.after.64bit.mir
@@ -0,0 +1,276 @@
+// MIR for `main` after built
+
+| User Type Annotations
+| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:12:16: 12:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
+| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] }: &ReStatic [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:13:16: 13:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
+|
+fn main() -> () {
+ let mut _0: ();
+ let _1: ();
+ let mut _2: (&&[u8], &&[u8; 4]);
+ let mut _3: &&[u8];
+ let _4: &[u8];
+ let mut _5: &&[u8; 4];
+ let _6: &[u8; 4];
+ let _7: [u8; 4];
+ let _8: &&[u8];
+ let _9: &&[u8; 4];
+ let mut _10: bool;
+ let mut _11: &&[u8];
+ let mut _12: &&[u8; 4];
+ let mut _13: !;
+ let _15: !;
+ let mut _16: core::panicking::AssertKind;
+ let mut _17: &&[u8];
+ let _18: &&[u8];
+ let mut _19: &&[u8; 4];
+ let _20: &&[u8; 4];
+ let mut _21: std::option::Option<std::fmt::Arguments<'_>>;
+ let _22: ();
+ let mut _23: (&&[u8], &&[u8; 4]);
+ let mut _24: &&[u8];
+ let _25: &[u8];
+ let mut _26: &&[u8; 4];
+ let _27: &[u8; 4];
+ let _28: &&[u8];
+ let _29: &&[u8; 4];
+ let mut _30: bool;
+ let mut _31: &&[u8];
+ let mut _32: &&[u8; 4];
+ let mut _33: !;
+ let _35: !;
+ let mut _36: core::panicking::AssertKind;
+ let mut _37: &&[u8];
+ let _38: &&[u8];
+ let mut _39: &&[u8; 4];
+ let _40: &&[u8; 4];
+ let mut _41: std::option::Option<std::fmt::Arguments<'_>>;
+ scope 1 {
+ debug left_val => _8;
+ debug right_val => _9;
+ let _14: core::panicking::AssertKind;
+ scope 2 {
+ debug kind => _14;
+ }
+ }
+ scope 3 {
+ debug left_val => _28;
+ debug right_val => _29;
+ let _34: core::panicking::AssertKind;
+ scope 4 {
+ debug kind => _34;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb21];
+ }
+
+ bb1: {
+ _3 = &_4;
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = [const 65_u8, const 65_u8, const 65_u8, const 65_u8];
+ _6 = &_7;
+ _5 = &_6;
+ _2 = (move _3, move _5);
+ StorageDead(_5);
+ StorageDead(_3);
+ FakeRead(ForMatchedPlace(None), _2);
+ StorageLive(_8);
+ _8 = (_2.0: &&[u8]);
+ StorageLive(_9);
+ _9 = (_2.1: &&[u8; 4]);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = &(*_8);
+ StorageLive(_12);
+ _12 = &(*_9);
+ _10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb2, unwind: bb21];
+ }
+
+ bb2: {
+ switchInt(move _10) -> [0: bb4, otherwise: bb3];
+ }
+
+ bb3: {
+ StorageDead(_12);
+ StorageDead(_11);
+ goto -> bb8;
+ }
+
+ bb4: {
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_14);
+ _14 = core::panicking::AssertKind::Eq;
+ FakeRead(ForLet(None), _14);
+ StorageLive(_15);
+ StorageLive(_16);
+ _16 = move _14;
+ StorageLive(_17);
+ StorageLive(_18);
+ _18 = &(*_8);
+ _17 = &(*_18);
+ StorageLive(_19);
+ StorageLive(_20);
+ _20 = &(*_9);
+ _19 = &(*_20);
+ StorageLive(_21);
+ _21 = Option::<Arguments<'_>>::None;
+ _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> bb21;
+ }
+
+ bb6: {
+ StorageDead(_21);
+ StorageDead(_19);
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageDead(_20);
+ StorageDead(_18);
+ StorageDead(_15);
+ StorageDead(_14);
+ unreachable;
+ }
+
+ bb7: {
+ goto -> bb9;
+ }
+
+ bb8: {
+ _1 = const ();
+ goto -> bb9;
+ }
+
+ bb9: {
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ goto -> bb10;
+ }
+
+ bb10: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ StorageLive(_22);
+ StorageLive(_23);
+ StorageLive(_24);
+ StorageLive(_25);
+ _25 = function_with_bytes::<&*b"AAAA">() -> [return: bb11, unwind: bb21];
+ }
+
+ bb11: {
+ _24 = &_25;
+ StorageLive(_26);
+ StorageLive(_27);
+ _27 = const b"AAAA";
+ _26 = &_27;
+ _23 = (move _24, move _26);
+ StorageDead(_26);
+ StorageDead(_24);
+ FakeRead(ForMatchedPlace(None), _23);
+ StorageLive(_28);
+ _28 = (_23.0: &&[u8]);
+ StorageLive(_29);
+ _29 = (_23.1: &&[u8; 4]);
+ StorageLive(_30);
+ StorageLive(_31);
+ _31 = &(*_28);
+ StorageLive(_32);
+ _32 = &(*_29);
+ _30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb12, unwind: bb21];
+ }
+
+ bb12: {
+ switchInt(move _30) -> [0: bb14, otherwise: bb13];
+ }
+
+ bb13: {
+ StorageDead(_32);
+ StorageDead(_31);
+ goto -> bb18;
+ }
+
+ bb14: {
+ goto -> bb15;
+ }
+
+ bb15: {
+ StorageDead(_32);
+ StorageDead(_31);
+ StorageLive(_34);
+ _34 = core::panicking::AssertKind::Eq;
+ FakeRead(ForLet(None), _34);
+ StorageLive(_35);
+ StorageLive(_36);
+ _36 = move _34;
+ StorageLive(_37);
+ StorageLive(_38);
+ _38 = &(*_28);
+ _37 = &(*_38);
+ StorageLive(_39);
+ StorageLive(_40);
+ _40 = &(*_29);
+ _39 = &(*_40);
+ StorageLive(_41);
+ _41 = Option::<Arguments<'_>>::None;
+ _35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> bb21;
+ }
+
+ bb16: {
+ StorageDead(_41);
+ StorageDead(_39);
+ StorageDead(_37);
+ StorageDead(_36);
+ StorageDead(_40);
+ StorageDead(_38);
+ StorageDead(_35);
+ StorageDead(_34);
+ unreachable;
+ }
+
+ bb17: {
+ goto -> bb19;
+ }
+
+ bb18: {
+ _22 = const ();
+ goto -> bb19;
+ }
+
+ bb19: {
+ StorageDead(_30);
+ StorageDead(_29);
+ StorageDead(_28);
+ goto -> bb20;
+ }
+
+ bb20: {
+ StorageDead(_27);
+ StorageDead(_25);
+ StorageDead(_23);
+ StorageDead(_22);
+ _0 = const ();
+ return;
+ }
+
+ bb21 (cleanup): {
+ resume;
+ }
+}
+
+alloc4 (size: 4, align: 1) {
+ 41 41 41 41 │ AAAA
+}
diff --git a/tests/mir-opt/issue_99325.rs b/tests/mir-opt/issue_99325.rs
index fe819cddb..3603228a5 100644
--- a/tests/mir-opt/issue_99325.rs
+++ b/tests/mir-opt/issue_99325.rs
@@ -1,3 +1,5 @@
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
#![feature(adt_const_params)]
#![allow(incomplete_features)]
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
index 6174d5259..5242c5f6a 100644
--- 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
@@ -32,12 +32,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
- StorageDead(_5);
- StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_8);
_8 = _1;
_9 = Len((*_2));
@@ -52,6 +52,8 @@
}
bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
_0 = const 42_u8;
goto -> bb5;
}
diff --git a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff
index 60c0772d8..a9e99933b 100644
--- a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff
+++ b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff
@@ -32,12 +32,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
- StorageDead(_5);
- StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_8);
_8 = _1;
_9 = Len((*_2));
@@ -52,6 +52,8 @@
}
bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
_0 = const 42_u8;
goto -> bb5;
}
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
index e2de18452..7749ba6be 100644
--- 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
@@ -35,12 +35,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
- StorageDead(_5);
- StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_8);
_8 = _1;
_9 = Len((*_2));
@@ -55,6 +55,8 @@
}
bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_11);
_11 = const 0_usize;
_12 = Len((*_2));
diff --git a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff
index eb81e0eea..fcc2c1653 100644
--- a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff
+++ b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff
@@ -35,12 +35,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
- StorageDead(_5);
- StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_8);
_8 = _1;
_9 = Len((*_2));
@@ -55,6 +55,8 @@
}
bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_11);
_11 = const 0_usize;
_12 = Len((*_2));
diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff
index 95a4a83d6..b2cf3cc1c 100644
--- a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff
+++ b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff
@@ -12,6 +12,7 @@
StorageLive(_2);
_2 = &raw const (*_1);
- _0 = read_via_copy::<Never>(move _2) -> unwind unreachable;
++ _0 = (*_2);
+ unreachable;
}
}
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
index 95a4a83d6..b2cf3cc1c 100644
--- 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
@@ -12,6 +12,7 @@
StorageLive(_2);
_2 = &raw const (*_1);
- _0 = read_via_copy::<Never>(move _2) -> unwind unreachable;
++ _0 = (*_2);
+ unreachable;
}
}
diff --git a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff
index 70b33fb70..7f752ca0f 100644
--- a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff
+++ b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff
@@ -28,12 +28,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
- StorageDead(_5);
- StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_7);
_7 = _1;
_8 = Len((*_2));
@@ -48,6 +48,8 @@
}
bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
_0 = const 42_u8;
goto -> bb5;
}
diff --git a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff
index 310b3b26a..d73b563a0 100644
--- a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff
+++ b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff
@@ -28,12 +28,12 @@
bb1: {
StorageDead(_6);
_3 = Lt(move _4, move _5);
- StorageDead(_5);
- StorageDead(_4);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
}
bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_7);
_7 = _1;
_8 = Len((*_2));
@@ -48,6 +48,8 @@
}
bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
_0 = const 42_u8;
goto -> bb5;
}
diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff
index be09ed641..137688ff6 100644
--- a/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff
+++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff
@@ -80,8 +80,8 @@
_6 = &(_2.1: bool);
StorageLive(_8);
_8 = &(_2.2: std::string::String);
-- _3 = &shallow (_2.0: bool);
-- _4 = &shallow (_2.1: bool);
+- _3 = &fake (_2.0: bool);
+- _4 = &fake (_2.1: bool);
StorageLive(_9);
StorageLive(_10);
_10 = _1;
@@ -137,8 +137,8 @@
_6 = &(_2.0: bool);
StorageLive(_8);
_8 = &(_2.2: std::string::String);
-- _3 = &shallow (_2.0: bool);
-- _4 = &shallow (_2.1: bool);
+- _3 = &fake (_2.0: bool);
+- _4 = &fake (_2.1: bool);
StorageLive(_12);
StorageLive(_13);
_13 = _1;
@@ -243,7 +243,7 @@
}
- bb25 (cleanup): {
-- drop(_2) -> [return: bb26, unwind terminate];
+- drop(_2) -> [return: bb26, unwind terminate(cleanup)];
+ bb22 (cleanup): {
+ goto -> bb27;
}
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
index be09ed641..137688ff6 100644
--- 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
@@ -80,8 +80,8 @@
_6 = &(_2.1: bool);
StorageLive(_8);
_8 = &(_2.2: std::string::String);
-- _3 = &shallow (_2.0: bool);
-- _4 = &shallow (_2.1: bool);
+- _3 = &fake (_2.0: bool);
+- _4 = &fake (_2.1: bool);
StorageLive(_9);
StorageLive(_10);
_10 = _1;
@@ -137,8 +137,8 @@
_6 = &(_2.0: bool);
StorageLive(_8);
_8 = &(_2.2: std::string::String);
-- _3 = &shallow (_2.0: bool);
-- _4 = &shallow (_2.1: bool);
+- _3 = &fake (_2.0: bool);
+- _4 = &fake (_2.1: bool);
StorageLive(_12);
StorageLive(_13);
_13 = _1;
@@ -243,7 +243,7 @@
}
- bb25 (cleanup): {
-- drop(_2) -> [return: bb26, unwind terminate];
+- drop(_2) -> [return: bb26, unwind terminate(cleanup)];
+ bb22 (cleanup): {
+ goto -> bb27;
}
diff --git a/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir b/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir
index 7f8eb82c7..8764236bf 100644
--- a/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir
@@ -68,7 +68,7 @@ fn main() -> () {
}
bb9: {
- _8 = &shallow _1;
+ _8 = &fake _1;
StorageLive(_9);
_9 = _2;
switchInt(move _9) -> [0: bb11, otherwise: bb10];
diff --git a/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff
index b5edbfee0..5a71bef93 100644
--- a/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff
+++ b/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff
@@ -40,39 +40,43 @@
- }
-
- bb3: {
+- switchInt(move _5) -> [0: bb5, otherwise: bb4];
+- }
+-
+- bb4: {
+ StorageLive(_7);
+ _7 = move _6;
+ _5 = Ne(_7, const false);
+ StorageDead(_7);
++ StorageLive(_8);
++ _8 = move _5;
StorageDead(_6);
-- switchInt(move _5) -> [0: bb5, otherwise: bb4];
-- }
--
-- bb4: {
- _4 = const true;
- goto -> bb6;
- }
-
- bb5: {
+- StorageDead(_6);
- _4 = const false;
- goto -> bb6;
- }
-
- bb6: {
-+ StorageLive(_8);
-+ _8 = move _5;
-+ _4 = Ne(_8, const false);
-+ StorageDead(_8);
- StorageDead(_5);
- switchInt(move _4) -> [0: bb8, otherwise: bb7];
- }
-
- bb7: {
++ _4 = Ne(_8, const false);
++ StorageDead(_8);
++ StorageLive(_9);
++ _9 = move _4;
+ StorageDead(_5);
- _3 = const true;
- goto -> bb9;
- }
-
- bb8: {
+- StorageDead(_5);
- _3 = const false;
- goto -> bb9;
- }
@@ -82,8 +86,6 @@
- }
-
- bb10: {
-+ StorageLive(_9);
-+ _9 = move _4;
+ _3 = Ne(_9, const false);
+ StorageDead(_9);
+ StorageLive(_10);
diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir
index 56b0f8165..c581d0f84 100644
--- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir
+++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir
@@ -22,7 +22,7 @@
|
fn main() -> () {
let mut _0: ();
- let mut _1: [usize; Const { ty: usize, kind: Leaf(0x00000003) }];
+ let mut _1: [usize; ValTree(Leaf(0x00000003): usize)];
let _3: usize;
let mut _4: usize;
let mut _5: bool;
diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir
index 83b851eed..48243e34d 100644
--- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir
+++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir
@@ -22,7 +22,7 @@
|
fn main() -> () {
let mut _0: ();
- let mut _1: [usize; Const { ty: usize, kind: Leaf(0x0000000000000003) }];
+ let mut _1: [usize; ValTree(Leaf(0x0000000000000003): usize)];
let _3: usize;
let mut _4: usize;
let mut _5: bool;
diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir
index e22fc7d54..99a7a6b61 100644
--- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir
+++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir
@@ -31,7 +31,7 @@ fn main() -> () {
}
bb3 (cleanup): {
- drop(_2) -> [return: bb4, unwind terminate];
+ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir
index 6fb107929..7364b329e 100644
--- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir
+++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir
@@ -31,7 +31,7 @@ fn main() -> () {
}
bb3 (cleanup): {
- drop(_2) -> [return: bb4, unwind terminate];
+ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
diff --git a/tests/mir-opt/not_equal_false.opt.InstSimplify.diff b/tests/mir-opt/not_equal_false.opt.InstSimplify.diff
index 71353be24..1342966aa 100644
--- a/tests/mir-opt/not_equal_false.opt.InstSimplify.diff
+++ b/tests/mir-opt/not_equal_false.opt.InstSimplify.diff
@@ -13,16 +13,17 @@
_3 = _1;
- _2 = Ne(move _3, const false);
+ _2 = move _3;
- StorageDead(_3);
switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
+ StorageDead(_3);
_0 = const 0_u32;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
_0 = const 1_u32;
goto -> bb3;
}
diff --git a/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
index bc0479002..0ef191804 100644
--- a/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
+++ b/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -33,7 +33,7 @@ fn main() -> () {
bb1 (cleanup): {
(_1.0: Aligned) = move _4;
- drop(_1) -> [return: bb3, unwind terminate];
+ drop(_1) -> [return: bb3, unwind terminate(cleanup)];
}
bb2: {
diff --git a/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir
index c7fd397fc..838e30fa3 100644
--- a/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir
@@ -7,130 +7,111 @@ fn naive(_1: &Blueprint, _2: &Blueprint) -> bool {
let mut _3: u32;
let mut _4: u32;
let mut _5: bool;
- let mut _6: bool;
+ let mut _6: u32;
let mut _7: u32;
- let mut _8: u32;
- let mut _9: bool;
- let mut _10: bool;
- let mut _11: u32;
+ let mut _8: bool;
+ let mut _9: u32;
+ let mut _10: u32;
+ let mut _11: bool;
let mut _12: u32;
- let mut _13: bool;
+ let mut _13: u32;
let mut _14: bool;
let mut _15: u32;
let mut _16: u32;
- let mut _17: bool;
- let mut _18: u32;
- let mut _19: u32;
- let mut _20: bool;
bb0: {
- StorageLive(_14);
- StorageLive(_10);
- StorageLive(_6);
StorageLive(_5);
StorageLive(_3);
_3 = ((*_1).0: u32);
StorageLive(_4);
_4 = ((*_2).0: u32);
_5 = Eq(move _3, move _4);
- StorageDead(_4);
- StorageDead(_3);
switchInt(move _5) -> [0: bb1, otherwise: bb2];
}
bb1: {
- _6 = const false;
- goto -> bb3;
+ StorageDead(_4);
+ StorageDead(_3);
+ goto -> bb8;
}
bb2: {
- StorageLive(_9);
- StorageLive(_7);
- _7 = ((*_1).1: u32);
+ StorageDead(_4);
+ StorageDead(_3);
StorageLive(_8);
- _8 = ((*_2).1: u32);
- _9 = Eq(move _7, move _8);
- StorageDead(_8);
- StorageDead(_7);
- _6 = move _9;
- goto -> bb3;
+ StorageLive(_6);
+ _6 = ((*_1).1: u32);
+ StorageLive(_7);
+ _7 = ((*_2).1: u32);
+ _8 = Eq(move _6, move _7);
+ switchInt(move _8) -> [0: bb3, otherwise: bb4];
}
bb3: {
- StorageDead(_9);
- StorageDead(_5);
- switchInt(move _6) -> [0: bb4, otherwise: bb5];
+ StorageDead(_7);
+ StorageDead(_6);
+ goto -> bb8;
}
bb4: {
- _10 = const false;
- goto -> bb6;
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_11);
+ StorageLive(_9);
+ _9 = ((*_1).2: u32);
+ StorageLive(_10);
+ _10 = ((*_2).2: u32);
+ _11 = Eq(move _9, move _10);
+ switchInt(move _11) -> [0: bb5, otherwise: bb6];
}
bb5: {
- StorageLive(_13);
- StorageLive(_11);
- _11 = ((*_1).2: u32);
- StorageLive(_12);
- _12 = ((*_2).2: u32);
- _13 = Eq(move _11, move _12);
- StorageDead(_12);
- StorageDead(_11);
- _10 = move _13;
- goto -> bb6;
+ StorageDead(_10);
+ StorageDead(_9);
+ goto -> bb8;
}
bb6: {
- StorageDead(_13);
- StorageDead(_6);
- switchInt(move _10) -> [0: bb7, otherwise: bb8];
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageLive(_14);
+ StorageLive(_12);
+ _12 = ((*_1).3: u32);
+ StorageLive(_13);
+ _13 = ((*_2).3: u32);
+ _14 = Eq(move _12, move _13);
+ switchInt(move _14) -> [0: bb7, otherwise: bb9];
}
bb7: {
- _14 = const false;
- goto -> bb9;
+ StorageDead(_13);
+ StorageDead(_12);
+ goto -> bb8;
}
bb8: {
- StorageLive(_17);
+ _0 = const false;
+ goto -> bb10;
+ }
+
+ bb9: {
+ StorageDead(_13);
+ StorageDead(_12);
StorageLive(_15);
- _15 = ((*_1).3: u32);
+ _15 = ((*_1).4: u32);
StorageLive(_16);
- _16 = ((*_2).3: u32);
- _17 = Eq(move _15, move _16);
+ _16 = ((*_2).4: u32);
+ _0 = Eq(move _15, move _16);
StorageDead(_16);
StorageDead(_15);
- _14 = move _17;
- goto -> bb9;
- }
-
- bb9: {
- StorageDead(_17);
- StorageDead(_10);
- switchInt(move _14) -> [0: bb10, otherwise: bb11];
+ goto -> bb10;
}
bb10: {
- _0 = const false;
- goto -> bb12;
- }
-
- bb11: {
- StorageLive(_20);
- StorageLive(_18);
- _18 = ((*_1).4: u32);
- StorageLive(_19);
- _19 = ((*_2).4: u32);
- _20 = Eq(move _18, move _19);
- StorageDead(_19);
- StorageDead(_18);
- _0 = move _20;
- goto -> bb12;
- }
-
- bb12: {
- StorageDead(_20);
StorageDead(_14);
+ StorageDead(_11);
+ StorageDead(_8);
+ StorageDead(_5);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir
index 1e619bc97..8452fa12f 100644
--- a/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir
@@ -27,12 +27,12 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
StorageLive(_4);
_4 = ((*_2).0: u32);
_5 = Ne(move _3, move _4);
- StorageDead(_4);
- StorageDead(_3);
switchInt(move _5) -> [0: bb1, otherwise: bb10];
}
bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
StorageDead(_5);
StorageLive(_8);
StorageLive(_6);
@@ -40,12 +40,12 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
StorageLive(_7);
_7 = ((*_2).1: u32);
_8 = Ne(move _6, move _7);
- StorageDead(_7);
- StorageDead(_6);
switchInt(move _8) -> [0: bb2, otherwise: bb9];
}
bb2: {
+ StorageDead(_7);
+ StorageDead(_6);
StorageDead(_8);
StorageLive(_11);
StorageLive(_9);
@@ -53,12 +53,12 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
StorageLive(_10);
_10 = ((*_2).2: u32);
_11 = Ne(move _9, move _10);
- StorageDead(_10);
- StorageDead(_9);
switchInt(move _11) -> [0: bb3, otherwise: bb8];
}
bb3: {
+ StorageDead(_10);
+ StorageDead(_9);
StorageDead(_11);
StorageLive(_14);
StorageLive(_12);
@@ -66,12 +66,12 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
StorageLive(_13);
_13 = ((*_2).3: u32);
_14 = Ne(move _12, move _13);
- StorageDead(_13);
- StorageDead(_12);
switchInt(move _14) -> [0: bb4, otherwise: bb7];
}
bb4: {
+ StorageDead(_13);
+ StorageDead(_12);
StorageDead(_14);
StorageLive(_17);
StorageLive(_15);
@@ -79,42 +79,52 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
StorageLive(_16);
_16 = ((*_2).4: u32);
_17 = Ne(move _15, move _16);
- StorageDead(_16);
- StorageDead(_15);
switchInt(move _17) -> [0: bb5, otherwise: bb6];
}
bb5: {
+ StorageDead(_16);
+ StorageDead(_15);
StorageDead(_17);
_0 = const true;
goto -> bb11;
}
bb6: {
+ StorageDead(_16);
+ StorageDead(_15);
_0 = const false;
StorageDead(_17);
goto -> bb11;
}
bb7: {
+ StorageDead(_13);
+ StorageDead(_12);
_0 = const false;
StorageDead(_14);
goto -> bb11;
}
bb8: {
+ StorageDead(_10);
+ StorageDead(_9);
_0 = const false;
StorageDead(_11);
goto -> bb11;
}
bb9: {
+ StorageDead(_7);
+ StorageDead(_6);
_0 = const false;
StorageDead(_8);
goto -> bb11;
}
bb10: {
+ StorageDead(_4);
+ StorageDead(_3);
_0 = const false;
StorageDead(_5);
goto -> bb11;
diff --git a/tests/mir-opt/pre-codegen/chained_comparison.rs b/tests/mir-opt/pre-codegen/chained_comparison.rs
index f7879140f..430300419 100644
--- a/tests/mir-opt/pre-codegen/chained_comparison.rs
+++ b/tests/mir-opt/pre-codegen/chained_comparison.rs
@@ -1,5 +1,4 @@
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
-// ignore-debug
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/checked_ops.rs b/tests/mir-opt/pre-codegen/checked_ops.rs
index dee43b0c6..23d78e987 100644
--- a/tests/mir-opt/pre-codegen/checked_ops.rs
+++ b/tests/mir-opt/pre-codegen/checked_ops.rs
@@ -1,6 +1,5 @@
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
// needs-unwind
-// ignore-debug
// only-x86_64
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
index b2ea96f03..75f81c5aa 100644
--- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
@@ -40,16 +40,22 @@ fn step_forward(_1: u32, _2: usize) -> u32 {
_5 = Eq(_4, const 1_isize);
_6 = Not(move _5);
StorageDead(_5);
- StorageDead(_3);
- StorageDead(_8);
- switchInt(move _6) -> [0: bb3, otherwise: bb2];
+ switchInt(move _6) -> [0: bb2, otherwise: bb3];
}
bb2: {
- assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb3, unwind continue];
+ StorageDead(_3);
+ StorageDead(_8);
+ goto -> bb4;
}
bb3: {
+ StorageDead(_3);
+ StorageDead(_8);
+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb4, unwind continue];
+ }
+
+ bb4: {
StorageDead(_6);
StorageLive(_7);
_7 = _2 as u32 (IntToInt);
diff --git a/tests/mir-opt/pre-codegen/intrinsics.rs b/tests/mir-opt/pre-codegen/intrinsics.rs
index ecdb656cb..e32e04384 100644
--- a/tests/mir-opt/pre-codegen/intrinsics.rs
+++ b/tests/mir-opt/pre-codegen/intrinsics.rs
@@ -1,6 +1,5 @@
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
-// ignore-debug
// Checks that we do not have any branches in the MIR for the two tested functions.
diff --git a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
index 940b9ae11..4db829a5e 100644
--- a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
@@ -83,7 +83,7 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
}
bb9 (cleanup): {
- drop(_5) -> [return: bb10, unwind terminate];
+ drop(_5) -> [return: bb10, unwind terminate(cleanup)];
}
bb10 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
index 2e51faeba..0d79f2de1 100644
--- a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
@@ -63,17 +63,19 @@ fn int_range(_1: usize, _2: usize) -> () {
_7 = Lt(move _5, move _6);
StorageDead(_6);
StorageDead(_5);
- StorageDead(_16);
- StorageDead(_15);
switchInt(move _7) -> [0: bb2, otherwise: bb3];
}
bb2: {
+ StorageDead(_16);
+ StorageDead(_15);
_8 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
+ StorageDead(_16);
+ StorageDead(_15);
_9 = (_4.0: usize);
StorageLive(_10);
_10 = <usize as Step>::forward_unchecked(_9, const 1_usize) -> [return: bb4, unwind continue];
diff --git a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
index 261416036..c30df7425 100644
--- a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
@@ -75,7 +75,7 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
}
bb9 (cleanup): {
- drop(_5) -> [return: bb10, unwind terminate];
+ drop(_5) -> [return: bb10, unwind terminate(cleanup)];
}
bb10 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/loops.rs b/tests/mir-opt/pre-codegen/loops.rs
index 67f549a51..f3ba40922 100644
--- a/tests/mir-opt/pre-codegen/loops.rs
+++ b/tests/mir-opt/pre-codegen/loops.rs
@@ -1,6 +1,5 @@
// compile-flags: -O -Zmir-opt-level=2 -g
// needs-unwind
-// ignore-debug
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir
index 8eff46fb9..cb29473d7 100644
--- a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir
@@ -67,7 +67,7 @@ fn vec_move(_1: Vec<impl Sized>) -> () {
}
bb9 (cleanup): {
- drop(_3) -> [return: bb10, unwind terminate];
+ drop(_3) -> [return: bb10, unwind terminate(cleanup)];
}
bb10 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir
index 26919dd98..630babaa8 100644
--- a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir
@@ -10,23 +10,53 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 {
scope 2 {
scope 3 {
debug result => _0;
- scope 6 (inlined std::ptr::write::<u32>) {
+ scope 16 (inlined std::ptr::write::<u32>) {
debug dst => _1;
debug src => _2;
- scope 7 {
+ scope 17 {
}
}
}
scope 4 (inlined std::ptr::read::<u32>) {
debug src => _1;
scope 5 {
+ scope 6 (inlined std::ptr::read::runtime::<u32>) {
+ debug src => _1;
+ scope 7 (inlined intrinsics::is_aligned_and_not_null::<u32>) {
+ debug ptr => _1;
+ scope 8 (inlined ptr::const_ptr::<impl *const u32>::is_null) {
+ debug self => _1;
+ let mut _3: *const u8;
+ scope 9 {
+ scope 10 (inlined ptr::const_ptr::<impl *const T>::is_null::runtime_impl) {
+ debug ptr => _3;
+ scope 11 (inlined ptr::const_ptr::<impl *const u8>::addr) {
+ debug self => _3;
+ scope 12 {
+ scope 13 (inlined ptr::const_ptr::<impl *const u8>::cast::<()>) {
+ debug self => _3;
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 14 (inlined ptr::const_ptr::<impl *const u32>::is_aligned) {
+ debug self => _1;
+ scope 15 (inlined align_of::<u32>) {
+ }
+ }
+ }
+ }
}
}
}
}
bb0: {
+ StorageLive(_3);
_0 = (*_1);
+ StorageDead(_3);
(*_1) = _2;
return;
}
diff --git a/tests/mir-opt/pre-codegen/mem_replace.rs b/tests/mir-opt/pre-codegen/mem_replace.rs
index e5066c38b..a139848ba 100644
--- a/tests/mir-opt/pre-codegen/mem_replace.rs
+++ b/tests/mir-opt/pre-codegen/mem_replace.rs
@@ -1,6 +1,6 @@
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
-// ignore-debug
+// ignore-debug the standard library debug assertions leak into this test
#![crate_type = "lib"]
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
index 2c607b4c0..681e9666e 100644
--- 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
@@ -55,5 +55,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc5 (size: 8, align: 4) {
++ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
index b6929f3f9..db16b8d82 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
@@ -55,5 +55,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc5 (size: 8, align: 4) {
++ 04 00 00 00 00 __ __ __ │ .....░░░
}
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
index 2c607b4c0..681e9666e 100644
--- 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
@@ -55,5 +55,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc5 (size: 8, align: 4) {
++ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
index b6929f3f9..db16b8d82 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
@@ -55,5 +55,9 @@
StorageDead(_1);
return;
}
++ }
++
++ alloc5 (size: 8, align: 4) {
++ 04 00 00 00 00 __ __ __ │ .....░░░
}
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
index d76b46bdd..9664ccfb0 100644
--- 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
@@ -66,17 +66,19 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
_8 = Lt(move _6, move _7);
StorageDead(_7);
StorageDead(_6);
- StorageDead(_19);
- StorageDead(_18);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
}
bb2: {
+ StorageDead(_19);
+ StorageDead(_18);
_9 = Option::<u32>::None;
goto -> bb5;
}
bb3: {
+ StorageDead(_19);
+ StorageDead(_18);
_10 = (_5.0: u32);
StorageLive(_11);
_11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable];
diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
index 4d7c017da..dc8b46b6c 100644
--- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
@@ -66,17 +66,19 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
_8 = Lt(move _6, move _7);
StorageDead(_7);
StorageDead(_6);
- StorageDead(_19);
- StorageDead(_18);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
}
bb2: {
+ StorageDead(_19);
+ StorageDead(_18);
_9 = Option::<u32>::None;
goto -> bb5;
}
bb3: {
+ StorageDead(_19);
+ StorageDead(_18);
_10 = (_5.0: u32);
StorageLive(_11);
_11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb11];
@@ -127,7 +129,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
bb11 (cleanup): {
- drop(_3) -> [return: bb12, unwind terminate];
+ drop(_3) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir
index bbab4e47a..a677e8b43 100644
--- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir
@@ -82,7 +82,7 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
bb8 (cleanup): {
- drop(_3) -> [return: bb9, unwind terminate];
+ drop(_3) -> [return: bb9, unwind terminate(cleanup)];
}
bb9 (cleanup): {
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
index 7360aa3e6..fff713b5a 100644
--- 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
@@ -38,17 +38,19 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
_4 = Lt(move _2, move _3);
StorageDead(_3);
StorageDead(_2);
- StorageDead(_8);
- StorageDead(_7);
switchInt(move _4) -> [0: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_8);
+ StorageDead(_7);
_0 = Option::<u32>::None;
goto -> bb4;
}
bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
_5 = ((*_1).0: u32);
StorageLive(_6);
_6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind unreachable];
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
index 61957082d..cc12c0122 100644
--- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
@@ -38,17 +38,19 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
_4 = Lt(move _2, move _3);
StorageDead(_3);
StorageDead(_2);
- StorageDead(_8);
- StorageDead(_7);
switchInt(move _4) -> [0: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_8);
+ StorageDead(_7);
_0 = Option::<u32>::None;
goto -> bb4;
}
bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
_5 = ((*_1).0: u32);
StorageLive(_6);
_6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind continue];
diff --git a/tests/mir-opt/pre-codegen/range_iter.rs b/tests/mir-opt/pre-codegen/range_iter.rs
index cabd9419e..955214478 100644
--- a/tests/mir-opt/pre-codegen/range_iter.rs
+++ b/tests/mir-opt/pre-codegen/range_iter.rs
@@ -1,6 +1,5 @@
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
-// ignore-debug
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
index 68d78f743..48b780aea 100644
--- a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
@@ -3,9 +3,9 @@
fn ezmap(_1: Option<i32>) -> Option<i32> {
debug x => _1;
let mut _0: std::option::Option<i32>;
- scope 1 (inlined map::<i32, i32, [closure@$DIR/simple_option_map.rs:18:12: 18:15]>) {
+ scope 1 (inlined map::<i32, i32, {closure@$DIR/simple_option_map.rs:17:12: 17:15}>) {
debug slf => _1;
- debug f => const ZeroSized: [closure@$DIR/simple_option_map.rs:18:12: 18:15];
+ debug f => const ZeroSized: {closure@$DIR/simple_option_map.rs:17:12: 17:15};
let mut _2: isize;
let _3: i32;
let mut _4: i32;
diff --git a/tests/mir-opt/pre-codegen/simple_option_map.rs b/tests/mir-opt/pre-codegen/simple_option_map.rs
index fb3da68e4..d4f28dda6 100644
--- a/tests/mir-opt/pre-codegen/simple_option_map.rs
+++ b/tests/mir-opt/pre-codegen/simple_option_map.rs
@@ -1,6 +1,5 @@
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
-// ignore-debug
#[inline(always)]
fn map<T, U, F>(slf: Option<T>, f: F) -> Option<U>
diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
index 1488779f9..ed286beb4 100644
--- a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
@@ -1,6 +1,6 @@
// MIR for `variant_a::{closure#0}` after PreCodegen
-fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2: &&(usize, usize, usize, usize)) -> bool {
+fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2: &&(usize, usize, usize, usize)) -> bool {
let mut _0: bool;
let mut _3: &(usize, usize, usize, usize);
let _4: &usize;
@@ -12,30 +12,27 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2
let _10: &usize;
let _11: &usize;
let mut _16: bool;
- let mut _17: bool;
- let _18: &usize;
- let mut _23: bool;
- let _24: &usize;
- let mut _29: bool;
- let mut _30: bool;
- let _31: &usize;
- let mut _36: bool;
+ let _17: &usize;
+ let mut _22: bool;
+ let _23: &usize;
+ let mut _28: bool;
+ let _29: &usize;
+ let mut _34: &&usize;
+ let mut _35: &&usize;
+ let mut _36: &&usize;
let mut _37: &&usize;
let mut _38: &&usize;
let mut _39: &&usize;
let mut _40: &&usize;
let mut _41: &&usize;
- let mut _42: &&usize;
- let mut _43: &&usize;
- let mut _44: &&usize;
scope 1 {
debug a => _4;
debug b => _6;
debug c => _8;
debug d => _10;
scope 2 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _37;
- debug other => _38;
+ debug self => _34;
+ debug other => _35;
let mut _12: &usize;
let mut _13: &usize;
scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
@@ -46,39 +43,39 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2
}
}
scope 4 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _41;
- debug other => _42;
- let mut _25: &usize;
- let mut _26: &usize;
+ debug self => _36;
+ debug other => _37;
+ let mut _18: &usize;
+ let mut _19: &usize;
scope 5 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
- debug self => _25;
- debug other => _26;
- let mut _27: usize;
- let mut _28: usize;
+ debug self => _18;
+ debug other => _19;
+ let mut _20: usize;
+ let mut _21: usize;
}
}
scope 6 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _39;
- debug other => _40;
- let mut _19: &usize;
- let mut _20: &usize;
+ debug self => _38;
+ debug other => _39;
+ let mut _24: &usize;
+ let mut _25: &usize;
scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
- debug self => _19;
- debug other => _20;
- let mut _21: usize;
- let mut _22: usize;
+ debug self => _24;
+ debug other => _25;
+ let mut _26: usize;
+ let mut _27: usize;
}
}
scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _43;
- debug other => _44;
- let mut _32: &usize;
- let mut _33: &usize;
+ debug self => _40;
+ debug other => _41;
+ let mut _30: &usize;
+ let mut _31: &usize;
scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
- debug self => _32;
- debug other => _33;
- let mut _34: usize;
- let mut _35: usize;
+ debug self => _30;
+ debug other => _31;
+ let mut _32: usize;
+ let mut _33: usize;
}
}
}
@@ -96,10 +93,9 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2
StorageLive(_10);
_9 = deref_copy (*_2);
_10 = &((*_9).3: usize);
- StorageLive(_17);
StorageLive(_16);
- StorageLive(_37);
- StorageLive(_38);
+ StorageLive(_34);
+ StorageLive(_35);
StorageLive(_11);
_11 = _8;
_12 = deref_copy _4;
@@ -111,109 +107,109 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2
_16 = Le(move _14, move _15);
StorageDead(_15);
StorageDead(_14);
- StorageDead(_11);
- StorageDead(_38);
- StorageDead(_37);
switchInt(move _16) -> [0: bb1, otherwise: bb2];
}
bb1: {
- _17 = const false;
- goto -> bb3;
+ StorageDead(_11);
+ StorageDead(_35);
+ StorageDead(_34);
+ goto -> bb4;
}
bb2: {
- StorageLive(_23);
- StorageLive(_39);
- StorageLive(_40);
- StorageLive(_18);
- _18 = _6;
- _19 = deref_copy _10;
- _20 = deref_copy _18;
+ StorageDead(_11);
+ StorageDead(_35);
+ StorageDead(_34);
+ StorageLive(_22);
+ StorageLive(_36);
+ StorageLive(_37);
+ StorageLive(_17);
+ _17 = _6;
+ _18 = deref_copy _10;
+ _19 = deref_copy _17;
+ StorageLive(_20);
+ _20 = (*_18);
StorageLive(_21);
_21 = (*_19);
- StorageLive(_22);
- _22 = (*_20);
- _23 = Le(move _21, move _22);
- StorageDead(_22);
+ _22 = Le(move _20, move _21);
StorageDead(_21);
- StorageDead(_18);
- StorageDead(_40);
- StorageDead(_39);
- _17 = move _23;
- goto -> bb3;
+ StorageDead(_20);
+ switchInt(move _22) -> [0: bb3, otherwise: bb8];
}
bb3: {
- StorageDead(_23);
- StorageDead(_16);
- switchInt(move _17) -> [0: bb4, otherwise: bb8];
+ StorageDead(_17);
+ StorageDead(_37);
+ StorageDead(_36);
+ goto -> bb4;
}
bb4: {
- StorageLive(_30);
- StorageLive(_29);
- StorageLive(_41);
- StorageLive(_42);
- StorageLive(_24);
- _24 = _4;
- _25 = deref_copy _8;
- _26 = deref_copy _24;
+ StorageLive(_28);
+ StorageLive(_38);
+ StorageLive(_39);
+ StorageLive(_23);
+ _23 = _4;
+ _24 = deref_copy _8;
+ _25 = deref_copy _23;
+ StorageLive(_26);
+ _26 = (*_24);
StorageLive(_27);
_27 = (*_25);
- StorageLive(_28);
- _28 = (*_26);
- _29 = Le(move _27, move _28);
- StorageDead(_28);
+ _28 = Le(move _26, move _27);
StorageDead(_27);
- StorageDead(_24);
- StorageDead(_42);
- StorageDead(_41);
- switchInt(move _29) -> [0: bb5, otherwise: bb6];
+ StorageDead(_26);
+ switchInt(move _28) -> [0: bb5, otherwise: bb6];
}
bb5: {
- _30 = const false;
+ StorageDead(_23);
+ StorageDead(_39);
+ StorageDead(_38);
+ _0 = const false;
goto -> bb7;
}
bb6: {
- StorageLive(_36);
- StorageLive(_43);
- StorageLive(_44);
- StorageLive(_31);
- _31 = _10;
- _32 = deref_copy _6;
- _33 = deref_copy _31;
- StorageLive(_34);
- _34 = (*_32);
- StorageLive(_35);
- _35 = (*_33);
- _36 = Le(move _34, move _35);
- StorageDead(_35);
- StorageDead(_34);
- StorageDead(_31);
- StorageDead(_44);
- StorageDead(_43);
- _30 = move _36;
+ StorageDead(_23);
+ StorageDead(_39);
+ StorageDead(_38);
+ StorageLive(_40);
+ StorageLive(_41);
+ StorageLive(_29);
+ _29 = _10;
+ _30 = deref_copy _6;
+ _31 = deref_copy _29;
+ StorageLive(_32);
+ _32 = (*_30);
+ StorageLive(_33);
+ _33 = (*_31);
+ _0 = Le(move _32, move _33);
+ StorageDead(_33);
+ StorageDead(_32);
+ StorageDead(_29);
+ StorageDead(_41);
+ StorageDead(_40);
goto -> bb7;
}
bb7: {
- StorageDead(_36);
- StorageDead(_29);
- _0 = move _30;
+ StorageDead(_28);
goto -> bb9;
}
bb8: {
+ StorageDead(_17);
+ StorageDead(_37);
+ StorageDead(_36);
_0 = const true;
goto -> bb9;
}
bb9: {
- StorageDead(_30);
- StorageDead(_17);
+ StorageDead(_22);
+ StorageDead(_16);
StorageDead(_10);
StorageDead(_8);
StorageDead(_6);
diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
index bab9f0b58..80c8cebff 100644
--- a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
@@ -1,6 +1,6 @@
// MIR for `variant_b::{closure#0}` after PreCodegen
-fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:11:25: 11:41], _2: &&(usize, usize, usize, usize)) -> bool {
+fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:11:25: 11:41}, _2: &&(usize, usize, usize, usize)) -> bool {
let mut _0: bool;
let mut _3: &(usize, usize, usize, usize);
let _4: usize;
@@ -13,9 +13,6 @@ fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:11:25: 11:41],
let mut _11: bool;
let mut _12: bool;
let mut _13: bool;
- let mut _14: bool;
- let mut _15: bool;
- let mut _16: bool;
scope 1 {
debug a => _4;
debug b => _6;
@@ -32,64 +29,46 @@ fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:11:25: 11:41],
_8 = ((*_7).2: usize);
_9 = deref_copy (*_2);
_10 = ((*_9).3: usize);
- StorageLive(_12);
StorageLive(_11);
_11 = Le(_4, _8);
- switchInt(move _11) -> [0: bb1, otherwise: bb2];
+ switchInt(move _11) -> [0: bb2, otherwise: bb1];
}
bb1: {
- _12 = const false;
- goto -> bb3;
+ StorageLive(_12);
+ _12 = Le(_10, _6);
+ switchInt(move _12) -> [0: bb2, otherwise: bb6];
}
bb2: {
StorageLive(_13);
- _13 = Le(_10, _6);
- _12 = move _13;
- goto -> bb3;
+ _13 = Le(_8, _4);
+ switchInt(move _13) -> [0: bb3, otherwise: bb4];
}
bb3: {
- StorageDead(_13);
- StorageDead(_11);
- switchInt(move _12) -> [0: bb4, otherwise: bb8];
+ _0 = const false;
+ goto -> bb5;
}
bb4: {
- StorageLive(_15);
- StorageLive(_14);
- _14 = Le(_8, _4);
- switchInt(move _14) -> [0: bb5, otherwise: bb6];
+ _0 = Le(_6, _10);
+ goto -> bb5;
}
bb5: {
- _15 = const false;
+ StorageDead(_13);
goto -> bb7;
}
bb6: {
- StorageLive(_16);
- _16 = Le(_6, _10);
- _15 = move _16;
+ _0 = const true;
goto -> bb7;
}
bb7: {
- StorageDead(_16);
- StorageDead(_14);
- _0 = move _15;
- goto -> bb9;
- }
-
- bb8: {
- _0 = const true;
- goto -> bb9;
- }
-
- bb9: {
- StorageDead(_15);
StorageDead(_12);
+ StorageDead(_11);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/slice_index.rs b/tests/mir-opt/pre-codegen/slice_index.rs
index d80bff50c..57ffb07e2 100644
--- a/tests/mir-opt/pre-codegen/slice_index.rs
+++ b/tests/mir-opt/pre-codegen/slice_index.rs
@@ -1,6 +1,6 @@
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
-// ignore-debug
+// ignore-debug the standard library debug assertions leak into this test
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir
index 07a58309e..8590c9d3b 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir
@@ -58,16 +58,17 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
StorageLive(_3);
_3 = Len((*_1));
_4 = Lt(_2, move _3);
- StorageDead(_3);
switchInt(move _4) -> [0: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_3);
_0 = const Option::<&mut u32>::None;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
StorageLive(_8);
StorageLive(_5);
_5 = &raw mut (*_1);
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir
index 07a58309e..8590c9d3b 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir
@@ -58,16 +58,17 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
StorageLive(_3);
_3 = Len((*_1));
_4 = Lt(_2, move _3);
- StorageDead(_3);
switchInt(move _4) -> [0: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_3);
_0 = const Option::<&mut u32>::None;
goto -> bb3;
}
bb2: {
+ StorageDead(_3);
StorageLive(_8);
StorageLive(_5);
_5 = &raw mut (*_1);
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
index 2f5d356a2..2fd669aee 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
@@ -8,46 +8,63 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
let mut _4: usize;
scope 1 (inlined core::slice::<impl [u32]>::get_unchecked_mut::<std::ops::Range<usize>>) {
debug self => _1;
- debug index => std::ops::Range<usize>{ .0 => _3, .1 => _4, };
+ debug ((index: std::ops::Range<usize>).0: usize) => _3;
+ debug ((index: std::ops::Range<usize>).1: usize) => _4;
let mut _5: *mut [u32];
let mut _13: *mut [u32];
scope 2 {
scope 3 (inlined <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked_mut) {
- debug self => std::ops::Range<usize>{ .0 => _3, .1 => _4, };
+ debug ((self: std::ops::Range<usize>).0: usize) => _3;
+ debug ((self: std::ops::Range<usize>).1: usize) => _4;
debug slice => _5;
let mut _7: *mut u32;
let mut _8: *mut u32;
- let _14: usize;
let _15: usize;
+ let _16: usize;
scope 4 {
- debug this => std::ops::Range<usize>{ .0 => _14, .1 => _15, };
+ debug ((this: std::ops::Range<usize>).0: usize) => _15;
+ debug ((this: std::ops::Range<usize>).1: usize) => _16;
scope 5 {
let _6: usize;
scope 6 {
debug new_len => _6;
- scope 7 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
+ scope 11 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
debug self => _5;
}
- scope 8 (inlined ptr::mut_ptr::<impl *mut u32>::add) {
+ scope 12 (inlined ptr::mut_ptr::<impl *mut u32>::add) {
debug self => _7;
debug count => _3;
- scope 9 {
+ scope 13 {
}
}
- scope 10 (inlined slice_from_raw_parts_mut::<u32>) {
+ scope 14 (inlined slice_from_raw_parts_mut::<u32>) {
debug data => _8;
debug len => _6;
let mut _9: *mut ();
- scope 11 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) {
+ scope 15 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) {
debug self => _8;
}
- scope 12 (inlined std::ptr::from_raw_parts_mut::<[u32]>) {
+ scope 16 (inlined std::ptr::from_raw_parts_mut::<[u32]>) {
debug data_address => _9;
debug metadata => _6;
let mut _10: *const ();
let mut _11: std::ptr::metadata::PtrComponents<[u32]>;
let mut _12: std::ptr::metadata::PtrRepr<[u32]>;
- scope 13 {
+ scope 17 {
+ }
+ }
+ }
+ }
+ scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) {
+ debug ((this: std::ops::Range<usize>).0: usize) => _15;
+ debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug slice => _5;
+ scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) {
+ debug self => _5;
+ let mut _14: *const [u32];
+ scope 9 (inlined std::ptr::metadata::<[u32]>) {
+ debug ptr => _14;
+ scope 10 {
}
}
}
@@ -63,9 +80,10 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
_4 = move (_2.1: usize);
StorageLive(_5);
_5 = &raw mut (*_1);
+ StorageLive(_6);
StorageLive(_14);
StorageLive(_15);
- StorageLive(_6);
+ StorageLive(_16);
_6 = SubUnchecked(_4, _3);
StorageLive(_8);
StorageLive(_7);
@@ -86,9 +104,10 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
- StorageDead(_6);
- StorageDead(_14);
+ StorageDead(_16);
StorageDead(_15);
+ StorageDead(_14);
+ StorageDead(_6);
StorageDead(_5);
_0 = &mut (*_13);
return;
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
index 2f5d356a2..2fd669aee 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
@@ -8,46 +8,63 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
let mut _4: usize;
scope 1 (inlined core::slice::<impl [u32]>::get_unchecked_mut::<std::ops::Range<usize>>) {
debug self => _1;
- debug index => std::ops::Range<usize>{ .0 => _3, .1 => _4, };
+ debug ((index: std::ops::Range<usize>).0: usize) => _3;
+ debug ((index: std::ops::Range<usize>).1: usize) => _4;
let mut _5: *mut [u32];
let mut _13: *mut [u32];
scope 2 {
scope 3 (inlined <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked_mut) {
- debug self => std::ops::Range<usize>{ .0 => _3, .1 => _4, };
+ debug ((self: std::ops::Range<usize>).0: usize) => _3;
+ debug ((self: std::ops::Range<usize>).1: usize) => _4;
debug slice => _5;
let mut _7: *mut u32;
let mut _8: *mut u32;
- let _14: usize;
let _15: usize;
+ let _16: usize;
scope 4 {
- debug this => std::ops::Range<usize>{ .0 => _14, .1 => _15, };
+ debug ((this: std::ops::Range<usize>).0: usize) => _15;
+ debug ((this: std::ops::Range<usize>).1: usize) => _16;
scope 5 {
let _6: usize;
scope 6 {
debug new_len => _6;
- scope 7 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
+ scope 11 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
debug self => _5;
}
- scope 8 (inlined ptr::mut_ptr::<impl *mut u32>::add) {
+ scope 12 (inlined ptr::mut_ptr::<impl *mut u32>::add) {
debug self => _7;
debug count => _3;
- scope 9 {
+ scope 13 {
}
}
- scope 10 (inlined slice_from_raw_parts_mut::<u32>) {
+ scope 14 (inlined slice_from_raw_parts_mut::<u32>) {
debug data => _8;
debug len => _6;
let mut _9: *mut ();
- scope 11 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) {
+ scope 15 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) {
debug self => _8;
}
- scope 12 (inlined std::ptr::from_raw_parts_mut::<[u32]>) {
+ scope 16 (inlined std::ptr::from_raw_parts_mut::<[u32]>) {
debug data_address => _9;
debug metadata => _6;
let mut _10: *const ();
let mut _11: std::ptr::metadata::PtrComponents<[u32]>;
let mut _12: std::ptr::metadata::PtrRepr<[u32]>;
- scope 13 {
+ scope 17 {
+ }
+ }
+ }
+ }
+ scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) {
+ debug ((this: std::ops::Range<usize>).0: usize) => _15;
+ debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug slice => _5;
+ scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) {
+ debug self => _5;
+ let mut _14: *const [u32];
+ scope 9 (inlined std::ptr::metadata::<[u32]>) {
+ debug ptr => _14;
+ scope 10 {
}
}
}
@@ -63,9 +80,10 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
_4 = move (_2.1: usize);
StorageLive(_5);
_5 = &raw mut (*_1);
+ StorageLive(_6);
StorageLive(_14);
StorageLive(_15);
- StorageLive(_6);
+ StorageLive(_16);
_6 = SubUnchecked(_4, _3);
StorageLive(_8);
StorageLive(_7);
@@ -86,9 +104,10 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
- StorageDead(_6);
- StorageDead(_14);
+ StorageDead(_16);
StorageDead(_15);
+ StorageDead(_14);
+ StorageDead(_6);
StorageDead(_5);
_0 = &mut (*_13);
return;
diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir
index 836fa2677..3d76bab7c 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir
@@ -195,7 +195,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb11 (cleanup): {
- drop(_2) -> [return: bb12, unwind terminate];
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir
index 65baaf64a..e8586cec9 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir
@@ -182,7 +182,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb11 (cleanup): {
- drop(_2) -> [return: bb12, unwind terminate];
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
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
index 4edf4b4fb..4afe2eda1 100644
--- 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
@@ -75,17 +75,19 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
_8 = Lt(move _6, move _7);
StorageDead(_7);
StorageDead(_6);
- StorageDead(_22);
- StorageDead(_21);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
}
bb2: {
+ StorageDead(_22);
+ StorageDead(_21);
_9 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
+ StorageDead(_22);
+ StorageDead(_21);
_10 = (_5.0: usize);
StorageLive(_11);
_11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable];
diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
index f7b19e80e..48092608d 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
@@ -75,17 +75,19 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
_8 = Lt(move _6, move _7);
StorageDead(_7);
StorageDead(_6);
- StorageDead(_22);
- StorageDead(_21);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
}
bb2: {
+ StorageDead(_22);
+ StorageDead(_21);
_9 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
+ StorageDead(_22);
+ StorageDead(_21);
_10 = (_5.0: usize);
StorageLive(_11);
_11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb12];
@@ -143,7 +145,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb12 (cleanup): {
- drop(_2) -> [return: bb13, unwind terminate];
+ drop(_2) -> [return: bb13, unwind terminate(cleanup)];
}
bb13 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
index 43f8806e1..3cdc49f60 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
@@ -196,7 +196,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb11 (cleanup): {
- drop(_2) -> [return: bb12, unwind terminate];
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/slice_iter.rs b/tests/mir-opt/pre-codegen/slice_iter.rs
index 4e954aa34..179005636 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.rs
+++ b/tests/mir-opt/pre-codegen/slice_iter.rs
@@ -1,6 +1,6 @@
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
-// ignore-debug
+// ignore-debug the standard library debug assertions leak into this test
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
index ed7107e53..1d3317efd 100644
--- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
@@ -1,21 +1,21 @@
// MIR for `outer` after PreCodegen
fn outer(_1: u8) -> u8 {
- debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15
- let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26
- let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13
+ debug v => _1; // in scope 0 at $DIR/spans.rs:9:14: 9:15
+ let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:9:24: 9:26
+ let mut _2: &u8; // in scope 0 at $DIR/spans.rs:10:11: 10:13
bb0: {
- StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13
- _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13
- _0 = inner(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/spans.rs:11:5: 11:14
- // mir::Constant
- // + span: $DIR/spans.rs:11:5: 11:10
- // + literal: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(<ZST>) }
+ StorageLive(_2); // scope 0 at $DIR/spans.rs:10:11: 10:13
+ _2 = &_1; // scope 0 at $DIR/spans.rs:10:11: 10:13
+ _0 = inner(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/spans.rs:10:5: 10:14
+ // mir::ConstOperand
+ // + span: $DIR/spans.rs:10:5: 10:10
+ // + const_: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(inner) }
}
bb1: {
- StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14
- return; // scope 0 at $DIR/spans.rs:12:2: 12:2
+ StorageDead(_2); // scope 0 at $DIR/spans.rs:10:13: 10:14
+ return; // scope 0 at $DIR/spans.rs:11:2: 11:2
}
}
diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
index dc436dc26..aba66861f 100644
--- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
@@ -1,21 +1,21 @@
// MIR for `outer` after PreCodegen
fn outer(_1: u8) -> u8 {
- debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15
- let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26
- let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13
+ debug v => _1; // in scope 0 at $DIR/spans.rs:9:14: 9:15
+ let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:9:24: 9:26
+ let mut _2: &u8; // in scope 0 at $DIR/spans.rs:10:11: 10:13
bb0: {
- StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13
- _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13
- _0 = inner(move _2) -> [return: bb1, unwind continue]; // scope 0 at $DIR/spans.rs:11:5: 11:14
- // mir::Constant
- // + span: $DIR/spans.rs:11:5: 11:10
- // + literal: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(<ZST>) }
+ StorageLive(_2); // scope 0 at $DIR/spans.rs:10:11: 10:13
+ _2 = &_1; // scope 0 at $DIR/spans.rs:10:11: 10:13
+ _0 = inner(move _2) -> [return: bb1, unwind continue]; // scope 0 at $DIR/spans.rs:10:5: 10:14
+ // mir::ConstOperand
+ // + span: $DIR/spans.rs:10:5: 10:10
+ // + const_: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(inner) }
}
bb1: {
- StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14
- return; // scope 0 at $DIR/spans.rs:12:2: 12:2
+ StorageDead(_2); // scope 0 at $DIR/spans.rs:10:13: 10:14
+ return; // scope 0 at $DIR/spans.rs:11:2: 11:2
}
}
diff --git a/tests/mir-opt/pre-codegen/spans.rs b/tests/mir-opt/pre-codegen/spans.rs
index 6ae9935ee..295eb0476 100644
--- a/tests/mir-opt/pre-codegen/spans.rs
+++ b/tests/mir-opt/pre-codegen/spans.rs
@@ -2,7 +2,6 @@
//
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -Zmir-include-spans
-// ignore-wasm32
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/try_identity.rs b/tests/mir-opt/pre-codegen/try_identity.rs
index 079ecccab..a227c82d6 100644
--- a/tests/mir-opt/pre-codegen/try_identity.rs
+++ b/tests/mir-opt/pre-codegen/try_identity.rs
@@ -1,6 +1,5 @@
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
-// ignore-debug
// Track the status of MIR optimizations simplifying `Ok(res?)` for both the old and new desugarings
// of that syntax.
diff --git a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff
index 33322c41b..6c469d744 100644
--- a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff
+++ b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff
@@ -34,10 +34,10 @@
}
bb4: {
-- _4 = &shallow _1;
-- _5 = &shallow (*((_1 as Some).0: &&i32));
-- _6 = &shallow ((_1 as Some).0: &&i32);
-- _7 = &shallow (*(*((_1 as Some).0: &&i32)));
+- _4 = &fake _1;
+- _5 = &fake (*((_1 as Some).0: &&i32));
+- _6 = &fake ((_1 as Some).0: &&i32);
+- _7 = &fake (*(*((_1 as Some).0: &&i32)));
+ nop;
+ nop;
+ nop;
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
index 33322c41b..6c469d744 100644
--- 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
@@ -34,10 +34,10 @@
}
bb4: {
-- _4 = &shallow _1;
-- _5 = &shallow (*((_1 as Some).0: &&i32));
-- _6 = &shallow ((_1 as Some).0: &&i32);
-- _7 = &shallow (*(*((_1 as Some).0: &&i32)));
+- _4 = &fake _1;
+- _5 = &fake (*((_1 as Some).0: &&i32));
+- _6 = &fake ((_1 as Some).0: &&i32);
+- _7 = &fake (*(*((_1 as Some).0: &&i32)));
+ nop;
+ nop;
+ nop;
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
index 70efdbf4b..566b6af95 100644
--- 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
@@ -19,17 +19,16 @@ fn array_casts() -> () {
let mut _18: &usize;
let _19: usize;
let mut _22: bool;
- let mut _23: bool;
+ let mut _23: usize;
let mut _24: usize;
- let mut _25: usize;
- let mut _26: !;
- let _28: !;
- let mut _29: core::panicking::AssertKind;
- let mut _30: &usize;
- let _31: &usize;
- let mut _32: &usize;
- let _33: &usize;
- let mut _34: std::option::Option<std::fmt::Arguments<'_>>;
+ let mut _25: !;
+ let _27: !;
+ let mut _28: core::panicking::AssertKind;
+ let mut _29: &usize;
+ let _30: &usize;
+ let mut _31: &usize;
+ let _32: &usize;
+ let mut _33: std::option::Option<std::fmt::Arguments<'_>>;
scope 1 {
debug x => _1;
let _2: *mut usize;
@@ -45,15 +44,15 @@ fn array_casts() -> () {
debug p => _9;
let _20: &usize;
let _21: &usize;
- let mut _35: &usize;
+ let mut _34: &usize;
scope 6 {
}
scope 7 {
debug left_val => _20;
debug right_val => _21;
- let _27: core::panicking::AssertKind;
+ let _26: core::panicking::AssertKind;
scope 8 {
- debug kind => _27;
+ debug kind => _26;
}
}
}
@@ -110,9 +109,9 @@ fn array_casts() -> () {
_15 = (*_16);
_14 = &_15;
StorageLive(_18);
- _35 = const _;
- Retag(_35);
- _18 = &(*_35);
+ _34 = const _;
+ Retag(_34);
+ _18 = &(*_34);
_13 = (move _14, move _18);
Retag(_13);
StorageDead(_18);
@@ -125,39 +124,16 @@ fn array_casts() -> () {
Retag(_21);
StorageLive(_22);
StorageLive(_23);
+ _23 = (*_20);
StorageLive(_24);
- _24 = (*_20);
- StorageLive(_25);
- _25 = (*_21);
- _23 = Eq(move _24, move _25);
- StorageDead(_25);
- StorageDead(_24);
- _22 = Not(move _23);
- StorageDead(_23);
+ _24 = (*_21);
+ _22 = Eq(move _23, move _24);
switchInt(move _22) -> [0: bb4, otherwise: bb3];
}
bb3: {
- StorageLive(_27);
- _27 = core::panicking::AssertKind::Eq;
- StorageLive(_28);
- StorageLive(_29);
- _29 = move _27;
- StorageLive(_30);
- StorageLive(_31);
- _31 = &(*_20);
- _30 = &(*_31);
- StorageLive(_32);
- StorageLive(_33);
- _33 = &(*_21);
- _32 = &(*_33);
- StorageLive(_34);
- _34 = Option::<Arguments<'_>>::None;
- Retag(_34);
- _28 = core::panicking::assert_failed::<usize, usize>(move _29, move _30, move _32, move _34) -> unwind unreachable;
- }
-
- bb4: {
+ StorageDead(_24);
+ StorageDead(_23);
_12 = const ();
StorageDead(_22);
StorageDead(_21);
@@ -173,4 +149,26 @@ fn array_casts() -> () {
StorageDead(_1);
return;
}
+
+ bb4: {
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageLive(_26);
+ _26 = core::panicking::AssertKind::Eq;
+ StorageLive(_27);
+ StorageLive(_28);
+ _28 = move _26;
+ StorageLive(_29);
+ StorageLive(_30);
+ _30 = &(*_20);
+ _29 = &(*_30);
+ StorageLive(_31);
+ StorageLive(_32);
+ _32 = &(*_21);
+ _31 = &(*_32);
+ StorageLive(_33);
+ _33 = Option::<Arguments<'_>>::None;
+ Retag(_33);
+ _27 = core::panicking::assert_failed::<usize, usize>(move _28, move _29, move _31, move _33) -> unwind unreachable;
+ }
}
diff --git a/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
index cfa9628d4..d0d317632 100644
--- a/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
+++ b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -19,17 +19,16 @@ fn array_casts() -> () {
let mut _18: &usize;
let _19: usize;
let mut _22: bool;
- let mut _23: bool;
+ let mut _23: usize;
let mut _24: usize;
- let mut _25: usize;
- let mut _26: !;
- let _28: !;
- let mut _29: core::panicking::AssertKind;
- let mut _30: &usize;
- let _31: &usize;
- let mut _32: &usize;
- let _33: &usize;
- let mut _34: std::option::Option<std::fmt::Arguments<'_>>;
+ let mut _25: !;
+ let _27: !;
+ let mut _28: core::panicking::AssertKind;
+ let mut _29: &usize;
+ let _30: &usize;
+ let mut _31: &usize;
+ let _32: &usize;
+ let mut _33: std::option::Option<std::fmt::Arguments<'_>>;
scope 1 {
debug x => _1;
let _2: *mut usize;
@@ -45,15 +44,15 @@ fn array_casts() -> () {
debug p => _9;
let _20: &usize;
let _21: &usize;
- let mut _35: &usize;
+ let mut _34: &usize;
scope 6 {
}
scope 7 {
debug left_val => _20;
debug right_val => _21;
- let _27: core::panicking::AssertKind;
+ let _26: core::panicking::AssertKind;
scope 8 {
- debug kind => _27;
+ debug kind => _26;
}
}
}
@@ -110,9 +109,9 @@ fn array_casts() -> () {
_15 = (*_16);
_14 = &_15;
StorageLive(_18);
- _35 = const _;
- Retag(_35);
- _18 = &(*_35);
+ _34 = const _;
+ Retag(_34);
+ _18 = &(*_34);
_13 = (move _14, move _18);
Retag(_13);
StorageDead(_18);
@@ -125,39 +124,16 @@ fn array_casts() -> () {
Retag(_21);
StorageLive(_22);
StorageLive(_23);
+ _23 = (*_20);
StorageLive(_24);
- _24 = (*_20);
- StorageLive(_25);
- _25 = (*_21);
- _23 = Eq(move _24, move _25);
- StorageDead(_25);
- StorageDead(_24);
- _22 = Not(move _23);
- StorageDead(_23);
+ _24 = (*_21);
+ _22 = Eq(move _23, move _24);
switchInt(move _22) -> [0: bb4, otherwise: bb3];
}
bb3: {
- StorageLive(_27);
- _27 = core::panicking::AssertKind::Eq;
- StorageLive(_28);
- StorageLive(_29);
- _29 = move _27;
- StorageLive(_30);
- StorageLive(_31);
- _31 = &(*_20);
- _30 = &(*_31);
- StorageLive(_32);
- StorageLive(_33);
- _33 = &(*_21);
- _32 = &(*_33);
- StorageLive(_34);
- _34 = Option::<Arguments<'_>>::None;
- Retag(_34);
- _28 = core::panicking::assert_failed::<usize, usize>(move _29, move _30, move _32, move _34) -> unwind continue;
- }
-
- bb4: {
+ StorageDead(_24);
+ StorageDead(_23);
_12 = const ();
StorageDead(_22);
StorageDead(_21);
@@ -173,4 +149,26 @@ fn array_casts() -> () {
StorageDead(_1);
return;
}
+
+ bb4: {
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageLive(_26);
+ _26 = core::panicking::AssertKind::Eq;
+ StorageLive(_27);
+ StorageLive(_28);
+ _28 = move _26;
+ StorageLive(_29);
+ StorageLive(_30);
+ _30 = &(*_20);
+ _29 = &(*_30);
+ StorageLive(_31);
+ StorageLive(_32);
+ _32 = &(*_21);
+ _31 = &(*_32);
+ StorageLive(_33);
+ _33 = Option::<Arguments<'_>>::None;
+ Retag(_33);
+ _27 = core::panicking::assert_failed::<usize, usize>(move _28, move _29, move _31, move _33) -> unwind continue;
+ }
}
diff --git a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir
index 4a3d19784..7f3310919 100644
--- a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir
+++ b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir
@@ -1,6 +1,6 @@
// MIR for `main::{closure#0}` after SimplifyCfg-elaborate-drops
-fn main::{closure#0}(_1: &[closure@main::{closure#0}], _2: &i32) -> &i32 {
+fn main::{closure#0}(_1: &{closure@main::{closure#0}}, _2: &i32) -> &i32 {
debug x => _2;
let mut _0: &i32;
let _3: &i32;
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
index 4a3d19784..7f3310919 100644
--- 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
@@ -1,6 +1,6 @@
// MIR for `main::{closure#0}` after SimplifyCfg-elaborate-drops
-fn main::{closure#0}(_1: &[closure@main::{closure#0}], _2: &i32) -> &i32 {
+fn main::{closure#0}(_1: &{closure@main::{closure#0}}, _2: &i32) -> &i32 {
debug x => _2;
let mut _0: &i32;
let _3: &i32;
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
index fb37bec10..ec894fa51 100644
--- 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
@@ -10,7 +10,7 @@ fn main() -> () {
let mut _7: &mut i32;
let mut _9: &mut i32;
let mut _12: *mut i32;
- let mut _14: [closure@main::{closure#0}];
+ let mut _14: {closure@main::{closure#0}};
let mut _16: for<'a> fn(&'a i32) -> &'a i32;
let mut _17: &i32;
let _18: &i32;
@@ -103,7 +103,7 @@ fn main() -> () {
StorageDead(_2);
StorageLive(_13);
StorageLive(_14);
- _14 = [closure@main::{closure#0}];
+ _14 = {closure@main::{closure#0}};
Retag(_14);
_13 = move _14 as for<'a> fn(&'a i32) -> &'a i32 (PointerCoercion(ClosureFnPointer(Normal)));
StorageDead(_14);
diff --git a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
index 508f96409..d89124f69 100644
--- a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
+++ b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -10,7 +10,7 @@ fn main() -> () {
let mut _7: &mut i32;
let mut _9: &mut i32;
let mut _12: *mut i32;
- let mut _14: [closure@main::{closure#0}];
+ let mut _14: {closure@main::{closure#0}};
let mut _16: for<'a> fn(&'a i32) -> &'a i32;
let mut _17: &i32;
let _18: &i32;
@@ -103,7 +103,7 @@ fn main() -> () {
StorageDead(_2);
StorageLive(_13);
StorageLive(_14);
- _14 = [closure@main::{closure#0}];
+ _14 = {closure@main::{closure#0}};
Retag(_14);
_13 = move _14 as for<'a> fn(&'a i32) -> &'a i32 (PointerCoercion(ClosureFnPointer(Normal)));
StorageDead(_14);
@@ -167,11 +167,11 @@ fn main() -> () {
}
bb7 (cleanup): {
- drop(_21) -> [return: bb9, unwind terminate];
+ drop(_21) -> [return: bb9, unwind terminate(cleanup)];
}
bb8 (cleanup): {
- drop(_5) -> [return: bb9, unwind terminate];
+ drop(_5) -> [return: bb9, unwind terminate(cleanup)];
}
bb9 (cleanup): {
diff --git a/tests/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir b/tests/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir
index 9bf69acd3..3a8b457a7 100644
--- a/tests/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir
+++ b/tests/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir
@@ -24,7 +24,7 @@ fn std::ptr::drop_in_place(_1: *mut [String]) -> () {
bb3 (cleanup): {
_4 = &raw mut (*_1)[_3];
_3 = Add(move _3, const 1_usize);
- drop((*_4)) -> [return: bb4, unwind terminate];
+ drop((*_4)) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
diff --git a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff
index bb14b909a..b020d1baa 100644
--- a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff
@@ -33,7 +33,8 @@
+ let _32: u32;
scope 1 {
- debug foo => _1;
-+ debug foo => Foo<T>{ .0 => _31, .1 => _32, };
++ debug ((foo: Foo<T>).0: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>) => _31;
++ debug ((foo: Foo<T>).1: u32) => _32;
let _5: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>;
scope 2 {
debug x => _5;
diff --git a/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff
index 7ee043169..1330f9b3a 100644
--- a/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff
@@ -8,7 +8,8 @@
+ let _5: u8;
scope 1 {
- debug y => _1;
-+ debug y => (usize, u8){ .0 => _4, .1 => _5, };
++ debug ((y: (usize, u8)).0: usize) => _4;
++ debug ((y: (usize, u8)).1: u8) => _5;
let _2: usize;
scope 2 {
debug t => _2;
diff --git a/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff
index 0a1de891a..362133863 100644
--- a/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff
@@ -11,7 +11,10 @@
+ let _14: std::option::Option<isize>;
scope 1 {
- debug y => _2;
-+ debug y => Foo{ .0 => _11, .1 => _12, .2 => _13, .3 => _14, };
++ debug ((y: Foo).0: u8) => _11;
++ debug ((y: Foo).1: ()) => _12;
++ debug ((y: Foo).2: &str) => _13;
++ debug ((y: Foo).3: std::option::Option<isize>) => _14;
let _3: u8;
scope 2 {
debug t => _3;
@@ -25,7 +28,10 @@
+ let _10: std::option::Option<isize>;
scope 4 {
- debug z => _5;
-+ debug z => Foo{ .0 => _7, .1 => _8, .2 => _9, .3 => _10, };
++ debug ((z: Foo).0: u8) => _7;
++ debug ((z: Foo).1: ()) => _8;
++ debug ((z: Foo).2: &str) => _9;
++ debug ((z: Foo).3: std::option::Option<isize>) => _10;
let _6: ();
scope 5 {
debug a => _6;
diff --git a/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff
index d7c57c293..304bf2fb1 100644
--- a/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff
@@ -11,7 +11,10 @@
+ let _8: std::option::Option<isize>;
scope 1 {
- debug y => _2;
-+ debug y => Foo{ .0 => _5, .1 => _6, .2 => _7, .3 => _8, };
++ debug ((y: Foo).0: u8) => _5;
++ debug ((y: Foo).1: ()) => _6;
++ debug ((y: Foo).2: &str) => _7;
++ debug ((y: Foo).3: std::option::Option<isize>) => _8;
let _3: u8;
scope 2 {
debug t => _3;
diff --git a/tests/mir-opt/ssa_unreachable_116212.rs b/tests/mir-opt/ssa_unreachable_116212.rs
new file mode 100644
index 000000000..f58866587
--- /dev/null
+++ b/tests/mir-opt/ssa_unreachable_116212.rs
@@ -0,0 +1,14 @@
+// Regression test for issue #116212.
+
+#![feature(never_type)]
+
+use std::mem::MaybeUninit;
+
+struct Foo {
+ x: u8,
+ y: !,
+}
+
+fn main() {
+ let foo = unsafe { MaybeUninit::<Foo>::uninit().assume_init() };
+}
diff --git a/tests/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir b/tests/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir
index ee90a5407..b58794183 100644
--- a/tests/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir
+++ b/tests/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir
@@ -22,7 +22,7 @@ fn std::ptr::drop_in_place(_1: *mut Vec<i32>) -> () {
}
bb4 (cleanup): {
- drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> [return: bb2, unwind terminate];
+ drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> [return: bb2, unwind terminate(cleanup)];
}
bb5: {