summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mir-opt')
-rw-r--r--tests/mir-opt/README.md18
-rw-r--r--tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir542
-rw-r--r--tests/mir-opt/address_of.borrow_and_cast.SimplifyCfg-initial.after.mir68
-rw-r--r--tests/mir-opt/address_of.rs1
-rw-r--r--tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir64
-rw-r--r--tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir61
-rw-r--r--tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir61
-rw-r--r--tests/mir-opt/array_index_is_temporary.rs9
-rw-r--r--tests/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir16
-rw-r--r--tests/mir-opt/asm_unwind_panic_abort.rs3
-rw-r--r--tests/mir-opt/basic_assignment.main.ElaborateDrops.diff94
-rw-r--r--tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir90
-rw-r--r--tests/mir-opt/basic_assignment.rs18
-rw-r--r--tests/mir-opt/bool_compare.opt1.InstSimplify.diff35
-rw-r--r--tests/mir-opt/bool_compare.opt2.InstSimplify.diff35
-rw-r--r--tests/mir-opt/bool_compare.opt3.InstSimplify.diff35
-rw-r--r--tests/mir-opt/bool_compare.opt4.InstSimplify.diff35
-rw-r--r--tests/mir-opt/bool_compare.rs28
-rw-r--r--tests/mir-opt/box_expr.main.ElaborateDrops.before.mir80
-rw-r--r--tests/mir-opt/box_expr.main.ElaborateDrops.diff89
-rw-r--r--tests/mir-opt/box_expr.rs17
-rw-r--r--tests/mir-opt/building/async_await.a-{closure#0}.coroutine_resume.0.mir47
-rw-r--r--tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir39
-rw-r--r--tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir354
-rw-r--r--tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir343
-rw-r--r--tests/mir-opt/building/async_await.rs7
-rw-r--r--tests/mir-opt/building/custom/aggregate_exprs.adt.built.after.mir18
-rw-r--r--tests/mir-opt/building/custom/aggregate_exprs.array.built.after.mir16
-rw-r--r--tests/mir-opt/building/custom/aggregate_exprs.rs1
-rw-r--r--tests/mir-opt/building/custom/aggregate_exprs.tuple.built.after.mir6
-rw-r--r--tests/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir18
-rw-r--r--tests/mir-opt/building/custom/arbitrary_let.rs1
-rw-r--r--tests/mir-opt/building/custom/arrays.arrays.built.after.mir14
-rw-r--r--tests/mir-opt/building/custom/arrays.rs1
-rw-r--r--tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir6
-rw-r--r--tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir6
-rw-r--r--tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir6
-rw-r--r--tests/mir-opt/building/custom/as_cast.rs1
-rw-r--r--tests/mir-opt/building/custom/composite_return.rs1
-rw-r--r--tests/mir-opt/building/custom/composite_return.tuple.built.after.mir8
-rw-r--r--tests/mir-opt/building/custom/consts.consts.built.after.mir27
-rw-r--r--tests/mir-opt/building/custom/consts.rs1
-rw-r--r--tests/mir-opt/building/custom/consts.statics.built.after.mir22
-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.rs72
-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/custom/enums.rs1
-rw-r--r--tests/mir-opt/building/custom/enums.set_discr.built.after.mir8
-rw-r--r--tests/mir-opt/building/custom/enums.set_discr_repr.built.after.mir6
-rw-r--r--tests/mir-opt/building/custom/enums.switch_bool.built.after.mir12
-rw-r--r--tests/mir-opt/building/custom/enums.switch_option.built.after.mir16
-rw-r--r--tests/mir-opt/building/custom/enums.switch_option_repr.built.after.mir16
-rw-r--r--tests/mir-opt/building/custom/operators.f.built.after.mir46
-rw-r--r--tests/mir-opt/building/custom/operators.rs1
-rw-r--r--tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir10
-rw-r--r--tests/mir-opt/building/custom/projections.rs1
-rw-r--r--tests/mir-opt/building/custom/projections.set.built.after.mir6
-rw-r--r--tests/mir-opt/building/custom/projections.simple_index.built.after.mir12
-rw-r--r--tests/mir-opt/building/custom/projections.tuples.built.after.mir8
-rw-r--r--tests/mir-opt/building/custom/projections.unions.built.after.mir6
-rw-r--r--tests/mir-opt/building/custom/projections.unwrap.built.after.mir6
-rw-r--r--tests/mir-opt/building/custom/projections.unwrap_deref.built.after.mir6
-rw-r--r--tests/mir-opt/building/custom/references.immut_ref.built.after.mir12
-rw-r--r--tests/mir-opt/building/custom/references.mut_ref.built.after.mir12
-rw-r--r--tests/mir-opt/building/custom/references.raw_pointer.built.after.mir6
-rw-r--r--tests/mir-opt/building/custom/references.raw_pointer_offset.built.after.mir6
-rw-r--r--tests/mir-opt/building/custom/references.rs1
-rw-r--r--tests/mir-opt/building/custom/simple_assign.rs1
-rw-r--r--tests/mir-opt/building/custom/simple_assign.simple.built.after.mir20
-rw-r--r--tests/mir-opt/building/custom/simple_assign.simple_ref.built.after.mir6
-rw-r--r--tests/mir-opt/building/custom/terminators.assert_nonzero.built.after.mir8
-rw-r--r--tests/mir-opt/building/custom/terminators.direct_call.built.after.mir9
-rw-r--r--tests/mir-opt/building/custom/terminators.drop_first.built.after.mir8
-rw-r--r--tests/mir-opt/building/custom/terminators.drop_second.built.after.mir6
-rw-r--r--tests/mir-opt/building/custom/terminators.indirect_call.built.after.mir6
-rw-r--r--tests/mir-opt/building/custom/terminators.rs9
-rw-r--r--tests/mir-opt/building/custom/unwind_action.rs68
-rw-r--r--tests/mir-opt/building/custom/unwind_terminate.rs34
-rw-r--r--tests/mir-opt/building/enum_cast.bar.built.after.mir30
-rw-r--r--tests/mir-opt/building/enum_cast.boo.built.after.mir30
-rw-r--r--tests/mir-opt/building/enum_cast.droppy.built.after.mir82
-rw-r--r--tests/mir-opt/building/enum_cast.far.built.after.mir30
-rw-r--r--tests/mir-opt/building/enum_cast.foo.built.after.mir20
-rw-r--r--tests/mir-opt/building/enum_cast.offsetty.built.after.mir38
-rw-r--r--tests/mir-opt/building/enum_cast.rs1
-rw-r--r--tests/mir-opt/building/enum_cast.signy.built.after.mir38
-rw-r--r--tests/mir-opt/building/enum_cast.unsigny.built.after.mir20
-rw-r--r--tests/mir-opt/building/issue_101867.main.built.after.mir76
-rw-r--r--tests/mir-opt/building/issue_101867.rs1
-rw-r--r--tests/mir-opt/building/issue_110508.rs14
-rw-r--r--tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir14
-rw-r--r--tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir14
-rw-r--r--tests/mir-opt/building/issue_49232.main.built.after.mir77
-rw-r--r--tests/mir-opt/building/issue_49232.rs1
-rw-r--r--tests/mir-opt/building/logical_or_in_conditional.rs40
-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.mir126
-rw-r--r--tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir126
-rw-r--r--tests/mir-opt/building/match_false_edges.main.built.after.mir190
-rw-r--r--tests/mir-opt/building/match_false_edges.rs1
-rw-r--r--tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir133
-rw-r--r--tests/mir-opt/building/receiver_ptr_mutability.rs1
-rw-r--r--tests/mir-opt/building/shifts.rs1
-rw-r--r--tests/mir-opt/building/shifts.shift_signed.built.after.mir238
-rw-r--r--tests/mir-opt/building/shifts.shift_unsigned.built.after.mir214
-rw-r--r--tests/mir-opt/building/simple_match.match_bool.built.after.mir20
-rw-r--r--tests/mir-opt/building/simple_match.rs1
-rw-r--r--tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir389
-rw-r--r--tests/mir-opt/building/storage_live_dead_in_statics.rs1
-rw-r--r--tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir116
-rw-r--r--tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir116
-rw-r--r--tests/mir-opt/building/uniform_array_move_out.rs1
-rw-r--r--tests/mir-opt/building/while_storage.rs60
-rw-r--r--tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir70
-rw-r--r--tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir70
-rw-r--r--tests/mir-opt/byte_slice.main.SimplifyCfg-elaborate-drops.after.mir31
-rw-r--r--tests/mir-opt/byte_slice.rs1
-rw-r--r--tests/mir-opt/casts.redundant.InstSimplify.diff25
-rw-r--r--tests/mir-opt/casts.redundant.PreCodegen.after.mir14
-rw-r--r--tests/mir-opt/casts.roundtrip.PreCodegen.after.mir15
-rw-r--r--tests/mir-opt/casts.rs17
-rw-r--r--tests/mir-opt/combine_array_len.norm2.InstSimplify.diff77
-rw-r--r--tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff82
-rw-r--r--tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff90
-rw-r--r--tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff43
-rw-r--r--tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff24
-rw-r--r--tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir59
-rw-r--r--tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir63
-rw-r--r--tests/mir-opt/const_allocation.rs1
-rw-r--r--tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir57
-rw-r--r--tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir59
-rw-r--r--tests/mir-opt/const_allocation2.rs1
-rw-r--r--tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir43
-rw-r--r--tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir41
-rw-r--r--tests/mir-opt/const_allocation3.rs1
-rw-r--r--tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff150
-rw-r--r--tests/mir-opt/const_debuginfo.rs16
-rw-r--r--tests/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff56
-rw-r--r--tests/mir-opt/const_goto.rs1
-rw-r--r--tests/mir-opt/const_goto_const_eval_fail.f.ConstGoto.diff44
-rw-r--r--tests/mir-opt/const_goto_const_eval_fail.rs3
-rw-r--r--tests/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff131
-rw-r--r--tests/mir-opt/const_goto_storage.rs1
-rw-r--r--tests/mir-opt/const_promotion_extern_static.BAR-promoted[0].SimplifyCfg-elaborate-drops.after.mir23
-rw-r--r--tests/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff64
-rw-r--r--tests/mir-opt/const_promotion_extern_static.BOP.built.after.mir20
-rw-r--r--tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir23
-rw-r--r--tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff64
-rw-r--r--tests/mir-opt/const_promotion_extern_static.rs1
-rw-r--r--tests/mir-opt/const_prop/address_of_pair.fn0.ConstProp.diff58
-rw-r--r--tests/mir-opt/const_prop/address_of_pair.rs14
-rw-r--r--tests/mir-opt/const_prop/aggregate.foo.ConstProp.diff55
-rw-r--r--tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-abort.diff55
-rw-r--r--tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-unwind.diff55
-rw-r--r--tests/mir-opt/const_prop/aggregate.foo.PreCodegen.after.mir49
-rw-r--r--tests/mir-opt/const_prop/aggregate.main.ConstProp.diff44
-rw-r--r--tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff42
-rw-r--r--tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff42
-rw-r--r--tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir39
-rw-r--r--tests/mir-opt/const_prop/aggregate.rs19
-rw-r--r--tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.diff39
-rw-r--r--tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff39
-rw-r--r--tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff39
-rw-r--r--tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.diff39
-rw-r--r--tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff39
-rw-r--r--tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff39
-rw-r--r--tests/mir-opt/const_prop/array_index.rs5
-rw-r--r--tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.diff53
-rw-r--r--tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff54
-rw-r--r--tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff54
-rw-r--r--tests/mir-opt/const_prop/bad_op_div_by_zero.rs9
-rw-r--r--tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff53
-rw-r--r--tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff54
-rw-r--r--tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff54
-rw-r--r--tests/mir-opt/const_prop/bad_op_mod_by_zero.rs10
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff57
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff54
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff54
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff57
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff54
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff54
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs9
-rw-r--r--tests/mir-opt/const_prop/boolean_identities.rs11
-rw-r--r--tests/mir-opt/const_prop/boolean_identities.test.ConstProp.diff58
-rw-r--r--tests/mir-opt/const_prop/boxes.main.ConstProp.diff60
-rw-r--r--tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff54
-rw-r--r--tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff58
-rw-r--r--tests/mir-opt/const_prop/boxes.rs9
-rw-r--r--tests/mir-opt/const_prop/cast.main.ConstProp.diff30
-rw-r--r--tests/mir-opt/const_prop/cast.rs6
-rw-r--r--tests/mir-opt/const_prop/checked_add.main.ConstProp.diff28
-rw-r--r--tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff32
-rw-r--r--tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff32
-rw-r--r--tests/mir-opt/const_prop/checked_add.rs6
-rw-r--r--tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff44
-rw-r--r--tests/mir-opt/const_prop/const_prop_fails_gracefully.rs11
-rw-r--r--tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff31
-rw-r--r--tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff26
-rw-r--r--tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff26
-rw-r--r--tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir9
-rw-r--r--tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.panic-abort.mir9
-rw-r--r--tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.panic-unwind.mir9
-rw-r--r--tests/mir-opt/const_prop/control_flow_simplification.rs3
-rw-r--r--tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff57
-rw-r--r--tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff57
-rw-r--r--tests/mir-opt/const_prop/discriminant.rs14
-rw-r--r--tests/mir-opt/const_prop/indirect.main.ConstProp.diff33
-rw-r--r--tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff37
-rw-r--r--tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff37
-rw-r--r--tests/mir-opt/const_prop/indirect.rs5
-rw-r--r--tests/mir-opt/const_prop/indirect_mutation.bar.ConstProp.diff41
-rw-r--r--tests/mir-opt/const_prop/indirect_mutation.foo.ConstProp.diff35
-rw-r--r--tests/mir-opt/const_prop/indirect_mutation.rs41
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.diff39
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff45
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff45
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.rs10
-rw-r--r--tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff92
-rw-r--r--tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff106
-rw-r--r--tests/mir-opt/const_prop/invalid_constant.rs1
-rw-r--r--tests/mir-opt/const_prop/issue_66971.main.ConstProp.diff23
-rw-r--r--tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff37
-rw-r--r--tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff37
-rw-r--r--tests/mir-opt/const_prop/issue_66971.rs5
-rw-r--r--tests/mir-opt/const_prop/issue_67019.main.ConstProp.diff28
-rw-r--r--tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff42
-rw-r--r--tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff42
-rw-r--r--tests/mir-opt/const_prop/issue_67019.rs5
-rw-r--r--tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff39
-rw-r--r--tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff39
-rw-r--r--tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff39
-rw-r--r--tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff39
-rw-r--r--tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff39
-rw-r--r--tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff39
-rw-r--r--tests/mir-opt/const_prop/large_array_index.rs4
-rw-r--r--tests/mir-opt/const_prop/mult_by_zero.rs6
-rw-r--r--tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff18
-rw-r--r--tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff30
-rw-r--r--tests/mir-opt/const_prop/mutable_variable.rs6
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff40
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate.rs6
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff38
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs8
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff35
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-abort.diff32
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-unwind.diff32
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs9
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff57
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_no_prop.rs8
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff53
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff54
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff54
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs15
-rw-r--r--tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff44
-rw-r--r--tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff124
-rw-r--r--tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff124
-rw-r--r--tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff40
-rw-r--r--tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff110
-rw-r--r--tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff110
-rw-r--r--tests/mir-opt/const_prop/offset_of.rs21
-rw-r--r--tests/mir-opt/const_prop/overwrite_with_const_with_params.rs26
-rw-r--r--tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff20
-rw-r--r--tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-abort.diff38
-rw-r--r--tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-unwind.diff38
-rw-r--r--tests/mir-opt/const_prop/pointer_expose_address.rs18
-rw-r--r--tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff62
-rw-r--r--tests/mir-opt/const_prop/read_immutable_static.rs3
-rw-r--r--tests/mir-opt/const_prop/ref_deref.main.ConstProp.diff34
-rw-r--r--tests/mir-opt/const_prop/ref_deref.rs7
-rw-r--r--tests/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff34
-rw-r--r--tests/mir-opt/const_prop/ref_deref_project.rs8
-rw-r--r--tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff33
-rw-r--r--tests/mir-opt/const_prop/reify_fn_ptr.rs4
-rw-r--r--tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff44
-rw-r--r--tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff44
-rw-r--r--tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff44
-rw-r--r--tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff44
-rw-r--r--tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff44
-rw-r--r--tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff44
-rw-r--r--tests/mir-opt/const_prop/repeat.rs6
-rw-r--r--tests/mir-opt/const_prop/return_place.add.ConstProp.diff21
-rw-r--r--tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff25
-rw-r--r--tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff25
-rw-r--r--tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir16
-rw-r--r--tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir20
-rw-r--r--tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir20
-rw-r--r--tests/mir-opt/const_prop/return_place.rs4
-rw-r--r--tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff34
-rw-r--r--tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-abort.diff32
-rw-r--r--tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff32
-rw-r--r--tests/mir-opt/const_prop/scalar_literal_propagation.rs5
-rw-r--r--tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff50
-rw-r--r--tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff50
-rw-r--r--tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff50
-rw-r--r--tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff50
-rw-r--r--tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff50
-rw-r--r--tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff50
-rw-r--r--tests/mir-opt/const_prop/slice_len.rs8
-rw-r--r--tests/mir-opt/const_prop/switch_int.main.ConstProp.diff34
-rw-r--r--tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-abort.diff28
-rw-r--r--tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-unwind.diff28
-rw-r--r--tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff34
-rw-r--r--tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-abort.diff28
-rw-r--r--tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff28
-rw-r--r--tests/mir-opt/const_prop/switch_int.rs10
-rw-r--r--tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff8
-rw-r--r--tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff8
-rw-r--r--tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff8
-rw-r--r--tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff8
-rw-r--r--tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff8
-rw-r--r--tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff8
-rw-r--r--tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff21
-rw-r--r--tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff21
-rw-r--r--tests/mir-opt/const_prop/transmute.rs22
-rw-r--r--tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff22
-rw-r--r--tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff22
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff20
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff20
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff18
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff18
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff25
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff25
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff17
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff17
-rw-r--r--tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff8
-rw-r--r--tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff8
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff35
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff45
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff45
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.rs6
-rw-r--r--tests/mir-opt/const_prop/while_let_loops.change_loop_body.ConstProp.diff58
-rw-r--r--tests/mir-opt/const_prop/while_let_loops.rs2
-rw-r--r--tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff41
-rw-r--r--tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff35
-rw-r--r--tests/mir-opt/const_prop_miscompile.rs23
-rw-r--r--tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff33
-rw-r--r--tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-abort.diff27
-rw-r--r--tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-unwind.diff27
-rw-r--r--tests/mir-opt/copy-prop/borrowed_local.rs7
-rw-r--r--tests/mir-opt/copy-prop/branch.foo.CopyProp.diff65
-rw-r--r--tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-abort.diff56
-rw-r--r--tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-unwind.diff56
-rw-r--r--tests/mir-opt/copy-prop/branch.rs3
-rw-r--r--tests/mir-opt/copy-prop/calls.multiple_edges.CopyProp.diff21
-rw-r--r--tests/mir-opt/copy-prop/calls.nrvo.CopyProp.diff24
-rw-r--r--tests/mir-opt/copy-prop/calls.rs44
-rw-r--r--tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.diff23
-rw-r--r--tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-abort.diff23
-rw-r--r--tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-unwind.diff23
-rw-r--r--tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.diff28
-rw-r--r--tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-abort.diff25
-rw-r--r--tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-unwind.diff25
-rw-r--r--tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.diff18
-rw-r--r--tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-abort.diff18
-rw-r--r--tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-unwind.diff18
-rw-r--r--tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.diff28
-rw-r--r--tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-abort.diff25
-rw-r--r--tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-unwind.diff25
-rw-r--r--tests/mir-opt/copy-prop/copy_propagation_arg.rs3
-rw-r--r--tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.diff31
-rw-r--r--tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-abort.diff25
-rw-r--r--tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-unwind.diff25
-rw-r--r--tests/mir-opt/copy-prop/custom_move_arg.rs7
-rw-r--r--tests/mir-opt/copy-prop/cycle.main.CopyProp.diff60
-rw-r--r--tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-abort.diff54
-rw-r--r--tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-unwind.diff54
-rw-r--r--tests/mir-opt/copy-prop/cycle.rs3
-rw-r--r--tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.mir29
-rw-r--r--tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-abort.mir26
-rw-r--r--tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-unwind.mir26
-rw-r--r--tests/mir-opt/copy-prop/dead_stores_79191.rs3
-rw-r--r--tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.mir29
-rw-r--r--tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-abort.mir26
-rw-r--r--tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-unwind.mir26
-rw-r--r--tests/mir-opt/copy-prop/dead_stores_better.rs3
-rw-r--r--tests/mir-opt/copy-prop/issue_107511.main.CopyProp.diff138
-rw-r--r--tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff129
-rw-r--r--tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-unwind.diff129
-rw-r--r--tests/mir-opt/copy-prop/issue_107511.rs3
-rw-r--r--tests/mir-opt/copy-prop/move_arg.f.CopyProp.diff40
-rw-r--r--tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-abort.diff37
-rw-r--r--tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-unwind.diff37
-rw-r--r--tests/mir-opt/copy-prop/move_arg.rs3
-rw-r--r--tests/mir-opt/copy-prop/move_projection.f.CopyProp.diff31
-rw-r--r--tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-abort.diff25
-rw-r--r--tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-unwind.diff25
-rw-r--r--tests/mir-opt/copy-prop/move_projection.rs7
-rw-r--r--tests/mir-opt/copy-prop/mutate_through_pointer.f.CopyProp.diff20
-rw-r--r--tests/mir-opt/copy-prop/mutate_through_pointer.rs3
-rw-r--r--tests/mir-opt/copy-prop/non_dominate.f.CopyProp.diff22
-rw-r--r--tests/mir-opt/copy-prop/non_dominate.rs1
-rw-r--r--tests/mir-opt/copy-prop/partial_init.main.CopyProp.diff8
-rw-r--r--tests/mir-opt/copy-prop/partial_init.rs1
-rw-r--r--tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.diff56
-rw-r--r--tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff53
-rw-r--r--tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff53
-rw-r--r--tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.diff52
-rw-r--r--tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff49
-rw-r--r--tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff49
-rw-r--r--tests/mir-opt/copy-prop/reborrow.remut.CopyProp.diff50
-rw-r--r--tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-abort.diff47
-rw-r--r--tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-unwind.diff47
-rw-r--r--tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.diff50
-rw-r--r--tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-abort.diff47
-rw-r--r--tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-unwind.diff47
-rw-r--r--tests/mir-opt/copy-prop/reborrow.rs3
-rw-r--r--tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-abort.mir82
-rw-r--r--tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-unwind.mir91
-rw-r--r--tests/mir-opt/coroutine_drop_cleanup.rs15
-rw-r--r--tests/mir-opt/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir83
-rw-r--r--tests/mir-opt/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir118
-rw-r--r--tests/mir-opt/coroutine_storage_dead_unwind.rs (renamed from tests/mir-opt/generator_storage_dead_unwind.rs)9
-rw-r--r--tests/mir-opt/coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir89
-rw-r--r--tests/mir-opt/coroutine_tiny.rs (renamed from tests/mir-opt/generator_tiny.rs)7
-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.rs9
-rw-r--r--tests/mir-opt/dataflow-const-prop/boolean_identities.rs11
-rw-r--r--tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff33
-rw-r--r--tests/mir-opt/dataflow-const-prop/cast.main.DataflowConstProp.diff48
-rw-r--r--tests/mir-opt/dataflow-const-prop/cast.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.diff80
-rw-r--r--tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff88
-rw-r--r--tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff88
-rw-r--r--tests/mir-opt/dataflow-const-prop/checked.rs3
-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.rs18
-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.diff82
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff82
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.diff82
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff26
-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.mutate_discriminant.DataflowConstProp.diff26
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.rs23
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff68
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff68
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.diff63
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff131
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff131
-rw-r--r--tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff152
-rw-r--r--tests/mir-opt/dataflow-const-prop/if.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff39
-rw-r--r--tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff45
-rw-r--r--tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff45
-rw-r--r--tests/mir-opt/dataflow-const-prop/inherit_overflow.rs3
-rw-r--r--tests/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff34
-rw-r--r--tests/mir-opt/dataflow-const-prop/issue_81605.rs1
-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.rs10
-rw-r--r--tests/mir-opt/dataflow-const-prop/mult_by_zero.rs11
-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.rs50
-rw-r--r--tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.diff55
-rw-r--r--tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff49
-rw-r--r--tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff49
-rw-r--r--tests/mir-opt/dataflow-const-prop/ref_without_sb.rs3
-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.rs9
-rw-r--r--tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff67
-rw-r--r--tests/mir-opt/dataflow-const-prop/repr_transparent.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff66
-rw-r--r--tests/mir-opt/dataflow-const-prop/self_assign.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff24
-rw-r--r--tests/mir-opt/dataflow-const-prop/self_assign_add.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.diff54
-rw-r--r--tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff51
-rw-r--r--tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff51
-rw-r--r--tests/mir-opt/dataflow-const-prop/sibling_ptr.rs3
-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.rs13
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff247
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff247
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.diff51
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.rs27
-rw-r--r--tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff40
-rw-r--r--tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff37
-rw-r--r--tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff37
-rw-r--r--tests/mir-opt/dataflow-const-prop/terminator.rs3
-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.rs85
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff24
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff24
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff22
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff22
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff24
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff24
-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/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff112
-rw-r--r--tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff112
-rw-r--r--tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.diff71
-rw-r--r--tests/mir-opt/dataflow-const-prop/tuple.rs4
-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.move_simple.DeadStoreElimination.panic-abort.diff23
-rw-r--r--tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-unwind.diff23
-rw-r--r--tests/mir-opt/dead-store-elimination/call_arg_copy.rs42
-rw-r--r--tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff69
-rw-r--r--tests/mir-opt/dead-store-elimination/cycle.rs38
-rw-r--r--tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff22
-rw-r--r--tests/mir-opt/dead-store-elimination/place_mention.rs1
-rw-r--r--tests/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff44
-rw-r--r--tests/mir-opt/dead-store-elimination/provenance_soundness.retags.DeadStoreElimination.diff10
-rw-r--r--tests/mir-opt/dead-store-elimination/provenance_soundness.rs1
-rw-r--r--tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff100
-rw-r--r--tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff96
-rw-r--r--tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff96
-rw-r--r--tests/mir-opt/deduplicate_blocks.rs3
-rw-r--r--tests/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir67
-rw-r--r--tests/mir-opt/deref-patterns/string.rs1
-rw-r--r--tests/mir-opt/derefer_complex_case.main.Derefer.diff105
-rw-r--r--tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff99
-rw-r--r--tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff95
-rw-r--r--tests/mir-opt/derefer_complex_case.rs3
-rw-r--r--tests/mir-opt/derefer_inline_test.main.Derefer.diff45
-rw-r--r--tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff38
-rw-r--r--tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff38
-rw-r--r--tests/mir-opt/derefer_inline_test.rs3
-rw-r--r--tests/mir-opt/derefer_terminator_test.main.Derefer.diff92
-rw-r--r--tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff98
-rw-r--r--tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff94
-rw-r--r--tests/mir-opt/derefer_terminator_test.rs3
-rw-r--r--tests/mir-opt/derefer_test.main.Derefer.diff66
-rw-r--r--tests/mir-opt/derefer_test.rs1
-rw-r--r--tests/mir-opt/derefer_test_multiple.main.Derefer.diff118
-rw-r--r--tests/mir-opt/derefer_test_multiple.rs1
-rw-r--r--tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff75
-rw-r--r--tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff66
-rw-r--r--tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff66
-rw-r--r--tests/mir-opt/dest-prop/branch.rs3
-rw-r--r--tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff26
-rw-r--r--tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-abort.diff26
-rw-r--r--tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.diff26
-rw-r--r--tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff32
-rw-r--r--tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff29
-rw-r--r--tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff29
-rw-r--r--tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff22
-rw-r--r--tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-abort.diff22
-rw-r--r--tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff22
-rw-r--r--tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff32
-rw-r--r--tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff29
-rw-r--r--tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff29
-rw-r--r--tests/mir-opt/dest-prop/copy_propagation_arg.rs3
-rw-r--r--tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff77
-rw-r--r--tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff71
-rw-r--r--tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff71
-rw-r--r--tests/mir-opt/dest-prop/cycle.rs3
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.mir34
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir31
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir31
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_79191.rs3
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.mir33
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir31
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir31
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_better.rs3
-rw-r--r--tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.diff43
-rw-r--r--tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff43
-rw-r--r--tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff43
-rw-r--r--tests/mir-opt/dest-prop/simple.rs3
-rw-r--r--tests/mir-opt/dest-prop/union.main.DestinationPropagation.diff35
-rw-r--r--tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff25
-rw-r--r--tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff25
-rw-r--r--tests/mir-opt/dest-prop/union.rs3
-rw-r--r--tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.diff86
-rw-r--r--tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff80
-rw-r--r--tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff80
-rw-r--r--tests/mir-opt/dest-prop/unreachable.rs3
-rw-r--r--tests/mir-opt/dont_inline_type_id.call.Inline.diff20
-rw-r--r--tests/mir-opt/dont_inline_type_id.rs16
-rw-r--r--tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff23
-rw-r--r--tests/mir-opt/dont_yeet_assert.rs11
-rw-r--r--tests/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff98
-rw-r--r--tests/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff110
-rw-r--r--tests/mir-opt/early_otherwise_branch.opt3.EarlyOtherwiseBranch.diff98
-rw-r--r--tests/mir-opt/early_otherwise_branch.rs1
-rw-r--r--tests/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff132
-rw-r--r--tests/mir-opt/early_otherwise_branch_3_element_tuple.rs1
-rw-r--r--tests/mir-opt/early_otherwise_branch_68867.rs1
-rw-r--r--tests/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff334
-rw-r--r--tests/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff108
-rw-r--r--tests/mir-opt/early_otherwise_branch_noopt.rs1
-rw-r--r--tests/mir-opt/early_otherwise_branch_soundness.no_deref_ptr.EarlyOtherwiseBranch.diff42
-rw-r--r--tests/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff30
-rw-r--r--tests/mir-opt/early_otherwise_branch_soundness.rs1
-rw-r--r--tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff118
-rw-r--r--tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff118
-rw-r--r--tests/mir-opt/enum_opt.invalid.EnumSizeOpt.32bit.diff34
-rw-r--r--tests/mir-opt/enum_opt.invalid.EnumSizeOpt.64bit.diff34
-rw-r--r--tests/mir-opt/enum_opt.rs1
-rw-r--r--tests/mir-opt/enum_opt.trunc.EnumSizeOpt.32bit.diff52
-rw-r--r--tests/mir-opt/enum_opt.trunc.EnumSizeOpt.64bit.diff52
-rw-r--r--tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff118
-rw-r--r--tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff118
-rw-r--r--tests/mir-opt/equal_true.opt.InstSimplify.diff35
-rw-r--r--tests/mir-opt/equal_true.rs11
-rw-r--r--tests/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir88
-rw-r--r--tests/mir-opt/exponential_or.rs1
-rw-r--r--tests/mir-opt/fn_ptr_shim.core.ops-function-Fn-call.AddMovesForPackedDrops.before.mir8
-rw-r--r--tests/mir-opt/fn_ptr_shim.rs1
-rw-r--r--tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff129
-rw-r--r--tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff111
-rw-r--r--tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff111
-rw-r--r--tests/mir-opt/funky_arms.rs5
-rw-r--r--tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir91
-rw-r--r--tests/mir-opt/generator_drop_cleanup.rs14
-rw-r--r--tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir124
-rw-r--r--tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir89
-rw-r--r--tests/mir-opt/graphviz.rs1
-rw-r--r--tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff349
-rw-r--r--tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff349
-rw-r--r--tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff105
-rw-r--r--tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff105
-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.diff564
-rw-r--r--tests/mir-opt/gvn.cast.GVN.panic-unwind.diff564
-rw-r--r--tests/mir-opt/gvn.comparison.GVN.panic-abort.diff94
-rw-r--r--tests/mir-opt/gvn.comparison.GVN.panic-unwind.diff94
-rw-r--r--tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff104
-rw-r--r--tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff104
-rw-r--r--tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff203
-rw-r--r--tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff203
-rw-r--r--tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff38
-rw-r--r--tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff38
-rw-r--r--tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff118
-rw-r--r--tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff118
-rw-r--r--tests/mir-opt/gvn.indirect_static.GVN.panic-abort.diff19
-rw-r--r--tests/mir-opt/gvn.indirect_static.GVN.panic-unwind.diff19
-rw-r--r--tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff208
-rw-r--r--tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff208
-rw-r--r--tests/mir-opt/gvn.references.GVN.panic-abort.diff180
-rw-r--r--tests/mir-opt/gvn.references.GVN.panic-unwind.diff188
-rw-r--r--tests/mir-opt/gvn.repeat.GVN.panic-abort.diff79
-rw-r--r--tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff79
-rw-r--r--tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff81
-rw-r--r--tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff81
-rw-r--r--tests/mir-opt/gvn.rs673
-rw-r--r--tests/mir-opt/gvn.slices.GVN.panic-abort.diff313
-rw-r--r--tests/mir-opt/gvn.slices.GVN.panic-unwind.diff313
-rw-r--r--tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff966
-rw-r--r--tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff966
-rw-r--r--tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff49
-rw-r--r--tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff49
-rw-r--r--tests/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff24
-rw-r--r--tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff33
-rw-r--r--tests/mir-opt/if_condition_int.dont_remove_comparison.SimplifyComparisonIntegral.diff76
-rw-r--r--tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff40
-rw-r--r--tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff40
-rw-r--r--tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff72
-rw-r--r--tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff40
-rw-r--r--tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff40
-rw-r--r--tests/mir-opt/if_condition_int.rs1
-rw-r--r--tests/mir-opt/inline/asm_unwind.main.Inline.diff45
-rw-r--r--tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff34
-rw-r--r--tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff42
-rw-r--r--tests/mir-opt/inline/asm_unwind.rs10
-rw-r--r--tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.diff33
-rw-r--r--tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.panic-unwind.diff30
-rw-r--r--tests/mir-opt/inline/caller_with_trivial_bound.rs7
-rw-r--r--tests/mir-opt/inline/cycle.f.Inline.diff43
-rw-r--r--tests/mir-opt/inline/cycle.f.Inline.panic-abort.diff32
-rw-r--r--tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff40
-rw-r--r--tests/mir-opt/inline/cycle.g.Inline.diff58
-rw-r--r--tests/mir-opt/inline/cycle.g.Inline.panic-abort.diff38
-rw-r--r--tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff46
-rw-r--r--tests/mir-opt/inline/cycle.main.Inline.diff58
-rw-r--r--tests/mir-opt/inline/cycle.main.Inline.panic-abort.diff38
-rw-r--r--tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff46
-rw-r--r--tests/mir-opt/inline/cycle.rs13
-rw-r--r--tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-abort.diff29
-rw-r--r--tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff37
-rw-r--r--tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs13
-rw-r--r--tests/mir-opt/inline/dyn_trait.get_query.Inline.diff54
-rw-r--r--tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff45
-rw-r--r--tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff45
-rw-r--r--tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.diff23
-rw-r--r--tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff20
-rw-r--r--tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff20
-rw-r--r--tests/mir-opt/inline/dyn_trait.rs10
-rw-r--r--tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.diff33
-rw-r--r--tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff28
-rw-r--r--tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff28
-rw-r--r--tests/mir-opt/inline/exponential_runtime.main.Inline.diff75
-rw-r--r--tests/mir-opt/inline/exponential_runtime.main.Inline.panic-abort.diff134
-rw-r--r--tests/mir-opt/inline/exponential_runtime.main.Inline.panic-unwind.diff134
-rw-r--r--tests/mir-opt/inline/exponential_runtime.rs11
-rw-r--r--tests/mir-opt/inline/indirect_destination.rs42
-rw-r--r--tests/mir-opt/inline/inline_any_operand.bar.Inline.after.mir49
-rw-r--r--tests/mir-opt/inline/inline_any_operand.rs2
-rw-r--r--tests/mir-opt/inline/inline_async.rs3
-rw-r--r--tests/mir-opt/inline/inline_box_fn.call.Inline.panic-abort.diff32
-rw-r--r--tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff40
-rw-r--r--tests/mir-opt/inline/inline_box_fn.rs10
-rw-r--r--tests/mir-opt/inline/inline_closure.foo.Inline.after.mir82
-rw-r--r--tests/mir-opt/inline/inline_closure.rs3
-rw-r--r--tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir84
-rw-r--r--tests/mir-opt/inline/inline_closure_borrows_arg.rs3
-rw-r--r--tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir112
-rw-r--r--tests/mir-opt/inline/inline_closure_captures.rs3
-rw-r--r--tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.diff24
-rw-r--r--tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.diff24
-rw-r--r--tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.diff25
-rw-r--r--tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.diff22
-rw-r--r--tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.diff22
-rw-r--r--tests/mir-opt/inline/inline_compatibility.rs62
-rw-r--r--tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff113
-rw-r--r--tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff127
-rw-r--r--tests/mir-opt/inline/inline_coroutine.rs20
-rw-r--r--tests/mir-opt/inline/inline_cycle.one.Inline.diff30
-rw-r--r--tests/mir-opt/inline/inline_cycle.one.Inline.panic-abort.diff25
-rw-r--r--tests/mir-opt/inline/inline_cycle.one.Inline.panic-unwind.diff25
-rw-r--r--tests/mir-opt/inline/inline_cycle.rs3
-rw-r--r--tests/mir-opt/inline/inline_cycle.two.Inline.diff42
-rw-r--r--tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff30
-rw-r--r--tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff30
-rw-r--r--tests/mir-opt/inline/inline_cycle_generic.main.Inline.diff29
-rw-r--r--tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-abort.diff26
-rw-r--r--tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-unwind.diff26
-rw-r--r--tests/mir-opt/inline/inline_cycle_generic.rs3
-rw-r--r--tests/mir-opt/inline/inline_diverging.f.Inline.diff24
-rw-r--r--tests/mir-opt/inline/inline_diverging.f.Inline.panic-abort.diff21
-rw-r--r--tests/mir-opt/inline/inline_diverging.f.Inline.panic-unwind.diff21
-rw-r--r--tests/mir-opt/inline/inline_diverging.g.Inline.diff49
-rw-r--r--tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff42
-rw-r--r--tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff42
-rw-r--r--tests/mir-opt/inline/inline_diverging.h.Inline.diff83
-rw-r--r--tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff51
-rw-r--r--tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff68
-rw-r--r--tests/mir-opt/inline/inline_diverging.rs10
-rw-r--r--tests/mir-opt/inline/inline_generator.main.Inline.diff132
-rw-r--r--tests/mir-opt/inline/inline_generator.rs16
-rw-r--r--tests/mir-opt/inline/inline_instruction_set.default.Inline.diff56
-rw-r--r--tests/mir-opt/inline/inline_instruction_set.rs10
-rw-r--r--tests/mir-opt/inline/inline_instruction_set.t32.Inline.diff56
-rw-r--r--tests/mir-opt/inline/inline_into_box_place.main.Inline.diff81
-rw-r--r--tests/mir-opt/inline/inline_into_box_place.rs9
-rw-r--r--tests/mir-opt/inline/inline_options.main.Inline.after.mir55
-rw-r--r--tests/mir-opt/inline/inline_options.main.Inline.after.panic-abort.mir43
-rw-r--r--tests/mir-opt/inline/inline_options.main.Inline.after.panic-unwind.mir43
-rw-r--r--tests/mir-opt/inline/inline_options.rs5
-rw-r--r--tests/mir-opt/inline/inline_retag.bar.Inline.after.mir107
-rw-r--r--tests/mir-opt/inline/inline_retag.rs11
-rw-r--r--tests/mir-opt/inline/inline_shims.clone.Inline.diff26
-rw-r--r--tests/mir-opt/inline/inline_shims.clone.Inline.panic-abort.diff23
-rw-r--r--tests/mir-opt/inline/inline_shims.clone.Inline.panic-unwind.diff23
-rw-r--r--tests/mir-opt/inline/inline_shims.drop.Inline.diff56
-rw-r--r--tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff64
-rw-r--r--tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff50
-rw-r--r--tests/mir-opt/inline/inline_shims.rs6
-rw-r--r--tests/mir-opt/inline/inline_specialization.main.Inline.diff28
-rw-r--r--tests/mir-opt/inline/inline_specialization.main.Inline.panic-abort.diff25
-rw-r--r--tests/mir-opt/inline/inline_specialization.main.Inline.panic-unwind.diff25
-rw-r--r--tests/mir-opt/inline/inline_specialization.rs4
-rw-r--r--tests/mir-opt/inline/inline_trait_method.rs5
-rw-r--r--tests/mir-opt/inline/inline_trait_method.test.Inline.after.mir21
-rw-r--r--tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir18
-rw-r--r--tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir18
-rw-r--r--tests/mir-opt/inline/inline_trait_method_2.rs5
-rw-r--r--tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.mir28
-rw-r--r--tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir25
-rw-r--r--tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir25
-rw-r--r--tests/mir-opt/inline/issue_106141.outer.Inline.diff55
-rw-r--r--tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff49
-rw-r--r--tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff49
-rw-r--r--tests/mir-opt/inline/issue_106141.rs9
-rw-r--r--tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir36
-rw-r--r--tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir48
-rw-r--r--tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir28
-rw-r--r--tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir40
-rw-r--r--tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.rs8
-rw-r--r--tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir59
-rw-r--r--tests/mir-opt/inline/issue_76997_inline_scopes_parenting.rs10
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.Inline.diff68
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff45
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff56
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.RevealAll.diff57
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff58
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-unwind.diff58
-rw-r--r--tests/mir-opt/inline/issue_78442.rs7
-rw-r--r--tests/mir-opt/inline/polymorphic_recursion.rs1
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.rs24
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-abort.diff36
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-unwind.diff36
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-abort.mir22
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-unwind.mir22
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff152
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff41
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff41
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir138
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir27
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir27
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff36
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff36
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir22
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir22
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff152
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff41
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff41
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir138
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir27
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir27
-rw-r--r--tests/mir-opt/inline/unit_test.rs19
-rw-r--r--tests/mir-opt/inline/unsized_argument.caller.Inline.diff50
-rw-r--r--tests/mir-opt/inline/unsized_argument.rs2
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.rs4
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff55
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff50
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff54
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir41
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir40
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir40
-rw-r--r--tests/mir-opt/inline_generically_if_sized.call.Inline.diff24
-rw-r--r--tests/mir-opt/inline_generically_if_sized.rs18
-rw-r--r--tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff10
-rw-r--r--tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff54
-rw-r--r--tests/mir-opt/instrument_coverage.rs1
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff36
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff36
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff36
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff36
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff36
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff36
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.rs68
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff36
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff36
-rw-r--r--tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff34
-rw-r--r--tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff26
-rw-r--r--tests/mir-opt/instsimplify/casts.rs25
-rw-r--r--tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff77
-rw-r--r--tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff77
-rw-r--r--tests/mir-opt/instsimplify/combine_array_len.rs (renamed from tests/mir-opt/combine_array_len.rs)6
-rw-r--r--tests/mir-opt/instsimplify/combine_clone_of_primitives.rs (renamed from tests/mir-opt/combine_clone_of_primitives.rs)8
-rw-r--r--tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff65
-rw-r--r--tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff73
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff83
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff39
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff24
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.rs (renamed from tests/mir-opt/combine_transmutes.rs)22
-rw-r--r--tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff21
-rw-r--r--tests/mir-opt/instsimplify/duplicate_switch_targets.rs (renamed from tests/mir-opt/instsimplify_duplicate_switch_targets.rs)8
-rw-r--r--tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify.diff33
-rw-r--r--tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff19
-rw-r--r--tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff36
-rw-r--r--tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff36
-rw-r--r--tests/mir-opt/instsimplify/intrinsic_asserts.rs (renamed from tests/mir-opt/intrinsic_asserts.rs)22
-rw-r--r--tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff21
-rw-r--r--tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff42
-rw-r--r--tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff47
-rw-r--r--tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff45
-rw-r--r--tests/mir-opt/issue_101973.inner.ConstProp.diff85
-rw-r--r--tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff83
-rw-r--r--tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff83
-rw-r--r--tests/mir-opt/issue_101973.rs3
-rw-r--r--tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.mir25
-rw-r--r--tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-abort.mir16
-rw-r--r--tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-unwind.mir16
-rw-r--r--tests/mir-opt/issue_104451_unwindable_intrinsics.rs3
-rw-r--r--tests/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir56
-rw-r--r--tests/mir-opt/issue_38669.rs1
-rw-r--r--tests/mir-opt/issue_41110.main.ElaborateDrops.diff75
-rw-r--r--tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff69
-rw-r--r--tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff69
-rw-r--r--tests/mir-opt/issue_41110.rs3
-rw-r--r--tests/mir-opt/issue_41110.test.ElaborateDrops.diff105
-rw-r--r--tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff99
-rw-r--r--tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff99
-rw-r--r--tests/mir-opt/issue_41697.rs1
-rw-r--r--tests/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir18
-rw-r--r--tests/mir-opt/issue_41888.main.ElaborateDrops.diff151
-rw-r--r--tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff147
-rw-r--r--tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff147
-rw-r--r--tests/mir-opt/issue_41888.rs3
-rw-r--r--tests/mir-opt/issue_62289.rs3
-rw-r--r--tests/mir-opt/issue_62289.test.ElaborateDrops.before.mir122
-rw-r--r--tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir114
-rw-r--r--tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir114
-rw-r--r--tests/mir-opt/issue_72181.bar.built.after.mir16
-rw-r--r--tests/mir-opt/issue_72181.foo.built.after.mir28
-rw-r--r--tests/mir-opt/issue_72181.main.built.after.mir77
-rw-r--r--tests/mir-opt/issue_72181.rs1
-rw-r--r--tests/mir-opt/issue_72181_1.f.built.after.mir11
-rw-r--r--tests/mir-opt/issue_72181_1.main.built.after.mir58
-rw-r--r--tests/mir-opt/issue_72181_1.rs1
-rw-r--r--tests/mir-opt/issue_76432.rs3
-rw-r--r--tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff60
-rw-r--r--tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff55
-rw-r--r--tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff55
-rw-r--r--tests/mir-opt/issue_78192.f.InstSimplify.diff36
-rw-r--r--tests/mir-opt/issue_78192.rs1
-rw-r--r--tests/mir-opt/issue_91633.bar.built.after.mir35
-rw-r--r--tests/mir-opt/issue_91633.foo.built.after.mir57
-rw-r--r--tests/mir-opt/issue_91633.fun.built.after.mir40
-rw-r--r--tests/mir-opt/issue_91633.hey.built.after.mir39
-rw-r--r--tests/mir-opt/issue_91633.rs1
-rw-r--r--tests/mir-opt/issue_99325.main.built.after.32bit.mir276
-rw-r--r--tests/mir-opt/issue_99325.main.built.after.64bit.mir276
-rw-r--r--tests/mir-opt/issue_99325.main.built.after.mir295
-rw-r--r--tests/mir-opt/issue_99325.rs3
-rw-r--r--tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir84
-rw-r--r--tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir77
-rw-r--r--tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir77
-rw-r--r--tests/mir-opt/issues/issue_59352.rs3
-rw-r--r--tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff72
-rw-r--r--tests/mir-opt/issues/issue_75439.rs1
-rw-r--r--tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-abort.diff57
-rw-r--r--tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-unwind.diff57
-rw-r--r--tests/mir-opt/jump_threading.dfa.JumpThreading.panic-abort.diff68
-rw-r--r--tests/mir-opt/jump_threading.dfa.JumpThreading.panic-unwind.diff68
-rw-r--r--tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-abort.diff59
-rw-r--r--tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-unwind.diff59
-rw-r--r--tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-abort.diff45
-rw-r--r--tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-unwind.diff45
-rw-r--r--tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff139
-rw-r--r--tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff139
-rw-r--r--tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-abort.diff54
-rw-r--r--tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-unwind.diff54
-rw-r--r--tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff56
-rw-r--r--tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff56
-rw-r--r--tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-abort.diff26
-rw-r--r--tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-unwind.diff26
-rw-r--r--tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-abort.diff57
-rw-r--r--tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-unwind.diff57
-rw-r--r--tests/mir-opt/jump_threading.rs480
-rw-r--r--tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff98
-rw-r--r--tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff98
-rw-r--r--tests/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir56
-rw-r--r--tests/mir-opt/loop_test.rs1
-rw-r--r--tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff64
-rw-r--r--tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff66
-rw-r--r--tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff66
-rw-r--r--tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff77
-rw-r--r--tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff79
-rw-r--r--tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff79
-rw-r--r--tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.diff26
-rw-r--r--tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-abort.diff26
-rw-r--r--tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-unwind.diff26
-rw-r--r--tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.diff26
-rw-r--r--tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.panic-abort.diff26
-rw-r--r--tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.panic-unwind.diff26
-rw-r--r--tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff50
-rw-r--r--tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-abort.diff50
-rw-r--r--tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-unwind.diff50
-rw-r--r--tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.diff44
-rw-r--r--tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.panic-abort.diff44
-rw-r--r--tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.panic-unwind.diff44
-rw-r--r--tests/mir-opt/lower_array_len.rs16
-rw-r--r--tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.diff20
-rw-r--r--tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.panic-abort.diff17
-rw-r--r--tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.panic-unwind.diff17
-rw-r--r--tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.diff26
-rw-r--r--tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-abort.diff23
-rw-r--r--tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-unwind.diff23
-rw-r--r--tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff119
-rw-r--r--tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-abort.diff94
-rw-r--r--tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-unwind.diff98
-rw-r--r--tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff72
-rw-r--r--tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-abort.diff69
-rw-r--r--tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff69
-rw-r--r--tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.diff29
-rw-r--r--tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-abort.diff26
-rw-r--r--tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-unwind.diff26
-rw-r--r--tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.diff31
-rw-r--r--tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-abort.diff28
-rw-r--r--tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-unwind.diff28
-rw-r--r--tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff54
-rw-r--r--tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff30
-rw-r--r--tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-abort.diff27
-rw-r--r--tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-unwind.diff27
-rw-r--r--tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff27
-rw-r--r--tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-abort.diff24
-rw-r--r--tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff24
-rw-r--r--tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff21
-rw-r--r--tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff19
-rw-r--r--tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff19
-rw-r--r--tests/mir-opt/lower_intrinsics.rs104
-rw-r--r--tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.diff20
-rw-r--r--tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.panic-abort.diff17
-rw-r--r--tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.panic-unwind.diff17
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff27
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-abort.diff24
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff24
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff27
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-abort.diff24
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff24
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff25
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff25
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff25
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff25
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff23
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff23
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff25
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff23
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff23
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff22
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-abort.diff19
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff19
-rw-r--r--tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff154
-rw-r--r--tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff154
-rw-r--r--tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff21
-rw-r--r--tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-abort.diff18
-rw-r--r--tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff18
-rw-r--r--tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.diff83
-rw-r--r--tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-abort.diff74
-rw-r--r--tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-unwind.diff74
-rw-r--r--tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff83
-rw-r--r--tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-abort.diff74
-rw-r--r--tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-unwind.diff74
-rw-r--r--tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff36
-rw-r--r--tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-abort.diff33
-rw-r--r--tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-unwind.diff33
-rw-r--r--tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff63
-rw-r--r--tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff62
-rw-r--r--tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff62
-rw-r--r--tests/mir-opt/lower_slice_len.rs4
-rw-r--r--tests/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff272
-rw-r--r--tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff272
-rw-r--r--tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff272
-rw-r--r--tests/mir-opt/match_arm_scopes.rs3
-rw-r--r--tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir106
-rw-r--r--tests/mir-opt/match_test.rs1
-rw-r--r--tests/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.diff116
-rw-r--r--tests/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff70
-rw-r--r--tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff134
-rw-r--r--tests/mir-opt/matches_reduce_branches.rs1
-rw-r--r--tests/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff22
-rw-r--r--tests/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff22
-rw-r--r--tests/mir-opt/matches_u8.rs1
-rw-r--r--tests/mir-opt/multiple_return_terminators.rs1
-rw-r--r--tests/mir-opt/multiple_return_terminators.test.MultipleReturnTerminators.diff6
-rw-r--r--tests/mir-opt/nll/named_lifetimes_basic.rs1
-rw-r--r--tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir30
-rw-r--r--tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir112
-rw-r--r--tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir112
-rw-r--r--tests/mir-opt/nll/region_subtyping_basic.rs1
-rw-r--r--tests/mir-opt/no_drop_for_inactive_variant.rs3
-rw-r--r--tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir49
-rw-r--r--tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-abort.mir38
-rw-r--r--tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-unwind.mir43
-rw-r--r--tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.mir49
-rw-r--r--tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir40
-rw-r--r--tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir40
-rw-r--r--tests/mir-opt/no_spurious_drop_after_call.rs3
-rw-r--r--tests/mir-opt/not_equal_false.opt.InstSimplify.diff35
-rw-r--r--tests/mir-opt/not_equal_false.rs10
-rw-r--r--tests/mir-opt/nrvo_miscompile_111005.rs1
-rw-r--r--tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff17
-rw-r--r--tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.diff43
-rw-r--r--tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-abort.diff42
-rw-r--r--tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff42
-rw-r--r--tests/mir-opt/nrvo_simple.rs3
-rw-r--r--tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir55
-rw-r--r--tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir46
-rw-r--r--tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir55
-rw-r--r--tests/mir-opt/packed_struct_drop_aligned.rs3
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir84
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir117
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir136
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.rs51
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir68
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.rs17
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir69
-rw-r--r--tests/mir-opt/pre-codegen/duplicate_switch_targets.rs1
-rw-r--r--tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir27
-rw-r--r--tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir21
-rw-r--r--tests/mir-opt/pre-codegen/intrinsics.f_unit.PreCodegen.after.mir17
-rw-r--r--tests/mir-opt/pre-codegen/intrinsics.rs2
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff123
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff92
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff123
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff92
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs15
-rw-r--r--tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir87
-rw-r--r--tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir120
-rw-r--r--tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir78
-rw-r--r--tests/mir-opt/pre-codegen/loops.rs37
-rw-r--r--tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir76
-rw-r--r--tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir14
-rw-r--r--tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir80
-rw-r--r--tests/mir-opt/pre-codegen/mem_replace.rs3
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.diff59
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff63
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff63
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.diff59
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff63
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff63
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.panic-abort.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.panic-unwind.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-abort.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-unwind.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff71
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff71
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff71
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff71
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff71
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff71
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-abort.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-unwind.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-abort.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-unwind.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.rs3
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir91
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir133
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir141
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir95
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir83
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir91
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.mir20
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir17
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir17
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.mir20
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir73
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir73
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.rs3
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir58
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.rs2
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.rs16
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir243
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir74
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.rs4
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir105
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir92
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir92
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir134
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir106
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir106
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir26
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir19
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir19
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.mir20
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir20
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir20
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir196
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir204
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir203
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir183
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir191
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir149
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir157
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir220
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir198
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir206
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.rs19
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir17
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir14
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir14
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.mir17
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir14
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir14
-rw-r--r--tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir18
-rw-r--r--tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir18
-rw-r--r--tests/mir-opt/pre-codegen/spans.rs16
-rw-r--r--tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir68
-rw-r--r--tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir34
-rw-r--r--tests/mir-opt/pre-codegen/try_identity.rs2
-rw-r--r--tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff247
-rw-r--r--tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff37
-rw-r--r--tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff61
-rw-r--r--tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff27
-rw-r--r--tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff107
-rw-r--r--tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff28
-rw-r--r--tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff691
-rw-r--r--tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff743
-rw-r--r--tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff685
-rw-r--r--tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff665
-rw-r--r--tests/mir-opt/reference_prop.rs343
-rw-r--r--tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff78
-rw-r--r--tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.diff74
-rw-r--r--tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff73
-rw-r--r--tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff73
-rw-r--r--tests/mir-opt/remove_fake_borrows.rs3
-rw-r--r--tests/mir-opt/remove_never_const.no_codegen.PreCodegen.after.mir4
-rw-r--r--tests/mir-opt/remove_never_const.rs1
-rw-r--r--tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff98
-rw-r--r--tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff92
-rw-r--r--tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-unwind.diff92
-rw-r--r--tests/mir-opt/remove_storage_markers.rs3
-rw-r--r--tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff31
-rw-r--r--tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-abort.diff27
-rw-r--r--tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-unwind.diff31
-rw-r--r--tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff31
-rw-r--r--tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-abort.diff27
-rw-r--r--tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-unwind.diff31
-rw-r--r--tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.diff27
-rw-r--r--tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-abort.diff27
-rw-r--r--tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff27
-rw-r--r--tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff27
-rw-r--r--tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-abort.diff27
-rw-r--r--tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff27
-rw-r--r--tests/mir-opt/remove_unneeded_drops.rs3
-rw-r--r--tests/mir-opt/remove_zsts.get_union.PreCodegen.after.mir6
-rw-r--r--tests/mir-opt/remove_zsts.get_union.RemoveZsts.diff22
-rw-r--r--tests/mir-opt/remove_zsts.rs1
-rw-r--r--tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir188
-rw-r--r--tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-abort.mir174
-rw-r--r--tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir174
-rw-r--r--tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir22
-rw-r--r--tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-abort.mir23
-rw-r--r--tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-unwind.mir19
-rw-r--r--tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.mir21
-rw-r--r--tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir21
-rw-r--r--tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-unwind.mir21
-rw-r--r--tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir199
-rw-r--r--tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir168
-rw-r--r--tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir180
-rw-r--r--tests/mir-opt/retag.rs3
-rw-r--r--tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir18
-rw-r--r--tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir18
-rw-r--r--tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir18
-rw-r--r--tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.mir15
-rw-r--r--tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir15
-rw-r--r--tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir15
-rw-r--r--tests/mir-opt/return_an_array.rs1
-rw-r--r--tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff134
-rw-r--r--tests/mir-opt/separate_const_switch.rs3
-rw-r--r--tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff91
-rw-r--r--tests/mir-opt/simplify_arm.rs1
-rw-r--r--tests/mir-opt/simplify_arm_identity.rs1
-rw-r--r--tests/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff50
-rw-r--r--tests/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff53
-rw-r--r--tests/mir-opt/simplify_cfg.rs1
-rw-r--r--tests/mir-opt/simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff14
-rw-r--r--tests/mir-opt/simplify_duplicate_unreachable_blocks.rs1
-rw-r--r--tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff36
-rw-r--r--tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff29
-rw-r--r--tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff29
-rw-r--r--tests/mir-opt/simplify_if.rs3
-rw-r--r--tests/mir-opt/simplify_locals.c.SimplifyLocals-before-const-prop.diff40
-rw-r--r--tests/mir-opt/simplify_locals.d1.SimplifyLocals-before-const-prop.diff14
-rw-r--r--tests/mir-opt/simplify_locals.d2.SimplifyLocals-before-const-prop.diff32
-rw-r--r--tests/mir-opt/simplify_locals.expose_addr.SimplifyLocals-before-const-prop.diff24
-rw-r--r--tests/mir-opt/simplify_locals.r.SimplifyLocals-before-const-prop.diff32
-rw-r--r--tests/mir-opt/simplify_locals.rs1
-rw-r--r--tests/mir-opt/simplify_locals.t1.SimplifyLocals-before-const-prop.diff22
-rw-r--r--tests/mir-opt/simplify_locals.t2.SimplifyLocals-before-const-prop.diff22
-rw-r--r--tests/mir-opt/simplify_locals.t3.SimplifyLocals-before-const-prop.diff30
-rw-r--r--tests/mir-opt/simplify_locals.t4.SimplifyLocals-before-const-prop.diff22
-rw-r--r--tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.diff53
-rw-r--r--tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-abort.diff50
-rw-r--r--tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-unwind.diff50
-rw-r--r--tests/mir-opt/simplify_locals_fixedpoint.rs3
-rw-r--r--tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.diff101
-rw-r--r--tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-abort.diff86
-rw-r--r--tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-unwind.diff86
-rw-r--r--tests/mir-opt/simplify_locals_removes_unused_consts.rs3
-rw-r--r--tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals-before-const-prop.diff52
-rw-r--r--tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs1
-rw-r--r--tests/mir-opt/simplify_match.main.ConstProp.diff33
-rw-r--r--tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff30
-rw-r--r--tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff30
-rw-r--r--tests/mir-opt/simplify_match.rs3
-rw-r--r--tests/mir-opt/simplify_try_if_let.rs1
-rw-r--r--tests/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir48
-rw-r--r--tests/mir-opt/slice_drop_shim.rs1
-rw-r--r--tests/mir-opt/slice_filter.rs20
-rw-r--r--tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff279
-rw-r--r--tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff165
-rw-r--r--tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff267
-rw-r--r--tests/mir-opt/slice_filter.variant_b-{closure#0}.CopyProp.diff139
-rw-r--r--tests/mir-opt/slice_filter.variant_b-{closure#0}.DestinationPropagation.diff109
-rw-r--r--tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff103
-rw-r--r--tests/mir-opt/spanview_block.main.built.after.html9
-rw-r--r--tests/mir-opt/spanview_block.rs1
-rw-r--r--tests/mir-opt/spanview_statement.main.built.after.html9
-rw-r--r--tests/mir-opt/spanview_statement.rs1
-rw-r--r--tests/mir-opt/spanview_terminator.main.built.after.html7
-rw-r--r--tests/mir-opt/spanview_terminator.rs1
-rw-r--r--tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff295
-rw-r--r--tests/mir-opt/sroa/lifetimes.rs1
-rw-r--r--tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff63
-rw-r--r--tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff150
-rw-r--r--tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff52
-rw-r--r--tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff46
-rw-r--r--tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff52
-rw-r--r--tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff119
-rw-r--r--tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff85
-rw-r--r--tests/mir-opt/sroa/structs.rs1
-rw-r--r--tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff48
-rw-r--r--tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff24
-rw-r--r--tests/mir-opt/ssa_unreachable_116212.rs15
-rw-r--r--tests/mir-opt/storage_ranges.main.nll.0.mir68
-rw-r--r--tests/mir-opt/storage_ranges.rs1
-rw-r--r--tests/mir-opt/switch_to_self.rs22
-rw-r--r--tests/mir-opt/switch_to_self.test.MatchBranchSimplification.diff19
-rw-r--r--tests/mir-opt/tls_access.main.PreCodegen.after.mir34
-rw-r--r--tests/mir-opt/tls_access.rs1
-rw-r--r--tests/mir-opt/uninhabited_enum.process_never.SimplifyLocals-final.after.mir10
-rw-r--r--tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir8
-rw-r--r--tests/mir-opt/uninhabited_enum.rs1
-rw-r--r--tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.diff119
-rw-r--r--tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.diff48
-rw-r--r--tests/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir69
-rw-r--r--tests/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff95
-rw-r--r--tests/mir-opt/uninhabited_enum_branching.rs69
-rw-r--r--tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.diff57
-rw-r--r--tests/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir97
-rw-r--r--tests/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff139
-rw-r--r--tests/mir-opt/uninhabited_enum_branching2.rs34
-rw-r--r--tests/mir-opt/uninhabited_fallthrough_elimination.eliminate_fallthrough.UninhabitedEnumBranching.diff28
-rw-r--r--tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff30
-rw-r--r--tests/mir-opt/uninhabited_fallthrough_elimination.rs1
-rw-r--r--tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff45
-rw-r--r--tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff45
-rw-r--r--tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-abort.diff72
-rw-r--r--tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-unwind.diff72
-rw-r--r--tests/mir-opt/unreachable.main.UnreachablePropagation.diff70
-rw-r--r--tests/mir-opt/unreachable.rs51
-rw-r--r--tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff71
-rw-r--r--tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff69
-rw-r--r--tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff69
-rw-r--r--tests/mir-opt/unreachable_diverging.rs21
-rw-r--r--tests/mir-opt/unusual_item_types.E-V-{constant#0}.built.after.mir6
-rw-r--r--tests/mir-opt/unusual_item_types.Test-X-{constructor#0}.built.after.mir6
-rw-r--r--tests/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir25
-rw-r--r--tests/mir-opt/unusual_item_types.rs1
-rw-r--r--tests/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.built.after.mir10
-rw-r--r--tests/mir-opt/while_storage.rs20
-rw-r--r--tests/mir-opt/while_storage.while_loop.PreCodegen.after.mir52
1363 files changed, 48980 insertions, 22791 deletions
diff --git a/tests/mir-opt/README.md b/tests/mir-opt/README.md
index 0721d9f70..39a7b5aea 100644
--- a/tests/mir-opt/README.md
+++ b/tests/mir-opt/README.md
@@ -49,3 +49,21 @@ This exists mainly for completeness and is rarely useful.
```
// EMIT_MIR $file_name_of_some_mir_dump.before.mir
```
+
+# FileCheck directives
+
+The LLVM FileCheck tool is used to verify the contents of output MIR against `CHECK` directives
+present in the test file. This works on the runtime MIR, generated by `--emit=mir`, and not
+on the output of a individual passes.
+
+Use `// skip-filecheck` to prevent FileCheck from running.
+
+To check MIR for function `foo`, start with a `// CHECK-LABEL fn foo(` directive.
+
+`{{regex}}` syntax allows to match `regex`.
+
+`[[name:regex]]` syntax allows to bind `name` to a string matching `regex`, and refer to it
+as `[[name]]` in later directives, `regex` should be written not to match a leading space.
+Use `[[my_local:_.*]]` to name a local, and `[[my_bb:bb.*]]` to name a block.
+
+Documentation for FileCheck is available here: https://www.llvm.org/docs/CommandGuide/FileCheck.html
diff --git a/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir b/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir
index b1d34a196..76938c14e 100644
--- a/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir
@@ -1,115 +1,115 @@
// MIR for `address_of_reborrow` after SimplifyCfg-initial
| User Type Annotations
-| 0: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:7:5: 7:18, inferred_ty: *const [i32; 10]
-| 1: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:9:5: 9:25, inferred_ty: *const dyn std::marker::Send
-| 2: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:13:12: 13:20, inferred_ty: *const [i32; 10]
-| 3: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:13:12: 13:20, inferred_ty: *const [i32; 10]
-| 4: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:14:12: 14:28, inferred_ty: *const [i32; 10]
-| 5: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:14:12: 14:28, inferred_ty: *const [i32; 10]
-| 6: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:15:12: 15:27, inferred_ty: *const dyn std::marker::Send
-| 7: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:15:12: 15:27, inferred_ty: *const dyn std::marker::Send
-| 8: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:16:12: 16:24, inferred_ty: *const [i32]
-| 9: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:16:12: 16:24, inferred_ty: *const [i32]
-| 10: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:18:5: 18:18, inferred_ty: *const [i32; 10]
-| 11: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:20:5: 20:25, inferred_ty: *const dyn std::marker::Send
-| 12: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:23:12: 23:20, inferred_ty: *const [i32; 10]
-| 13: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:23:12: 23:20, inferred_ty: *const [i32; 10]
-| 14: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:24:12: 24:28, inferred_ty: *const [i32; 10]
-| 15: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:24:12: 24:28, inferred_ty: *const [i32; 10]
-| 16: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:25:12: 25:27, inferred_ty: *const dyn std::marker::Send
-| 17: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:25:12: 25:27, inferred_ty: *const dyn std::marker::Send
-| 18: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:26:12: 26:24, inferred_ty: *const [i32]
-| 19: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:26:12: 26:24, inferred_ty: *const [i32]
-| 20: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:28:5: 28:16, inferred_ty: *mut [i32; 10]
-| 21: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:30:5: 30:23, inferred_ty: *mut dyn std::marker::Send
-| 22: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:33:12: 33:18, inferred_ty: *mut [i32; 10]
-| 23: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:33:12: 33:18, inferred_ty: *mut [i32; 10]
-| 24: user_ty: Canonical { value: Ty(*mut [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:34:12: 34:26, inferred_ty: *mut [i32; 10]
-| 25: user_ty: Canonical { value: Ty(*mut [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:34:12: 34:26, inferred_ty: *mut [i32; 10]
-| 26: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:35:12: 35:25, inferred_ty: *mut dyn std::marker::Send
-| 27: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:35:12: 35:25, inferred_ty: *mut dyn std::marker::Send
-| 28: user_ty: Canonical { value: Ty(*mut [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:36:12: 36:22, inferred_ty: *mut [i32]
-| 29: user_ty: Canonical { value: Ty(*mut [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:36:12: 36:22, inferred_ty: *mut [i32]
+| 0: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:8:5: 8:18, inferred_ty: *const [i32; 10]
+| 1: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:10:5: 10:25, inferred_ty: *const dyn std::marker::Send
+| 2: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:14:12: 14:20, inferred_ty: *const [i32; 10]
+| 3: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:14:12: 14:20, inferred_ty: *const [i32; 10]
+| 4: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:15:12: 15:28, inferred_ty: *const [i32; 10]
+| 5: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:15:12: 15:28, inferred_ty: *const [i32; 10]
+| 6: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:16:12: 16:27, inferred_ty: *const dyn std::marker::Send
+| 7: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:16:12: 16:27, inferred_ty: *const dyn std::marker::Send
+| 8: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:17:12: 17:24, inferred_ty: *const [i32]
+| 9: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:17:12: 17:24, inferred_ty: *const [i32]
+| 10: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:19:5: 19:18, inferred_ty: *const [i32; 10]
+| 11: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:21:5: 21:25, inferred_ty: *const dyn std::marker::Send
+| 12: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:24:12: 24:20, inferred_ty: *const [i32; 10]
+| 13: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:24:12: 24:20, inferred_ty: *const [i32; 10]
+| 14: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:25:12: 25:28, inferred_ty: *const [i32; 10]
+| 15: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:25:12: 25:28, inferred_ty: *const [i32; 10]
+| 16: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:26:12: 26:27, inferred_ty: *const dyn std::marker::Send
+| 17: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:26:12: 26:27, inferred_ty: *const dyn std::marker::Send
+| 18: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:27:12: 27:24, inferred_ty: *const [i32]
+| 19: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:27:12: 27:24, inferred_ty: *const [i32]
+| 20: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:29:5: 29:16, inferred_ty: *mut [i32; 10]
+| 21: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:31:5: 31:23, inferred_ty: *mut dyn std::marker::Send
+| 22: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:34:12: 34:18, inferred_ty: *mut [i32; 10]
+| 23: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:34:12: 34:18, inferred_ty: *mut [i32; 10]
+| 24: user_ty: Canonical { value: Ty(*mut [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:35:12: 35:26, inferred_ty: *mut [i32; 10]
+| 25: user_ty: Canonical { value: Ty(*mut [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:35:12: 35:26, inferred_ty: *mut [i32; 10]
+| 26: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:36:12: 36:25, inferred_ty: *mut dyn std::marker::Send
+| 27: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:36:12: 36:25, inferred_ty: *mut dyn std::marker::Send
+| 28: user_ty: Canonical { value: Ty(*mut [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:37:12: 37:22, inferred_ty: *mut [i32]
+| 29: user_ty: Canonical { value: Ty(*mut [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:37:12: 37:22, inferred_ty: *mut [i32]
|
fn address_of_reborrow() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/address_of.rs:+0:26: +0:26
- let _1: &[i32; 10]; // in scope 0 at $DIR/address_of.rs:+1:9: +1:10
- let _2: [i32; 10]; // in scope 0 at $DIR/address_of.rs:+1:14: +1:21
- let mut _4: [i32; 10]; // in scope 0 at $DIR/address_of.rs:+2:22: +2:29
- let _5: *const [i32; 10]; // in scope 0 at $DIR/address_of.rs:+4:5: +4:18
- let mut _6: *const [i32; 10]; // in scope 0 at $DIR/address_of.rs:+4:5: +4:18
- let _7: *const [i32; 10]; // in scope 0 at $DIR/address_of.rs:+5:5: +5:26
- let _8: *const dyn std::marker::Send; // in scope 0 at $DIR/address_of.rs:+6:5: +6:25
- let mut _9: *const dyn std::marker::Send; // in scope 0 at $DIR/address_of.rs:+6:5: +6:25
- let mut _10: *const [i32; 10]; // in scope 0 at $DIR/address_of.rs:+6:5: +6:6
- let _11: *const [i32]; // in scope 0 at $DIR/address_of.rs:+7:5: +7:22
- let mut _12: *const [i32; 10]; // in scope 0 at $DIR/address_of.rs:+7:5: +7:6
- let _13: *const i32; // in scope 0 at $DIR/address_of.rs:+8:5: +8:20
- let mut _14: *const [i32; 10]; // in scope 0 at $DIR/address_of.rs:+8:5: +8:6
- let mut _18: *const [i32; 10]; // in scope 0 at $DIR/address_of.rs:+12:30: +12:31
- let mut _20: *const [i32; 10]; // in scope 0 at $DIR/address_of.rs:+13:27: +13:28
- let _21: *const [i32; 10]; // in scope 0 at $DIR/address_of.rs:+15:5: +15:18
- let mut _22: *const [i32; 10]; // in scope 0 at $DIR/address_of.rs:+15:5: +15:18
- let _23: *const [i32; 10]; // in scope 0 at $DIR/address_of.rs:+16:5: +16:26
- let _24: *const dyn std::marker::Send; // in scope 0 at $DIR/address_of.rs:+17:5: +17:25
- let mut _25: *const dyn std::marker::Send; // in scope 0 at $DIR/address_of.rs:+17:5: +17:25
- let mut _26: *const [i32; 10]; // in scope 0 at $DIR/address_of.rs:+17:5: +17:6
- let _27: *const [i32]; // in scope 0 at $DIR/address_of.rs:+18:5: +18:22
- let mut _28: *const [i32; 10]; // in scope 0 at $DIR/address_of.rs:+18:5: +18:6
- let mut _32: *const [i32; 10]; // in scope 0 at $DIR/address_of.rs:+22:30: +22:31
- let mut _34: *const [i32; 10]; // in scope 0 at $DIR/address_of.rs:+23:27: +23:28
- let _35: *mut [i32; 10]; // in scope 0 at $DIR/address_of.rs:+25:5: +25:16
- let mut _36: *mut [i32; 10]; // in scope 0 at $DIR/address_of.rs:+25:5: +25:16
- let _37: *mut [i32; 10]; // in scope 0 at $DIR/address_of.rs:+26:5: +26:24
- let _38: *mut dyn std::marker::Send; // in scope 0 at $DIR/address_of.rs:+27:5: +27:23
- let mut _39: *mut dyn std::marker::Send; // in scope 0 at $DIR/address_of.rs:+27:5: +27:23
- let mut _40: *mut [i32; 10]; // in scope 0 at $DIR/address_of.rs:+27:5: +27:6
- let _41: *mut [i32]; // in scope 0 at $DIR/address_of.rs:+28:5: +28:20
- let mut _42: *mut [i32; 10]; // in scope 0 at $DIR/address_of.rs:+28:5: +28:6
- let mut _46: *mut [i32; 10]; // in scope 0 at $DIR/address_of.rs:+32:28: +32:29
- let mut _48: *mut [i32; 10]; // in scope 0 at $DIR/address_of.rs:+33:25: +33:26
+ let mut _0: ();
+ let _1: &[i32; 10];
+ let _2: [i32; 10];
+ let mut _4: [i32; 10];
+ let _5: *const [i32; 10];
+ let mut _6: *const [i32; 10];
+ let _7: *const [i32; 10];
+ let _8: *const dyn std::marker::Send;
+ let mut _9: *const dyn std::marker::Send;
+ let mut _10: *const [i32; 10];
+ let _11: *const [i32];
+ let mut _12: *const [i32; 10];
+ let _13: *const i32;
+ let mut _14: *const [i32; 10];
+ let mut _18: *const [i32; 10];
+ let mut _20: *const [i32; 10];
+ let _21: *const [i32; 10];
+ let mut _22: *const [i32; 10];
+ let _23: *const [i32; 10];
+ let _24: *const dyn std::marker::Send;
+ let mut _25: *const dyn std::marker::Send;
+ let mut _26: *const [i32; 10];
+ let _27: *const [i32];
+ let mut _28: *const [i32; 10];
+ let mut _32: *const [i32; 10];
+ let mut _34: *const [i32; 10];
+ let _35: *mut [i32; 10];
+ let mut _36: *mut [i32; 10];
+ let _37: *mut [i32; 10];
+ let _38: *mut dyn std::marker::Send;
+ let mut _39: *mut dyn std::marker::Send;
+ let mut _40: *mut [i32; 10];
+ let _41: *mut [i32];
+ let mut _42: *mut [i32; 10];
+ let mut _46: *mut [i32; 10];
+ let mut _48: *mut [i32; 10];
scope 1 {
- debug y => _1; // in scope 1 at $DIR/address_of.rs:+1:9: +1:10
- let mut _3: &mut [i32; 10]; // in scope 1 at $DIR/address_of.rs:+2:9: +2:14
+ debug y => _1;
+ let mut _3: &mut [i32; 10];
scope 2 {
- debug z => _3; // in scope 2 at $DIR/address_of.rs:+2:9: +2:14
- let _15: *const [i32; 10] as UserTypeProjection { base: UserType(2), projs: [] }; // in scope 2 at $DIR/address_of.rs:+10:9: +10:10
+ debug z => _3;
+ let _15: *const [i32; 10] as UserTypeProjection { base: UserType(2), projs: [] };
scope 3 {
- debug p => _15; // in scope 3 at $DIR/address_of.rs:+10:9: +10:10
- let _16: *const [i32; 10] as UserTypeProjection { base: UserType(4), projs: [] }; // in scope 3 at $DIR/address_of.rs:+11:9: +11:10
+ debug p => _15;
+ let _16: *const [i32; 10] as UserTypeProjection { base: UserType(4), projs: [] };
scope 4 {
- debug p => _16; // in scope 4 at $DIR/address_of.rs:+11:9: +11:10
- let _17: *const dyn std::marker::Send as UserTypeProjection { base: UserType(6), projs: [] }; // in scope 4 at $DIR/address_of.rs:+12:9: +12:10
+ debug p => _16;
+ let _17: *const dyn std::marker::Send as UserTypeProjection { base: UserType(6), projs: [] };
scope 5 {
- debug p => _17; // in scope 5 at $DIR/address_of.rs:+12:9: +12:10
- let _19: *const [i32] as UserTypeProjection { base: UserType(8), projs: [] }; // in scope 5 at $DIR/address_of.rs:+13:9: +13:10
+ debug p => _17;
+ let _19: *const [i32] as UserTypeProjection { base: UserType(8), projs: [] };
scope 6 {
- debug p => _19; // in scope 6 at $DIR/address_of.rs:+13:9: +13:10
- let _29: *const [i32; 10] as UserTypeProjection { base: UserType(12), projs: [] }; // in scope 6 at $DIR/address_of.rs:+20:9: +20:10
+ debug p => _19;
+ let _29: *const [i32; 10] as UserTypeProjection { base: UserType(12), projs: [] };
scope 7 {
- debug p => _29; // in scope 7 at $DIR/address_of.rs:+20:9: +20:10
- let _30: *const [i32; 10] as UserTypeProjection { base: UserType(14), projs: [] }; // in scope 7 at $DIR/address_of.rs:+21:9: +21:10
+ debug p => _29;
+ let _30: *const [i32; 10] as UserTypeProjection { base: UserType(14), projs: [] };
scope 8 {
- debug p => _30; // in scope 8 at $DIR/address_of.rs:+21:9: +21:10
- let _31: *const dyn std::marker::Send as UserTypeProjection { base: UserType(16), projs: [] }; // in scope 8 at $DIR/address_of.rs:+22:9: +22:10
+ debug p => _30;
+ let _31: *const dyn std::marker::Send as UserTypeProjection { base: UserType(16), projs: [] };
scope 9 {
- debug p => _31; // in scope 9 at $DIR/address_of.rs:+22:9: +22:10
- let _33: *const [i32] as UserTypeProjection { base: UserType(18), projs: [] }; // in scope 9 at $DIR/address_of.rs:+23:9: +23:10
+ debug p => _31;
+ let _33: *const [i32] as UserTypeProjection { base: UserType(18), projs: [] };
scope 10 {
- debug p => _33; // in scope 10 at $DIR/address_of.rs:+23:9: +23:10
- let _43: *mut [i32; 10] as UserTypeProjection { base: UserType(22), projs: [] }; // in scope 10 at $DIR/address_of.rs:+30:9: +30:10
+ debug p => _33;
+ let _43: *mut [i32; 10] as UserTypeProjection { base: UserType(22), projs: [] };
scope 11 {
- debug p => _43; // in scope 11 at $DIR/address_of.rs:+30:9: +30:10
- let _44: *mut [i32; 10] as UserTypeProjection { base: UserType(24), projs: [] }; // in scope 11 at $DIR/address_of.rs:+31:9: +31:10
+ debug p => _43;
+ let _44: *mut [i32; 10] as UserTypeProjection { base: UserType(24), projs: [] };
scope 12 {
- debug p => _44; // in scope 12 at $DIR/address_of.rs:+31:9: +31:10
- let _45: *mut dyn std::marker::Send as UserTypeProjection { base: UserType(26), projs: [] }; // in scope 12 at $DIR/address_of.rs:+32:9: +32:10
+ debug p => _44;
+ let _45: *mut dyn std::marker::Send as UserTypeProjection { base: UserType(26), projs: [] };
scope 13 {
- debug p => _45; // in scope 13 at $DIR/address_of.rs:+32:9: +32:10
- let _47: *mut [i32] as UserTypeProjection { base: UserType(28), projs: [] }; // in scope 13 at $DIR/address_of.rs:+33:9: +33:10
+ debug p => _45;
+ let _47: *mut [i32] as UserTypeProjection { base: UserType(28), projs: [] };
scope 14 {
- debug p => _47; // in scope 14 at $DIR/address_of.rs:+33:9: +33:10
+ debug p => _47;
}
}
}
@@ -126,183 +126,183 @@ fn address_of_reborrow() -> () {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/address_of.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/address_of.rs:+1:14: +1:21
- _2 = [const 0_i32; 10]; // scope 0 at $DIR/address_of.rs:+1:14: +1:21
- _1 = &_2; // scope 0 at $DIR/address_of.rs:+1:13: +1:21
- FakeRead(ForLet(None), _1); // scope 0 at $DIR/address_of.rs:+1:9: +1:10
- StorageLive(_3); // scope 1 at $DIR/address_of.rs:+2:9: +2:14
- StorageLive(_4); // scope 1 at $DIR/address_of.rs:+2:22: +2:29
- _4 = [const 0_i32; 10]; // scope 1 at $DIR/address_of.rs:+2:22: +2:29
- _3 = &mut _4; // scope 1 at $DIR/address_of.rs:+2:17: +2:29
- FakeRead(ForLet(None), _3); // scope 1 at $DIR/address_of.rs:+2:9: +2:14
- StorageLive(_5); // scope 2 at $DIR/address_of.rs:+4:5: +4:18
- StorageLive(_6); // scope 2 at $DIR/address_of.rs:+4:5: +4:18
- _6 = &raw const (*_1); // scope 2 at $DIR/address_of.rs:+4:5: +4:6
- AscribeUserType(_6, o, UserTypeProjection { base: UserType(0), projs: [] }); // scope 2 at $DIR/address_of.rs:+4:5: +4:18
- _5 = _6; // scope 2 at $DIR/address_of.rs:+4:5: +4:18
- StorageDead(_6); // scope 2 at $DIR/address_of.rs:+4:18: +4:19
- StorageDead(_5); // scope 2 at $DIR/address_of.rs:+4:18: +4:19
- StorageLive(_7); // scope 2 at $DIR/address_of.rs:+5:5: +5:26
- _7 = &raw const (*_1); // scope 2 at $DIR/address_of.rs:+5:5: +5:6
- StorageDead(_7); // scope 2 at $DIR/address_of.rs:+5:26: +5:27
- StorageLive(_8); // scope 2 at $DIR/address_of.rs:+6:5: +6:25
- StorageLive(_9); // scope 2 at $DIR/address_of.rs:+6:5: +6:25
- StorageLive(_10); // scope 2 at $DIR/address_of.rs:+6:5: +6:6
- _10 = &raw const (*_1); // scope 2 at $DIR/address_of.rs:+6:5: +6:6
- _9 = move _10 as *const dyn std::marker::Send (Pointer(Unsize)); // scope 2 at $DIR/address_of.rs:+6:5: +6:6
- StorageDead(_10); // scope 2 at $DIR/address_of.rs:+6:5: +6:6
- AscribeUserType(_9, o, UserTypeProjection { base: UserType(1), projs: [] }); // scope 2 at $DIR/address_of.rs:+6:5: +6:25
- _8 = _9; // scope 2 at $DIR/address_of.rs:+6:5: +6:25
- StorageDead(_9); // scope 2 at $DIR/address_of.rs:+6:25: +6:26
- StorageDead(_8); // scope 2 at $DIR/address_of.rs:+6:25: +6:26
- StorageLive(_11); // scope 2 at $DIR/address_of.rs:+7:5: +7:22
- StorageLive(_12); // scope 2 at $DIR/address_of.rs:+7:5: +7:6
- _12 = &raw const (*_1); // scope 2 at $DIR/address_of.rs:+7:5: +7:6
- _11 = move _12 as *const [i32] (Pointer(Unsize)); // scope 2 at $DIR/address_of.rs:+7:5: +7:6
- StorageDead(_12); // scope 2 at $DIR/address_of.rs:+7:5: +7:6
- StorageDead(_11); // scope 2 at $DIR/address_of.rs:+7:22: +7:23
- StorageLive(_13); // scope 2 at $DIR/address_of.rs:+8:5: +8:20
- StorageLive(_14); // scope 2 at $DIR/address_of.rs:+8:5: +8:6
- _14 = &raw const (*_1); // scope 2 at $DIR/address_of.rs:+8:5: +8:6
- _13 = move _14 as *const i32 (Pointer(ArrayToPointer)); // scope 2 at $DIR/address_of.rs:+8:5: +8:20
- StorageDead(_14); // scope 2 at $DIR/address_of.rs:+8:19: +8:20
- StorageDead(_13); // scope 2 at $DIR/address_of.rs:+8:20: +8:21
- StorageLive(_15); // scope 2 at $DIR/address_of.rs:+10:9: +10:10
- _15 = &raw const (*_1); // scope 2 at $DIR/address_of.rs:+10:23: +10:24
- FakeRead(ForLet(None), _15); // scope 2 at $DIR/address_of.rs:+10:9: +10:10
- AscribeUserType(_15, o, UserTypeProjection { base: UserType(3), projs: [] }); // scope 2 at $DIR/address_of.rs:+10:12: +10:20
- StorageLive(_16); // scope 3 at $DIR/address_of.rs:+11:9: +11:10
- _16 = &raw const (*_1); // scope 3 at $DIR/address_of.rs:+11:31: +11:32
- FakeRead(ForLet(None), _16); // scope 3 at $DIR/address_of.rs:+11:9: +11:10
- AscribeUserType(_16, o, UserTypeProjection { base: UserType(5), projs: [] }); // scope 3 at $DIR/address_of.rs:+11:12: +11:28
- StorageLive(_17); // scope 4 at $DIR/address_of.rs:+12:9: +12:10
- StorageLive(_18); // scope 4 at $DIR/address_of.rs:+12:30: +12:31
- _18 = &raw const (*_1); // scope 4 at $DIR/address_of.rs:+12:30: +12:31
- _17 = move _18 as *const dyn std::marker::Send (Pointer(Unsize)); // scope 4 at $DIR/address_of.rs:+12:30: +12:31
- StorageDead(_18); // scope 4 at $DIR/address_of.rs:+12:30: +12:31
- FakeRead(ForLet(None), _17); // scope 4 at $DIR/address_of.rs:+12:9: +12:10
- AscribeUserType(_17, o, UserTypeProjection { base: UserType(7), projs: [] }); // scope 4 at $DIR/address_of.rs:+12:12: +12:27
- StorageLive(_19); // scope 5 at $DIR/address_of.rs:+13:9: +13:10
- StorageLive(_20); // scope 5 at $DIR/address_of.rs:+13:27: +13:28
- _20 = &raw const (*_1); // scope 5 at $DIR/address_of.rs:+13:27: +13:28
- _19 = move _20 as *const [i32] (Pointer(Unsize)); // scope 5 at $DIR/address_of.rs:+13:27: +13:28
- StorageDead(_20); // scope 5 at $DIR/address_of.rs:+13:27: +13:28
- FakeRead(ForLet(None), _19); // scope 5 at $DIR/address_of.rs:+13:9: +13:10
- AscribeUserType(_19, o, UserTypeProjection { base: UserType(9), projs: [] }); // scope 5 at $DIR/address_of.rs:+13:12: +13:24
- StorageLive(_21); // scope 6 at $DIR/address_of.rs:+15:5: +15:18
- StorageLive(_22); // scope 6 at $DIR/address_of.rs:+15:5: +15:18
- _22 = &raw const (*_3); // scope 6 at $DIR/address_of.rs:+15:5: +15:6
- AscribeUserType(_22, o, UserTypeProjection { base: UserType(10), projs: [] }); // scope 6 at $DIR/address_of.rs:+15:5: +15:18
- _21 = _22; // scope 6 at $DIR/address_of.rs:+15:5: +15:18
- StorageDead(_22); // scope 6 at $DIR/address_of.rs:+15:18: +15:19
- StorageDead(_21); // scope 6 at $DIR/address_of.rs:+15:18: +15:19
- StorageLive(_23); // scope 6 at $DIR/address_of.rs:+16:5: +16:26
- _23 = &raw const (*_3); // scope 6 at $DIR/address_of.rs:+16:5: +16:6
- StorageDead(_23); // scope 6 at $DIR/address_of.rs:+16:26: +16:27
- StorageLive(_24); // scope 6 at $DIR/address_of.rs:+17:5: +17:25
- StorageLive(_25); // scope 6 at $DIR/address_of.rs:+17:5: +17:25
- StorageLive(_26); // scope 6 at $DIR/address_of.rs:+17:5: +17:6
- _26 = &raw const (*_3); // scope 6 at $DIR/address_of.rs:+17:5: +17:6
- _25 = move _26 as *const dyn std::marker::Send (Pointer(Unsize)); // scope 6 at $DIR/address_of.rs:+17:5: +17:6
- StorageDead(_26); // scope 6 at $DIR/address_of.rs:+17:5: +17:6
- AscribeUserType(_25, o, UserTypeProjection { base: UserType(11), projs: [] }); // scope 6 at $DIR/address_of.rs:+17:5: +17:25
- _24 = _25; // scope 6 at $DIR/address_of.rs:+17:5: +17:25
- StorageDead(_25); // scope 6 at $DIR/address_of.rs:+17:25: +17:26
- StorageDead(_24); // scope 6 at $DIR/address_of.rs:+17:25: +17:26
- StorageLive(_27); // scope 6 at $DIR/address_of.rs:+18:5: +18:22
- StorageLive(_28); // scope 6 at $DIR/address_of.rs:+18:5: +18:6
- _28 = &raw const (*_3); // scope 6 at $DIR/address_of.rs:+18:5: +18:6
- _27 = move _28 as *const [i32] (Pointer(Unsize)); // scope 6 at $DIR/address_of.rs:+18:5: +18:6
- StorageDead(_28); // scope 6 at $DIR/address_of.rs:+18:5: +18:6
- StorageDead(_27); // scope 6 at $DIR/address_of.rs:+18:22: +18:23
- StorageLive(_29); // scope 6 at $DIR/address_of.rs:+20:9: +20:10
- _29 = &raw const (*_3); // scope 6 at $DIR/address_of.rs:+20:23: +20:24
- FakeRead(ForLet(None), _29); // scope 6 at $DIR/address_of.rs:+20:9: +20:10
- AscribeUserType(_29, o, UserTypeProjection { base: UserType(13), projs: [] }); // scope 6 at $DIR/address_of.rs:+20:12: +20:20
- StorageLive(_30); // scope 7 at $DIR/address_of.rs:+21:9: +21:10
- _30 = &raw const (*_3); // scope 7 at $DIR/address_of.rs:+21:31: +21:32
- FakeRead(ForLet(None), _30); // scope 7 at $DIR/address_of.rs:+21:9: +21:10
- AscribeUserType(_30, o, UserTypeProjection { base: UserType(15), projs: [] }); // scope 7 at $DIR/address_of.rs:+21:12: +21:28
- StorageLive(_31); // scope 8 at $DIR/address_of.rs:+22:9: +22:10
- StorageLive(_32); // scope 8 at $DIR/address_of.rs:+22:30: +22:31
- _32 = &raw const (*_3); // scope 8 at $DIR/address_of.rs:+22:30: +22:31
- _31 = move _32 as *const dyn std::marker::Send (Pointer(Unsize)); // scope 8 at $DIR/address_of.rs:+22:30: +22:31
- StorageDead(_32); // scope 8 at $DIR/address_of.rs:+22:30: +22:31
- FakeRead(ForLet(None), _31); // scope 8 at $DIR/address_of.rs:+22:9: +22:10
- AscribeUserType(_31, o, UserTypeProjection { base: UserType(17), projs: [] }); // scope 8 at $DIR/address_of.rs:+22:12: +22:27
- StorageLive(_33); // scope 9 at $DIR/address_of.rs:+23:9: +23:10
- StorageLive(_34); // scope 9 at $DIR/address_of.rs:+23:27: +23:28
- _34 = &raw const (*_3); // scope 9 at $DIR/address_of.rs:+23:27: +23:28
- _33 = move _34 as *const [i32] (Pointer(Unsize)); // scope 9 at $DIR/address_of.rs:+23:27: +23:28
- StorageDead(_34); // scope 9 at $DIR/address_of.rs:+23:27: +23:28
- FakeRead(ForLet(None), _33); // scope 9 at $DIR/address_of.rs:+23:9: +23:10
- AscribeUserType(_33, o, UserTypeProjection { base: UserType(19), projs: [] }); // scope 9 at $DIR/address_of.rs:+23:12: +23:24
- StorageLive(_35); // scope 10 at $DIR/address_of.rs:+25:5: +25:16
- StorageLive(_36); // scope 10 at $DIR/address_of.rs:+25:5: +25:16
- _36 = &raw mut (*_3); // scope 10 at $DIR/address_of.rs:+25:5: +25:6
- AscribeUserType(_36, o, UserTypeProjection { base: UserType(20), projs: [] }); // scope 10 at $DIR/address_of.rs:+25:5: +25:16
- _35 = _36; // scope 10 at $DIR/address_of.rs:+25:5: +25:16
- StorageDead(_36); // scope 10 at $DIR/address_of.rs:+25:16: +25:17
- StorageDead(_35); // scope 10 at $DIR/address_of.rs:+25:16: +25:17
- StorageLive(_37); // scope 10 at $DIR/address_of.rs:+26:5: +26:24
- _37 = &raw mut (*_3); // scope 10 at $DIR/address_of.rs:+26:5: +26:6
- StorageDead(_37); // scope 10 at $DIR/address_of.rs:+26:24: +26:25
- StorageLive(_38); // scope 10 at $DIR/address_of.rs:+27:5: +27:23
- StorageLive(_39); // scope 10 at $DIR/address_of.rs:+27:5: +27:23
- StorageLive(_40); // scope 10 at $DIR/address_of.rs:+27:5: +27:6
- _40 = &raw mut (*_3); // scope 10 at $DIR/address_of.rs:+27:5: +27:6
- _39 = move _40 as *mut dyn std::marker::Send (Pointer(Unsize)); // scope 10 at $DIR/address_of.rs:+27:5: +27:6
- StorageDead(_40); // scope 10 at $DIR/address_of.rs:+27:5: +27:6
- AscribeUserType(_39, o, UserTypeProjection { base: UserType(21), projs: [] }); // scope 10 at $DIR/address_of.rs:+27:5: +27:23
- _38 = _39; // scope 10 at $DIR/address_of.rs:+27:5: +27:23
- StorageDead(_39); // scope 10 at $DIR/address_of.rs:+27:23: +27:24
- StorageDead(_38); // scope 10 at $DIR/address_of.rs:+27:23: +27:24
- StorageLive(_41); // scope 10 at $DIR/address_of.rs:+28:5: +28:20
- StorageLive(_42); // scope 10 at $DIR/address_of.rs:+28:5: +28:6
- _42 = &raw mut (*_3); // scope 10 at $DIR/address_of.rs:+28:5: +28:6
- _41 = move _42 as *mut [i32] (Pointer(Unsize)); // scope 10 at $DIR/address_of.rs:+28:5: +28:6
- StorageDead(_42); // scope 10 at $DIR/address_of.rs:+28:5: +28:6
- StorageDead(_41); // scope 10 at $DIR/address_of.rs:+28:20: +28:21
- StorageLive(_43); // scope 10 at $DIR/address_of.rs:+30:9: +30:10
- _43 = &raw mut (*_3); // scope 10 at $DIR/address_of.rs:+30:21: +30:22
- FakeRead(ForLet(None), _43); // scope 10 at $DIR/address_of.rs:+30:9: +30:10
- AscribeUserType(_43, o, UserTypeProjection { base: UserType(23), projs: [] }); // scope 10 at $DIR/address_of.rs:+30:12: +30:18
- StorageLive(_44); // scope 11 at $DIR/address_of.rs:+31:9: +31:10
- _44 = &raw mut (*_3); // scope 11 at $DIR/address_of.rs:+31:29: +31:30
- FakeRead(ForLet(None), _44); // scope 11 at $DIR/address_of.rs:+31:9: +31:10
- AscribeUserType(_44, o, UserTypeProjection { base: UserType(25), projs: [] }); // scope 11 at $DIR/address_of.rs:+31:12: +31:26
- StorageLive(_45); // scope 12 at $DIR/address_of.rs:+32:9: +32:10
- StorageLive(_46); // scope 12 at $DIR/address_of.rs:+32:28: +32:29
- _46 = &raw mut (*_3); // scope 12 at $DIR/address_of.rs:+32:28: +32:29
- _45 = move _46 as *mut dyn std::marker::Send (Pointer(Unsize)); // scope 12 at $DIR/address_of.rs:+32:28: +32:29
- StorageDead(_46); // scope 12 at $DIR/address_of.rs:+32:28: +32:29
- FakeRead(ForLet(None), _45); // scope 12 at $DIR/address_of.rs:+32:9: +32:10
- AscribeUserType(_45, o, UserTypeProjection { base: UserType(27), projs: [] }); // scope 12 at $DIR/address_of.rs:+32:12: +32:25
- StorageLive(_47); // scope 13 at $DIR/address_of.rs:+33:9: +33:10
- StorageLive(_48); // scope 13 at $DIR/address_of.rs:+33:25: +33:26
- _48 = &raw mut (*_3); // scope 13 at $DIR/address_of.rs:+33:25: +33:26
- _47 = move _48 as *mut [i32] (Pointer(Unsize)); // scope 13 at $DIR/address_of.rs:+33:25: +33:26
- StorageDead(_48); // scope 13 at $DIR/address_of.rs:+33:25: +33:26
- FakeRead(ForLet(None), _47); // scope 13 at $DIR/address_of.rs:+33:9: +33:10
- AscribeUserType(_47, o, UserTypeProjection { base: UserType(29), projs: [] }); // scope 13 at $DIR/address_of.rs:+33:12: +33:22
- _0 = const (); // scope 0 at $DIR/address_of.rs:+0:26: +34:2
- StorageDead(_47); // scope 13 at $DIR/address_of.rs:+34:1: +34:2
- StorageDead(_45); // scope 12 at $DIR/address_of.rs:+34:1: +34:2
- StorageDead(_44); // scope 11 at $DIR/address_of.rs:+34:1: +34:2
- StorageDead(_43); // scope 10 at $DIR/address_of.rs:+34:1: +34:2
- StorageDead(_33); // scope 9 at $DIR/address_of.rs:+34:1: +34:2
- StorageDead(_31); // scope 8 at $DIR/address_of.rs:+34:1: +34:2
- StorageDead(_30); // scope 7 at $DIR/address_of.rs:+34:1: +34:2
- StorageDead(_29); // scope 6 at $DIR/address_of.rs:+34:1: +34:2
- StorageDead(_19); // scope 5 at $DIR/address_of.rs:+34:1: +34:2
- StorageDead(_17); // scope 4 at $DIR/address_of.rs:+34:1: +34:2
- StorageDead(_16); // scope 3 at $DIR/address_of.rs:+34:1: +34:2
- StorageDead(_15); // scope 2 at $DIR/address_of.rs:+34:1: +34:2
- StorageDead(_4); // scope 1 at $DIR/address_of.rs:+34:1: +34:2
- StorageDead(_3); // scope 1 at $DIR/address_of.rs:+34:1: +34:2
- StorageDead(_2); // scope 0 at $DIR/address_of.rs:+34:1: +34:2
- StorageDead(_1); // scope 0 at $DIR/address_of.rs:+34:1: +34:2
- return; // scope 0 at $DIR/address_of.rs:+34:2: +34:2
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = [const 0_i32; 10];
+ _1 = &_2;
+ FakeRead(ForLet(None), _1);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = [const 0_i32; 10];
+ _3 = &mut _4;
+ FakeRead(ForLet(None), _3);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = &raw const (*_1);
+ AscribeUserType(_6, o, UserTypeProjection { base: UserType(0), projs: [] });
+ _5 = _6;
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_7);
+ _7 = &raw const (*_1);
+ StorageDead(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = &raw const (*_1);
+ _9 = move _10 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ StorageDead(_10);
+ AscribeUserType(_9, o, UserTypeProjection { base: UserType(1), projs: [] });
+ _8 = _9;
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = &raw const (*_1);
+ _11 = move _12 as *const [i32] (PointerCoercion(Unsize));
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_13);
+ StorageLive(_14);
+ _14 = &raw const (*_1);
+ _13 = move _14 as *const i32 (PointerCoercion(ArrayToPointer));
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageLive(_15);
+ _15 = &raw const (*_1);
+ FakeRead(ForLet(None), _15);
+ AscribeUserType(_15, o, UserTypeProjection { base: UserType(3), projs: [] });
+ StorageLive(_16);
+ _16 = &raw const (*_1);
+ FakeRead(ForLet(None), _16);
+ AscribeUserType(_16, o, UserTypeProjection { base: UserType(5), projs: [] });
+ StorageLive(_17);
+ StorageLive(_18);
+ _18 = &raw const (*_1);
+ _17 = move _18 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ StorageDead(_18);
+ FakeRead(ForLet(None), _17);
+ AscribeUserType(_17, o, UserTypeProjection { base: UserType(7), projs: [] });
+ StorageLive(_19);
+ StorageLive(_20);
+ _20 = &raw const (*_1);
+ _19 = move _20 as *const [i32] (PointerCoercion(Unsize));
+ StorageDead(_20);
+ FakeRead(ForLet(None), _19);
+ AscribeUserType(_19, o, UserTypeProjection { base: UserType(9), projs: [] });
+ StorageLive(_21);
+ StorageLive(_22);
+ _22 = &raw const (*_3);
+ AscribeUserType(_22, o, UserTypeProjection { base: UserType(10), projs: [] });
+ _21 = _22;
+ StorageDead(_22);
+ StorageDead(_21);
+ StorageLive(_23);
+ _23 = &raw const (*_3);
+ StorageDead(_23);
+ StorageLive(_24);
+ StorageLive(_25);
+ StorageLive(_26);
+ _26 = &raw const (*_3);
+ _25 = move _26 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ StorageDead(_26);
+ AscribeUserType(_25, o, UserTypeProjection { base: UserType(11), projs: [] });
+ _24 = _25;
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageLive(_27);
+ StorageLive(_28);
+ _28 = &raw const (*_3);
+ _27 = move _28 as *const [i32] (PointerCoercion(Unsize));
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageLive(_29);
+ _29 = &raw const (*_3);
+ FakeRead(ForLet(None), _29);
+ AscribeUserType(_29, o, UserTypeProjection { base: UserType(13), projs: [] });
+ StorageLive(_30);
+ _30 = &raw const (*_3);
+ FakeRead(ForLet(None), _30);
+ AscribeUserType(_30, o, UserTypeProjection { base: UserType(15), projs: [] });
+ StorageLive(_31);
+ StorageLive(_32);
+ _32 = &raw const (*_3);
+ _31 = move _32 as *const dyn std::marker::Send (PointerCoercion(Unsize));
+ StorageDead(_32);
+ FakeRead(ForLet(None), _31);
+ AscribeUserType(_31, o, UserTypeProjection { base: UserType(17), projs: [] });
+ StorageLive(_33);
+ StorageLive(_34);
+ _34 = &raw const (*_3);
+ _33 = move _34 as *const [i32] (PointerCoercion(Unsize));
+ StorageDead(_34);
+ FakeRead(ForLet(None), _33);
+ AscribeUserType(_33, o, UserTypeProjection { base: UserType(19), projs: [] });
+ StorageLive(_35);
+ StorageLive(_36);
+ _36 = &raw mut (*_3);
+ AscribeUserType(_36, o, UserTypeProjection { base: UserType(20), projs: [] });
+ _35 = _36;
+ StorageDead(_36);
+ StorageDead(_35);
+ StorageLive(_37);
+ _37 = &raw mut (*_3);
+ StorageDead(_37);
+ StorageLive(_38);
+ StorageLive(_39);
+ StorageLive(_40);
+ _40 = &raw mut (*_3);
+ _39 = move _40 as *mut dyn std::marker::Send (PointerCoercion(Unsize));
+ StorageDead(_40);
+ AscribeUserType(_39, o, UserTypeProjection { base: UserType(21), projs: [] });
+ _38 = _39;
+ StorageDead(_39);
+ StorageDead(_38);
+ StorageLive(_41);
+ StorageLive(_42);
+ _42 = &raw mut (*_3);
+ _41 = move _42 as *mut [i32] (PointerCoercion(Unsize));
+ StorageDead(_42);
+ StorageDead(_41);
+ StorageLive(_43);
+ _43 = &raw mut (*_3);
+ FakeRead(ForLet(None), _43);
+ AscribeUserType(_43, o, UserTypeProjection { base: UserType(23), projs: [] });
+ StorageLive(_44);
+ _44 = &raw mut (*_3);
+ FakeRead(ForLet(None), _44);
+ AscribeUserType(_44, o, UserTypeProjection { base: UserType(25), projs: [] });
+ StorageLive(_45);
+ StorageLive(_46);
+ _46 = &raw mut (*_3);
+ _45 = move _46 as *mut dyn std::marker::Send (PointerCoercion(Unsize));
+ StorageDead(_46);
+ FakeRead(ForLet(None), _45);
+ AscribeUserType(_45, o, UserTypeProjection { base: UserType(27), projs: [] });
+ StorageLive(_47);
+ StorageLive(_48);
+ _48 = &raw mut (*_3);
+ _47 = move _48 as *mut [i32] (PointerCoercion(Unsize));
+ StorageDead(_48);
+ FakeRead(ForLet(None), _47);
+ AscribeUserType(_47, o, UserTypeProjection { base: UserType(29), projs: [] });
+ _0 = const ();
+ StorageDead(_47);
+ StorageDead(_45);
+ StorageDead(_44);
+ StorageDead(_43);
+ StorageDead(_33);
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageDead(_29);
+ StorageDead(_19);
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageDead(_15);
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/address_of.borrow_and_cast.SimplifyCfg-initial.after.mir b/tests/mir-opt/address_of.borrow_and_cast.SimplifyCfg-initial.after.mir
index 4c67376b5..a07ccd460 100644
--- a/tests/mir-opt/address_of.borrow_and_cast.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/address_of.borrow_and_cast.SimplifyCfg-initial.after.mir
@@ -1,47 +1,47 @@
// MIR for `borrow_and_cast` after SimplifyCfg-initial
fn borrow_and_cast(_1: i32) -> () {
- debug x => _1; // in scope 0 at $DIR/address_of.rs:+0:20: +0:25
- let mut _0: (); // return place in scope 0 at $DIR/address_of.rs:+0:32: +0:32
- let _2: *const i32; // in scope 0 at $DIR/address_of.rs:+1:9: +1:10
- let _3: &i32; // in scope 0 at $DIR/address_of.rs:+1:13: +1:15
- let _5: &mut i32; // in scope 0 at $DIR/address_of.rs:+2:13: +2:19
- let mut _7: &mut i32; // in scope 0 at $DIR/address_of.rs:+3:13: +3:19
+ debug x => _1;
+ let mut _0: ();
+ let _2: *const i32;
+ let _3: &i32;
+ let _5: &mut i32;
+ let mut _7: &mut i32;
scope 1 {
- debug p => _2; // in scope 1 at $DIR/address_of.rs:+1:9: +1:10
- let _4: *const i32; // in scope 1 at $DIR/address_of.rs:+2:9: +2:10
+ debug p => _2;
+ let _4: *const i32;
scope 2 {
- debug q => _4; // in scope 2 at $DIR/address_of.rs:+2:9: +2:10
- let _6: *mut i32; // in scope 2 at $DIR/address_of.rs:+3:9: +3:10
+ debug q => _4;
+ let _6: *mut i32;
scope 3 {
- debug r => _6; // in scope 3 at $DIR/address_of.rs:+3:9: +3:10
+ debug r => _6;
}
}
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/address_of.rs:+1:9: +1:10
- StorageLive(_3); // scope 0 at $DIR/address_of.rs:+1:13: +1:15
- _3 = &_1; // scope 0 at $DIR/address_of.rs:+1:13: +1:15
- _2 = &raw const (*_3); // scope 0 at $DIR/address_of.rs:+1:13: +1:15
- FakeRead(ForLet(None), _2); // scope 0 at $DIR/address_of.rs:+1:9: +1:10
- StorageDead(_3); // scope 0 at $DIR/address_of.rs:+1:29: +1:30
- StorageLive(_4); // scope 1 at $DIR/address_of.rs:+2:9: +2:10
- StorageLive(_5); // scope 1 at $DIR/address_of.rs:+2:13: +2:19
- _5 = &mut _1; // scope 1 at $DIR/address_of.rs:+2:13: +2:19
- _4 = &raw const (*_5); // scope 1 at $DIR/address_of.rs:+2:13: +2:19
- FakeRead(ForLet(None), _4); // scope 1 at $DIR/address_of.rs:+2:9: +2:10
- StorageDead(_5); // scope 1 at $DIR/address_of.rs:+2:33: +2:34
- StorageLive(_6); // scope 2 at $DIR/address_of.rs:+3:9: +3:10
- StorageLive(_7); // scope 2 at $DIR/address_of.rs:+3:13: +3:19
- _7 = &mut _1; // scope 2 at $DIR/address_of.rs:+3:13: +3:19
- _6 = &raw mut (*_7); // scope 2 at $DIR/address_of.rs:+3:13: +3:19
- FakeRead(ForLet(None), _6); // scope 2 at $DIR/address_of.rs:+3:9: +3:10
- StorageDead(_7); // scope 2 at $DIR/address_of.rs:+3:31: +3:32
- _0 = const (); // scope 0 at $DIR/address_of.rs:+0:32: +4:2
- StorageDead(_6); // scope 2 at $DIR/address_of.rs:+4:1: +4:2
- StorageDead(_4); // scope 1 at $DIR/address_of.rs:+4:1: +4:2
- StorageDead(_2); // scope 0 at $DIR/address_of.rs:+4:1: +4:2
- return; // scope 0 at $DIR/address_of.rs:+4:2: +4:2
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &_1;
+ _2 = &raw const (*_3);
+ FakeRead(ForLet(None), _2);
+ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = &mut _1;
+ _4 = &raw const (*_5);
+ FakeRead(ForLet(None), _4);
+ StorageDead(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &mut _1;
+ _6 = &raw mut (*_7);
+ FakeRead(ForLet(None), _6);
+ StorageDead(_7);
+ _0 = const ();
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/address_of.rs b/tests/mir-opt/address_of.rs
index c4bea5613..57a317a4a 100644
--- a/tests/mir-opt/address_of.rs
+++ b/tests/mir-opt/address_of.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR address_of.address_of_reborrow.SimplifyCfg-initial.after.mir
fn address_of_reborrow() {
diff --git a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir
deleted file mode 100644
index 4be382fac..000000000
--- a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir
+++ /dev/null
@@ -1,64 +0,0 @@
-// MIR for `main` after SimplifyCfg-elaborate-drops
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/array_index_is_temporary.rs:+0:11: +0:11
- let mut _1: [u32; 3]; // in scope 0 at $DIR/array_index_is_temporary.rs:+1:9: +1:14
- let mut _4: &mut usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
- let mut _5: u32; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:12: +4:29
- let mut _6: *mut usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:25: +4:26
- let _7: usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:7: +4:8
- let mut _8: usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
- let mut _9: bool; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/array_index_is_temporary.rs:+1:9: +1:14
- let mut _2: usize; // in scope 1 at $DIR/array_index_is_temporary.rs:+2:9: +2:14
- scope 2 {
- debug y => _2; // in scope 2 at $DIR/array_index_is_temporary.rs:+2:9: +2:14
- let _3: *mut usize; // in scope 2 at $DIR/array_index_is_temporary.rs:+3:9: +3:10
- scope 3 {
- debug z => _3; // in scope 3 at $DIR/array_index_is_temporary.rs:+3:9: +3:10
- scope 4 {
- }
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/array_index_is_temporary.rs:+1:9: +1:14
- _1 = [const 42_u32, const 43_u32, const 44_u32]; // scope 0 at $DIR/array_index_is_temporary.rs:+1:17: +1:29
- StorageLive(_2); // scope 1 at $DIR/array_index_is_temporary.rs:+2:9: +2:14
- _2 = const 1_usize; // scope 1 at $DIR/array_index_is_temporary.rs:+2:17: +2:18
- StorageLive(_3); // scope 2 at $DIR/array_index_is_temporary.rs:+3:9: +3:10
- StorageLive(_4); // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
- _4 = &mut _2; // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
- _3 = &raw mut (*_4); // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
- StorageDead(_4); // scope 2 at $DIR/array_index_is_temporary.rs:+3:31: +3:32
- StorageLive(_5); // scope 3 at $DIR/array_index_is_temporary.rs:+4:12: +4:29
- StorageLive(_6); // scope 4 at $DIR/array_index_is_temporary.rs:+4:25: +4:26
- _6 = _3; // scope 4 at $DIR/array_index_is_temporary.rs:+4:25: +4:26
- _5 = foo(move _6) -> bb1; // scope 4 at $DIR/array_index_is_temporary.rs:+4:21: +4:27
- // mir::Constant
- // + span: $DIR/array_index_is_temporary.rs:17:21: 17:24
- // + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_6); // scope 4 at $DIR/array_index_is_temporary.rs:+4:26: +4:27
- StorageLive(_7); // scope 3 at $DIR/array_index_is_temporary.rs:+4:7: +4:8
- _7 = _2; // scope 3 at $DIR/array_index_is_temporary.rs:+4:7: +4:8
- _8 = Len(_1); // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
- _9 = Lt(_7, _8); // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
- assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb2; // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
- }
-
- bb2: {
- _1[_7] = move _5; // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:29
- StorageDead(_5); // scope 3 at $DIR/array_index_is_temporary.rs:+4:28: +4:29
- StorageDead(_7); // scope 3 at $DIR/array_index_is_temporary.rs:+4:29: +4:30
- _0 = const (); // scope 0 at $DIR/array_index_is_temporary.rs:+0:11: +5:2
- StorageDead(_3); // scope 2 at $DIR/array_index_is_temporary.rs:+5:1: +5:2
- StorageDead(_2); // scope 1 at $DIR/array_index_is_temporary.rs:+5:1: +5:2
- StorageDead(_1); // scope 0 at $DIR/array_index_is_temporary.rs:+5:1: +5:2
- return; // scope 0 at $DIR/array_index_is_temporary.rs:+5:2: +5:2
- }
-}
diff --git a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir
new file mode 100644
index 000000000..9b4c221df
--- /dev/null
+++ b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir
@@ -0,0 +1,61 @@
+// MIR for `main` after SimplifyCfg-elaborate-drops
+
+fn main() -> () {
+ let mut _0: ();
+ let mut _1: [u32; 3];
+ let mut _4: &mut usize;
+ let mut _5: u32;
+ let mut _6: *mut usize;
+ let _7: usize;
+ let mut _8: usize;
+ let mut _9: bool;
+ scope 1 {
+ debug x => _1;
+ let mut _2: usize;
+ scope 2 {
+ debug y => _2;
+ let _3: *mut usize;
+ scope 3 {
+ debug z => _3;
+ scope 4 {
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = [const 42_u32, const 43_u32, const 44_u32];
+ StorageLive(_2);
+ _2 = const 1_usize;
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &mut _2;
+ _3 = &raw mut (*_4);
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = _3;
+ _5 = foo(move _6) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_6);
+ StorageLive(_7);
+ _7 = _2;
+ _8 = Len(_1);
+ _9 = Lt(_7, _8);
+ assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ _1[_7] = move _5;
+ StorageDead(_5);
+ StorageDead(_7);
+ _0 = const ();
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+}
diff --git a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
new file mode 100644
index 000000000..4b05610f7
--- /dev/null
+++ b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -0,0 +1,61 @@
+// MIR for `main` after SimplifyCfg-elaborate-drops
+
+fn main() -> () {
+ let mut _0: ();
+ let mut _1: [u32; 3];
+ let mut _4: &mut usize;
+ let mut _5: u32;
+ let mut _6: *mut usize;
+ let _7: usize;
+ let mut _8: usize;
+ let mut _9: bool;
+ scope 1 {
+ debug x => _1;
+ let mut _2: usize;
+ scope 2 {
+ debug y => _2;
+ let _3: *mut usize;
+ scope 3 {
+ debug z => _3;
+ scope 4 {
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = [const 42_u32, const 43_u32, const 44_u32];
+ StorageLive(_2);
+ _2 = const 1_usize;
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &mut _2;
+ _3 = &raw mut (*_4);
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = _3;
+ _5 = foo(move _6) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_6);
+ StorageLive(_7);
+ _7 = _2;
+ _8 = Len(_1);
+ _9 = Lt(_7, _8);
+ assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind continue];
+ }
+
+ bb2: {
+ _1[_7] = move _5;
+ StorageDead(_5);
+ StorageDead(_7);
+ _0 = const ();
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+}
diff --git a/tests/mir-opt/array_index_is_temporary.rs b/tests/mir-opt/array_index_is_temporary.rs
index 702b9c70e..f5edc6890 100644
--- a/tests/mir-opt/array_index_is_temporary.rs
+++ b/tests/mir-opt/array_index_is_temporary.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// unit-test: SimplifyCfg-elaborate-drops
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Retagging (from Stacked Borrows) relies on the array index being a fresh
// temporary, so that side-effects cannot change it.
// Test that this is indeed the case.
@@ -11,6 +12,12 @@ unsafe fn foo(z: *mut usize) -> u32 {
// EMIT_MIR array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: debug y => [[y:_.*]];
+ // CHECK: [[y]] = const 1_usize;
+ // CHECK: [[tmp:_.*]] = [[y]];
+ // CHECK: [[x]][[[tmp]]] =
let mut x = [42, 43, 44];
let mut y = 1;
let z: *mut usize = &mut y;
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 f6954ab35..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
@@ -1,20 +1,20 @@
// MIR for `main` after AbortUnwindingCalls
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/asm_unwind_panic_abort.rs:+0:11: +0:11
- let _1: (); // in scope 0 at $DIR/asm_unwind_panic_abort.rs:+2:9: +2:49
+ let mut _0: ();
+ let _1: ();
scope 1 {
}
bb0: {
- StorageLive(_1); // scope 1 at $DIR/asm_unwind_panic_abort.rs:+2:9: +2:49
- _1 = const (); // scope 1 at $DIR/asm_unwind_panic_abort.rs:+2:9: +2:49
- asm!("", options(MAY_UNWIND)) -> [return: bb1, unwind terminate]; // scope 1 at $DIR/asm_unwind_panic_abort.rs:+2:9: +2:49
+ StorageLive(_1);
+ _1 = const ();
+ asm!("", options(MAY_UNWIND)) -> [return: bb1, unwind terminate(abi)];
}
bb1: {
- StorageDead(_1); // scope 1 at $DIR/asm_unwind_panic_abort.rs:+2:48: +2:49
- _0 = const (); // scope 1 at $DIR/asm_unwind_panic_abort.rs:+1:5: +3:6
- return; // scope 0 at $DIR/asm_unwind_panic_abort.rs:+4:2: +4:2
+ StorageDead(_1);
+ _0 = const ();
+ return;
}
}
diff --git a/tests/mir-opt/asm_unwind_panic_abort.rs b/tests/mir-opt/asm_unwind_panic_abort.rs
index ad8f9398e..a80dcb385 100644
--- a/tests/mir-opt/asm_unwind_panic_abort.rs
+++ b/tests/mir-opt/asm_unwind_panic_abort.rs
@@ -9,6 +9,9 @@
// EMIT_MIR asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: asm!(
+ // CHECK-SAME: unwind terminate(abi)
unsafe {
std::arch::asm!("", options(may_unwind));
}
diff --git a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff
index d663c3435..f187f9597 100644
--- a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff
+++ b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff
@@ -2,88 +2,86 @@
+ // MIR for `main` after ElaborateDrops
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/basic_assignment.rs:+0:11: +0:11
- let _1: bool; // in scope 0 at $DIR/basic_assignment.rs:+1:9: +1:17
- let mut _3: bool; // in scope 0 at $DIR/basic_assignment.rs:+6:16: +6:24
- let mut _6: std::option::Option<std::boxed::Box<u32>>; // in scope 0 at $DIR/basic_assignment.rs:+13:14: +13:20
+ let mut _0: ();
+ let _1: bool;
+ let mut _3: bool;
+ let mut _6: std::option::Option<std::boxed::Box<u32>>;
scope 1 {
- debug nodrop_x => _1; // in scope 1 at $DIR/basic_assignment.rs:+1:9: +1:17
- let _2: bool; // in scope 1 at $DIR/basic_assignment.rs:+2:9: +2:17
+ debug nodrop_x => _1;
+ let _2: bool;
scope 2 {
- debug nodrop_y => _2; // in scope 2 at $DIR/basic_assignment.rs:+2:9: +2:17
- let _4: std::option::Option<std::boxed::Box<u32>>; // in scope 2 at $DIR/basic_assignment.rs:+8:9: +8:15
+ debug nodrop_y => _2;
+ let _4: std::option::Option<std::boxed::Box<u32>>;
scope 3 {
- debug drop_x => _4; // in scope 3 at $DIR/basic_assignment.rs:+8:9: +8:15
- let _5: std::option::Option<std::boxed::Box<u32>>; // in scope 3 at $DIR/basic_assignment.rs:+9:9: +9:15
+ debug drop_x => _4;
+ let _5: std::option::Option<std::boxed::Box<u32>>;
scope 4 {
- debug drop_y => _5; // in scope 4 at $DIR/basic_assignment.rs:+9:9: +9:15
+ debug drop_y => _5;
}
}
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/basic_assignment.rs:+1:9: +1:17
- _1 = const false; // scope 0 at $DIR/basic_assignment.rs:+1:20: +1:25
- StorageLive(_2); // scope 1 at $DIR/basic_assignment.rs:+2:9: +2:17
- StorageLive(_3); // scope 2 at $DIR/basic_assignment.rs:+6:16: +6:24
- _3 = _1; // scope 2 at $DIR/basic_assignment.rs:+6:16: +6:24
- _2 = move _3; // scope 2 at $DIR/basic_assignment.rs:+6:5: +6:24
- StorageDead(_3); // scope 2 at $DIR/basic_assignment.rs:+6:23: +6:24
- StorageLive(_4); // scope 2 at $DIR/basic_assignment.rs:+8:9: +8:15
- _4 = Option::<Box<u32>>::None; // scope 2 at $DIR/basic_assignment.rs:+8:36: +8:40
- StorageLive(_5); // scope 3 at $DIR/basic_assignment.rs:+9:9: +9:15
- StorageLive(_6); // scope 4 at $DIR/basic_assignment.rs:+13:14: +13:20
- _6 = move _4; // scope 4 at $DIR/basic_assignment.rs:+13:14: +13:20
-- drop(_5) -> [return: bb1, unwind: bb2]; // scope 4 at $DIR/basic_assignment.rs:+13:5: +13:11
-+ goto -> bb1; // scope 4 at $DIR/basic_assignment.rs:+13:5: +13:11
+ StorageLive(_1);
+ _1 = const false;
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _2 = move _3;
+ StorageDead(_3);
+ StorageLive(_4);
+ _4 = Option::<Box<u32>>::None;
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = move _4;
+- drop(_5) -> [return: bb1, unwind: bb2];
++ goto -> bb1;
}
bb1: {
- _5 = move _6; // scope 4 at $DIR/basic_assignment.rs:+13:5: +13:11
-- drop(_6) -> [return: bb3, unwind: bb6]; // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20
-+ goto -> bb3; // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20
+ _5 = move _6;
+- drop(_6) -> [return: bb3, unwind: bb6];
++ goto -> bb3;
}
bb2 (cleanup): {
- _5 = move _6; // scope 4 at $DIR/basic_assignment.rs:+13:5: +13:11
- drop(_6) -> [return: bb6, unwind terminate]; // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20
+ _5 = move _6;
+- drop(_6) -> [return: bb6, unwind terminate(cleanup)];
++ goto -> bb6;
}
bb3: {
- StorageDead(_6); // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20
- _0 = const (); // scope 0 at $DIR/basic_assignment.rs:+0:11: +14:2
- drop(_5) -> [return: bb4, unwind: bb7]; // scope 3 at $DIR/basic_assignment.rs:+14:1: +14:2
+ StorageDead(_6);
+ _0 = const ();
+ drop(_5) -> [return: bb4, unwind: bb7];
}
bb4: {
- StorageDead(_5); // scope 3 at $DIR/basic_assignment.rs:+14:1: +14:2
-- drop(_4) -> bb5; // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2
-+ goto -> bb5; // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2
+ StorageDead(_5);
+- drop(_4) -> [return: bb5, unwind continue];
++ goto -> bb5;
}
bb5: {
- StorageDead(_4); // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2
- StorageDead(_2); // scope 1 at $DIR/basic_assignment.rs:+14:1: +14:2
- StorageDead(_1); // scope 0 at $DIR/basic_assignment.rs:+14:1: +14:2
- return; // scope 0 at $DIR/basic_assignment.rs:+14:2: +14:2
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
bb6 (cleanup): {
- drop(_5) -> [return: bb7, unwind terminate]; // scope 3 at $DIR/basic_assignment.rs:+14:1: +14:2
+- drop(_5) -> [return: bb7, unwind terminate(cleanup)];
++ goto -> bb7;
}
bb7 (cleanup): {
-- drop(_4) -> [return: bb8, unwind terminate]; // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2
-+ goto -> bb8; // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2
+- drop(_4) -> [return: bb8, unwind terminate(cleanup)];
++ goto -> bb8;
}
bb8 (cleanup): {
- resume; // scope 0 at $DIR/basic_assignment.rs:+0:1: +14:2
-+ }
-+
-+ bb9 (cleanup): {
-+ unreachable; // scope 0 at $DIR/basic_assignment.rs:+0:1: +14:2
+ resume;
}
}
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 d63497e3a..5df663388 100644
--- a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir
@@ -1,86 +1,86 @@
// MIR for `main` after SimplifyCfg-initial
| User Type Annotations
-| 0: user_ty: Canonical { value: Ty(std::option::Option<std::boxed::Box<u32>>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:20:17: 20:33, inferred_ty: std::option::Option<std::boxed::Box<u32>>
-| 1: user_ty: Canonical { value: Ty(std::option::Option<std::boxed::Box<u32>>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:20:17: 20:33, inferred_ty: std::option::Option<std::boxed::Box<u32>>
+| 0: user_ty: Canonical { value: Ty(std::option::Option<std::boxed::Box<u32>>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:38:17: 38:33, inferred_ty: std::option::Option<std::boxed::Box<u32>>
+| 1: user_ty: Canonical { value: Ty(std::option::Option<std::boxed::Box<u32>>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:38:17: 38:33, inferred_ty: std::option::Option<std::boxed::Box<u32>>
|
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/basic_assignment.rs:+0:11: +0:11
- let _1: bool; // in scope 0 at $DIR/basic_assignment.rs:+1:9: +1:17
- let mut _3: bool; // in scope 0 at $DIR/basic_assignment.rs:+6:16: +6:24
- let mut _6: std::option::Option<std::boxed::Box<u32>>; // in scope 0 at $DIR/basic_assignment.rs:+13:14: +13:20
+ let mut _0: ();
+ let _1: bool;
+ let mut _3: bool;
+ let mut _6: std::option::Option<std::boxed::Box<u32>>;
scope 1 {
- debug nodrop_x => _1; // in scope 1 at $DIR/basic_assignment.rs:+1:9: +1:17
- let _2: bool; // in scope 1 at $DIR/basic_assignment.rs:+2:9: +2:17
+ debug nodrop_x => _1;
+ let _2: bool;
scope 2 {
- debug nodrop_y => _2; // in scope 2 at $DIR/basic_assignment.rs:+2:9: +2:17
- let _4: std::option::Option<std::boxed::Box<u32>> as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 2 at $DIR/basic_assignment.rs:+8:9: +8:15
+ debug nodrop_y => _2;
+ let _4: std::option::Option<std::boxed::Box<u32>> as UserTypeProjection { base: UserType(0), projs: [] };
scope 3 {
- debug drop_x => _4; // in scope 3 at $DIR/basic_assignment.rs:+8:9: +8:15
- let _5: std::option::Option<std::boxed::Box<u32>>; // in scope 3 at $DIR/basic_assignment.rs:+9:9: +9:15
+ debug drop_x => _4;
+ let _5: std::option::Option<std::boxed::Box<u32>>;
scope 4 {
- debug drop_y => _5; // in scope 4 at $DIR/basic_assignment.rs:+9:9: +9:15
+ debug drop_y => _5;
}
}
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/basic_assignment.rs:+1:9: +1:17
- _1 = const false; // scope 0 at $DIR/basic_assignment.rs:+1:20: +1:25
- FakeRead(ForLet(None), _1); // scope 0 at $DIR/basic_assignment.rs:+1:9: +1:17
- StorageLive(_2); // scope 1 at $DIR/basic_assignment.rs:+2:9: +2:17
- StorageLive(_3); // scope 2 at $DIR/basic_assignment.rs:+6:16: +6:24
- _3 = _1; // scope 2 at $DIR/basic_assignment.rs:+6:16: +6:24
- _2 = move _3; // scope 2 at $DIR/basic_assignment.rs:+6:5: +6:24
- StorageDead(_3); // scope 2 at $DIR/basic_assignment.rs:+6:23: +6:24
- StorageLive(_4); // scope 2 at $DIR/basic_assignment.rs:+8:9: +8:15
- _4 = Option::<Box<u32>>::None; // scope 2 at $DIR/basic_assignment.rs:+8:36: +8:40
- FakeRead(ForLet(None), _4); // scope 2 at $DIR/basic_assignment.rs:+8:9: +8:15
- AscribeUserType(_4, o, UserTypeProjection { base: UserType(1), projs: [] }); // scope 2 at $DIR/basic_assignment.rs:+8:17: +8:33
- StorageLive(_5); // scope 3 at $DIR/basic_assignment.rs:+9:9: +9:15
- StorageLive(_6); // scope 4 at $DIR/basic_assignment.rs:+13:14: +13:20
- _6 = move _4; // scope 4 at $DIR/basic_assignment.rs:+13:14: +13:20
- drop(_5) -> [return: bb1, unwind: bb2]; // scope 4 at $DIR/basic_assignment.rs:+13:5: +13:11
+ StorageLive(_1);
+ _1 = const false;
+ FakeRead(ForLet(None), _1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _2 = move _3;
+ StorageDead(_3);
+ StorageLive(_4);
+ _4 = Option::<Box<u32>>::None;
+ FakeRead(ForLet(None), _4);
+ AscribeUserType(_4, o, UserTypeProjection { base: UserType(1), projs: [] });
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = move _4;
+ drop(_5) -> [return: bb1, unwind: bb2];
}
bb1: {
- _5 = move _6; // scope 4 at $DIR/basic_assignment.rs:+13:5: +13:11
- drop(_6) -> [return: bb3, unwind: bb6]; // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20
+ _5 = move _6;
+ drop(_6) -> [return: bb3, unwind: bb6];
}
bb2 (cleanup): {
- _5 = move _6; // scope 4 at $DIR/basic_assignment.rs:+13:5: +13:11
- drop(_6) -> [return: bb6, unwind terminate]; // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20
+ _5 = move _6;
+ drop(_6) -> [return: bb6, unwind terminate(cleanup)];
}
bb3: {
- StorageDead(_6); // scope 4 at $DIR/basic_assignment.rs:+13:19: +13:20
- _0 = const (); // scope 0 at $DIR/basic_assignment.rs:+0:11: +14:2
- drop(_5) -> [return: bb4, unwind: bb7]; // scope 3 at $DIR/basic_assignment.rs:+14:1: +14:2
+ StorageDead(_6);
+ _0 = const ();
+ drop(_5) -> [return: bb4, unwind: bb7];
}
bb4: {
- StorageDead(_5); // scope 3 at $DIR/basic_assignment.rs:+14:1: +14:2
- drop(_4) -> [return: bb5, unwind: bb8]; // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2
+ StorageDead(_5);
+ drop(_4) -> [return: bb5, unwind: bb8];
}
bb5: {
- StorageDead(_4); // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2
- StorageDead(_2); // scope 1 at $DIR/basic_assignment.rs:+14:1: +14:2
- StorageDead(_1); // scope 0 at $DIR/basic_assignment.rs:+14:1: +14:2
- return; // scope 0 at $DIR/basic_assignment.rs:+14:2: +14:2
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
bb6 (cleanup): {
- drop(_5) -> [return: bb7, unwind terminate]; // scope 3 at $DIR/basic_assignment.rs:+14:1: +14:2
+ drop(_5) -> [return: bb7, unwind terminate(cleanup)];
}
bb7 (cleanup): {
- drop(_4) -> [return: bb8, unwind terminate]; // scope 2 at $DIR/basic_assignment.rs:+14:1: +14:2
+ drop(_4) -> [return: bb8, unwind terminate(cleanup)];
}
bb8 (cleanup): {
- resume; // scope 0 at $DIR/basic_assignment.rs:+0:1: +14:2
+ resume;
}
}
diff --git a/tests/mir-opt/basic_assignment.rs b/tests/mir-opt/basic_assignment.rs
index 92434e44a..30a410988 100644
--- a/tests/mir-opt/basic_assignment.rs
+++ b/tests/mir-opt/basic_assignment.rs
@@ -1,3 +1,4 @@
+// unit-test: ElaborateDrops
// needs-unwind
// this tests move up progration, which is not yet implemented
@@ -10,6 +11,23 @@
// destruction.
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug nodrop_x => [[nodrop_x:_.*]];
+ // CHECK: debug nodrop_y => [[nodrop_y:_.*]];
+ // CHECK: debug drop_x => [[drop_x:_.*]];
+ // CHECK: debug drop_y => [[drop_y:_.*]];
+ // CHECK-NOT: drop([[nodrop_x]])
+ // CHECK-NOT: drop([[nodrop_y]])
+ // CHECK-NOT: drop([[drop_x]])
+ // CHECK: [[drop_tmp:_.*]] = move [[drop_x]];
+ // CHECK-NOT: drop([[drop_x]])
+ // CHECK-NOT: drop([[drop_tmp]])
+ // CHECK: [[drop_y]] = move [[drop_tmp]];
+ // CHECK-NOT: drop([[drop_x]])
+ // CHECK-NOT: drop([[drop_tmp]])
+ // CHECK: drop([[drop_y]])
+ // CHECK-NOT: drop([[drop_x]])
+ // CHECK-NOT: drop([[drop_tmp]])
let nodrop_x = false;
let nodrop_y;
diff --git a/tests/mir-opt/bool_compare.opt1.InstSimplify.diff b/tests/mir-opt/bool_compare.opt1.InstSimplify.diff
deleted file mode 100644
index 6c9df8f04..000000000
--- a/tests/mir-opt/bool_compare.opt1.InstSimplify.diff
+++ /dev/null
@@ -1,35 +0,0 @@
-- // MIR for `opt1` before InstSimplify
-+ // MIR for `opt1` after InstSimplify
-
- fn opt1(_1: bool) -> u32 {
- debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10
- let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:+0:21: +0:24
- let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
- let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:9
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
- StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:9
- _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:9
-- _2 = Ne(move _3, const true); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
-+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
- StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
- }
-
- bb1: {
- _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:20: +1:21
- goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34
- }
-
- bb2: {
- _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:31: +1:32
- goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34
- }
-
- bb3: {
- StorageDead(_2); // scope 0 at $DIR/bool_compare.rs:+1:33: +1:34
- return; // scope 0 at $DIR/bool_compare.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/bool_compare.opt2.InstSimplify.diff b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff
deleted file mode 100644
index 9fb398265..000000000
--- a/tests/mir-opt/bool_compare.opt2.InstSimplify.diff
+++ /dev/null
@@ -1,35 +0,0 @@
-- // MIR for `opt2` before InstSimplify
-+ // MIR for `opt2` after InstSimplify
-
- fn opt2(_1: bool) -> u32 {
- debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10
- let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:+0:21: +0:24
- let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
- let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:+1:16: +1:17
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
- StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17
- _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17
-- _2 = Ne(const true, move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
-+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
- StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17
- }
-
- bb1: {
- _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:20: +1:21
- goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34
- }
-
- bb2: {
- _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:31: +1:32
- goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34
- }
-
- bb3: {
- StorageDead(_2); // scope 0 at $DIR/bool_compare.rs:+1:33: +1:34
- return; // scope 0 at $DIR/bool_compare.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/bool_compare.opt3.InstSimplify.diff b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff
deleted file mode 100644
index 3a47da867..000000000
--- a/tests/mir-opt/bool_compare.opt3.InstSimplify.diff
+++ /dev/null
@@ -1,35 +0,0 @@
-- // MIR for `opt3` before InstSimplify
-+ // MIR for `opt3` after InstSimplify
-
- fn opt3(_1: bool) -> u32 {
- debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10
- let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:+0:21: +0:24
- let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
- let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:9
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
- StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:9
- _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:9
-- _2 = Eq(move _3, const false); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
-+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
- StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
- }
-
- bb1: {
- _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:21: +1:22
- goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35
- }
-
- bb2: {
- _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:32: +1:33
- goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35
- }
-
- bb3: {
- StorageDead(_2); // scope 0 at $DIR/bool_compare.rs:+1:34: +1:35
- return; // scope 0 at $DIR/bool_compare.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/bool_compare.opt4.InstSimplify.diff b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff
deleted file mode 100644
index 5319c987d..000000000
--- a/tests/mir-opt/bool_compare.opt4.InstSimplify.diff
+++ /dev/null
@@ -1,35 +0,0 @@
-- // MIR for `opt4` before InstSimplify
-+ // MIR for `opt4` after InstSimplify
-
- fn opt4(_1: bool) -> u32 {
- debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10
- let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:+0:21: +0:24
- let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
- let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:+1:17: +1:18
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
- StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18
- _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18
-- _2 = Eq(const false, move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
-+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
- StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18
- }
-
- bb1: {
- _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:21: +1:22
- goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35
- }
-
- bb2: {
- _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:32: +1:33
- goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35
- }
-
- bb3: {
- StorageDead(_2); // scope 0 at $DIR/bool_compare.rs:+1:34: +1:35
- return; // scope 0 at $DIR/bool_compare.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/bool_compare.rs b/tests/mir-opt/bool_compare.rs
deleted file mode 100644
index 080f7f72d..000000000
--- a/tests/mir-opt/bool_compare.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// unit-test: InstSimplify
-
-// EMIT_MIR bool_compare.opt1.InstSimplify.diff
-fn opt1(x: bool) -> u32 {
- if x != true { 0 } else { 1 }
-}
-
-// EMIT_MIR bool_compare.opt2.InstSimplify.diff
-fn opt2(x: bool) -> u32 {
- if true != x { 0 } else { 1 }
-}
-
-// EMIT_MIR bool_compare.opt3.InstSimplify.diff
-fn opt3(x: bool) -> u32 {
- if x == false { 0 } else { 1 }
-}
-
-// EMIT_MIR bool_compare.opt4.InstSimplify.diff
-fn opt4(x: bool) -> u32 {
- if false == x { 0 } else { 1 }
-}
-
-fn main() {
- opt1(false);
- opt2(false);
- opt3(false);
- opt4(false);
-}
diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.before.mir b/tests/mir-opt/box_expr.main.ElaborateDrops.before.mir
deleted file mode 100644
index bac5b21df..000000000
--- a/tests/mir-opt/box_expr.main.ElaborateDrops.before.mir
+++ /dev/null
@@ -1,80 +0,0 @@
-// MIR for `main` before ElaborateDrops
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/box_expr.rs:+0:11: +0:11
- let _1: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:+1:9: +1:10
- let mut _2: usize; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23
- let mut _3: usize; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23
- let mut _4: *mut u8; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23
- let mut _5: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23
- let _6: (); // in scope 0 at $DIR/box_expr.rs:+3:5: +3:12
- let mut _7: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:+3:10: +3:11
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/box_expr.rs:+1:9: +1:10
- }
- scope 2 {
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/box_expr.rs:+1:9: +1:10
- _2 = SizeOf(S); // scope 2 at $DIR/box_expr.rs:+2:5: +2:23
- _3 = AlignOf(S); // scope 2 at $DIR/box_expr.rs:+2:5: +2:23
- _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; // scope 2 at $DIR/box_expr.rs:+2:5: +2:23
- // mir::Constant
- // + span: $DIR/box_expr.rs:8:5: 8:23
- // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageLive(_5); // scope 0 at $DIR/box_expr.rs:+2:5: +2:23
- _5 = ShallowInitBox(move _4, S); // scope 0 at $DIR/box_expr.rs:+2:5: +2:23
- (*_5) = S::new() -> [return: bb2, unwind: bb8]; // scope 0 at $DIR/box_expr.rs:+2:14: +2:22
- // mir::Constant
- // + span: $DIR/box_expr.rs:8:14: 8:20
- // + literal: Const { ty: fn() -> S {S::new}, val: Value(<ZST>) }
- }
-
- bb2: {
- _1 = move _5; // scope 0 at $DIR/box_expr.rs:+2:5: +2:23
- drop(_5) -> bb3; // scope 0 at $DIR/box_expr.rs:+2:22: +2:23
- }
-
- bb3: {
- StorageDead(_5); // scope 0 at $DIR/box_expr.rs:+2:22: +2:23
- StorageLive(_6); // scope 1 at $DIR/box_expr.rs:+3:5: +3:12
- StorageLive(_7); // scope 1 at $DIR/box_expr.rs:+3:10: +3:11
- _7 = move _1; // scope 1 at $DIR/box_expr.rs:+3:10: +3:11
- _6 = std::mem::drop::<Box<S>>(move _7) -> [return: bb4, unwind: bb6]; // scope 1 at $DIR/box_expr.rs:+3:5: +3:12
- // mir::Constant
- // + span: $DIR/box_expr.rs:9:5: 9:9
- // + literal: Const { ty: fn(Box<S>) {std::mem::drop::<Box<S>>}, val: Value(<ZST>) }
- }
-
- bb4: {
- StorageDead(_7); // scope 1 at $DIR/box_expr.rs:+3:11: +3:12
- StorageDead(_6); // scope 1 at $DIR/box_expr.rs:+3:12: +3:13
- _0 = const (); // scope 0 at $DIR/box_expr.rs:+0:11: +4:2
- drop(_1) -> bb5; // scope 0 at $DIR/box_expr.rs:+4:1: +4:2
- }
-
- bb5: {
- StorageDead(_1); // scope 0 at $DIR/box_expr.rs:+4:1: +4:2
- return; // scope 0 at $DIR/box_expr.rs:+4:2: +4:2
- }
-
- bb6 (cleanup): {
- drop(_7) -> [return: bb7, unwind terminate]; // scope 1 at $DIR/box_expr.rs:+3:11: +3:12
- }
-
- bb7 (cleanup): {
- drop(_1) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/box_expr.rs:+4:1: +4:2
- }
-
- bb8 (cleanup): {
- drop(_5) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/box_expr.rs:+2:22: +2:23
- }
-
- bb9 (cleanup): {
- resume; // scope 0 at $DIR/box_expr.rs:+0:1: +4:2
- }
-}
diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.diff b/tests/mir-opt/box_expr.main.ElaborateDrops.diff
new file mode 100644
index 000000000..88b12f19e
--- /dev/null
+++ b/tests/mir-opt/box_expr.main.ElaborateDrops.diff
@@ -0,0 +1,89 @@
+- // MIR for `main` before ElaborateDrops
++ // MIR for `main` after ElaborateDrops
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::boxed::Box<S>;
+ let mut _2: usize;
+ let mut _3: usize;
+ let mut _4: *mut u8;
+ let mut _5: std::boxed::Box<S>;
+ let _6: ();
+ let mut _7: std::boxed::Box<S>;
++ let mut _8: &mut std::boxed::Box<S>;
++ let mut _9: ();
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _2 = SizeOf(S);
+ _3 = AlignOf(S);
+ _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageLive(_5);
+ _5 = ShallowInitBox(move _4, S);
+ (*_5) = S::new() -> [return: bb2, unwind: bb8];
+ }
+
+ bb2: {
+ _1 = move _5;
+- drop(_5) -> [return: bb3, unwind continue];
++ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = move _1;
+ _6 = std::mem::drop::<Box<S>>(move _7) -> [return: bb4, unwind: bb6];
+ }
+
+ bb4: {
+ StorageDead(_7);
+ StorageDead(_6);
+ _0 = const ();
+- drop(_1) -> [return: bb5, unwind continue];
++ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb6 (cleanup): {
+- drop(_7) -> [return: bb7, unwind terminate(cleanup)];
++ goto -> bb7;
+ }
+
+ bb7 (cleanup): {
+- drop(_1) -> [return: bb9, unwind terminate(cleanup)];
++ goto -> bb9;
+ }
+
+ bb8 (cleanup): {
+- drop(_5) -> [return: bb9, unwind terminate(cleanup)];
++ goto -> bb11;
+ }
+
+ bb9 (cleanup): {
+ resume;
++ }
++
++ bb10 (cleanup): {
++ _8 = &mut _5;
++ _9 = <Box<S> as Drop>::drop(move _8) -> [return: bb9, unwind terminate(cleanup)];
++ }
++
++ bb11 (cleanup): {
++ goto -> bb10;
+ }
+ }
+
diff --git a/tests/mir-opt/box_expr.rs b/tests/mir-opt/box_expr.rs
index ad3670b5d..0421e232a 100644
--- a/tests/mir-opt/box_expr.rs
+++ b/tests/mir-opt/box_expr.rs
@@ -1,9 +1,22 @@
-// ignore-wasm32-bare compiled with panic=abort by default
+// unit-test: ElaborateDrops
+// needs-unwind
#![feature(rustc_attrs, stmt_expr_attributes)]
-// EMIT_MIR box_expr.main.ElaborateDrops.before.mir
+// EMIT_MIR box_expr.main.ElaborateDrops.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: [[box:_.*]] = ShallowInitBox(
+ // CHECK: [[ptr:_.*]] = ((([[box]].0: std::ptr::Unique<S>).0: std::ptr::NonNull<S>).0: *const S);
+ // CHECK: (*[[ptr]]) = S::new() -> [return: [[ret:bb.*]], unwind: [[unwind:bb.*]]];
+ // CHECK: [[ret]]: {
+ // CHECK: [[box2:_.*]] = move [[box]];
+ // CHECK: [[box3:_.*]] = move [[box2]];
+ // CHECK: std::mem::drop::<Box<S>>(move [[box3]])
+ // CHECK: [[unwind]] (cleanup): {
+ // CHECK: [[boxref:_.*]] = &mut [[box]];
+ // CHECK: <Box<S> as Drop>::drop(move [[boxref]])
+
let x = #[rustc_box]
Box::new(S::new());
drop(x);
diff --git a/tests/mir-opt/building/async_await.a-{closure#0}.coroutine_resume.0.mir b/tests/mir-opt/building/async_await.a-{closure#0}.coroutine_resume.0.mir
new file mode 100644
index 000000000..8b22743d2
--- /dev/null
+++ b/tests/mir-opt/building/async_await.a-{closure#0}.coroutine_resume.0.mir
@@ -0,0 +1,47 @@
+// MIR for `a::{closure#0}` 0 coroutine_resume
+/* coroutine_layout = CoroutineLayout {
+ field_tys: {},
+ variant_fields: {
+ Unresumed(0): [],
+ Returned (1): [],
+ Panicked (2): [],
+ },
+ storage_conflicts: BitMatrix(0x0) {},
+} */
+
+fn a::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>, _2: &mut Context<'_>) -> Poll<()> {
+ debug _task_context => _4;
+ let mut _0: std::task::Poll<()>;
+ let mut _3: ();
+ let mut _4: &mut std::task::Context<'_>;
+ let mut _5: u32;
+
+ bb0: {
+ _5 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16})));
+ switchInt(move _5) -> [0: bb1, 1: bb4, otherwise: bb5];
+ }
+
+ bb1: {
+ _4 = move _2;
+ _3 = const ();
+ goto -> bb3;
+ }
+
+ bb2: {
+ _0 = Poll::<()>::Ready(move _3);
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:12:14: 12: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.a-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir
deleted file mode 100644
index accb504c0..000000000
--- a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir
+++ /dev/null
@@ -1,39 +0,0 @@
-// MIR for `a::{closure#0}` 0 generator_resume
-/* generator_layout = GeneratorLayout {
- field_tys: {},
- variant_fields: {
- Unresumed(0): [],
- Returned (1): [],
- Panicked (2): [],
- },
- 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<()> {
- debug _task_context => _4; // in scope 0 at $DIR/async_await.rs:+0:14: +0:16
- let mut _0: std::task::Poll<()>; // return place in scope 0 at $DIR/async_await.rs:+0:14: +0:16
- let mut _3: (); // in scope 0 at $DIR/async_await.rs:+0:14: +0:16
- let mut _4: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+0:14: +0:16
- let mut _5: u32; // in scope 0 at $DIR/async_await.rs:+0:14: +0:16
-
- bb0: {
- _5 = discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:11:14: 11:16]))); // scope 0 at $DIR/async_await.rs:+0:14: +0:16
- switchInt(move _5) -> [0: bb1, 1: bb2, otherwise: bb3]; // scope 0 at $DIR/async_await.rs:+0:14: +0:16
- }
-
- bb1: {
- _4 = move _2; // scope 0 at $DIR/async_await.rs:+0:14: +0:16
- _3 = const (); // scope 0 at $DIR/async_await.rs:+0:14: +0:16
- _0 = Poll::<()>::Ready(move _3); // scope 0 at $DIR/async_await.rs:+0:16: +0:16
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:11:14: 11:16]))) = 1; // scope 0 at $DIR/async_await.rs:+0:16: +0:16
- return; // scope 0 at $DIR/async_await.rs:+0:16: +0:16
- }
-
- bb2: {
- assert(const false, "`async fn` resumed after completion") -> bb2; // scope 0 at $DIR/async_await.rs:+0:14: +0:16
- }
-
- bb3: {
- unreachable; // scope 0 at $DIR/async_await.rs:+0:14: +0:16
- }
-}
diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir
new file mode 100644
index 000000000..59e275124
--- /dev/null
+++ b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir
@@ -0,0 +1,354 @@
+// MIR for `b::{closure#0}` 0 coroutine_resume
+/* coroutine_layout = CoroutineLayout {
+ field_tys: {
+ _0: CoroutineSavedTy {
+ ty: Coroutine(
+ DefId(0:4 ~ async_await[ccf8]::a::{closure#0}),
+ [
+ std::future::ResumeTy,
+ (),
+ (),
+ CoroutineWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
+ (),
+ ],
+ Static,
+ ),
+ source_info: SourceInfo {
+ span: $DIR/async_await.rs:16:5: 16:14 (#9),
+ scope: scope[0],
+ },
+ ignore_for_traits: false,
+ },
+ _1: CoroutineSavedTy {
+ ty: Coroutine(
+ DefId(0:4 ~ async_await[ccf8]::a::{closure#0}),
+ [
+ std::future::ResumeTy,
+ (),
+ (),
+ CoroutineWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
+ (),
+ ],
+ Static,
+ ),
+ source_info: SourceInfo {
+ span: $DIR/async_await.rs:17:5: 17:14 (#11),
+ scope: scope[0],
+ },
+ ignore_for_traits: false,
+ },
+ },
+ variant_fields: {
+ Unresumed(0): [],
+ Returned (1): [],
+ Panicked (2): [],
+ Suspend0 (3): [_0],
+ Suspend1 (4): [_1],
+ },
+ storage_conflicts: BitMatrix(2x2) {
+ (_0, _0),
+ (_1, _1),
+ },
+} */
+
+fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:15:18: 18:2}>, _2: &mut Context<'_>) -> Poll<()> {
+ debug _task_context => _38;
+ let mut _0: std::task::Poll<()>;
+ let _3: ();
+ let mut _4: {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let mut _5: {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let mut _6: {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let mut _7: ();
+ let _8: ();
+ let mut _9: std::task::Poll<()>;
+ let mut _10: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>;
+ let mut _11: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let mut _12: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let mut _13: &mut std::task::Context<'_>;
+ let mut _14: &mut std::task::Context<'_>;
+ let mut _15: &mut std::task::Context<'_>;
+ let mut _16: isize;
+ let mut _18: !;
+ let mut _19: &mut std::task::Context<'_>;
+ let mut _20: ();
+ let mut _21: {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let mut _22: {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let mut _23: {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let _24: ();
+ let mut _25: std::task::Poll<()>;
+ let mut _26: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>;
+ let mut _27: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let mut _28: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let mut _29: &mut std::task::Context<'_>;
+ let mut _30: &mut std::task::Context<'_>;
+ let mut _31: &mut std::task::Context<'_>;
+ let mut _32: isize;
+ let mut _34: !;
+ let mut _35: &mut std::task::Context<'_>;
+ let mut _36: ();
+ let mut _37: ();
+ 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:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16});
+ let _17: ();
+ scope 2 {
+ }
+ scope 3 {
+ debug result => _17;
+ }
+ }
+ scope 4 {
+ debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16});
+ let _33: ();
+ scope 5 {
+ }
+ scope 6 {
+ debug result => _33;
+ }
+ }
+
+ bb0: {
+ _39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})));
+ switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb30];
+ }
+
+ bb1: {
+ _38 = move _2;
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = a() -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ _4 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_5);
+ PlaceMention(_4);
+ nop;
+ (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}) = move _4;
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageLive(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16});
+ _11 = &mut (*_12);
+ _10 = Pin::<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>::new_unchecked(move _11) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_11);
+ StorageLive(_13);
+ StorageLive(_14);
+ StorageLive(_15);
+ _15 = _38;
+ _14 = move _15;
+ goto -> bb6;
+ }
+
+ bb6: {
+ _13 = &mut (*_14);
+ StorageDead(_15);
+ _9 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ StorageDead(_13);
+ StorageDead(_10);
+ PlaceMention(_9);
+ _16 = discriminant(_9);
+ switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9];
+ }
+
+ bb8: {
+ _8 = const ();
+ StorageDead(_14);
+ StorageDead(_12);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_19);
+ StorageLive(_20);
+ _20 = ();
+ _0 = Poll::<()>::Pending;
+ StorageDead(_3);
+ StorageDead(_4);
+ StorageDead(_19);
+ StorageDead(_20);
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))) = 3;
+ return;
+ }
+
+ bb9: {
+ unreachable;
+ }
+
+ bb10: {
+ StorageLive(_17);
+ _17 = ((_9 as Ready).0: ());
+ _3 = _17;
+ StorageDead(_17);
+ StorageDead(_14);
+ StorageDead(_12);
+ StorageDead(_9);
+ StorageDead(_8);
+ drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16})) -> [return: bb12, unwind unreachable];
+ }
+
+ bb11: {
+ StorageDead(_20);
+ _38 = move _19;
+ StorageDead(_19);
+ _7 = const ();
+ goto -> bb4;
+ }
+
+ bb12: {
+ nop;
+ goto -> bb13;
+ }
+
+ bb13: {
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageLive(_21);
+ StorageLive(_22);
+ _22 = a() -> [return: bb14, unwind unreachable];
+ }
+
+ bb14: {
+ _21 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable];
+ }
+
+ bb15: {
+ StorageDead(_22);
+ PlaceMention(_21);
+ nop;
+ (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}) = move _21;
+ goto -> bb16;
+ }
+
+ bb16: {
+ StorageLive(_24);
+ StorageLive(_25);
+ StorageLive(_26);
+ StorageLive(_27);
+ StorageLive(_28);
+ _28 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16});
+ _27 = &mut (*_28);
+ _26 = Pin::<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>::new_unchecked(move _27) -> [return: bb17, unwind unreachable];
+ }
+
+ bb17: {
+ StorageDead(_27);
+ StorageLive(_29);
+ StorageLive(_30);
+ StorageLive(_31);
+ _31 = _38;
+ _30 = move _31;
+ goto -> bb18;
+ }
+
+ bb18: {
+ _29 = &mut (*_30);
+ StorageDead(_31);
+ _25 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable];
+ }
+
+ bb19: {
+ StorageDead(_29);
+ StorageDead(_26);
+ PlaceMention(_25);
+ _32 = discriminant(_25);
+ switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9];
+ }
+
+ bb20: {
+ _24 = const ();
+ StorageDead(_30);
+ StorageDead(_28);
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageLive(_35);
+ StorageLive(_36);
+ _36 = ();
+ _0 = Poll::<()>::Pending;
+ StorageDead(_21);
+ StorageDead(_35);
+ StorageDead(_36);
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))) = 4;
+ return;
+ }
+
+ bb21: {
+ StorageLive(_33);
+ _33 = ((_25 as Ready).0: ());
+ _37 = _33;
+ StorageDead(_33);
+ StorageDead(_30);
+ StorageDead(_28);
+ StorageDead(_25);
+ StorageDead(_24);
+ drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16})) -> [return: bb23, unwind unreachable];
+ }
+
+ bb22: {
+ StorageDead(_36);
+ _38 = move _35;
+ StorageDead(_35);
+ _7 = const ();
+ goto -> bb16;
+ }
+
+ bb23: {
+ nop;
+ goto -> bb24;
+ }
+
+ bb24: {
+ StorageDead(_21);
+ goto -> bb26;
+ }
+
+ bb25: {
+ _0 = Poll::<()>::Ready(move _37);
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))) = 1;
+ return;
+ }
+
+ bb26: {
+ goto -> bb25;
+ }
+
+ bb27: {
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_19);
+ StorageLive(_20);
+ _19 = move _2;
+ goto -> bb11;
+ }
+
+ bb28: {
+ StorageLive(_21);
+ StorageLive(_35);
+ StorageLive(_36);
+ _35 = move _2;
+ goto -> bb22;
+ }
+
+ bb29: {
+ assert(const false, "`async fn` resumed after completion") -> [success: bb29, unwind unreachable];
+ }
+
+ bb30: {
+ 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
deleted file mode 100644
index a9d1477b9..000000000
--- a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir
+++ /dev/null
@@ -1,343 +0,0 @@
-// MIR for `b::{closure#0}` 0 generator_resume
-/* generator_layout = GeneratorLayout {
- field_tys: {
- _0: GeneratorSavedTy {
- ty: impl std::future::Future<Output = ()>,
- source_info: SourceInfo {
- span: $DIR/async_await.rs:15:9: 15:14 (#8),
- scope: scope[0],
- },
- ignore_for_traits: false,
- },
- _1: GeneratorSavedTy {
- ty: impl std::future::Future<Output = ()>,
- source_info: SourceInfo {
- span: $DIR/async_await.rs:16:9: 16:14 (#10),
- scope: scope[0],
- },
- ignore_for_traits: false,
- },
- },
- variant_fields: {
- Unresumed(0): [],
- Returned (1): [],
- Panicked (2): [],
- Suspend0 (3): [_0],
- Suspend1 (4): [_1],
- },
- storage_conflicts: BitMatrix(2x2) {
- (_0, _0),
- (_1, _1),
- },
-} */
-
-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; // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
- let mut _0: std::task::Poll<()>; // return place in scope 0 at $DIR/async_await.rs:+0:18: +3:2
- let _3: (); // in scope 0 at $DIR/async_await.rs:+1:5: +1:14
- let mut _4: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
- let mut _5: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:5: +1:8
- let mut _6: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
- let mut _7: (); // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
- let _8: (); // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
- let mut _9: std::task::Poll<()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
- let mut _10: std::pin::Pin<&mut impl std::future::Future<Output = ()>>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
- let mut _11: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
- let mut _12: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
- let mut _13: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:5: +1:14
- let mut _14: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:5: +1:14
- let mut _15: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
- let mut _16: isize; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
- let mut _18: !; // in scope 0 at $DIR/async_await.rs:+1:5: +1:14
- let mut _19: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
- let mut _20: (); // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
- let mut _21: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
- let mut _22: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:5: +2:8
- let mut _23: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
- let _24: (); // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
- let mut _25: std::task::Poll<()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
- let mut _26: std::pin::Pin<&mut impl std::future::Future<Output = ()>>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
- let mut _27: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
- let mut _28: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
- let mut _29: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:5: +2:14
- let mut _30: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:5: +2:14
- let mut _31: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
- let mut _32: isize; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
- let mut _34: !; // in scope 0 at $DIR/async_await.rs:+2:5: +2:14
- let mut _35: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
- let mut _36: (); // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
- let mut _37: (); // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
- let mut _38: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
- let mut _39: u32; // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
- 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 = ()>); // in scope 1 at $DIR/async_await.rs:+1:9: +1:14
- let _17: (); // in scope 1 at $DIR/async_await.rs:+1:5: +1:14
- scope 2 {
- }
- scope 3 {
- debug result => _17; // in scope 3 at $DIR/async_await.rs:+1:5: +1:14
- }
- }
- 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 = ()>); // in scope 4 at $DIR/async_await.rs:+2:9: +2:14
- let _33: (); // in scope 4 at $DIR/async_await.rs:+2:5: +2:14
- scope 5 {
- }
- scope 6 {
- debug result => _33; // in scope 6 at $DIR/async_await.rs:+2:5: +2:14
- }
- }
-
- bb0: {
- _39 = discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))); // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- switchInt(move _39) -> [0: bb1, 1: bb28, 3: bb26, 4: bb27, otherwise: bb29]; // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- }
-
- bb1: {
- _38 = move _2; // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- StorageLive(_3); // scope 0 at $DIR/async_await.rs:+1:5: +1:14
- StorageLive(_4); // scope 0 at $DIR/async_await.rs:+1:9: +1:14
- StorageLive(_5); // scope 0 at $DIR/async_await.rs:+1:5: +1:8
- _5 = a() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+1:5: +1:8
- // mir::Constant
- // + span: $DIR/async_await.rs:15:5: 15:6
- // + literal: Const { ty: fn() -> impl Future<Output = ()> {a}, val: Value(<ZST>) }
- }
-
- bb2: {
- _4 = <impl Future<Output = ()> as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+1:9: +1:14
- // mir::Constant
- // + span: $DIR/async_await.rs:15:9: 15:14
- // + literal: Const { ty: fn(impl Future<Output = ()>) -> <impl Future<Output = ()> as IntoFuture>::IntoFuture {<impl Future<Output = ()> as IntoFuture>::into_future}, val: Value(<ZST>) }
- }
-
- bb3: {
- StorageDead(_5); // scope 0 at $DIR/async_await.rs:+1:13: +1:14
- nop; // scope 0 at $DIR/async_await.rs:+1:9: +1:14
- (((*(_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; // scope 0 at $DIR/async_await.rs:+1:9: +1:14
- goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- }
-
- bb4: {
- StorageLive(_8); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- StorageLive(_9); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- StorageLive(_10); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
- StorageLive(_11); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
- StorageLive(_12); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
- _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 = ()>); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
- _11 = &mut (*_12); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
- _10 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _11) -> [return: bb5, unwind unreachable]; // scope 2 at $DIR/async_await.rs:+1:9: +1:14
- // mir::Constant
- // + span: $DIR/async_await.rs:15:9: 15:14
- // + literal: Const { ty: unsafe fn(&mut impl Future<Output = ()>) -> Pin<&mut impl Future<Output = ()>> {Pin::<&mut impl Future<Output = ()>>::new_unchecked}, val: Value(<ZST>) }
- }
-
- bb5: {
- StorageDead(_11); // scope 2 at $DIR/async_await.rs:+1:13: +1:14
- StorageLive(_13); // scope 2 at $DIR/async_await.rs:+1:5: +1:14
- StorageLive(_14); // scope 2 at $DIR/async_await.rs:+1:5: +1:14
- StorageLive(_15); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
- _15 = _38; // scope 2 at $DIR/async_await.rs:+1:9: +1:14
- _14 = move _15; // scope 2 at $DIR/async_await.rs:+1:5: +1:14
- goto -> bb6; // scope 2 at $DIR/async_await.rs:+1:5: +1:14
- }
-
- bb6: {
- _13 = &mut (*_14); // scope 2 at $DIR/async_await.rs:+1:5: +1:14
- StorageDead(_15); // scope 2 at $DIR/async_await.rs:+1:13: +1:14
- _9 = <impl Future<Output = ()> as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable]; // scope 2 at $DIR/async_await.rs:+1:9: +1:14
- // mir::Constant
- // + span: $DIR/async_await.rs:15:9: 15:14
- // + literal: Const { ty: for<'a, 'b, 'c> fn(Pin<&'a mut impl Future<Output = ()>>, &'b mut Context<'c>) -> Poll<<impl Future<Output = ()> as Future>::Output> {<impl Future<Output = ()> as Future>::poll}, val: Value(<ZST>) }
- }
-
- bb7: {
- StorageDead(_13); // scope 2 at $DIR/async_await.rs:+1:13: +1:14
- StorageDead(_10); // scope 2 at $DIR/async_await.rs:+1:13: +1:14
- _16 = discriminant(_9); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9]; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- }
-
- bb8: {
- _8 = const (); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- StorageDead(_14); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- StorageDead(_12); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- StorageDead(_9); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- StorageDead(_8); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- StorageLive(_19); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- StorageLive(_20); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- _20 = (); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- _0 = Poll::<()>::Pending; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 3; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- return; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- }
-
- bb9: {
- unreachable; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- }
-
- bb10: {
- StorageLive(_17); // scope 1 at $DIR/async_await.rs:+1:5: +1:14
- _17 = ((_9 as Ready).0: ()); // scope 1 at $DIR/async_await.rs:+1:5: +1:14
- _3 = _17; // scope 3 at $DIR/async_await.rs:+1:5: +1:14
- StorageDead(_17); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- StorageDead(_14); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- StorageDead(_12); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- StorageDead(_9); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- StorageDead(_8); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- goto -> bb12; // scope 0 at $DIR/async_await.rs:+1:13: +1:14
- }
-
- bb11: {
- StorageDead(_20); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- _38 = move _19; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- StorageDead(_19); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- _7 = const (); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
- }
-
- bb12: {
- nop; // scope 0 at $DIR/async_await.rs:+1:13: +1:14
- goto -> bb13; // scope 0 at $DIR/async_await.rs:+1:14: +1:15
- }
-
- bb13: {
- StorageDead(_4); // scope 0 at $DIR/async_await.rs:+1:14: +1:15
- StorageDead(_3); // scope 0 at $DIR/async_await.rs:+1:14: +1:15
- StorageLive(_21); // scope 0 at $DIR/async_await.rs:+2:9: +2:14
- StorageLive(_22); // scope 0 at $DIR/async_await.rs:+2:5: +2:8
- _22 = a() -> [return: bb14, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+2:5: +2:8
- // mir::Constant
- // + span: $DIR/async_await.rs:16:5: 16:6
- // + literal: Const { ty: fn() -> impl Future<Output = ()> {a}, val: Value(<ZST>) }
- }
-
- bb14: {
- _21 = <impl Future<Output = ()> as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+2:9: +2:14
- // mir::Constant
- // + span: $DIR/async_await.rs:16:9: 16:14
- // + literal: Const { ty: fn(impl Future<Output = ()>) -> <impl Future<Output = ()> as IntoFuture>::IntoFuture {<impl Future<Output = ()> as IntoFuture>::into_future}, val: Value(<ZST>) }
- }
-
- bb15: {
- StorageDead(_22); // scope 0 at $DIR/async_await.rs:+2:13: +2:14
- nop; // scope 0 at $DIR/async_await.rs:+2:9: +2:14
- (((*(_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; // scope 0 at $DIR/async_await.rs:+2:9: +2:14
- goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
- }
-
- bb16: {
- StorageLive(_24); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
- StorageLive(_25); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
- StorageLive(_26); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
- StorageLive(_27); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
- StorageLive(_28); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
- _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 = ()>); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
- _27 = &mut (*_28); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
- _26 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _27) -> [return: bb17, unwind unreachable]; // scope 5 at $DIR/async_await.rs:+2:9: +2:14
- // mir::Constant
- // + span: $DIR/async_await.rs:16:9: 16:14
- // + literal: Const { ty: unsafe fn(&mut impl Future<Output = ()>) -> Pin<&mut impl Future<Output = ()>> {Pin::<&mut impl Future<Output = ()>>::new_unchecked}, val: Value(<ZST>) }
- }
-
- bb17: {
- StorageDead(_27); // scope 5 at $DIR/async_await.rs:+2:13: +2:14
- StorageLive(_29); // scope 5 at $DIR/async_await.rs:+2:5: +2:14
- StorageLive(_30); // scope 5 at $DIR/async_await.rs:+2:5: +2:14
- StorageLive(_31); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
- _31 = _38; // scope 5 at $DIR/async_await.rs:+2:9: +2:14
- _30 = move _31; // scope 5 at $DIR/async_await.rs:+2:5: +2:14
- goto -> bb18; // scope 5 at $DIR/async_await.rs:+2:5: +2:14
- }
-
- bb18: {
- _29 = &mut (*_30); // scope 5 at $DIR/async_await.rs:+2:5: +2:14
- StorageDead(_31); // scope 5 at $DIR/async_await.rs:+2:13: +2:14
- _25 = <impl Future<Output = ()> as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable]; // scope 5 at $DIR/async_await.rs:+2:9: +2:14
- // mir::Constant
- // + span: $DIR/async_await.rs:16:9: 16:14
- // + literal: Const { ty: for<'a, 'b, 'c> fn(Pin<&'a mut impl Future<Output = ()>>, &'b mut Context<'c>) -> Poll<<impl Future<Output = ()> as Future>::Output> {<impl Future<Output = ()> as Future>::poll}, val: Value(<ZST>) }
- }
-
- bb19: {
- StorageDead(_29); // scope 5 at $DIR/async_await.rs:+2:13: +2:14
- StorageDead(_26); // scope 5 at $DIR/async_await.rs:+2:13: +2:14
- _32 = discriminant(_25); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
- switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9]; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
- }
-
- bb20: {
- _24 = const (); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
- StorageDead(_30); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- StorageDead(_28); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- StorageDead(_25); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- StorageDead(_24); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- StorageLive(_35); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
- StorageLive(_36); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
- _36 = (); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
- _0 = Poll::<()>::Pending; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 4; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
- return; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
- }
-
- bb21: {
- StorageLive(_33); // scope 4 at $DIR/async_await.rs:+2:5: +2:14
- _33 = ((_25 as Ready).0: ()); // scope 4 at $DIR/async_await.rs:+2:5: +2:14
- _37 = _33; // scope 6 at $DIR/async_await.rs:+2:5: +2:14
- StorageDead(_33); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- StorageDead(_30); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- StorageDead(_28); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- StorageDead(_25); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- StorageDead(_24); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- goto -> bb23; // scope 0 at $DIR/async_await.rs:+2:13: +2:14
- }
-
- bb22: {
- StorageDead(_36); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- _38 = move _35; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
- StorageDead(_35); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- _7 = const (); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
- goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
- }
-
- bb23: {
- nop; // scope 0 at $DIR/async_await.rs:+2:13: +2:14
- goto -> bb24; // scope 0 at $DIR/async_await.rs:+3:1: +3:2
- }
-
- bb24: {
- StorageDead(_21); // scope 0 at $DIR/async_await.rs:+3:1: +3:2
- goto -> bb25; // scope 0 at $DIR/async_await.rs:+3:1: +3:2
- }
-
- bb25: {
- _0 = Poll::<()>::Ready(move _37); // scope 0 at $DIR/async_await.rs:+3:2: +3:2
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 1; // scope 0 at $DIR/async_await.rs:+3:2: +3:2
- return; // scope 0 at $DIR/async_await.rs:+3:2: +3:2
- }
-
- bb26: {
- StorageLive(_3); // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- StorageLive(_4); // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- StorageLive(_19); // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- StorageLive(_20); // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- _19 = move _2; // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- goto -> bb11; // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- }
-
- bb27: {
- StorageLive(_21); // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- StorageLive(_35); // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- StorageLive(_36); // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- _35 = move _2; // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- goto -> bb22; // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- }
-
- bb28: {
- assert(const false, "`async fn` resumed after completion") -> bb28; // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- }
-
- bb29: {
- unreachable; // scope 0 at $DIR/async_await.rs:+0:18: +3:2
- }
-}
diff --git a/tests/mir-opt/building/async_await.rs b/tests/mir-opt/building/async_await.rs
index 0b991e3b8..abdeafef6 100644
--- a/tests/mir-opt/building/async_await.rs
+++ b/tests/mir-opt/building/async_await.rs
@@ -1,4 +1,5 @@
-// This test makes sure that the generator MIR pass eliminates all calls to
+// skip-filecheck
+// This test makes sure that the coroutine MIR pass eliminates all calls to
// `get_context`, and that the MIR argument type for an async fn and all locals
// related to `yield` are `&mut Context`, and its return type is `Poll`.
@@ -7,10 +8,10 @@
#![crate_type = "lib"]
-// EMIT_MIR async_await.a-{closure#0}.generator_resume.0.mir
+// EMIT_MIR async_await.a-{closure#0}.coroutine_resume.0.mir
async fn a() {}
-// EMIT_MIR async_await.b-{closure#0}.generator_resume.0.mir
+// EMIT_MIR async_await.b-{closure#0}.coroutine_resume.0.mir
pub async fn b() {
a().await;
a().await
diff --git a/tests/mir-opt/building/custom/aggregate_exprs.adt.built.after.mir b/tests/mir-opt/building/custom/aggregate_exprs.adt.built.after.mir
index 49e8c812c..c14882142 100644
--- a/tests/mir-opt/building/custom/aggregate_exprs.adt.built.after.mir
+++ b/tests/mir-opt/building/custom/aggregate_exprs.adt.built.after.mir
@@ -1,16 +1,16 @@
// MIR for `adt` after built
fn adt() -> Onion {
- let mut _0: Onion; // return place in scope 0 at $DIR/aggregate_exprs.rs:+0:13: +0:18
- let mut _1: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _2: Foo; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _3: Bar; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: Onion;
+ let mut _1: i32;
+ let mut _2: Foo;
+ let mut _3: Bar;
bb0: {
- _1 = const 1_i32; // scope 0 at $DIR/aggregate_exprs.rs:+6:13: +6:20
- _2 = Foo { a: const 1_i32, b: const 2_i32 }; // scope 0 at $DIR/aggregate_exprs.rs:+7:13: +10:14
- _3 = Bar::Foo(move _2, _1); // scope 0 at $DIR/aggregate_exprs.rs:+11:13: +11:39
- _0 = Onion { neon: ((_3 as variant#0).1: i32) }; // scope 0 at $DIR/aggregate_exprs.rs:+12:13: +12:58
- return; // scope 0 at $DIR/aggregate_exprs.rs:+13:13: +13:21
+ _1 = const 1_i32;
+ _2 = Foo { a: const 1_i32, b: const 2_i32 };
+ _3 = Bar::Foo(move _2, _1);
+ _0 = Onion { neon: ((_3 as variant#0).1: i32) };
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/aggregate_exprs.array.built.after.mir b/tests/mir-opt/building/custom/aggregate_exprs.array.built.after.mir
index 30d128973..fde007aba 100644
--- a/tests/mir-opt/building/custom/aggregate_exprs.array.built.after.mir
+++ b/tests/mir-opt/building/custom/aggregate_exprs.array.built.after.mir
@@ -1,15 +1,15 @@
// MIR for `array` after built
fn array() -> [i32; 2] {
- let mut _0: [i32; 2]; // return place in scope 0 at $DIR/aggregate_exprs.rs:+0:15: +0:23
- let mut _1: [i32; 2]; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _2: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: [i32; 2];
+ let mut _1: [i32; 2];
+ let mut _2: i32;
bb0: {
- _1 = [const 42_i32, const 43_i32]; // scope 0 at $DIR/aggregate_exprs.rs:+5:13: +5:25
- _2 = const 1_i32; // scope 0 at $DIR/aggregate_exprs.rs:+6:13: +6:20
- _1 = [_2, const 2_i32]; // scope 0 at $DIR/aggregate_exprs.rs:+7:13: +7:25
- _0 = move _1; // scope 0 at $DIR/aggregate_exprs.rs:+8:13: +8:26
- return; // scope 0 at $DIR/aggregate_exprs.rs:+9:13: +9:21
+ _1 = [const 42_i32, const 43_i32];
+ _2 = const 1_i32;
+ _1 = [_2, const 2_i32];
+ _0 = move _1;
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/aggregate_exprs.rs b/tests/mir-opt/building/custom/aggregate_exprs.rs
index 554c9c03b..d58188624 100644
--- a/tests/mir-opt/building/custom/aggregate_exprs.rs
+++ b/tests/mir-opt/building/custom/aggregate_exprs.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/aggregate_exprs.tuple.built.after.mir b/tests/mir-opt/building/custom/aggregate_exprs.tuple.built.after.mir
index 5fe45ccc9..060f72c9c 100644
--- a/tests/mir-opt/building/custom/aggregate_exprs.tuple.built.after.mir
+++ b/tests/mir-opt/building/custom/aggregate_exprs.tuple.built.after.mir
@@ -1,10 +1,10 @@
// MIR for `tuple` after built
fn tuple() -> (i32, bool) {
- let mut _0: (i32, bool); // return place in scope 0 at $DIR/aggregate_exprs.rs:+0:15: +0:26
+ let mut _0: (i32, bool);
bb0: {
- _0 = (const 1_i32, const true); // scope 0 at $DIR/aggregate_exprs.rs:+3:13: +3:28
- return; // scope 0 at $DIR/aggregate_exprs.rs:+4:13: +4:21
+ _0 = (const 1_i32, const true);
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir b/tests/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir
index 20dd251e7..189996f11 100644
--- a/tests/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir
+++ b/tests/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir
@@ -1,22 +1,22 @@
// MIR for `arbitrary_let` after built
fn arbitrary_let(_1: i32) -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/arbitrary_let.rs:+0:29: +0:32
- let mut _2: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: i32;
+ let mut _2: i32;
+ let mut _3: i32;
bb0: {
- _2 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- goto -> bb2; // scope 0 at $DIR/arbitrary_let.rs:+4:13: +4:25
+ _2 = _1;
+ goto -> bb2;
}
bb1: {
- _0 = _3; // scope 0 at $DIR/arbitrary_let.rs:+7:13: +7:20
- return; // scope 0 at $DIR/arbitrary_let.rs:+8:13: +8:21
+ _0 = _3;
+ return;
}
bb2: {
- _3 = _2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- goto -> bb1; // scope 0 at $DIR/arbitrary_let.rs:+12:13: +12:24
+ _3 = _2;
+ goto -> bb1;
}
}
diff --git a/tests/mir-opt/building/custom/arbitrary_let.rs b/tests/mir-opt/building/custom/arbitrary_let.rs
index 776df3151..f8ee8504e 100644
--- a/tests/mir-opt/building/custom/arbitrary_let.rs
+++ b/tests/mir-opt/building/custom/arbitrary_let.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/arrays.arrays.built.after.mir b/tests/mir-opt/building/custom/arrays.arrays.built.after.mir
index 4c9212728..eaeba302f 100644
--- a/tests/mir-opt/building/custom/arrays.arrays.built.after.mir
+++ b/tests/mir-opt/building/custom/arrays.arrays.built.after.mir
@@ -1,14 +1,14 @@
// MIR for `arrays` after built
fn arrays() -> usize {
- let mut _0: usize; // return place in scope 0 at $DIR/arrays.rs:+0:32: +0:37
- let mut _1: [i32; C]; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _2: usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: usize;
+ let mut _1: [i32; C];
+ let mut _2: usize;
bb0: {
- _1 = [const 5_i32; C]; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _2 = Len(_1); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _0 = _2; // scope 0 at $DIR/arrays.rs:+4:9: +4:16
- return; // scope 0 at $DIR/arrays.rs:+5:9: +5:17
+ _1 = [const 5_i32; C];
+ _2 = Len(_1);
+ _0 = _2;
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/arrays.rs b/tests/mir-opt/building/custom/arrays.rs
index 8e0a1fd7a..fe6abc546 100644
--- a/tests/mir-opt/building/custom/arrays.rs
+++ b/tests/mir-opt/building/custom/arrays.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics, inline_const)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir b/tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir
index d0b770783..e3334bc7d 100644
--- a/tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir
+++ b/tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir
@@ -1,10 +1,10 @@
// MIR for `float_to_int` after built
fn float_to_int(_1: f32) -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/as_cast.rs:+0:28: +0:31
+ let mut _0: i32;
bb0: {
- _0 = _1 as i32 (FloatToInt); // scope 0 at $DIR/as_cast.rs:+3:13: +3:27
- return; // scope 0 at $DIR/as_cast.rs:+4:13: +4:21
+ _0 = _1 as i32 (FloatToInt);
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir b/tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir
index aaebff0d7..d71cb9d78 100644
--- a/tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir
+++ b/tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir
@@ -1,10 +1,10 @@
// MIR for `int_to_int` after built
fn int_to_int(_1: u32) -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/as_cast.rs:+0:26: +0:29
+ let mut _0: i32;
bb0: {
- _0 = _1 as i32 (IntToInt); // scope 0 at $DIR/as_cast.rs:+3:13: +3:27
- return; // scope 0 at $DIR/as_cast.rs:+4:13: +4:21
+ _0 = _1 as i32 (IntToInt);
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir b/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir
index f040cf53d..0dc46d61e 100644
--- a/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir
+++ b/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir
@@ -1,10 +1,10 @@
// MIR for `int_to_ptr` after built
fn int_to_ptr(_1: usize) -> *const i32 {
- let mut _0: *const i32; // return place in scope 0 at $DIR/as_cast.rs:+0:28: +0:38
+ let mut _0: *const i32;
bb0: {
- _0 = _1 as *const i32 (PointerFromExposedAddress); // scope 0 at $DIR/as_cast.rs:+3:13: +3:34
- return; // scope 0 at $DIR/as_cast.rs:+4:13: +4:21
+ _0 = _1 as *const i32 (PointerFromExposedAddress);
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/as_cast.rs b/tests/mir-opt/building/custom/as_cast.rs
index b4b5ac6aa..92aea64db 100644
--- a/tests/mir-opt/building/custom/as_cast.rs
+++ b/tests/mir-opt/building/custom/as_cast.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/composite_return.rs b/tests/mir-opt/building/custom/composite_return.rs
index 701d6b1ab..33c903fa0 100644
--- a/tests/mir-opt/building/custom/composite_return.rs
+++ b/tests/mir-opt/building/custom/composite_return.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/composite_return.tuple.built.after.mir b/tests/mir-opt/building/custom/composite_return.tuple.built.after.mir
index d159c1a65..836622ec2 100644
--- a/tests/mir-opt/building/custom/composite_return.tuple.built.after.mir
+++ b/tests/mir-opt/building/custom/composite_return.tuple.built.after.mir
@@ -1,11 +1,11 @@
// MIR for `tuple` after built
fn tuple() -> (i32, bool) {
- let mut _0: (i32, bool); // return place in scope 0 at $DIR/composite_return.rs:+0:15: +0:26
+ let mut _0: (i32, bool);
bb0: {
- (_0.0: i32) = const 1_i32; // scope 0 at $DIR/composite_return.rs:+4:13: +4:22
- (_0.1: bool) = const true; // scope 0 at $DIR/composite_return.rs:+5:13: +5:25
- return; // scope 0 at $DIR/composite_return.rs:+6:13: +6:21
+ (_0.0: i32) = const 1_i32;
+ (_0.1: bool) = const true;
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/consts.consts.built.after.mir b/tests/mir-opt/building/custom/consts.consts.built.after.mir
index ba753cfc2..05de272af 100644
--- a/tests/mir-opt/building/custom/consts.consts.built.after.mir
+++ b/tests/mir-opt/building/custom/consts.consts.built.after.mir
@@ -1,22 +1,19 @@
// MIR for `consts` after built
fn consts() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/consts.rs:+0:27: +0:27
- let mut _1: u8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _2: i8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _3: u32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _4: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _5: fn() {consts::<10>}; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: ();
+ let mut _1: u8;
+ let mut _2: i8;
+ let mut _3: u32;
+ let mut _4: i32;
+ let mut _5: fn() {consts::<10>};
bb0: {
- _1 = const 5_u8; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _2 = const _; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _3 = const C; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _4 = const _; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _5 = consts::<10>; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- // mir::Constant
- // + span: $DIR/consts.rs:16:18: 16:30
- // + literal: Const { ty: fn() {consts::<10>}, val: Value(<ZST>) }
- return; // scope 0 at $DIR/consts.rs:+7:9: +7:17
+ _1 = const 5_u8;
+ _2 = const _;
+ _3 = const C;
+ _4 = const _;
+ _5 = consts::<10>;
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/consts.rs b/tests/mir-opt/building/custom/consts.rs
index 16d10eb59..42abf5019 100644
--- a/tests/mir-opt/building/custom/consts.rs
+++ b/tests/mir-opt/building/custom/consts.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics, inline_const)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/consts.statics.built.after.mir b/tests/mir-opt/building/custom/consts.statics.built.after.mir
index bfef976aa..a5cb6ff99 100644
--- a/tests/mir-opt/building/custom/consts.statics.built.after.mir
+++ b/tests/mir-opt/building/custom/consts.statics.built.after.mir
@@ -1,27 +1,21 @@
// MIR for `statics` after built
fn statics() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/consts.rs:+0:14: +0:14
- let mut _1: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _2: *mut i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: ();
+ let mut _1: &i32;
+ let mut _2: *mut i32;
bb0: {
- _1 = const {alloc1: &i32}; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- // mir::Constant
- // + span: $DIR/consts.rs:27:31: 27:32
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) }
- _2 = const {alloc2: *mut i32}; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- // mir::Constant
- // + span: $DIR/consts.rs:28:38: 28:39
- // + literal: Const { ty: *mut i32, val: Value(Scalar(alloc2)) }
- return; // scope 0 at $DIR/consts.rs:+4:9: +4:17
+ _1 = const {ALLOC0: &i32};
+ _2 = const {ALLOC1: *mut i32};
+ return;
}
}
-alloc2 (static: T, size: 4, align: 4) {
+ALLOC1 (static: T, size: 4, align: 4) {
0a 0a 0a 0a │ ....
}
-alloc1 (static: S, size: 4, align: 4) {
+ALLOC0 (static: S, size: 4, align: 4) {
05 05 05 05 │ ....
}
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..3671a1ef0
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.rs
@@ -0,0 +1,72 @@
+// skip-filecheck
+#![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/custom/enums.rs b/tests/mir-opt/building/custom/enums.rs
index eca5b792e..6aab1503c 100644
--- a/tests/mir-opt/building/custom/enums.rs
+++ b/tests/mir-opt/building/custom/enums.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/enums.set_discr.built.after.mir b/tests/mir-opt/building/custom/enums.set_discr.built.after.mir
index 6d0747365..8cc66e7e5 100644
--- a/tests/mir-opt/building/custom/enums.set_discr.built.after.mir
+++ b/tests/mir-opt/building/custom/enums.set_discr.built.after.mir
@@ -1,11 +1,11 @@
// MIR for `set_discr` after built
fn set_discr(_1: &mut Option<()>) -> () {
- let mut _0: (); // return place in scope 0 at $DIR/enums.rs:+0:39: +0:39
+ let mut _0: ();
bb0: {
- Deinit((*_1)); // scope 0 at $DIR/enums.rs:+2:9: +2:24
- discriminant((*_1)) = 0; // scope 0 at $DIR/enums.rs:+3:9: +3:36
- return; // scope 0 at $DIR/enums.rs:+4:9: +4:17
+ Deinit((*_1));
+ discriminant((*_1)) = 0;
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/enums.set_discr_repr.built.after.mir b/tests/mir-opt/building/custom/enums.set_discr_repr.built.after.mir
index 6fdc3d0f4..55ade43ed 100644
--- a/tests/mir-opt/building/custom/enums.set_discr_repr.built.after.mir
+++ b/tests/mir-opt/building/custom/enums.set_discr_repr.built.after.mir
@@ -1,10 +1,10 @@
// MIR for `set_discr_repr` after built
fn set_discr_repr(_1: &mut Bool) -> () {
- let mut _0: (); // return place in scope 0 at $DIR/enums.rs:+0:33: +0:33
+ let mut _0: ();
bb0: {
- discriminant((*_1)) = 0; // scope 0 at $DIR/enums.rs:+2:9: +2:31
- return; // scope 0 at $DIR/enums.rs:+3:9: +3:17
+ discriminant((*_1)) = 0;
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/enums.switch_bool.built.after.mir b/tests/mir-opt/building/custom/enums.switch_bool.built.after.mir
index 95c57d2dc..f82e5f1c6 100644
--- a/tests/mir-opt/building/custom/enums.switch_bool.built.after.mir
+++ b/tests/mir-opt/building/custom/enums.switch_bool.built.after.mir
@@ -1,19 +1,19 @@
// MIR for `switch_bool` after built
fn switch_bool(_1: bool) -> u32 {
- let mut _0: u32; // return place in scope 0 at $DIR/enums.rs:+0:32: +0:35
+ let mut _0: u32;
bb0: {
- switchInt(_1) -> [1: bb1, 0: bb2, otherwise: bb2]; // scope 0 at $DIR/enums.rs:+3:13: +7:14
+ switchInt(_1) -> [1: bb1, 0: bb2, otherwise: bb2];
}
bb1: {
- _0 = const 5_u32; // scope 0 at $DIR/enums.rs:+11:13: +11:20
- return; // scope 0 at $DIR/enums.rs:+12:13: +12:21
+ _0 = const 5_u32;
+ return;
}
bb2: {
- _0 = const 10_u32; // scope 0 at $DIR/enums.rs:+16:13: +16:21
- return; // scope 0 at $DIR/enums.rs:+17:13: +17:21
+ _0 = const 10_u32;
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/enums.switch_option.built.after.mir b/tests/mir-opt/building/custom/enums.switch_option.built.after.mir
index a659ba7c1..fa03f274b 100644
--- a/tests/mir-opt/building/custom/enums.switch_option.built.after.mir
+++ b/tests/mir-opt/building/custom/enums.switch_option.built.after.mir
@@ -1,21 +1,21 @@
// MIR for `switch_option` after built
fn switch_option(_1: Option<()>) -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/enums.rs:+0:45: +0:49
- let mut _2: isize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: bool;
+ let mut _2: isize;
bb0: {
- _2 = discriminant(_1); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- switchInt(_2) -> [0: bb1, 1: bb2, otherwise: bb2]; // scope 0 at $DIR/enums.rs:+4:13: +8:14
+ _2 = discriminant(_1);
+ switchInt(_2) -> [0: bb1, 1: bb2, otherwise: bb2];
}
bb1: {
- _0 = const false; // scope 0 at $DIR/enums.rs:+12:13: +12:24
- return; // scope 0 at $DIR/enums.rs:+13:13: +13:21
+ _0 = const false;
+ return;
}
bb2: {
- _0 = const true; // scope 0 at $DIR/enums.rs:+17:13: +17:23
- return; // scope 0 at $DIR/enums.rs:+18:13: +18:21
+ _0 = const true;
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/enums.switch_option_repr.built.after.mir b/tests/mir-opt/building/custom/enums.switch_option_repr.built.after.mir
index d60e4b1b7..eec2197a8 100644
--- a/tests/mir-opt/building/custom/enums.switch_option_repr.built.after.mir
+++ b/tests/mir-opt/building/custom/enums.switch_option_repr.built.after.mir
@@ -1,21 +1,21 @@
// MIR for `switch_option_repr` after built
fn switch_option_repr(_1: Bool) -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/enums.rs:+0:40: +0:44
- let mut _2: u8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: bool;
+ let mut _2: u8;
bb0: {
- _2 = discriminant(_1); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- switchInt(_2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/enums.rs:+4:13: +7:14
+ _2 = discriminant(_1);
+ switchInt(_2) -> [0: bb2, otherwise: bb1];
}
bb1: {
- _0 = const true; // scope 0 at $DIR/enums.rs:+11:13: +11:23
- return; // scope 0 at $DIR/enums.rs:+12:13: +12:21
+ _0 = const true;
+ return;
}
bb2: {
- _0 = const false; // scope 0 at $DIR/enums.rs:+16:13: +16:24
- return; // scope 0 at $DIR/enums.rs:+17:13: +17:21
+ _0 = const false;
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/operators.f.built.after.mir b/tests/mir-opt/building/custom/operators.f.built.after.mir
index cb43d5e6e..33eb6b720 100644
--- a/tests/mir-opt/building/custom/operators.f.built.after.mir
+++ b/tests/mir-opt/building/custom/operators.f.built.after.mir
@@ -1,30 +1,30 @@
// MIR for `f` after built
fn f(_1: i32, _2: bool) -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/operators.rs:+0:30: +0:33
- let mut _3: (i32, bool); // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: i32;
+ let mut _3: (i32, bool);
bb0: {
- _1 = Neg(_1); // scope 0 at $DIR/operators.rs:+2:9: +2:15
- _2 = Not(_2); // scope 0 at $DIR/operators.rs:+3:9: +3:15
- _1 = Add(_1, _1); // scope 0 at $DIR/operators.rs:+4:9: +4:18
- _1 = Sub(_1, _1); // scope 0 at $DIR/operators.rs:+5:9: +5:18
- _1 = Mul(_1, _1); // scope 0 at $DIR/operators.rs:+6:9: +6:18
- _1 = Div(_1, _1); // scope 0 at $DIR/operators.rs:+7:9: +7:18
- _1 = Rem(_1, _1); // scope 0 at $DIR/operators.rs:+8:9: +8:18
- _1 = BitXor(_1, _1); // scope 0 at $DIR/operators.rs:+9:9: +9:18
- _1 = BitAnd(_1, _1); // scope 0 at $DIR/operators.rs:+10:9: +10:18
- _1 = Shl(_1, _1); // scope 0 at $DIR/operators.rs:+11:9: +11:19
- _1 = Shr(_1, _1); // scope 0 at $DIR/operators.rs:+12:9: +12:19
- _2 = Eq(_1, _1); // scope 0 at $DIR/operators.rs:+13:9: +13:19
- _2 = Lt(_1, _1); // scope 0 at $DIR/operators.rs:+14:9: +14:18
- _2 = Le(_1, _1); // scope 0 at $DIR/operators.rs:+15:9: +15:19
- _2 = Ge(_1, _1); // scope 0 at $DIR/operators.rs:+16:9: +16:19
- _2 = Gt(_1, _1); // scope 0 at $DIR/operators.rs:+17:9: +17:18
- _3 = CheckedAdd(_1, _1); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _2 = (_3.1: bool); // scope 0 at $DIR/operators.rs:+19:9: +19:18
- _1 = (_3.0: i32); // scope 0 at $DIR/operators.rs:+20:9: +20:18
- _0 = _1; // scope 0 at $DIR/operators.rs:+21:9: +21:16
- return; // scope 0 at $DIR/operators.rs:+22:9: +22:17
+ _1 = Neg(_1);
+ _2 = Not(_2);
+ _1 = Add(_1, _1);
+ _1 = Sub(_1, _1);
+ _1 = Mul(_1, _1);
+ _1 = Div(_1, _1);
+ _1 = Rem(_1, _1);
+ _1 = BitXor(_1, _1);
+ _1 = BitAnd(_1, _1);
+ _1 = Shl(_1, _1);
+ _1 = Shr(_1, _1);
+ _2 = Eq(_1, _1);
+ _2 = Lt(_1, _1);
+ _2 = Le(_1, _1);
+ _2 = Ge(_1, _1);
+ _2 = Gt(_1, _1);
+ _3 = CheckedAdd(_1, _1);
+ _2 = (_3.1: bool);
+ _1 = (_3.0: i32);
+ _0 = _1;
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/operators.rs b/tests/mir-opt/building/custom/operators.rs
index db7a48317..91bdf2b91 100644
--- a/tests/mir-opt/building/custom/operators.rs
+++ b/tests/mir-opt/building/custom/operators.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: --crate-type=lib
#![feature(custom_mir, core_intrinsics, inline_const)]
use std::intrinsics::mir::*;
diff --git a/tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir b/tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir
index 5233d0489..b1ba5f931 100644
--- a/tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir
+++ b/tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir
@@ -1,12 +1,12 @@
// MIR for `copy_for_deref` after built
fn copy_for_deref(_1: (&i32, i32)) -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/projections.rs:+0:38: +0:41
- let mut _2: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: i32;
+ let mut _2: &i32;
bb0: {
- _2 = deref_copy (_1.0: &i32); // scope 0 at $DIR/projections.rs:+4:13: +4:37
- _0 = (*_2); // scope 0 at $DIR/projections.rs:+5:13: +5:24
- return; // scope 0 at $DIR/projections.rs:+6:13: +6:21
+ _2 = deref_copy (_1.0: &i32);
+ _0 = (*_2);
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/projections.rs b/tests/mir-opt/building/custom/projections.rs
index 3c155deae..ac23fe590 100644
--- a/tests/mir-opt/building/custom/projections.rs
+++ b/tests/mir-opt/building/custom/projections.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/projections.set.built.after.mir b/tests/mir-opt/building/custom/projections.set.built.after.mir
index 2f15176a6..9e756c504 100644
--- a/tests/mir-opt/building/custom/projections.set.built.after.mir
+++ b/tests/mir-opt/building/custom/projections.set.built.after.mir
@@ -1,10 +1,10 @@
// MIR for `set` after built
fn set(_1: &mut Option<i32>) -> () {
- let mut _0: (); // return place in scope 0 at $DIR/projections.rs:+0:31: +0:31
+ let mut _0: ();
bb0: {
- (((*_1) as variant#1).0: i32) = const 10_i32; // scope 0 at $DIR/projections.rs:+2:9: +2:48
- return; // scope 0 at $DIR/projections.rs:+3:9: +3:17
+ (((*_1) as variant#1).0: i32) = const 10_i32;
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/projections.simple_index.built.after.mir b/tests/mir-opt/building/custom/projections.simple_index.built.after.mir
index fc422e4b3..f74c61009 100644
--- a/tests/mir-opt/building/custom/projections.simple_index.built.after.mir
+++ b/tests/mir-opt/building/custom/projections.simple_index.built.after.mir
@@ -1,13 +1,13 @@
// MIR for `simple_index` after built
fn simple_index(_1: [i32; 10], _2: &[i32]) -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/projections.rs:+0:45: +0:48
- let mut _3: usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: i32;
+ let mut _3: usize;
bb0: {
- _3 = const 3_usize; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _0 = _1[_3]; // scope 0 at $DIR/projections.rs:+3:9: +3:22
- _0 = (*_2)[_3]; // scope 0 at $DIR/projections.rs:+4:9: +4:25
- return; // scope 0 at $DIR/projections.rs:+5:9: +5:17
+ _3 = const 3_usize;
+ _0 = _1[_3];
+ _0 = (*_2)[_3];
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/projections.tuples.built.after.mir b/tests/mir-opt/building/custom/projections.tuples.built.after.mir
index dec575200..a370de2ed 100644
--- a/tests/mir-opt/building/custom/projections.tuples.built.after.mir
+++ b/tests/mir-opt/building/custom/projections.tuples.built.after.mir
@@ -1,11 +1,11 @@
// MIR for `tuples` after built
fn tuples(_1: (u32, i32)) -> (u32, i32) {
- let mut _0: (u32, i32); // return place in scope 0 at $DIR/projections.rs:+0:29: +0:39
+ let mut _0: (u32, i32);
bb0: {
- (_0.0: u32) = (_1.0: u32); // scope 0 at $DIR/projections.rs:+4:13: +4:24
- (_0.1: i32) = (_1.1: i32); // scope 0 at $DIR/projections.rs:+5:13: +5:24
- return; // scope 0 at $DIR/projections.rs:+6:13: +6:21
+ (_0.0: u32) = (_1.0: u32);
+ (_0.1: i32) = (_1.1: i32);
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/projections.unions.built.after.mir b/tests/mir-opt/building/custom/projections.unions.built.after.mir
index 922538a5f..4189b329e 100644
--- a/tests/mir-opt/building/custom/projections.unions.built.after.mir
+++ b/tests/mir-opt/building/custom/projections.unions.built.after.mir
@@ -1,10 +1,10 @@
// MIR for `unions` after built
fn unions(_1: U) -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/projections.rs:+0:20: +0:23
+ let mut _0: i32;
bb0: {
- _0 = (_1.0: i32); // scope 0 at $DIR/projections.rs:+2:9: +2:18
- return; // scope 0 at $DIR/projections.rs:+3:9: +3:17
+ _0 = (_1.0: i32);
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/projections.unwrap.built.after.mir b/tests/mir-opt/building/custom/projections.unwrap.built.after.mir
index 75b03a3c3..0c43bdc9d 100644
--- a/tests/mir-opt/building/custom/projections.unwrap.built.after.mir
+++ b/tests/mir-opt/building/custom/projections.unwrap.built.after.mir
@@ -1,10 +1,10 @@
// MIR for `unwrap` after built
fn unwrap(_1: Option<i32>) -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/projections.rs:+0:32: +0:35
+ let mut _0: i32;
bb0: {
- _0 = ((_1 as variant#1).0: i32); // scope 0 at $DIR/projections.rs:+2:9: +2:40
- return; // scope 0 at $DIR/projections.rs:+3:9: +3:17
+ _0 = ((_1 as variant#1).0: i32);
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/projections.unwrap_deref.built.after.mir b/tests/mir-opt/building/custom/projections.unwrap_deref.built.after.mir
index c6b0f7efa..39e978513 100644
--- a/tests/mir-opt/building/custom/projections.unwrap_deref.built.after.mir
+++ b/tests/mir-opt/building/custom/projections.unwrap_deref.built.after.mir
@@ -1,10 +1,10 @@
// MIR for `unwrap_deref` after built
fn unwrap_deref(_1: Option<&i32>) -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/projections.rs:+0:39: +0:42
+ let mut _0: i32;
bb0: {
- _0 = (*((_1 as variant#1).0: &i32)); // scope 0 at $DIR/projections.rs:+2:9: +2:49
- return; // scope 0 at $DIR/projections.rs:+3:9: +3:17
+ _0 = (*((_1 as variant#1).0: &i32));
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/references.immut_ref.built.after.mir b/tests/mir-opt/building/custom/references.immut_ref.built.after.mir
index f5ee11262..d1e1aab99 100644
--- a/tests/mir-opt/building/custom/references.immut_ref.built.after.mir
+++ b/tests/mir-opt/building/custom/references.immut_ref.built.after.mir
@@ -1,13 +1,13 @@
// MIR for `immut_ref` after built
fn immut_ref(_1: &i32) -> &i32 {
- let mut _0: &i32; // return place in scope 0 at $DIR/references.rs:+0:30: +0:34
- let mut _2: *const i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: &i32;
+ let mut _2: *const i32;
bb0: {
- _2 = &raw const (*_1); // scope 0 at $DIR/references.rs:+5:13: +5:29
- _0 = &(*_2); // scope 0 at $DIR/references.rs:+6:13: +6:23
- Retag(_0); // scope 0 at $DIR/references.rs:+7:13: +7:23
- return; // scope 0 at $DIR/references.rs:+8:13: +8:21
+ _2 = &raw const (*_1);
+ _0 = &(*_2);
+ Retag(_0);
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/references.mut_ref.built.after.mir b/tests/mir-opt/building/custom/references.mut_ref.built.after.mir
index 8e2ffc33b..c82cb3274 100644
--- a/tests/mir-opt/building/custom/references.mut_ref.built.after.mir
+++ b/tests/mir-opt/building/custom/references.mut_ref.built.after.mir
@@ -1,13 +1,13 @@
// MIR for `mut_ref` after built
fn mut_ref(_1: &mut i32) -> &mut i32 {
- let mut _0: &mut i32; // return place in scope 0 at $DIR/references.rs:+0:32: +0:40
- let mut _2: *mut i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: &mut i32;
+ let mut _2: *mut i32;
bb0: {
- _2 = &raw mut (*_1); // scope 0 at $DIR/references.rs:+5:13: +5:33
- _0 = &mut (*_2); // scope 0 at $DIR/references.rs:+6:13: +6:26
- Retag(_0); // scope 0 at $DIR/references.rs:+7:13: +7:23
- return; // scope 0 at $DIR/references.rs:+8:13: +8:21
+ _2 = &raw mut (*_1);
+ _0 = &mut (*_2);
+ Retag(_0);
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/references.raw_pointer.built.after.mir b/tests/mir-opt/building/custom/references.raw_pointer.built.after.mir
index 775e5e3ad..57c7f92a3 100644
--- a/tests/mir-opt/building/custom/references.raw_pointer.built.after.mir
+++ b/tests/mir-opt/building/custom/references.raw_pointer.built.after.mir
@@ -1,10 +1,10 @@
// MIR for `raw_pointer` after built
fn raw_pointer(_1: *const i32) -> *const i32 {
- let mut _0: *const i32; // return place in scope 0 at $DIR/references.rs:+0:38: +0:48
+ let mut _0: *const i32;
bb0: {
- _0 = &raw const (*_1); // scope 0 at $DIR/references.rs:+4:9: +4:27
- return; // scope 0 at $DIR/references.rs:+5:9: +5:17
+ _0 = &raw const (*_1);
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/references.raw_pointer_offset.built.after.mir b/tests/mir-opt/building/custom/references.raw_pointer_offset.built.after.mir
index f614aef40..8046b543e 100644
--- a/tests/mir-opt/building/custom/references.raw_pointer_offset.built.after.mir
+++ b/tests/mir-opt/building/custom/references.raw_pointer_offset.built.after.mir
@@ -1,10 +1,10 @@
// MIR for `raw_pointer_offset` after built
fn raw_pointer_offset(_1: *const i32) -> *const i32 {
- let mut _0: *const i32; // return place in scope 0 at $DIR/references.rs:+0:45: +0:55
+ let mut _0: *const i32;
bb0: {
- _0 = Offset(_1, const 1_isize); // scope 0 at $DIR/references.rs:+2:9: +2:33
- return; // scope 0 at $DIR/references.rs:+3:9: +3:17
+ _0 = Offset(_1, const 1_isize);
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/references.rs b/tests/mir-opt/building/custom/references.rs
index f87f6664c..04afe6e64 100644
--- a/tests/mir-opt/building/custom/references.rs
+++ b/tests/mir-opt/building/custom/references.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/simple_assign.rs b/tests/mir-opt/building/custom/simple_assign.rs
index db041aab2..844227229 100644
--- a/tests/mir-opt/building/custom/simple_assign.rs
+++ b/tests/mir-opt/building/custom/simple_assign.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/simple_assign.simple.built.after.mir b/tests/mir-opt/building/custom/simple_assign.simple.built.after.mir
index 743016708..6f7aaeed9 100644
--- a/tests/mir-opt/building/custom/simple_assign.simple.built.after.mir
+++ b/tests/mir-opt/building/custom/simple_assign.simple.built.after.mir
@@ -1,20 +1,20 @@
// MIR for `simple` after built
fn simple(_1: i32) -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/simple_assign.rs:+0:26: +0:29
- let mut _2: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: i32;
+ let mut _2: i32;
+ let mut _3: i32;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/simple_assign.rs:+6:13: +6:31
- _2 = _1; // scope 0 at $DIR/simple_assign.rs:+7:13: +7:22
- goto -> bb1; // scope 0 at $DIR/simple_assign.rs:+8:13: +8:23
+ StorageLive(_2);
+ _2 = _1;
+ goto -> bb1;
}
bb1: {
- _3 = move _2; // scope 0 at $DIR/simple_assign.rs:+12:13: +12:32
- StorageDead(_2); // scope 0 at $DIR/simple_assign.rs:+13:13: +13:31
- _0 = _3; // scope 0 at $DIR/simple_assign.rs:+14:13: +14:24
- return; // scope 0 at $DIR/simple_assign.rs:+15:13: +15:21
+ _3 = move _2;
+ StorageDead(_2);
+ _0 = _3;
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/simple_assign.simple_ref.built.after.mir b/tests/mir-opt/building/custom/simple_assign.simple_ref.built.after.mir
index 2b0e8f104..b6d822998 100644
--- a/tests/mir-opt/building/custom/simple_assign.simple_ref.built.after.mir
+++ b/tests/mir-opt/building/custom/simple_assign.simple_ref.built.after.mir
@@ -1,10 +1,10 @@
// MIR for `simple_ref` after built
fn simple_ref(_1: &mut i32) -> &mut i32 {
- let mut _0: &mut i32; // return place in scope 0 at $DIR/simple_assign.rs:+0:35: +0:43
+ let mut _0: &mut i32;
bb0: {
- _0 = move _1; // scope 0 at $DIR/simple_assign.rs:+2:9: +2:22
- return; // scope 0 at $DIR/simple_assign.rs:+3:9: +3:17
+ _0 = move _1;
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/terminators.assert_nonzero.built.after.mir b/tests/mir-opt/building/custom/terminators.assert_nonzero.built.after.mir
index a1a27226b..9cf26dff3 100644
--- a/tests/mir-opt/building/custom/terminators.assert_nonzero.built.after.mir
+++ b/tests/mir-opt/building/custom/terminators.assert_nonzero.built.after.mir
@@ -1,17 +1,17 @@
// MIR for `assert_nonzero` after built
fn assert_nonzero(_1: i32) -> () {
- let mut _0: (); // return place in scope 0 at $DIR/terminators.rs:+0:27: +0:27
+ let mut _0: ();
bb0: {
- switchInt(_1) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/terminators.rs:+3:13: +6:14
+ switchInt(_1) -> [0: bb1, otherwise: bb2];
}
bb1: {
- unreachable; // scope 0 at $DIR/terminators.rs:+10:13: +10:26
+ unreachable;
}
bb2: {
- return; // scope 0 at $DIR/terminators.rs:+14:13: +14:21
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/terminators.direct_call.built.after.mir b/tests/mir-opt/building/custom/terminators.direct_call.built.after.mir
index 1b2345a96..07044ceae 100644
--- a/tests/mir-opt/building/custom/terminators.direct_call.built.after.mir
+++ b/tests/mir-opt/building/custom/terminators.direct_call.built.after.mir
@@ -1,16 +1,13 @@
// MIR for `direct_call` after built
fn direct_call(_1: i32) -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/terminators.rs:+0:27: +0:30
+ let mut _0: i32;
bb0: {
- _0 = ident::<i32>(_1) -> bb1; // scope 0 at $DIR/terminators.rs:+3:13: +3:42
- // mir::Constant
- // + span: $DIR/terminators.rs:15:33: 15:38
- // + literal: Const { ty: fn(i32) -> i32 {ident::<i32>}, val: Value(<ZST>) }
+ _0 = ident::<i32>(_1) -> [return: bb1, unwind continue];
}
bb1: {
- return; // scope 0 at $DIR/terminators.rs:+7:13: +7:21
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/terminators.drop_first.built.after.mir b/tests/mir-opt/building/custom/terminators.drop_first.built.after.mir
index ada78c0fc..6524f754d 100644
--- a/tests/mir-opt/building/custom/terminators.drop_first.built.after.mir
+++ b/tests/mir-opt/building/custom/terminators.drop_first.built.after.mir
@@ -1,14 +1,14 @@
// MIR for `drop_first` after built
fn drop_first(_1: WriteOnDrop<'_>, _2: WriteOnDrop<'_>) -> () {
- let mut _0: (); // return place in scope 0 at $DIR/terminators.rs:+0:59: +0:59
+ let mut _0: ();
bb0: {
- drop(_1) -> bb1; // scope 0 at $DIR/terminators.rs:+3:13: +3:30
+ drop(_1) -> [return: bb1, unwind continue];
}
bb1: {
- _1 = move _2; // scope 0 at $DIR/terminators.rs:+7:13: +7:24
- return; // scope 0 at $DIR/terminators.rs:+8:13: +8:21
+ _1 = move _2;
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/terminators.drop_second.built.after.mir b/tests/mir-opt/building/custom/terminators.drop_second.built.after.mir
index f14246f2d..ed3728121 100644
--- a/tests/mir-opt/building/custom/terminators.drop_second.built.after.mir
+++ b/tests/mir-opt/building/custom/terminators.drop_second.built.after.mir
@@ -1,13 +1,13 @@
// MIR for `drop_second` after built
fn drop_second(_1: WriteOnDrop<'_>, _2: WriteOnDrop<'_>) -> () {
- let mut _0: (); // return place in scope 0 at $DIR/terminators.rs:+0:60: +0:60
+ let mut _0: ();
bb0: {
- drop(_2) -> bb1; // scope 0 at $DIR/terminators.rs:+3:13: +3:30
+ drop(_2) -> [return: bb1, unwind continue];
}
bb1: {
- return; // scope 0 at $DIR/terminators.rs:+7:13: +7:21
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/terminators.indirect_call.built.after.mir b/tests/mir-opt/building/custom/terminators.indirect_call.built.after.mir
index 2f1b14069..3b849354d 100644
--- a/tests/mir-opt/building/custom/terminators.indirect_call.built.after.mir
+++ b/tests/mir-opt/building/custom/terminators.indirect_call.built.after.mir
@@ -1,13 +1,13 @@
// MIR for `indirect_call` after built
fn indirect_call(_1: i32, _2: fn(i32) -> i32) -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/terminators.rs:+0:48: +0:51
+ let mut _0: i32;
bb0: {
- _0 = _2(_1) -> bb1; // scope 0 at $DIR/terminators.rs:+3:13: +3:38
+ _0 = _2(_1) -> [return: bb1, unwind continue];
}
bb1: {
- return; // scope 0 at $DIR/terminators.rs:+7:13: +7:21
+ return;
}
}
diff --git a/tests/mir-opt/building/custom/terminators.rs b/tests/mir-opt/building/custom/terminators.rs
index f12405661..a83a6c074 100644
--- a/tests/mir-opt/building/custom/terminators.rs
+++ b/tests/mir-opt/building/custom/terminators.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
@@ -12,7 +13,7 @@ fn ident<T>(t: T) -> T {
fn direct_call(x: i32) -> i32 {
mir!(
{
- Call(RET, retblock, ident(x))
+ Call(RET = ident(x), retblock, UnwindContinue())
}
retblock = {
@@ -26,7 +27,7 @@ fn direct_call(x: i32) -> i32 {
fn indirect_call(x: i32, f: fn(i32) -> i32) -> i32 {
mir!(
{
- Call(RET, retblock, f(x))
+ Call(RET = f(x), retblock, UnwindContinue())
}
retblock = {
@@ -48,7 +49,7 @@ impl<'a> Drop for WriteOnDrop<'a> {
fn drop_first<'a>(a: WriteOnDrop<'a>, b: WriteOnDrop<'a>) {
mir!(
{
- Drop(a, retblock)
+ Drop(a, retblock, UnwindContinue())
}
retblock = {
@@ -63,7 +64,7 @@ fn drop_first<'a>(a: WriteOnDrop<'a>, b: WriteOnDrop<'a>) {
fn drop_second<'a>(a: WriteOnDrop<'a>, b: WriteOnDrop<'a>) {
mir!(
{
- Drop(b, retblock)
+ Drop(b, retblock, UnwindContinue())
}
retblock = {
diff --git a/tests/mir-opt/building/custom/unwind_action.rs b/tests/mir-opt/building/custom/unwind_action.rs
new file mode 100644
index 000000000..e3c4ffac3
--- /dev/null
+++ b/tests/mir-opt/building/custom/unwind_action.rs
@@ -0,0 +1,68 @@
+// compile-flags: --crate-type=lib
+// edition:2021
+// needs-unwind
+#![feature(custom_mir, core_intrinsics)]
+use core::intrinsics::mir::*;
+
+// CHECK-LABEL: fn a()
+// CHECK: bb0: {
+// CHECK-NEXT: a() -> [return: bb1, unwind unreachable];
+#[custom_mir(dialect = "runtime", phase = "optimized")]
+pub fn a() {
+ mir!(
+ {
+ Call(RET = a(), bb1, UnwindUnreachable())
+ }
+ bb1 = {
+ Return()
+ }
+ )
+}
+
+// CHECK-LABEL: fn b()
+// CHECK: bb0: {
+// CHECK-NEXT: b() -> [return: bb1, unwind continue];
+#[custom_mir(dialect = "runtime", phase = "optimized")]
+pub fn b() {
+ mir!(
+ {
+ Call(RET = b(), bb1, UnwindContinue())
+ }
+ bb1 = {
+ Return()
+ }
+ )
+}
+
+// CHECK-LABEL: fn c()
+// CHECK: bb0: {
+// CHECK-NEXT: c() -> [return: bb1, unwind terminate(abi)];
+#[custom_mir(dialect = "runtime", phase = "optimized")]
+pub fn c() {
+ mir!(
+ {
+ Call(RET = c(), bb1, UnwindTerminate(ReasonAbi))
+ }
+ bb1 = {
+ Return()
+ }
+ )
+}
+
+// CHECK-LABEL: fn d()
+// CHECK: bb0: {
+// CHECK-NEXT: d() -> [return: bb1, unwind: bb2];
+#[custom_mir(dialect = "runtime", phase = "optimized")]
+pub fn d() {
+ mir!(
+ {
+ Call(RET = d(), bb1, UnwindCleanup(bb2))
+ }
+ bb1 = {
+ Return()
+ }
+ bb2 (cleanup) = {
+ UnwindResume()
+ }
+ )
+}
diff --git a/tests/mir-opt/building/custom/unwind_terminate.rs b/tests/mir-opt/building/custom/unwind_terminate.rs
new file mode 100644
index 000000000..efdf2ddb1
--- /dev/null
+++ b/tests/mir-opt/building/custom/unwind_terminate.rs
@@ -0,0 +1,34 @@
+// compile-flags: --crate-type=lib
+// edition:2021
+#![feature(custom_mir, core_intrinsics)]
+use core::intrinsics::mir::*;
+
+// CHECK-LABEL: fn f()
+// CHECK: bb1 (cleanup): {
+// CHECK-NEXT: terminate(abi);
+#[custom_mir(dialect = "runtime", phase = "optimized")]
+pub fn f() {
+ mir!(
+ {
+ Return()
+ }
+ bb1(cleanup) = {
+ UnwindTerminate(ReasonAbi)
+ }
+ )
+}
+
+// CHECK-LABEL: fn g()
+// CHECK: bb1 (cleanup): {
+// CHECK-NEXT: terminate(cleanup);
+#[custom_mir(dialect = "runtime", phase = "optimized")]
+pub fn g() {
+ mir!(
+ {
+ Return()
+ }
+ bb1(cleanup) = {
+ UnwindTerminate(ReasonInCleanup)
+ }
+ )
+}
diff --git a/tests/mir-opt/building/enum_cast.bar.built.after.mir b/tests/mir-opt/building/enum_cast.bar.built.after.mir
index 9f14c0284..512c73216 100644
--- a/tests/mir-opt/building/enum_cast.bar.built.after.mir
+++ b/tests/mir-opt/building/enum_cast.bar.built.after.mir
@@ -1,22 +1,22 @@
// MIR for `bar` after built
fn bar(_1: Bar) -> usize {
- debug bar => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11
- let mut _0: usize; // return place in scope 0 at $DIR/enum_cast.rs:+0:21: +0:26
- let _2: Bar; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- let mut _3: isize; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- let mut _4: u8; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ debug bar => _1;
+ let mut _0: usize;
+ let _2: Bar;
+ let mut _3: isize;
+ let mut _4: u8;
+ let mut _5: bool;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- _4 = _3 as u8 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- _5 = Le(_4, const 1_u8); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- assume(move _5); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- _0 = move _3 as usize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:16: +1:17
- return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
+ StorageLive(_2);
+ _2 = move _1;
+ _3 = discriminant(_2);
+ _4 = _3 as u8 (IntToInt);
+ _5 = Le(_4, const 1_u8);
+ assume(move _5);
+ _0 = move _3 as usize (IntToInt);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/building/enum_cast.boo.built.after.mir b/tests/mir-opt/building/enum_cast.boo.built.after.mir
index 715dedcf2..ad0adf14e 100644
--- a/tests/mir-opt/building/enum_cast.boo.built.after.mir
+++ b/tests/mir-opt/building/enum_cast.boo.built.after.mir
@@ -1,22 +1,22 @@
// MIR for `boo` after built
fn boo(_1: Boo) -> usize {
- debug boo => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11
- let mut _0: usize; // return place in scope 0 at $DIR/enum_cast.rs:+0:21: +0:26
- let _2: Boo; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- let mut _3: u8; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- let mut _4: u8; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ debug boo => _1;
+ let mut _0: usize;
+ let _2: Boo;
+ let mut _3: u8;
+ let mut _4: u8;
+ let mut _5: bool;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- _4 = _3 as u8 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- _5 = Le(_4, const 1_u8); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- assume(move _5); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- _0 = move _3 as usize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:16: +1:17
- return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
+ StorageLive(_2);
+ _2 = move _1;
+ _3 = discriminant(_2);
+ _4 = _3 as u8 (IntToInt);
+ _5 = Le(_4, const 1_u8);
+ assume(move _5);
+ _0 = move _3 as usize (IntToInt);
+ StorageDead(_2);
+ 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 6c177c61e..ea0edb610 100644
--- a/tests/mir-opt/building/enum_cast.droppy.built.after.mir
+++ b/tests/mir-opt/building/enum_cast.droppy.built.after.mir
@@ -1,71 +1,71 @@
// MIR for `droppy` after built
fn droppy() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/enum_cast.rs:+0:13: +0:13
- let _1: (); // in scope 0 at $DIR/enum_cast.rs:+1:5: +6:6
- let _2: Droppy; // in scope 0 at $DIR/enum_cast.rs:+2:13: +2:14
- let _4: Droppy; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:18
- let mut _5: isize; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:18
- let mut _6: u8; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:27
- let mut _7: bool; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:27
- let _8: Droppy; // in scope 0 at $DIR/enum_cast.rs:+7:9: +7:10
+ let mut _0: ();
+ let _1: ();
+ let _2: Droppy;
+ let _4: Droppy;
+ let mut _5: isize;
+ let mut _6: u8;
+ let mut _7: bool;
+ let _8: Droppy;
scope 1 {
- debug x => _2; // in scope 1 at $DIR/enum_cast.rs:+2:13: +2:14
+ debug x => _2;
scope 2 {
- debug y => _3; // in scope 2 at $DIR/enum_cast.rs:+5:13: +5:14
+ debug y => _3;
}
scope 3 {
- let _3: usize; // in scope 3 at $DIR/enum_cast.rs:+5:13: +5:14
+ let _3: usize;
}
}
scope 4 {
- debug z => _8; // in scope 4 at $DIR/enum_cast.rs:+7:9: +7:10
+ debug z => _8;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/enum_cast.rs:+1:5: +6:6
- StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+2:13: +2:14
- _2 = Droppy::C; // scope 0 at $DIR/enum_cast.rs:+2:17: +2:26
- FakeRead(ForLet(None), _2); // scope 0 at $DIR/enum_cast.rs:+2:13: +2:14
- StorageLive(_3); // scope 3 at $DIR/enum_cast.rs:+5:13: +5:14
- StorageLive(_4); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:18
- _4 = move _2; // scope 3 at $DIR/enum_cast.rs:+5:17: +5:18
- _5 = discriminant(_4); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
- _6 = _5 as u8 (IntToInt); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
- _7 = Le(_6, const 2_u8); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
- assume(move _7); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
- _3 = move _5 as usize (IntToInt); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
- drop(_4) -> [return: bb1, unwind: bb4]; // scope 3 at $DIR/enum_cast.rs:+5:26: +5:27
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = Droppy::C;
+ FakeRead(ForLet(None), _2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = move _2;
+ _5 = discriminant(_4);
+ _6 = _5 as u8 (IntToInt);
+ _7 = Le(_6, const 2_u8);
+ assume(move _7);
+ _3 = move _5 as usize (IntToInt);
+ drop(_4) -> [return: bb1, unwind: bb4];
}
bb1: {
- StorageDead(_4); // scope 3 at $DIR/enum_cast.rs:+5:26: +5:27
- FakeRead(ForLet(None), _3); // scope 3 at $DIR/enum_cast.rs:+5:13: +5:14
- _1 = const (); // scope 0 at $DIR/enum_cast.rs:+1:5: +6:6
- StorageDead(_3); // scope 1 at $DIR/enum_cast.rs:+6:5: +6:6
- drop(_2) -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/enum_cast.rs:+6:5: +6:6
+ StorageDead(_4);
+ FakeRead(ForLet(None), _3);
+ _1 = const ();
+ StorageDead(_3);
+ drop(_2) -> [return: bb2, unwind: bb5];
}
bb2: {
- StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+6:5: +6:6
- StorageDead(_1); // scope 0 at $DIR/enum_cast.rs:+6:5: +6:6
- StorageLive(_8); // scope 0 at $DIR/enum_cast.rs:+7:9: +7:10
- _8 = Droppy::B; // scope 0 at $DIR/enum_cast.rs:+7:13: +7:22
- FakeRead(ForLet(None), _8); // scope 0 at $DIR/enum_cast.rs:+7:9: +7:10
- _0 = const (); // scope 0 at $DIR/enum_cast.rs:+0:13: +8:2
- drop(_8) -> [return: bb3, unwind: bb5]; // scope 0 at $DIR/enum_cast.rs:+8:1: +8:2
+ StorageDead(_2);
+ StorageDead(_1);
+ StorageLive(_8);
+ _8 = Droppy::B;
+ FakeRead(ForLet(None), _8);
+ _0 = const ();
+ drop(_8) -> [return: bb3, unwind: bb5];
}
bb3: {
- StorageDead(_8); // scope 0 at $DIR/enum_cast.rs:+8:1: +8:2
- return; // scope 0 at $DIR/enum_cast.rs:+8:2: +8:2
+ StorageDead(_8);
+ return;
}
bb4 (cleanup): {
- drop(_2) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/enum_cast.rs:+6:5: +6:6
+ drop(_2) -> [return: bb5, unwind terminate(cleanup)];
}
bb5 (cleanup): {
- resume; // scope 0 at $DIR/enum_cast.rs:+0:1: +8:2
+ resume;
}
}
diff --git a/tests/mir-opt/building/enum_cast.far.built.after.mir b/tests/mir-opt/building/enum_cast.far.built.after.mir
index ab8129ca0..e75803c70 100644
--- a/tests/mir-opt/building/enum_cast.far.built.after.mir
+++ b/tests/mir-opt/building/enum_cast.far.built.after.mir
@@ -1,22 +1,22 @@
// MIR for `far` after built
fn far(_1: Far) -> isize {
- debug far => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11
- let mut _0: isize; // return place in scope 0 at $DIR/enum_cast.rs:+0:21: +0:26
- let _2: Far; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- let mut _3: i16; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- let mut _4: u16; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ debug far => _1;
+ let mut _0: isize;
+ let _2: Far;
+ let mut _3: i16;
+ let mut _4: u16;
+ let mut _5: bool;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- _4 = _3 as u16 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- _5 = Le(_4, const 1_u16); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- assume(move _5); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- _0 = move _3 as isize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:16: +1:17
- return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
+ StorageLive(_2);
+ _2 = move _1;
+ _3 = discriminant(_2);
+ _4 = _3 as u16 (IntToInt);
+ _5 = Le(_4, const 1_u16);
+ assume(move _5);
+ _0 = move _3 as isize (IntToInt);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/building/enum_cast.foo.built.after.mir b/tests/mir-opt/building/enum_cast.foo.built.after.mir
index 17e0abf2e..d4eea0534 100644
--- a/tests/mir-opt/building/enum_cast.foo.built.after.mir
+++ b/tests/mir-opt/building/enum_cast.foo.built.after.mir
@@ -1,17 +1,17 @@
// MIR for `foo` after built
fn foo(_1: Foo) -> usize {
- debug foo => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11
- let mut _0: usize; // return place in scope 0 at $DIR/enum_cast.rs:+0:21: +0:26
- let _2: Foo; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- let mut _3: isize; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ debug foo => _1;
+ let mut _0: usize;
+ let _2: Foo;
+ let mut _3: isize;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- _0 = move _3 as usize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:16: +1:17
- return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
+ StorageLive(_2);
+ _2 = move _1;
+ _3 = discriminant(_2);
+ _0 = move _3 as usize (IntToInt);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/building/enum_cast.offsetty.built.after.mir b/tests/mir-opt/building/enum_cast.offsetty.built.after.mir
index 7b2b583f2..282859d7c 100644
--- a/tests/mir-opt/building/enum_cast.offsetty.built.after.mir
+++ b/tests/mir-opt/building/enum_cast.offsetty.built.after.mir
@@ -1,26 +1,26 @@
// MIR for `offsetty` after built
fn offsetty(_1: NotStartingAtZero) -> u32 {
- debug x => _1; // in scope 0 at $DIR/enum_cast.rs:+0:13: +0:14
- let mut _0: u32; // return place in scope 0 at $DIR/enum_cast.rs:+0:38: +0:41
- let _2: NotStartingAtZero; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
- let mut _3: isize; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
- let mut _4: u8; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- let mut _6: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- let mut _7: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ debug x => _1;
+ let mut _0: u32;
+ let _2: NotStartingAtZero;
+ let mut _3: isize;
+ let mut _4: u8;
+ let mut _5: bool;
+ let mut _6: bool;
+ let mut _7: bool;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
- _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
- _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- _4 = _3 as u8 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- _5 = Ge(_4, const 4_u8); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- _6 = Le(_4, const 8_u8); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- _7 = BitAnd(move _5, move _6); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- assume(move _7); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- _0 = move _3 as u32 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:12: +1:13
- return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
+ StorageLive(_2);
+ _2 = move _1;
+ _3 = discriminant(_2);
+ _4 = _3 as u8 (IntToInt);
+ _5 = Ge(_4, const 4_u8);
+ _6 = Le(_4, const 8_u8);
+ _7 = BitAnd(move _5, move _6);
+ assume(move _7);
+ _0 = move _3 as u32 (IntToInt);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/building/enum_cast.rs b/tests/mir-opt/building/enum_cast.rs
index 431b5c708..df8e397c8 100644
--- a/tests/mir-opt/building/enum_cast.rs
+++ b/tests/mir-opt/building/enum_cast.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR enum_cast.foo.built.after.mir
// EMIT_MIR enum_cast.bar.built.after.mir
// EMIT_MIR enum_cast.boo.built.after.mir
diff --git a/tests/mir-opt/building/enum_cast.signy.built.after.mir b/tests/mir-opt/building/enum_cast.signy.built.after.mir
index ef4fea604..a9f7d6c78 100644
--- a/tests/mir-opt/building/enum_cast.signy.built.after.mir
+++ b/tests/mir-opt/building/enum_cast.signy.built.after.mir
@@ -1,26 +1,26 @@
// MIR for `signy` after built
fn signy(_1: SignedAroundZero) -> i16 {
- debug x => _1; // in scope 0 at $DIR/enum_cast.rs:+0:10: +0:11
- let mut _0: i16; // return place in scope 0 at $DIR/enum_cast.rs:+0:34: +0:37
- let _2: SignedAroundZero; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
- let mut _3: i16; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
- let mut _4: u16; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- let mut _6: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- let mut _7: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ debug x => _1;
+ let mut _0: i16;
+ let _2: SignedAroundZero;
+ let mut _3: i16;
+ let mut _4: u16;
+ let mut _5: bool;
+ let mut _6: bool;
+ let mut _7: bool;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
- _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
- _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- _4 = _3 as u16 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- _5 = Ge(_4, const 65534_u16); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- _6 = Le(_4, const 2_u16); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- _7 = BitOr(move _5, move _6); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- assume(move _7); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- _0 = move _3 as i16 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
- StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:12: +1:13
- return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
+ StorageLive(_2);
+ _2 = move _1;
+ _3 = discriminant(_2);
+ _4 = _3 as u16 (IntToInt);
+ _5 = Ge(_4, const 65534_u16);
+ _6 = Le(_4, const 2_u16);
+ _7 = BitOr(move _5, move _6);
+ assume(move _7);
+ _0 = move _3 as i16 (IntToInt);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/building/enum_cast.unsigny.built.after.mir b/tests/mir-opt/building/enum_cast.unsigny.built.after.mir
index 7ca147b15..a232ab942 100644
--- a/tests/mir-opt/building/enum_cast.unsigny.built.after.mir
+++ b/tests/mir-opt/building/enum_cast.unsigny.built.after.mir
@@ -1,17 +1,17 @@
// MIR for `unsigny` after built
fn unsigny(_1: UnsignedAroundZero) -> u16 {
- debug x => _1; // in scope 0 at $DIR/enum_cast.rs:+0:12: +0:13
- let mut _0: u16; // return place in scope 0 at $DIR/enum_cast.rs:+0:38: +0:41
- let _2: UnsignedAroundZero; // in scope 0 at $DIR/enum_cast.rs:+2:5: +2:6
- let mut _3: u16; // in scope 0 at $DIR/enum_cast.rs:+2:5: +2:6
+ debug x => _1;
+ let mut _0: u16;
+ let _2: UnsignedAroundZero;
+ let mut _3: u16;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+2:5: +2:6
- _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+2:5: +2:6
- _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+2:5: +2:13
- _0 = move _3 as u16 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+2:5: +2:13
- StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+2:12: +2:13
- return; // scope 0 at $DIR/enum_cast.rs:+3:2: +3:2
+ StorageLive(_2);
+ _2 = move _1;
+ _3 = discriminant(_2);
+ _0 = move _3 as u16 (IntToInt);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/building/issue_101867.main.built.after.mir b/tests/mir-opt/building/issue_101867.main.built.after.mir
index 44c25ce67..57f8cca9a 100644
--- a/tests/mir-opt/building/issue_101867.main.built.after.mir
+++ b/tests/mir-opt/building/issue_101867.main.built.after.mir
@@ -1,75 +1,69 @@
// MIR for `main` after built
| User Type Annotations
-| 0: user_ty: Canonical { value: Ty(std::option::Option<u8>), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:3:12: 3:22, inferred_ty: std::option::Option<u8>
-| 1: user_ty: Canonical { value: Ty(std::option::Option<u8>), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:3:12: 3:22, inferred_ty: std::option::Option<u8>
+| 0: user_ty: Canonical { value: Ty(std::option::Option<u8>), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:4:12: 4:22, inferred_ty: std::option::Option<u8>
+| 1: user_ty: Canonical { value: Ty(std::option::Option<u8>), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:4:12: 4:22, inferred_ty: std::option::Option<u8>
|
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/issue_101867.rs:+0:11: +0:11
- let _1: std::option::Option<u8> as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/issue_101867.rs:+1:9: +1:10
- let mut _2: !; // in scope 0 at $DIR/issue_101867.rs:+2:26: +4:6
- let _3: (); // in scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL
- let mut _4: !; // in scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL
- let mut _6: isize; // in scope 0 at $DIR/issue_101867.rs:+2:9: +2:16
+ let mut _0: ();
+ let _1: std::option::Option<u8> as UserTypeProjection { base: UserType(0), projs: [] };
+ let mut _2: !;
+ let _3: ();
+ let mut _4: !;
+ let mut _6: isize;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/issue_101867.rs:+1:9: +1:10
- let _5: u8; // in scope 1 at $DIR/issue_101867.rs:+2:14: +2:15
+ debug x => _1;
+ let _5: u8;
scope 2 {
- debug y => _5; // in scope 2 at $DIR/issue_101867.rs:+2:14: +2:15
+ debug y => _5;
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/issue_101867.rs:+1:9: +1:10
- _1 = Option::<u8>::Some(const 1_u8); // scope 0 at $DIR/issue_101867.rs:+1:25: +1:32
- FakeRead(ForLet(None), _1); // scope 0 at $DIR/issue_101867.rs:+1:9: +1:10
- AscribeUserType(_1, o, UserTypeProjection { base: UserType(1), projs: [] }); // scope 0 at $DIR/issue_101867.rs:+1:12: +1:22
- StorageLive(_5); // scope 1 at $DIR/issue_101867.rs:+2:14: +2:15
- FakeRead(ForMatchedPlace(None), _1); // scope 1 at $DIR/issue_101867.rs:+2:19: +2:20
- _6 = discriminant(_1); // scope 1 at $DIR/issue_101867.rs:+2:19: +2:20
- switchInt(move _6) -> [1: bb4, otherwise: bb3]; // scope 1 at $DIR/issue_101867.rs:+2:9: +2:16
+ StorageLive(_1);
+ _1 = Option::<u8>::Some(const 1_u8);
+ FakeRead(ForLet(None), _1);
+ AscribeUserType(_1, o, UserTypeProjection { base: UserType(1), projs: [] });
+ StorageLive(_5);
+ PlaceMention(_1);
+ _6 = discriminant(_1);
+ switchInt(move _6) -> [1: bb4, otherwise: bb3];
}
bb1: {
- StorageLive(_3); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL
- StorageLive(_4); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL
- _4 = begin_panic::<&str>(const "explicit panic") -> bb7; // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/std/src/panic.rs:LL:COL
- // + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value(<ZST>) }
- // mir::Constant
- // + span: $SRC_DIR/std/src/panic.rs:LL:COL
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = begin_panic::<&str>(const "explicit panic") -> bb7;
}
bb2: {
- StorageDead(_4); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL
- StorageDead(_3); // scope 1 at $DIR/issue_101867.rs:+3:16: +3:17
- unreachable; // scope 1 at $DIR/issue_101867.rs:+2:26: +4:6
+ StorageDead(_4);
+ StorageDead(_3);
+ unreachable;
}
bb3: {
- goto -> bb6; // scope 1 at $DIR/issue_101867.rs:+2:19: +2:20
+ goto -> bb6;
}
bb4: {
- falseEdge -> [real: bb5, imaginary: bb3]; // scope 1 at $DIR/issue_101867.rs:+2:9: +2:16
+ falseEdge -> [real: bb5, imaginary: bb3];
}
bb5: {
- _5 = ((_1 as Some).0: u8); // scope 1 at $DIR/issue_101867.rs:+2:14: +2:15
- _0 = const (); // scope 0 at $DIR/issue_101867.rs:+0:11: +5:2
- StorageDead(_5); // scope 1 at $DIR/issue_101867.rs:+5:1: +5:2
- StorageDead(_1); // scope 0 at $DIR/issue_101867.rs:+5:1: +5:2
- return; // scope 0 at $DIR/issue_101867.rs:+5:2: +5:2
+ _5 = ((_1 as Some).0: u8);
+ _0 = const ();
+ StorageDead(_5);
+ StorageDead(_1);
+ return;
}
bb6: {
- StorageDead(_5); // scope 1 at $DIR/issue_101867.rs:+5:1: +5:2
- goto -> bb1; // scope 0 at $DIR/issue_101867.rs:+0:11: +5:2
+ StorageDead(_5);
+ goto -> bb1;
}
bb7 (cleanup): {
- resume; // scope 0 at $DIR/issue_101867.rs:+0:1: +5:2
+ resume;
}
}
diff --git a/tests/mir-opt/building/issue_101867.rs b/tests/mir-opt/building/issue_101867.rs
index a32d8cb37..f8a531e89 100644
--- a/tests/mir-opt/building/issue_101867.rs
+++ b/tests/mir-opt/building/issue_101867.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR issue_101867.main.built.after.mir
fn main() {
let x: Option<u8> = Some(1);
diff --git a/tests/mir-opt/building/issue_110508.rs b/tests/mir-opt/building/issue_110508.rs
new file mode 100644
index 000000000..e597cd5d0
--- /dev/null
+++ b/tests/mir-opt/building/issue_110508.rs
@@ -0,0 +1,14 @@
+// skip-filecheck
+// EMIT_MIR issue_110508.{impl#0}-BAR.built.after.mir
+// EMIT_MIR issue_110508.{impl#0}-SELF_BAR.built.after.mir
+
+enum Foo {
+ Bar(()),
+}
+
+impl Foo {
+ const BAR: Foo = Foo::Bar(());
+ const SELF_BAR: Foo = Self::Bar(());
+}
+
+fn main() {}
diff --git a/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir b/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir
new file mode 100644
index 000000000..c3d28fae5
--- /dev/null
+++ b/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir
@@ -0,0 +1,14 @@
+// MIR for `<impl at $DIR/issue_110508.rs:9:1: 9:9>::BAR` after built
+
+const <impl at $DIR/issue_110508.rs:9:1: 9:9>::BAR: Foo = {
+ let mut _0: Foo;
+ let mut _1: ();
+
+ bb0: {
+ StorageLive(_1);
+ _1 = ();
+ _0 = Foo::Bar(move _1);
+ StorageDead(_1);
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir b/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir
new file mode 100644
index 000000000..177518c30
--- /dev/null
+++ b/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir
@@ -0,0 +1,14 @@
+// MIR for `<impl at $DIR/issue_110508.rs:9:1: 9:9>::SELF_BAR` after built
+
+const <impl at $DIR/issue_110508.rs:9:1: 9:9>::SELF_BAR: Foo = {
+ let mut _0: Foo;
+ let mut _1: ();
+
+ bb0: {
+ StorageLive(_1);
+ _1 = ();
+ _0 = Foo::Bar(move _1);
+ StorageDead(_1);
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/issue_49232.main.built.after.mir b/tests/mir-opt/building/issue_49232.main.built.after.mir
index cc135f417..ac50b3889 100644
--- a/tests/mir-opt/building/issue_49232.main.built.after.mir
+++ b/tests/mir-opt/building/issue_49232.main.built.after.mir
@@ -1,82 +1,79 @@
// MIR for `main` after built
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/issue_49232.rs:+0:11: +0:11
- let mut _1: (); // in scope 0 at $DIR/issue_49232.rs:+0:1: +10:2
- let _2: i32; // in scope 0 at $DIR/issue_49232.rs:+2:13: +2:19
- let mut _3: bool; // in scope 0 at $DIR/issue_49232.rs:+3:19: +3:23
- let mut _4: !; // in scope 0 at $DIR/issue_49232.rs:+5:25: +5:30
- let _5: (); // in scope 0 at $DIR/issue_49232.rs:+8:9: +8:22
- let mut _6: &i32; // in scope 0 at $DIR/issue_49232.rs:+8:14: +8:21
+ let mut _0: ();
+ let mut _1: ();
+ let _2: i32;
+ let mut _3: bool;
+ let mut _4: !;
+ let _5: ();
+ let mut _6: &i32;
scope 1 {
- debug beacon => _2; // in scope 1 at $DIR/issue_49232.rs:+2:13: +2:19
+ debug beacon => _2;
}
bb0: {
- goto -> bb1; // scope 0 at $DIR/issue_49232.rs:+1:5: +9:6
+ goto -> bb1;
}
bb1: {
- falseUnwind -> [real: bb2, unwind: bb11]; // scope 0 at $DIR/issue_49232.rs:+1:5: +9:6
+ falseUnwind -> [real: bb2, unwind: bb11];
}
bb2: {
- StorageLive(_2); // scope 0 at $DIR/issue_49232.rs:+2:13: +2:19
- StorageLive(_3); // scope 0 at $DIR/issue_49232.rs:+3:19: +3:23
- _3 = const true; // scope 0 at $DIR/issue_49232.rs:+3:19: +3:23
- FakeRead(ForMatchedPlace(None), _3); // scope 0 at $DIR/issue_49232.rs:+3:19: +3:23
- switchInt(_3) -> [0: bb3, otherwise: bb4]; // scope 0 at $DIR/issue_49232.rs:+3:13: +3:23
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = const true;
+ PlaceMention(_3);
+ switchInt(_3) -> [0: bb3, otherwise: bb4];
}
bb3: {
- falseEdge -> [real: bb5, imaginary: bb4]; // scope 0 at $DIR/issue_49232.rs:+4:17: +4:22
+ falseEdge -> [real: bb5, imaginary: bb4];
}
bb4: {
- _0 = const (); // scope 0 at $DIR/issue_49232.rs:+5:25: +5:30
- goto -> bb10; // scope 0 at $DIR/issue_49232.rs:+5:25: +5:30
+ _0 = const ();
+ goto -> bb10;
}
bb5: {
- _2 = const 4_i32; // scope 0 at $DIR/issue_49232.rs:+4:26: +4:27
- goto -> bb8; // scope 0 at $DIR/issue_49232.rs:+4:26: +4:27
+ _2 = const 4_i32;
+ goto -> bb8;
}
bb6: {
- unreachable; // scope 0 at $DIR/issue_49232.rs:+5:25: +5:30
+ unreachable;
}
bb7: {
- goto -> bb8; // scope 0 at $DIR/issue_49232.rs:+6:13: +6:14
+ goto -> bb8;
}
bb8: {
- FakeRead(ForLet(None), _2); // scope 0 at $DIR/issue_49232.rs:+2:13: +2:19
- StorageDead(_3); // scope 0 at $DIR/issue_49232.rs:+7:10: +7:11
- StorageLive(_5); // scope 1 at $DIR/issue_49232.rs:+8:9: +8:22
- StorageLive(_6); // scope 1 at $DIR/issue_49232.rs:+8:14: +8:21
- _6 = &_2; // scope 1 at $DIR/issue_49232.rs:+8:14: +8:21
- _5 = std::mem::drop::<&i32>(move _6) -> [return: bb9, unwind: bb11]; // scope 1 at $DIR/issue_49232.rs:+8:9: +8:22
- // mir::Constant
- // + span: $DIR/issue_49232.rs:13:9: 13:13
- // + literal: Const { ty: fn(&i32) {std::mem::drop::<&i32>}, val: Value(<ZST>) }
+ FakeRead(ForLet(None), _2);
+ StorageDead(_3);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = &_2;
+ _5 = std::mem::drop::<&i32>(move _6) -> [return: bb9, unwind: bb11];
}
bb9: {
- StorageDead(_6); // scope 1 at $DIR/issue_49232.rs:+8:21: +8:22
- StorageDead(_5); // scope 1 at $DIR/issue_49232.rs:+8:22: +8:23
- _1 = const (); // scope 0 at $DIR/issue_49232.rs:+1:10: +9:6
- StorageDead(_2); // scope 0 at $DIR/issue_49232.rs:+9:5: +9:6
- goto -> bb1; // scope 0 at $DIR/issue_49232.rs:+1:5: +9:6
+ StorageDead(_6);
+ StorageDead(_5);
+ _1 = const ();
+ StorageDead(_2);
+ goto -> bb1;
}
bb10: {
- StorageDead(_3); // scope 0 at $DIR/issue_49232.rs:+7:10: +7:11
- StorageDead(_2); // scope 0 at $DIR/issue_49232.rs:+9:5: +9:6
- return; // scope 0 at $DIR/issue_49232.rs:+10:2: +10:2
+ StorageDead(_3);
+ StorageDead(_2);
+ return;
}
bb11 (cleanup): {
- resume; // scope 0 at $DIR/issue_49232.rs:+0:1: +10:2
+ resume;
}
}
diff --git a/tests/mir-opt/building/issue_49232.rs b/tests/mir-opt/building/issue_49232.rs
index 7e9f0de81..ac06e0277 100644
--- a/tests/mir-opt/building/issue_49232.rs
+++ b/tests/mir-opt/building/issue_49232.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// We must mark a variable whose initialization fails due to an
// abort statement as StorageDead.
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..00e666ed9
--- /dev/null
+++ b/tests/mir-opt/building/logical_or_in_conditional.rs
@@ -0,0 +1,40 @@
+// skip-filecheck
+// 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..7407e7a8b
--- /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: {
+ PlaceMention(_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: {
+ PlaceMention(_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 0e6de839d..b99b0b995 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
@@ -1,113 +1,111 @@
// MIR for `full_tested_match` after built
fn full_tested_match() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:+0:28: +0:28
- let mut _1: (i32, i32); // in scope 0 at $DIR/match_false_edges.rs:+1:13: +5:6
- let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
- let mut _3: isize; // in scope 0 at $DIR/match_false_edges.rs:+2:9: +2:16
- let mut _4: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
- let _5: i32; // in scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
- let _6: &i32; // in scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
- let mut _7: bool; // in scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
- let mut _8: i32; // in scope 0 at $DIR/match_false_edges.rs:+2:35: +2:36
- let _9: i32; // in scope 0 at $DIR/match_false_edges.rs:+3:14: +3:15
- let mut _10: i32; // in scope 0 at $DIR/match_false_edges.rs:+3:24: +3:25
+ let mut _0: ();
+ let mut _1: (i32, i32);
+ let mut _2: std::option::Option<i32>;
+ let mut _3: isize;
+ let mut _4: &std::option::Option<i32>;
+ let _5: i32;
+ let _6: &i32;
+ let mut _7: bool;
+ let mut _8: i32;
+ let _9: i32;
+ let mut _10: i32;
scope 1 {
}
scope 2 {
- debug x => _5; // in scope 2 at $DIR/match_false_edges.rs:+2:14: +2:15
- debug x => _6; // in scope 2 at $DIR/match_false_edges.rs:+2:14: +2:15
+ debug x => _5;
+ debug x => _6;
}
scope 3 {
- debug y => _9; // in scope 3 at $DIR/match_false_edges.rs:+3:14: +3:15
+ debug y => _9;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/match_false_edges.rs:+1:13: +5:6
- StorageLive(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
- _2 = Option::<i32>::Some(const 42_i32); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
- FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
- _3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
- switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:27
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = Option::<i32>::Some(const 42_i32);
+ PlaceMention(_2);
+ _3 = discriminant(_2);
+ switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4];
}
bb1: {
- _1 = (const 3_i32, const 3_i32); // scope 0 at $DIR/match_false_edges.rs:+4:17: +4:23
- goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+4:17: +4:23
+ _1 = (const 3_i32, const 3_i32);
+ goto -> bb11;
}
bb2: {
- falseEdge -> [real: bb5, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:+2:9: +2:16
+ falseEdge -> [real: bb5, imaginary: bb3];
}
bb3: {
- falseEdge -> [real: bb10, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:16
+ falseEdge -> [real: bb10, imaginary: bb1];
}
bb4: {
- unreachable; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ FakeRead(ForMatchedPlace(None), _2);
+ unreachable;
}
bb5: {
- StorageLive(_6); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
- _6 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
- _4 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
- StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
- _7 = guard() -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
- // mir::Constant
- // + span: $DIR/match_false_edges.rs:14:20: 14:25
- // + literal: Const { ty: fn() -> bool {guard}, val: Value(<ZST>) }
+ StorageLive(_6);
+ _6 = &((_2 as Some).0: i32);
+ _4 = &fake _2;
+ StorageLive(_7);
+ _7 = guard() -> [return: bb6, unwind: bb12];
}
bb6: {
- switchInt(move _7) -> [0: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ switchInt(move _7) -> [0: bb8, otherwise: bb7];
}
bb7: {
- StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
- FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
- FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
- StorageLive(_5); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
- _5 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
- StorageLive(_8); // scope 2 at $DIR/match_false_edges.rs:+2:35: +2:36
- _8 = _5; // scope 2 at $DIR/match_false_edges.rs:+2:35: +2:36
- _1 = (const 1_i32, move _8); // scope 2 at $DIR/match_false_edges.rs:+2:31: +2:37
- StorageDead(_8); // scope 2 at $DIR/match_false_edges.rs:+2:36: +2:37
- StorageDead(_5); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
- StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
- goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
+ StorageDead(_7);
+ FakeRead(ForMatchGuard, _4);
+ FakeRead(ForGuardBinding, _6);
+ StorageLive(_5);
+ _5 = ((_2 as Some).0: i32);
+ StorageLive(_8);
+ _8 = _5;
+ _1 = (const 1_i32, move _8);
+ StorageDead(_8);
+ StorageDead(_5);
+ StorageDead(_6);
+ goto -> bb11;
}
bb8: {
- goto -> bb9; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ goto -> bb9;
}
bb9: {
- StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
- StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
- goto -> bb3; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ StorageDead(_7);
+ StorageDead(_6);
+ goto -> bb3;
}
bb10: {
- StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:+3:14: +3:15
- _9 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+3:14: +3:15
- StorageLive(_10); // scope 3 at $DIR/match_false_edges.rs:+3:24: +3:25
- _10 = _9; // scope 3 at $DIR/match_false_edges.rs:+3:24: +3:25
- _1 = (const 2_i32, move _10); // scope 3 at $DIR/match_false_edges.rs:+3:20: +3:26
- StorageDead(_10); // scope 3 at $DIR/match_false_edges.rs:+3:25: +3:26
- StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:+3:25: +3:26
- goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+3:25: +3:26
+ StorageLive(_9);
+ _9 = ((_2 as Some).0: i32);
+ StorageLive(_10);
+ _10 = _9;
+ _1 = (const 2_i32, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ goto -> bb11;
}
bb11: {
- PlaceMention(_1); // scope 0 at $DIR/match_false_edges.rs:+1:13: +5:6
- StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
- StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
- _0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:28: +6:2
- return; // scope 0 at $DIR/match_false_edges.rs:+6:2: +6:2
+ PlaceMention(_1);
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
}
bb12 (cleanup): {
- resume; // scope 0 at $DIR/match_false_edges.rs:+0:1: +6:2
+ resume;
}
}
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 37e6b1cd4..d1d86b55d 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
@@ -1,113 +1,111 @@
// MIR for `full_tested_match2` after built
fn full_tested_match2() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:+0:29: +0:29
- let mut _1: (i32, i32); // in scope 0 at $DIR/match_false_edges.rs:+1:13: +5:6
- let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
- let mut _3: isize; // in scope 0 at $DIR/match_false_edges.rs:+2:9: +2:16
- let mut _4: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
- let _5: i32; // in scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
- let _6: &i32; // in scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
- let mut _7: bool; // in scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
- let mut _8: i32; // in scope 0 at $DIR/match_false_edges.rs:+2:35: +2:36
- let _9: i32; // in scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
- let mut _10: i32; // in scope 0 at $DIR/match_false_edges.rs:+4:24: +4:25
+ let mut _0: ();
+ let mut _1: (i32, i32);
+ let mut _2: std::option::Option<i32>;
+ let mut _3: isize;
+ let mut _4: &std::option::Option<i32>;
+ let _5: i32;
+ let _6: &i32;
+ let mut _7: bool;
+ let mut _8: i32;
+ let _9: i32;
+ let mut _10: i32;
scope 1 {
}
scope 2 {
- debug x => _5; // in scope 2 at $DIR/match_false_edges.rs:+2:14: +2:15
- debug x => _6; // in scope 2 at $DIR/match_false_edges.rs:+2:14: +2:15
+ debug x => _5;
+ debug x => _6;
}
scope 3 {
- debug y => _9; // in scope 3 at $DIR/match_false_edges.rs:+4:14: +4:15
+ debug y => _9;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/match_false_edges.rs:+1:13: +5:6
- StorageLive(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
- _2 = Option::<i32>::Some(const 42_i32); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
- FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
- _3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
- switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:27
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = Option::<i32>::Some(const 42_i32);
+ PlaceMention(_2);
+ _3 = discriminant(_2);
+ switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4];
}
bb1: {
- falseEdge -> [real: bb10, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:13
+ falseEdge -> [real: bb10, imaginary: bb3];
}
bb2: {
- falseEdge -> [real: bb5, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+2:9: +2:16
+ falseEdge -> [real: bb5, imaginary: bb1];
}
bb3: {
- StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
- _9 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
- StorageLive(_10); // scope 3 at $DIR/match_false_edges.rs:+4:24: +4:25
- _10 = _9; // scope 3 at $DIR/match_false_edges.rs:+4:24: +4:25
- _1 = (const 2_i32, move _10); // scope 3 at $DIR/match_false_edges.rs:+4:20: +4:26
- StorageDead(_10); // scope 3 at $DIR/match_false_edges.rs:+4:25: +4:26
- StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:+4:25: +4:26
- goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+4:25: +4:26
+ StorageLive(_9);
+ _9 = ((_2 as Some).0: i32);
+ StorageLive(_10);
+ _10 = _9;
+ _1 = (const 2_i32, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ goto -> bb11;
}
bb4: {
- unreachable; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ FakeRead(ForMatchedPlace(None), _2);
+ unreachable;
}
bb5: {
- StorageLive(_6); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
- _6 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
- _4 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
- StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
- _7 = guard() -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
- // mir::Constant
- // + span: $DIR/match_false_edges.rs:25:20: 25:25
- // + literal: Const { ty: fn() -> bool {guard}, val: Value(<ZST>) }
+ StorageLive(_6);
+ _6 = &((_2 as Some).0: i32);
+ _4 = &fake _2;
+ StorageLive(_7);
+ _7 = guard() -> [return: bb6, unwind: bb12];
}
bb6: {
- switchInt(move _7) -> [0: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ switchInt(move _7) -> [0: bb8, otherwise: bb7];
}
bb7: {
- StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
- FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
- FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
- StorageLive(_5); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
- _5 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
- StorageLive(_8); // scope 2 at $DIR/match_false_edges.rs:+2:35: +2:36
- _8 = _5; // scope 2 at $DIR/match_false_edges.rs:+2:35: +2:36
- _1 = (const 1_i32, move _8); // scope 2 at $DIR/match_false_edges.rs:+2:31: +2:37
- StorageDead(_8); // scope 2 at $DIR/match_false_edges.rs:+2:36: +2:37
- StorageDead(_5); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
- StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
- goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
+ StorageDead(_7);
+ FakeRead(ForMatchGuard, _4);
+ FakeRead(ForGuardBinding, _6);
+ StorageLive(_5);
+ _5 = ((_2 as Some).0: i32);
+ StorageLive(_8);
+ _8 = _5;
+ _1 = (const 1_i32, move _8);
+ StorageDead(_8);
+ StorageDead(_5);
+ StorageDead(_6);
+ goto -> bb11;
}
bb8: {
- goto -> bb9; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ goto -> bb9;
}
bb9: {
- StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
- StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
- falseEdge -> [real: bb3, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ StorageDead(_7);
+ StorageDead(_6);
+ falseEdge -> [real: bb3, imaginary: bb1];
}
bb10: {
- _1 = (const 3_i32, const 3_i32); // scope 0 at $DIR/match_false_edges.rs:+3:17: +3:23
- goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+3:17: +3:23
+ _1 = (const 3_i32, const 3_i32);
+ goto -> bb11;
}
bb11: {
- PlaceMention(_1); // scope 0 at $DIR/match_false_edges.rs:+1:13: +5:6
- StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
- StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
- _0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:29: +6:2
- return; // scope 0 at $DIR/match_false_edges.rs:+6:2: +6:2
+ PlaceMention(_1);
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
}
bb12 (cleanup): {
- resume; // scope 0 at $DIR/match_false_edges.rs:+0:1: +6:2
+ resume;
}
}
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 7b8983138..1d4fe67f3 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
@@ -1,175 +1,169 @@
// MIR for `main` after built
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:+0:11: +0:11
- let mut _1: i32; // in scope 0 at $DIR/match_false_edges.rs:+1:13: +6:6
- let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
- let mut _3: isize; // in scope 0 at $DIR/match_false_edges.rs:+4:9: +4:16
- let mut _4: isize; // in scope 0 at $DIR/match_false_edges.rs:+2:9: +2:17
- let mut _5: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
- let _6: i32; // in scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16
- let _7: &i32; // in scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16
- let mut _8: bool; // in scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
- let _9: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+3:9: +3:11
- let _10: i32; // in scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
- let _11: &i32; // in scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
- let mut _12: bool; // in scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
- let mut _13: i32; // in scope 0 at $DIR/match_false_edges.rs:+4:27: +4:28
- let _14: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+5:9: +5:11
+ let mut _0: ();
+ let mut _1: i32;
+ let mut _2: std::option::Option<i32>;
+ let mut _3: isize;
+ let mut _4: isize;
+ let mut _5: &std::option::Option<i32>;
+ let _6: i32;
+ let _7: &i32;
+ let mut _8: bool;
+ let _9: std::option::Option<i32>;
+ let _10: i32;
+ let _11: &i32;
+ let mut _12: bool;
+ let mut _13: i32;
+ let _14: std::option::Option<i32>;
scope 1 {
}
scope 2 {
- debug _w => _6; // in scope 2 at $DIR/match_false_edges.rs:+2:14: +2:16
- debug _w => _7; // in scope 2 at $DIR/match_false_edges.rs:+2:14: +2:16
+ debug _w => _6;
+ debug _w => _7;
}
scope 3 {
- debug _x => _9; // in scope 3 at $DIR/match_false_edges.rs:+3:9: +3:11
+ debug _x => _9;
}
scope 4 {
- debug y => _10; // in scope 4 at $DIR/match_false_edges.rs:+4:14: +4:15
- debug y => _11; // in scope 4 at $DIR/match_false_edges.rs:+4:14: +4:15
+ debug y => _10;
+ debug y => _11;
}
scope 5 {
- debug _z => _14; // in scope 5 at $DIR/match_false_edges.rs:+5:9: +5:11
+ debug _z => _14;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/match_false_edges.rs:+1:13: +6:6
- StorageLive(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
- _2 = Option::<i32>::Some(const 1_i32); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
- FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
- _4 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
- switchInt(move _4) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = Option::<i32>::Some(const 1_i32);
+ PlaceMention(_2);
+ _4 = discriminant(_2);
+ switchInt(move _4) -> [1: bb2, otherwise: bb1];
}
bb1: {
- falseEdge -> [real: bb13, imaginary: bb6]; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:11
+ falseEdge -> [real: bb13, imaginary: bb6];
}
bb2: {
- falseEdge -> [real: bb8, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+2:9: +2:17
+ falseEdge -> [real: bb8, imaginary: bb1];
}
bb3: {
- goto -> bb1; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26
+ goto -> bb1;
}
bb4: {
- _3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
- switchInt(move _3) -> [1: bb6, otherwise: bb5]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26
+ _3 = discriminant(_2);
+ switchInt(move _3) -> [1: bb6, otherwise: bb5];
}
bb5: {
- StorageLive(_14); // scope 0 at $DIR/match_false_edges.rs:+5:9: +5:11
- _14 = _2; // scope 0 at $DIR/match_false_edges.rs:+5:9: +5:11
- _1 = const 4_i32; // scope 5 at $DIR/match_false_edges.rs:+5:15: +5:16
- StorageDead(_14); // scope 0 at $DIR/match_false_edges.rs:+5:15: +5:16
- goto -> bb19; // scope 0 at $DIR/match_false_edges.rs:+5:15: +5:16
+ StorageLive(_14);
+ _14 = _2;
+ _1 = const 4_i32;
+ StorageDead(_14);
+ goto -> bb19;
}
bb6: {
- falseEdge -> [real: bb14, imaginary: bb5]; // scope 0 at $DIR/match_false_edges.rs:+4:9: +4:16
+ falseEdge -> [real: bb14, imaginary: bb5];
}
bb7: {
- goto -> bb5; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26
+ goto -> bb5;
}
bb8: {
- StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16
- _7 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16
- _5 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
- StorageLive(_8); // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
- _8 = guard() -> [return: bb9, unwind: bb20]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
- // mir::Constant
- // + span: $DIR/match_false_edges.rs:34:21: 34:26
- // + literal: Const { ty: fn() -> bool {guard}, val: Value(<ZST>) }
+ StorageLive(_7);
+ _7 = &((_2 as Some).0: i32);
+ _5 = &fake _2;
+ StorageLive(_8);
+ _8 = guard() -> [return: bb9, unwind: bb20];
}
bb9: {
- switchInt(move _8) -> [0: bb11, otherwise: bb10]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
+ switchInt(move _8) -> [0: bb11, otherwise: bb10];
}
bb10: {
- StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28
- FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28
- FakeRead(ForGuardBinding, _7); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28
- StorageLive(_6); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16
- _6 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16
- _1 = const 1_i32; // scope 2 at $DIR/match_false_edges.rs:+2:32: +2:33
- StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33
- StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33
- goto -> bb19; // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33
+ StorageDead(_8);
+ FakeRead(ForMatchGuard, _5);
+ FakeRead(ForGuardBinding, _7);
+ StorageLive(_6);
+ _6 = ((_2 as Some).0: i32);
+ _1 = const 1_i32;
+ StorageDead(_6);
+ StorageDead(_7);
+ goto -> bb19;
}
bb11: {
- goto -> bb12; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
+ goto -> bb12;
}
bb12: {
- StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28
- StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33
- falseEdge -> [real: bb3, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
+ StorageDead(_8);
+ StorageDead(_7);
+ falseEdge -> [real: bb3, imaginary: bb1];
}
bb13: {
- StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:11
- _9 = _2; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:11
- _1 = const 2_i32; // scope 3 at $DIR/match_false_edges.rs:+3:15: +3:16
- StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:+3:15: +3:16
- goto -> bb19; // scope 0 at $DIR/match_false_edges.rs:+3:15: +3:16
+ StorageLive(_9);
+ _9 = _2;
+ _1 = const 2_i32;
+ StorageDead(_9);
+ goto -> bb19;
}
bb14: {
- StorageLive(_11); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
- _11 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
- _5 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
- StorageLive(_12); // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
- StorageLive(_13); // scope 0 at $DIR/match_false_edges.rs:+4:27: +4:28
- _13 = (*_11); // scope 0 at $DIR/match_false_edges.rs:+4:27: +4:28
- _12 = guard2(move _13) -> [return: bb15, unwind: bb20]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
- // mir::Constant
- // + span: $DIR/match_false_edges.rs:36:20: 36:26
- // + literal: Const { ty: fn(i32) -> bool {guard2}, val: Value(<ZST>) }
+ StorageLive(_11);
+ _11 = &((_2 as Some).0: i32);
+ _5 = &fake _2;
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = (*_11);
+ _12 = guard2(move _13) -> [return: bb15, unwind: bb20];
}
bb15: {
- switchInt(move _12) -> [0: bb17, otherwise: bb16]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
+ switchInt(move _12) -> [0: bb17, otherwise: bb16];
}
bb16: {
- StorageDead(_13); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
- StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
- FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
- FakeRead(ForGuardBinding, _11); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
- StorageLive(_10); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
- _10 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
- _1 = const 3_i32; // scope 4 at $DIR/match_false_edges.rs:+4:33: +4:34
- StorageDead(_10); // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34
- StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34
- goto -> bb19; // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34
+ StorageDead(_13);
+ StorageDead(_12);
+ FakeRead(ForMatchGuard, _5);
+ FakeRead(ForGuardBinding, _11);
+ StorageLive(_10);
+ _10 = ((_2 as Some).0: i32);
+ _1 = const 3_i32;
+ StorageDead(_10);
+ StorageDead(_11);
+ goto -> bb19;
}
bb17: {
- goto -> bb18; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
+ goto -> bb18;
}
bb18: {
- StorageDead(_13); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
- StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
- StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34
- falseEdge -> [real: bb7, imaginary: bb5]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_11);
+ falseEdge -> [real: bb7, imaginary: bb5];
}
bb19: {
- PlaceMention(_1); // scope 0 at $DIR/match_false_edges.rs:+1:13: +6:6
- StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+6:6: +6:7
- StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+6:6: +6:7
- _0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:11: +7:2
- return; // scope 0 at $DIR/match_false_edges.rs:+7:2: +7:2
+ PlaceMention(_1);
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
}
bb20 (cleanup): {
- resume; // scope 0 at $DIR/match_false_edges.rs:+0:1: +7:2
+ resume;
}
}
diff --git a/tests/mir-opt/building/match_false_edges.rs b/tests/mir-opt/building/match_false_edges.rs
index ddfcc1493..839eda40c 100644
--- a/tests/mir-opt/building/match_false_edges.rs
+++ b/tests/mir-opt/building/match_false_edges.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
fn guard() -> bool {
false
}
diff --git a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir
index 7a6944dee..e07c2b6fa 100644
--- a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir
+++ b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir
@@ -1,96 +1,87 @@
// MIR for `main` after built
| User Type Annotations
-| 0: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test
-| 1: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test
-| 2: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test
-| 3: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test
+| 0: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:15:14: 15:23, inferred_ty: *mut Test
+| 1: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:15:14: 15:23, inferred_ty: *mut Test
+| 2: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:19:18: 19:31, inferred_ty: &&&&*mut Test
+| 3: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:19:18: 19:31, inferred_ty: &&&&*mut Test
|
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/receiver_ptr_mutability.rs:+0:11: +0:11
- let _1: *mut Test as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+1:9: +1:12
- let _2: (); // in scope 0 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:12
- let mut _3: *const Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:12
- let mut _4: *mut Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:8
- let _6: &&&&*mut Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+5:34: +5:41
- let _7: &&&*mut Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+5:35: +5:41
- let _8: &&*mut Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+5:36: +5:41
- let _9: &*mut Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+5:37: +5:41
- let _10: (); // in scope 0 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
- let mut _11: *const Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
- let mut _12: *mut Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
+ let mut _0: ();
+ let _1: *mut Test as UserTypeProjection { base: UserType(0), projs: [] };
+ let _2: ();
+ let mut _3: *const Test;
+ let mut _4: *mut Test;
+ let _6: &&&&*mut Test;
+ let _7: &&&*mut Test;
+ let _8: &&*mut Test;
+ let _9: &*mut Test;
+ let _10: ();
+ let mut _11: *const Test;
+ let mut _12: *mut Test;
scope 1 {
- debug ptr => _1; // in scope 1 at $DIR/receiver_ptr_mutability.rs:+1:9: +1:12
- let _5: &&&&*mut Test as UserTypeProjection { base: UserType(2), projs: [] }; // in scope 1 at $DIR/receiver_ptr_mutability.rs:+5:9: +5:16
+ debug ptr => _1;
+ let _5: &&&&*mut Test as UserTypeProjection { base: UserType(2), projs: [] };
scope 2 {
- debug ptr_ref => _5; // in scope 2 at $DIR/receiver_ptr_mutability.rs:+5:9: +5:16
+ debug ptr_ref => _5;
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/receiver_ptr_mutability.rs:+1:9: +1:12
- _1 = null_mut::<Test>() -> [return: bb1, unwind: bb4]; // scope 0 at $DIR/receiver_ptr_mutability.rs:+1:26: +1:46
- // mir::Constant
- // + span: $DIR/receiver_ptr_mutability.rs:14:26: 14:44
- // + literal: Const { ty: fn() -> *mut Test {null_mut::<Test>}, val: Value(<ZST>) }
+ StorageLive(_1);
+ _1 = null_mut::<Test>() -> [return: bb1, unwind: bb4];
}
bb1: {
- FakeRead(ForLet(None), _1); // scope 0 at $DIR/receiver_ptr_mutability.rs:+1:9: +1:12
- AscribeUserType(_1, o, UserTypeProjection { base: UserType(1), projs: [] }); // scope 0 at $DIR/receiver_ptr_mutability.rs:+1:14: +1:23
- StorageLive(_2); // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:12
- StorageLive(_3); // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:12
- StorageLive(_4); // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:8
- _4 = _1; // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:8
- _3 = move _4 as *const Test (Pointer(MutToConstPointer)); // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:12
- StorageDead(_4); // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:7: +2:8
- _2 = Test::x(move _3) -> [return: bb2, unwind: bb4]; // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:12
- // mir::Constant
- // + span: $DIR/receiver_ptr_mutability.rs:15:9: 15:10
- // + literal: Const { ty: fn(*const Test) {Test::x}, val: Value(<ZST>) }
+ FakeRead(ForLet(None), _1);
+ AscribeUserType(_1, o, UserTypeProjection { base: UserType(1), projs: [] });
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ _3 = move _4 as *const Test (PointerCoercion(MutToConstPointer));
+ StorageDead(_4);
+ _2 = Test::x(move _3) -> [return: bb2, unwind: bb4];
}
bb2: {
- StorageDead(_3); // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:11: +2:12
- StorageDead(_2); // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:12: +2:13
- StorageLive(_5); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:9: +5:16
- StorageLive(_6); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:34: +5:41
- StorageLive(_7); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:35: +5:41
- StorageLive(_8); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:36: +5:41
- StorageLive(_9); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:37: +5:41
- _9 = &_1; // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:37: +5:41
- _8 = &_9; // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:36: +5:41
- _7 = &_8; // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:35: +5:41
- _6 = &_7; // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:34: +5:41
- _5 = &(*_6); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:34: +5:41
- FakeRead(ForLet(None), _5); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:9: +5:16
- AscribeUserType(_5, o, UserTypeProjection { base: UserType(3), projs: [] }); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:18: +5:31
- StorageDead(_6); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:41: +5:42
- StorageLive(_10); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
- StorageLive(_11); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
- StorageLive(_12); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
- _12 = (*(*(*(*_5)))); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
- _11 = move _12 as *const Test (Pointer(MutToConstPointer)); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
- StorageDead(_12); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:11: +6:12
- _10 = Test::x(move _11) -> [return: bb3, unwind: bb4]; // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
- // mir::Constant
- // + span: $DIR/receiver_ptr_mutability.rs:19:13: 19:14
- // + literal: Const { ty: fn(*const Test) {Test::x}, val: Value(<ZST>) }
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = &_1;
+ _8 = &_9;
+ _7 = &_8;
+ _6 = &_7;
+ _5 = &(*_6);
+ FakeRead(ForLet(None), _5);
+ AscribeUserType(_5, o, UserTypeProjection { base: UserType(3), projs: [] });
+ StorageDead(_6);
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = (*(*(*(*_5))));
+ _11 = move _12 as *const Test (PointerCoercion(MutToConstPointer));
+ StorageDead(_12);
+ _10 = Test::x(move _11) -> [return: bb3, unwind: bb4];
}
bb3: {
- StorageDead(_11); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:15: +6:16
- StorageDead(_10); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:16: +6:17
- _0 = const (); // scope 0 at $DIR/receiver_ptr_mutability.rs:+0:11: +7:2
- StorageDead(_9); // scope 1 at $DIR/receiver_ptr_mutability.rs:+7:1: +7:2
- StorageDead(_8); // scope 1 at $DIR/receiver_ptr_mutability.rs:+7:1: +7:2
- StorageDead(_7); // scope 1 at $DIR/receiver_ptr_mutability.rs:+7:1: +7:2
- StorageDead(_5); // scope 1 at $DIR/receiver_ptr_mutability.rs:+7:1: +7:2
- StorageDead(_1); // scope 0 at $DIR/receiver_ptr_mutability.rs:+7:1: +7:2
- return; // scope 0 at $DIR/receiver_ptr_mutability.rs:+7:2: +7:2
+ StorageDead(_11);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_1);
+ return;
}
bb4 (cleanup): {
- resume; // scope 0 at $DIR/receiver_ptr_mutability.rs:+0:1: +7:2
+ resume;
}
}
diff --git a/tests/mir-opt/building/receiver_ptr_mutability.rs b/tests/mir-opt/building/receiver_ptr_mutability.rs
index 668530968..4bb3b4cad 100644
--- a/tests/mir-opt/building/receiver_ptr_mutability.rs
+++ b/tests/mir-opt/building/receiver_ptr_mutability.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR receiver_ptr_mutability.main.built.after.mir
#![feature(arbitrary_self_types)]
diff --git a/tests/mir-opt/building/shifts.rs b/tests/mir-opt/building/shifts.rs
index 4b63a00a3..c94a142d3 100644
--- a/tests/mir-opt/building/shifts.rs
+++ b/tests/mir-opt/building/shifts.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -C debug-assertions=yes
// EMIT_MIR shifts.shift_signed.built.after.mir
diff --git a/tests/mir-opt/building/shifts.shift_signed.built.after.mir b/tests/mir-opt/building/shifts.shift_signed.built.after.mir
index 028777cef..8706ee9d4 100644
--- a/tests/mir-opt/building/shifts.shift_signed.built.after.mir
+++ b/tests/mir-opt/building/shifts.shift_signed.built.after.mir
@@ -1,147 +1,147 @@
// MIR for `shift_signed` after built
fn shift_signed(_1: i8, _2: u128, _3: i8, _4: i32, _5: i128) -> ([i8; 3], [u128; 3]) {
- debug small => _1; // in scope 0 at $DIR/shifts.rs:+0:17: +0:22
- debug big => _2; // in scope 0 at $DIR/shifts.rs:+0:28: +0:31
- debug a => _3; // in scope 0 at $DIR/shifts.rs:+0:39: +0:40
- debug b => _4; // in scope 0 at $DIR/shifts.rs:+0:46: +0:47
- debug c => _5; // in scope 0 at $DIR/shifts.rs:+0:54: +0:55
- let mut _0: ([i8; 3], [u128; 3]); // return place in scope 0 at $DIR/shifts.rs:+0:66: +0:86
- let mut _6: [i8; 3]; // in scope 0 at $DIR/shifts.rs:+2:9: +2:45
- let mut _7: i8; // in scope 0 at $DIR/shifts.rs:+2:10: +2:20
- let mut _8: i8; // in scope 0 at $DIR/shifts.rs:+2:10: +2:15
- let mut _9: i8; // in scope 0 at $DIR/shifts.rs:+2:19: +2:20
- let mut _10: u8; // in scope 0 at $DIR/shifts.rs:+2:10: +2:20
- let mut _11: bool; // in scope 0 at $DIR/shifts.rs:+2:10: +2:20
- let mut _12: i8; // in scope 0 at $DIR/shifts.rs:+2:22: +2:32
- let mut _13: i8; // in scope 0 at $DIR/shifts.rs:+2:22: +2:27
- let mut _14: i32; // in scope 0 at $DIR/shifts.rs:+2:31: +2:32
- let mut _15: u32; // in scope 0 at $DIR/shifts.rs:+2:22: +2:32
- let mut _16: bool; // in scope 0 at $DIR/shifts.rs:+2:22: +2:32
- let mut _17: i8; // in scope 0 at $DIR/shifts.rs:+2:34: +2:44
- let mut _18: i8; // in scope 0 at $DIR/shifts.rs:+2:34: +2:39
- let mut _19: i128; // in scope 0 at $DIR/shifts.rs:+2:43: +2:44
- let mut _20: u128; // in scope 0 at $DIR/shifts.rs:+2:34: +2:44
- let mut _21: bool; // in scope 0 at $DIR/shifts.rs:+2:34: +2:44
- let mut _22: [u128; 3]; // in scope 0 at $DIR/shifts.rs:+3:9: +3:39
- let mut _23: u128; // in scope 0 at $DIR/shifts.rs:+3:10: +3:18
- let mut _24: u128; // in scope 0 at $DIR/shifts.rs:+3:10: +3:13
- let mut _25: i8; // in scope 0 at $DIR/shifts.rs:+3:17: +3:18
- let mut _26: u8; // in scope 0 at $DIR/shifts.rs:+3:10: +3:18
- let mut _27: bool; // in scope 0 at $DIR/shifts.rs:+3:10: +3:18
- let mut _28: u128; // in scope 0 at $DIR/shifts.rs:+3:20: +3:28
- let mut _29: u128; // in scope 0 at $DIR/shifts.rs:+3:20: +3:23
- let mut _30: i32; // in scope 0 at $DIR/shifts.rs:+3:27: +3:28
- let mut _31: u32; // in scope 0 at $DIR/shifts.rs:+3:20: +3:28
- let mut _32: bool; // in scope 0 at $DIR/shifts.rs:+3:20: +3:28
- let mut _33: u128; // in scope 0 at $DIR/shifts.rs:+3:30: +3:38
- let mut _34: u128; // in scope 0 at $DIR/shifts.rs:+3:30: +3:33
- let mut _35: i128; // in scope 0 at $DIR/shifts.rs:+3:37: +3:38
- let mut _36: u128; // in scope 0 at $DIR/shifts.rs:+3:30: +3:38
- let mut _37: bool; // in scope 0 at $DIR/shifts.rs:+3:30: +3:38
+ debug small => _1;
+ debug big => _2;
+ debug a => _3;
+ debug b => _4;
+ debug c => _5;
+ let mut _0: ([i8; 3], [u128; 3]);
+ let mut _6: [i8; 3];
+ let mut _7: i8;
+ let mut _8: i8;
+ let mut _9: i8;
+ let mut _10: u8;
+ let mut _11: bool;
+ let mut _12: i8;
+ let mut _13: i8;
+ let mut _14: i32;
+ let mut _15: u32;
+ let mut _16: bool;
+ let mut _17: i8;
+ let mut _18: i8;
+ let mut _19: i128;
+ let mut _20: u128;
+ let mut _21: bool;
+ let mut _22: [u128; 3];
+ let mut _23: u128;
+ let mut _24: u128;
+ let mut _25: i8;
+ let mut _26: u8;
+ let mut _27: bool;
+ let mut _28: u128;
+ let mut _29: u128;
+ let mut _30: i32;
+ let mut _31: u32;
+ let mut _32: bool;
+ let mut _33: u128;
+ let mut _34: u128;
+ let mut _35: i128;
+ let mut _36: u128;
+ let mut _37: bool;
bb0: {
- StorageLive(_6); // scope 0 at $DIR/shifts.rs:+2:9: +2:45
- StorageLive(_7); // scope 0 at $DIR/shifts.rs:+2:10: +2:20
- StorageLive(_8); // scope 0 at $DIR/shifts.rs:+2:10: +2:15
- _8 = _1; // scope 0 at $DIR/shifts.rs:+2:10: +2:15
- StorageLive(_9); // scope 0 at $DIR/shifts.rs:+2:19: +2:20
- _9 = _3; // scope 0 at $DIR/shifts.rs:+2:19: +2:20
- _10 = _9 as u8 (IntToInt); // scope 0 at $DIR/shifts.rs:+2:10: +2:20
- _11 = Lt(move _10, const 8_u8); // scope 0 at $DIR/shifts.rs:+2:10: +2:20
- assert(move _11, "attempt to shift right by `{}`, which would overflow", _9) -> [success: bb1, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:10: +2:20
+ StorageLive(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = _1;
+ StorageLive(_9);
+ _9 = _3;
+ _10 = _9 as u8 (IntToInt);
+ _11 = Lt(move _10, const 8_u8);
+ assert(move _11, "attempt to shift right by `{}`, which would overflow", _9) -> [success: bb1, unwind: bb7];
}
bb1: {
- _7 = Shr(move _8, move _9); // scope 0 at $DIR/shifts.rs:+2:10: +2:20
- StorageDead(_9); // scope 0 at $DIR/shifts.rs:+2:19: +2:20
- StorageDead(_8); // scope 0 at $DIR/shifts.rs:+2:19: +2:20
- StorageLive(_12); // scope 0 at $DIR/shifts.rs:+2:22: +2:32
- StorageLive(_13); // scope 0 at $DIR/shifts.rs:+2:22: +2:27
- _13 = _1; // scope 0 at $DIR/shifts.rs:+2:22: +2:27
- StorageLive(_14); // scope 0 at $DIR/shifts.rs:+2:31: +2:32
- _14 = _4; // scope 0 at $DIR/shifts.rs:+2:31: +2:32
- _15 = _14 as u32 (IntToInt); // scope 0 at $DIR/shifts.rs:+2:22: +2:32
- _16 = Lt(move _15, const 8_u32); // scope 0 at $DIR/shifts.rs:+2:22: +2:32
- assert(move _16, "attempt to shift right by `{}`, which would overflow", _14) -> [success: bb2, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:22: +2:32
+ _7 = Shr(move _8, move _9);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = _1;
+ StorageLive(_14);
+ _14 = _4;
+ _15 = _14 as u32 (IntToInt);
+ _16 = Lt(move _15, const 8_u32);
+ assert(move _16, "attempt to shift right by `{}`, which would overflow", _14) -> [success: bb2, unwind: bb7];
}
bb2: {
- _12 = Shr(move _13, move _14); // scope 0 at $DIR/shifts.rs:+2:22: +2:32
- StorageDead(_14); // scope 0 at $DIR/shifts.rs:+2:31: +2:32
- StorageDead(_13); // scope 0 at $DIR/shifts.rs:+2:31: +2:32
- StorageLive(_17); // scope 0 at $DIR/shifts.rs:+2:34: +2:44
- StorageLive(_18); // scope 0 at $DIR/shifts.rs:+2:34: +2:39
- _18 = _1; // scope 0 at $DIR/shifts.rs:+2:34: +2:39
- StorageLive(_19); // scope 0 at $DIR/shifts.rs:+2:43: +2:44
- _19 = _5; // scope 0 at $DIR/shifts.rs:+2:43: +2:44
- _20 = _19 as u128 (IntToInt); // scope 0 at $DIR/shifts.rs:+2:34: +2:44
- _21 = Lt(move _20, const 8_u128); // scope 0 at $DIR/shifts.rs:+2:34: +2:44
- assert(move _21, "attempt to shift right by `{}`, which would overflow", _19) -> [success: bb3, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:34: +2:44
+ _12 = Shr(move _13, move _14);
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageLive(_17);
+ StorageLive(_18);
+ _18 = _1;
+ StorageLive(_19);
+ _19 = _5;
+ _20 = _19 as u128 (IntToInt);
+ _21 = Lt(move _20, const 8_u128);
+ assert(move _21, "attempt to shift right by `{}`, which would overflow", _19) -> [success: bb3, unwind: bb7];
}
bb3: {
- _17 = Shr(move _18, move _19); // scope 0 at $DIR/shifts.rs:+2:34: +2:44
- StorageDead(_19); // scope 0 at $DIR/shifts.rs:+2:43: +2:44
- StorageDead(_18); // scope 0 at $DIR/shifts.rs:+2:43: +2:44
- _6 = [move _7, move _12, move _17]; // scope 0 at $DIR/shifts.rs:+2:9: +2:45
- StorageDead(_17); // scope 0 at $DIR/shifts.rs:+2:44: +2:45
- StorageDead(_12); // scope 0 at $DIR/shifts.rs:+2:44: +2:45
- StorageDead(_7); // scope 0 at $DIR/shifts.rs:+2:44: +2:45
- StorageLive(_22); // scope 0 at $DIR/shifts.rs:+3:9: +3:39
- StorageLive(_23); // scope 0 at $DIR/shifts.rs:+3:10: +3:18
- StorageLive(_24); // scope 0 at $DIR/shifts.rs:+3:10: +3:13
- _24 = _2; // scope 0 at $DIR/shifts.rs:+3:10: +3:13
- StorageLive(_25); // scope 0 at $DIR/shifts.rs:+3:17: +3:18
- _25 = _3; // scope 0 at $DIR/shifts.rs:+3:17: +3:18
- _26 = _25 as u8 (IntToInt); // scope 0 at $DIR/shifts.rs:+3:10: +3:18
- _27 = Lt(move _26, const 128_u8); // scope 0 at $DIR/shifts.rs:+3:10: +3:18
- assert(move _27, "attempt to shift left by `{}`, which would overflow", _25) -> [success: bb4, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+3:10: +3:18
+ _17 = Shr(move _18, move _19);
+ StorageDead(_19);
+ StorageDead(_18);
+ _6 = [move _7, move _12, move _17];
+ StorageDead(_17);
+ StorageDead(_12);
+ StorageDead(_7);
+ StorageLive(_22);
+ StorageLive(_23);
+ StorageLive(_24);
+ _24 = _2;
+ StorageLive(_25);
+ _25 = _3;
+ _26 = _25 as u8 (IntToInt);
+ _27 = Lt(move _26, const 128_u8);
+ assert(move _27, "attempt to shift left by `{}`, which would overflow", _25) -> [success: bb4, unwind: bb7];
}
bb4: {
- _23 = Shl(move _24, move _25); // scope 0 at $DIR/shifts.rs:+3:10: +3:18
- StorageDead(_25); // scope 0 at $DIR/shifts.rs:+3:17: +3:18
- StorageDead(_24); // scope 0 at $DIR/shifts.rs:+3:17: +3:18
- StorageLive(_28); // scope 0 at $DIR/shifts.rs:+3:20: +3:28
- StorageLive(_29); // scope 0 at $DIR/shifts.rs:+3:20: +3:23
- _29 = _2; // scope 0 at $DIR/shifts.rs:+3:20: +3:23
- StorageLive(_30); // scope 0 at $DIR/shifts.rs:+3:27: +3:28
- _30 = _4; // scope 0 at $DIR/shifts.rs:+3:27: +3:28
- _31 = _30 as u32 (IntToInt); // scope 0 at $DIR/shifts.rs:+3:20: +3:28
- _32 = Lt(move _31, const 128_u32); // scope 0 at $DIR/shifts.rs:+3:20: +3:28
- assert(move _32, "attempt to shift left by `{}`, which would overflow", _30) -> [success: bb5, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+3:20: +3:28
+ _23 = Shl(move _24, move _25);
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageLive(_28);
+ StorageLive(_29);
+ _29 = _2;
+ StorageLive(_30);
+ _30 = _4;
+ _31 = _30 as u32 (IntToInt);
+ _32 = Lt(move _31, const 128_u32);
+ assert(move _32, "attempt to shift left by `{}`, which would overflow", _30) -> [success: bb5, unwind: bb7];
}
bb5: {
- _28 = Shl(move _29, move _30); // scope 0 at $DIR/shifts.rs:+3:20: +3:28
- StorageDead(_30); // scope 0 at $DIR/shifts.rs:+3:27: +3:28
- StorageDead(_29); // scope 0 at $DIR/shifts.rs:+3:27: +3:28
- StorageLive(_33); // scope 0 at $DIR/shifts.rs:+3:30: +3:38
- StorageLive(_34); // scope 0 at $DIR/shifts.rs:+3:30: +3:33
- _34 = _2; // scope 0 at $DIR/shifts.rs:+3:30: +3:33
- StorageLive(_35); // scope 0 at $DIR/shifts.rs:+3:37: +3:38
- _35 = _5; // scope 0 at $DIR/shifts.rs:+3:37: +3:38
- _36 = _35 as u128 (IntToInt); // scope 0 at $DIR/shifts.rs:+3:30: +3:38
- _37 = Lt(move _36, const 128_u128); // scope 0 at $DIR/shifts.rs:+3:30: +3:38
- assert(move _37, "attempt to shift left by `{}`, which would overflow", _35) -> [success: bb6, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+3:30: +3:38
+ _28 = Shl(move _29, move _30);
+ StorageDead(_30);
+ StorageDead(_29);
+ StorageLive(_33);
+ StorageLive(_34);
+ _34 = _2;
+ StorageLive(_35);
+ _35 = _5;
+ _36 = _35 as u128 (IntToInt);
+ _37 = Lt(move _36, const 128_u128);
+ assert(move _37, "attempt to shift left by `{}`, which would overflow", _35) -> [success: bb6, unwind: bb7];
}
bb6: {
- _33 = Shl(move _34, move _35); // scope 0 at $DIR/shifts.rs:+3:30: +3:38
- StorageDead(_35); // scope 0 at $DIR/shifts.rs:+3:37: +3:38
- StorageDead(_34); // scope 0 at $DIR/shifts.rs:+3:37: +3:38
- _22 = [move _23, move _28, move _33]; // scope 0 at $DIR/shifts.rs:+3:9: +3:39
- StorageDead(_33); // scope 0 at $DIR/shifts.rs:+3:38: +3:39
- StorageDead(_28); // scope 0 at $DIR/shifts.rs:+3:38: +3:39
- StorageDead(_23); // scope 0 at $DIR/shifts.rs:+3:38: +3:39
- _0 = (move _6, move _22); // scope 0 at $DIR/shifts.rs:+1:5: +4:6
- StorageDead(_22); // scope 0 at $DIR/shifts.rs:+4:5: +4:6
- StorageDead(_6); // scope 0 at $DIR/shifts.rs:+4:5: +4:6
- return; // scope 0 at $DIR/shifts.rs:+5:2: +5:2
+ _33 = Shl(move _34, move _35);
+ StorageDead(_35);
+ StorageDead(_34);
+ _22 = [move _23, move _28, move _33];
+ StorageDead(_33);
+ StorageDead(_28);
+ StorageDead(_23);
+ _0 = (move _6, move _22);
+ StorageDead(_22);
+ StorageDead(_6);
+ return;
}
bb7 (cleanup): {
- resume; // scope 0 at $DIR/shifts.rs:+0:1: +5:2
+ resume;
}
}
diff --git a/tests/mir-opt/building/shifts.shift_unsigned.built.after.mir b/tests/mir-opt/building/shifts.shift_unsigned.built.after.mir
index 04da2d20d..dfd3b5b35 100644
--- a/tests/mir-opt/building/shifts.shift_unsigned.built.after.mir
+++ b/tests/mir-opt/building/shifts.shift_unsigned.built.after.mir
@@ -1,135 +1,135 @@
// MIR for `shift_unsigned` after built
fn shift_unsigned(_1: u8, _2: i128, _3: u8, _4: u32, _5: u128) -> ([u8; 3], [i128; 3]) {
- debug small => _1; // in scope 0 at $DIR/shifts.rs:+0:19: +0:24
- debug big => _2; // in scope 0 at $DIR/shifts.rs:+0:30: +0:33
- debug a => _3; // in scope 0 at $DIR/shifts.rs:+0:41: +0:42
- debug b => _4; // in scope 0 at $DIR/shifts.rs:+0:48: +0:49
- debug c => _5; // in scope 0 at $DIR/shifts.rs:+0:56: +0:57
- let mut _0: ([u8; 3], [i128; 3]); // return place in scope 0 at $DIR/shifts.rs:+0:68: +0:88
- let mut _6: [u8; 3]; // in scope 0 at $DIR/shifts.rs:+2:9: +2:45
- let mut _7: u8; // in scope 0 at $DIR/shifts.rs:+2:10: +2:20
- let mut _8: u8; // in scope 0 at $DIR/shifts.rs:+2:10: +2:15
- let mut _9: u8; // in scope 0 at $DIR/shifts.rs:+2:19: +2:20
- let mut _10: bool; // in scope 0 at $DIR/shifts.rs:+2:10: +2:20
- let mut _11: u8; // in scope 0 at $DIR/shifts.rs:+2:22: +2:32
- let mut _12: u8; // in scope 0 at $DIR/shifts.rs:+2:22: +2:27
- let mut _13: u32; // in scope 0 at $DIR/shifts.rs:+2:31: +2:32
- let mut _14: bool; // in scope 0 at $DIR/shifts.rs:+2:22: +2:32
- let mut _15: u8; // in scope 0 at $DIR/shifts.rs:+2:34: +2:44
- let mut _16: u8; // in scope 0 at $DIR/shifts.rs:+2:34: +2:39
- let mut _17: u128; // in scope 0 at $DIR/shifts.rs:+2:43: +2:44
- let mut _18: bool; // in scope 0 at $DIR/shifts.rs:+2:34: +2:44
- let mut _19: [i128; 3]; // in scope 0 at $DIR/shifts.rs:+3:9: +3:39
- let mut _20: i128; // in scope 0 at $DIR/shifts.rs:+3:10: +3:18
- let mut _21: i128; // in scope 0 at $DIR/shifts.rs:+3:10: +3:13
- let mut _22: u8; // in scope 0 at $DIR/shifts.rs:+3:17: +3:18
- let mut _23: bool; // in scope 0 at $DIR/shifts.rs:+3:10: +3:18
- let mut _24: i128; // in scope 0 at $DIR/shifts.rs:+3:20: +3:28
- let mut _25: i128; // in scope 0 at $DIR/shifts.rs:+3:20: +3:23
- let mut _26: u32; // in scope 0 at $DIR/shifts.rs:+3:27: +3:28
- let mut _27: bool; // in scope 0 at $DIR/shifts.rs:+3:20: +3:28
- let mut _28: i128; // in scope 0 at $DIR/shifts.rs:+3:30: +3:38
- let mut _29: i128; // in scope 0 at $DIR/shifts.rs:+3:30: +3:33
- let mut _30: u128; // in scope 0 at $DIR/shifts.rs:+3:37: +3:38
- let mut _31: bool; // in scope 0 at $DIR/shifts.rs:+3:30: +3:38
+ debug small => _1;
+ debug big => _2;
+ debug a => _3;
+ debug b => _4;
+ debug c => _5;
+ let mut _0: ([u8; 3], [i128; 3]);
+ let mut _6: [u8; 3];
+ let mut _7: u8;
+ let mut _8: u8;
+ let mut _9: u8;
+ let mut _10: bool;
+ let mut _11: u8;
+ let mut _12: u8;
+ let mut _13: u32;
+ let mut _14: bool;
+ let mut _15: u8;
+ let mut _16: u8;
+ let mut _17: u128;
+ let mut _18: bool;
+ let mut _19: [i128; 3];
+ let mut _20: i128;
+ let mut _21: i128;
+ let mut _22: u8;
+ let mut _23: bool;
+ let mut _24: i128;
+ let mut _25: i128;
+ let mut _26: u32;
+ let mut _27: bool;
+ let mut _28: i128;
+ let mut _29: i128;
+ let mut _30: u128;
+ let mut _31: bool;
bb0: {
- StorageLive(_6); // scope 0 at $DIR/shifts.rs:+2:9: +2:45
- StorageLive(_7); // scope 0 at $DIR/shifts.rs:+2:10: +2:20
- StorageLive(_8); // scope 0 at $DIR/shifts.rs:+2:10: +2:15
- _8 = _1; // scope 0 at $DIR/shifts.rs:+2:10: +2:15
- StorageLive(_9); // scope 0 at $DIR/shifts.rs:+2:19: +2:20
- _9 = _3; // scope 0 at $DIR/shifts.rs:+2:19: +2:20
- _10 = Lt(_9, const 8_u8); // scope 0 at $DIR/shifts.rs:+2:10: +2:20
- assert(move _10, "attempt to shift right by `{}`, which would overflow", _9) -> [success: bb1, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:10: +2:20
+ StorageLive(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = _1;
+ StorageLive(_9);
+ _9 = _3;
+ _10 = Lt(_9, const 8_u8);
+ assert(move _10, "attempt to shift right by `{}`, which would overflow", _9) -> [success: bb1, unwind: bb7];
}
bb1: {
- _7 = Shr(move _8, move _9); // scope 0 at $DIR/shifts.rs:+2:10: +2:20
- StorageDead(_9); // scope 0 at $DIR/shifts.rs:+2:19: +2:20
- StorageDead(_8); // scope 0 at $DIR/shifts.rs:+2:19: +2:20
- StorageLive(_11); // scope 0 at $DIR/shifts.rs:+2:22: +2:32
- StorageLive(_12); // scope 0 at $DIR/shifts.rs:+2:22: +2:27
- _12 = _1; // scope 0 at $DIR/shifts.rs:+2:22: +2:27
- StorageLive(_13); // scope 0 at $DIR/shifts.rs:+2:31: +2:32
- _13 = _4; // scope 0 at $DIR/shifts.rs:+2:31: +2:32
- _14 = Lt(_13, const 8_u32); // scope 0 at $DIR/shifts.rs:+2:22: +2:32
- assert(move _14, "attempt to shift right by `{}`, which would overflow", _13) -> [success: bb2, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:22: +2:32
+ _7 = Shr(move _8, move _9);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = _1;
+ StorageLive(_13);
+ _13 = _4;
+ _14 = Lt(_13, const 8_u32);
+ assert(move _14, "attempt to shift right by `{}`, which would overflow", _13) -> [success: bb2, unwind: bb7];
}
bb2: {
- _11 = Shr(move _12, move _13); // scope 0 at $DIR/shifts.rs:+2:22: +2:32
- StorageDead(_13); // scope 0 at $DIR/shifts.rs:+2:31: +2:32
- StorageDead(_12); // scope 0 at $DIR/shifts.rs:+2:31: +2:32
- StorageLive(_15); // scope 0 at $DIR/shifts.rs:+2:34: +2:44
- StorageLive(_16); // scope 0 at $DIR/shifts.rs:+2:34: +2:39
- _16 = _1; // scope 0 at $DIR/shifts.rs:+2:34: +2:39
- StorageLive(_17); // scope 0 at $DIR/shifts.rs:+2:43: +2:44
- _17 = _5; // scope 0 at $DIR/shifts.rs:+2:43: +2:44
- _18 = Lt(_17, const 8_u128); // scope 0 at $DIR/shifts.rs:+2:34: +2:44
- assert(move _18, "attempt to shift right by `{}`, which would overflow", _17) -> [success: bb3, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+2:34: +2:44
+ _11 = Shr(move _12, move _13);
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageLive(_15);
+ StorageLive(_16);
+ _16 = _1;
+ StorageLive(_17);
+ _17 = _5;
+ _18 = Lt(_17, const 8_u128);
+ assert(move _18, "attempt to shift right by `{}`, which would overflow", _17) -> [success: bb3, unwind: bb7];
}
bb3: {
- _15 = Shr(move _16, move _17); // scope 0 at $DIR/shifts.rs:+2:34: +2:44
- StorageDead(_17); // scope 0 at $DIR/shifts.rs:+2:43: +2:44
- StorageDead(_16); // scope 0 at $DIR/shifts.rs:+2:43: +2:44
- _6 = [move _7, move _11, move _15]; // scope 0 at $DIR/shifts.rs:+2:9: +2:45
- StorageDead(_15); // scope 0 at $DIR/shifts.rs:+2:44: +2:45
- StorageDead(_11); // scope 0 at $DIR/shifts.rs:+2:44: +2:45
- StorageDead(_7); // scope 0 at $DIR/shifts.rs:+2:44: +2:45
- StorageLive(_19); // scope 0 at $DIR/shifts.rs:+3:9: +3:39
- StorageLive(_20); // scope 0 at $DIR/shifts.rs:+3:10: +3:18
- StorageLive(_21); // scope 0 at $DIR/shifts.rs:+3:10: +3:13
- _21 = _2; // scope 0 at $DIR/shifts.rs:+3:10: +3:13
- StorageLive(_22); // scope 0 at $DIR/shifts.rs:+3:17: +3:18
- _22 = _3; // scope 0 at $DIR/shifts.rs:+3:17: +3:18
- _23 = Lt(_22, const 128_u8); // scope 0 at $DIR/shifts.rs:+3:10: +3:18
- assert(move _23, "attempt to shift left by `{}`, which would overflow", _22) -> [success: bb4, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+3:10: +3:18
+ _15 = Shr(move _16, move _17);
+ StorageDead(_17);
+ StorageDead(_16);
+ _6 = [move _7, move _11, move _15];
+ StorageDead(_15);
+ StorageDead(_11);
+ StorageDead(_7);
+ StorageLive(_19);
+ StorageLive(_20);
+ StorageLive(_21);
+ _21 = _2;
+ StorageLive(_22);
+ _22 = _3;
+ _23 = Lt(_22, const 128_u8);
+ assert(move _23, "attempt to shift left by `{}`, which would overflow", _22) -> [success: bb4, unwind: bb7];
}
bb4: {
- _20 = Shl(move _21, move _22); // scope 0 at $DIR/shifts.rs:+3:10: +3:18
- StorageDead(_22); // scope 0 at $DIR/shifts.rs:+3:17: +3:18
- StorageDead(_21); // scope 0 at $DIR/shifts.rs:+3:17: +3:18
- StorageLive(_24); // scope 0 at $DIR/shifts.rs:+3:20: +3:28
- StorageLive(_25); // scope 0 at $DIR/shifts.rs:+3:20: +3:23
- _25 = _2; // scope 0 at $DIR/shifts.rs:+3:20: +3:23
- StorageLive(_26); // scope 0 at $DIR/shifts.rs:+3:27: +3:28
- _26 = _4; // scope 0 at $DIR/shifts.rs:+3:27: +3:28
- _27 = Lt(_26, const 128_u32); // scope 0 at $DIR/shifts.rs:+3:20: +3:28
- assert(move _27, "attempt to shift left by `{}`, which would overflow", _26) -> [success: bb5, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+3:20: +3:28
+ _20 = Shl(move _21, move _22);
+ StorageDead(_22);
+ StorageDead(_21);
+ StorageLive(_24);
+ StorageLive(_25);
+ _25 = _2;
+ StorageLive(_26);
+ _26 = _4;
+ _27 = Lt(_26, const 128_u32);
+ assert(move _27, "attempt to shift left by `{}`, which would overflow", _26) -> [success: bb5, unwind: bb7];
}
bb5: {
- _24 = Shl(move _25, move _26); // scope 0 at $DIR/shifts.rs:+3:20: +3:28
- StorageDead(_26); // scope 0 at $DIR/shifts.rs:+3:27: +3:28
- StorageDead(_25); // scope 0 at $DIR/shifts.rs:+3:27: +3:28
- StorageLive(_28); // scope 0 at $DIR/shifts.rs:+3:30: +3:38
- StorageLive(_29); // scope 0 at $DIR/shifts.rs:+3:30: +3:33
- _29 = _2; // scope 0 at $DIR/shifts.rs:+3:30: +3:33
- StorageLive(_30); // scope 0 at $DIR/shifts.rs:+3:37: +3:38
- _30 = _5; // scope 0 at $DIR/shifts.rs:+3:37: +3:38
- _31 = Lt(_30, const 128_u128); // scope 0 at $DIR/shifts.rs:+3:30: +3:38
- assert(move _31, "attempt to shift left by `{}`, which would overflow", _30) -> [success: bb6, unwind: bb7]; // scope 0 at $DIR/shifts.rs:+3:30: +3:38
+ _24 = Shl(move _25, move _26);
+ StorageDead(_26);
+ StorageDead(_25);
+ StorageLive(_28);
+ StorageLive(_29);
+ _29 = _2;
+ StorageLive(_30);
+ _30 = _5;
+ _31 = Lt(_30, const 128_u128);
+ assert(move _31, "attempt to shift left by `{}`, which would overflow", _30) -> [success: bb6, unwind: bb7];
}
bb6: {
- _28 = Shl(move _29, move _30); // scope 0 at $DIR/shifts.rs:+3:30: +3:38
- StorageDead(_30); // scope 0 at $DIR/shifts.rs:+3:37: +3:38
- StorageDead(_29); // scope 0 at $DIR/shifts.rs:+3:37: +3:38
- _19 = [move _20, move _24, move _28]; // scope 0 at $DIR/shifts.rs:+3:9: +3:39
- StorageDead(_28); // scope 0 at $DIR/shifts.rs:+3:38: +3:39
- StorageDead(_24); // scope 0 at $DIR/shifts.rs:+3:38: +3:39
- StorageDead(_20); // scope 0 at $DIR/shifts.rs:+3:38: +3:39
- _0 = (move _6, move _19); // scope 0 at $DIR/shifts.rs:+1:5: +4:6
- StorageDead(_19); // scope 0 at $DIR/shifts.rs:+4:5: +4:6
- StorageDead(_6); // scope 0 at $DIR/shifts.rs:+4:5: +4:6
- return; // scope 0 at $DIR/shifts.rs:+5:2: +5:2
+ _28 = Shl(move _29, move _30);
+ StorageDead(_30);
+ StorageDead(_29);
+ _19 = [move _20, move _24, move _28];
+ StorageDead(_28);
+ StorageDead(_24);
+ StorageDead(_20);
+ _0 = (move _6, move _19);
+ StorageDead(_19);
+ StorageDead(_6);
+ return;
}
bb7 (cleanup): {
- resume; // scope 0 at $DIR/shifts.rs:+0:1: +5:2
+ resume;
}
}
diff --git a/tests/mir-opt/building/simple_match.match_bool.built.after.mir b/tests/mir-opt/building/simple_match.match_bool.built.after.mir
index aa2fd4632..06de4c510 100644
--- a/tests/mir-opt/building/simple_match.match_bool.built.after.mir
+++ b/tests/mir-opt/building/simple_match.match_bool.built.after.mir
@@ -1,29 +1,29 @@
// MIR for `match_bool` after built
fn match_bool(_1: bool) -> usize {
- debug x => _1; // in scope 0 at $DIR/simple_match.rs:+0:15: +0:16
- let mut _0: usize; // return place in scope 0 at $DIR/simple_match.rs:+0:27: +0:32
+ debug x => _1;
+ let mut _0: usize;
bb0: {
- FakeRead(ForMatchedPlace(None), _1); // scope 0 at $DIR/simple_match.rs:+1:11: +1:12
- switchInt(_1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/simple_match.rs:+1:5: +1:12
+ PlaceMention(_1);
+ switchInt(_1) -> [0: bb2, otherwise: bb1];
}
bb1: {
- falseEdge -> [real: bb3, imaginary: bb2]; // scope 0 at $DIR/simple_match.rs:+2:9: +2:13
+ falseEdge -> [real: bb3, imaginary: bb2];
}
bb2: {
- _0 = const 20_usize; // scope 0 at $DIR/simple_match.rs:+3:14: +3:16
- goto -> bb4; // scope 0 at $DIR/simple_match.rs:+3:14: +3:16
+ _0 = const 20_usize;
+ goto -> bb4;
}
bb3: {
- _0 = const 10_usize; // scope 0 at $DIR/simple_match.rs:+2:17: +2:19
- goto -> bb4; // scope 0 at $DIR/simple_match.rs:+2:17: +2:19
+ _0 = const 10_usize;
+ goto -> bb4;
}
bb4: {
- return; // scope 0 at $DIR/simple_match.rs:+5:2: +5:2
+ return;
}
}
diff --git a/tests/mir-opt/building/simple_match.rs b/tests/mir-opt/building/simple_match.rs
index 0ef97dde6..4f0a3046a 100644
--- a/tests/mir-opt/building/simple_match.rs
+++ b/tests/mir-opt/building/simple_match.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that we don't generate unnecessarily large MIR for very simple matches
diff --git a/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir b/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir
index 1d3f77e07..683f63065 100644
--- a/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir
+++ b/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir
@@ -1,203 +1,200 @@
// MIR for `XXX` after built
static XXX: &Foo = {
- let mut _0: &Foo; // return place in scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:13: +0:25
- let _1: &Foo; // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:28: +18:2
- let _2: Foo; // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:29: +18:2
- let mut _3: &[(u32, u32)]; // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
- let mut _4: &[(u32, u32); 42]; // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
- let _5: &[(u32, u32); 42]; // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
- let _6: [(u32, u32); 42]; // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:12: +17:6
- let mut _7: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:9: +3:15
- let mut _8: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:17: +3:23
- let mut _9: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:25: +3:31
- let mut _10: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:9: +4:15
- let mut _11: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:17: +4:23
- let mut _12: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:25: +4:31
- let mut _13: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:9: +5:15
- let mut _14: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:17: +5:23
- let mut _15: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:25: +5:31
- let mut _16: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:9: +6:15
- let mut _17: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:17: +6:23
- let mut _18: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:25: +6:31
- let mut _19: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:9: +7:15
- let mut _20: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:17: +7:23
- let mut _21: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:25: +7:31
- let mut _22: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:9: +8:15
- let mut _23: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:17: +8:23
- let mut _24: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:25: +8:31
- let mut _25: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:9: +9:15
- let mut _26: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:17: +9:23
- let mut _27: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:25: +9:31
- let mut _28: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:9: +10:15
- let mut _29: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:17: +10:23
- let mut _30: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:25: +10:31
- let mut _31: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:9: +11:15
- let mut _32: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:17: +11:23
- let mut _33: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:25: +11:31
- let mut _34: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:9: +12:15
- let mut _35: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:17: +12:23
- let mut _36: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:25: +12:31
- let mut _37: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:9: +13:15
- let mut _38: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:17: +13:23
- let mut _39: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:25: +13:31
- let mut _40: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:9: +14:15
- let mut _41: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:17: +14:23
- let mut _42: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:25: +14:31
- let mut _43: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:9: +15:15
- let mut _44: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:17: +15:23
- let mut _45: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:25: +15:31
- let mut _46: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:9: +16:15
- let mut _47: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:17: +16:23
- let mut _48: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:25: +16:31
+ let mut _0: &Foo;
+ let _1: &Foo;
+ let _2: Foo;
+ let mut _3: &[(u32, u32)];
+ let mut _4: &[(u32, u32); 42];
+ let _5: &[(u32, u32); 42];
+ let _6: [(u32, u32); 42];
+ let mut _7: (u32, u32);
+ let mut _8: (u32, u32);
+ let mut _9: (u32, u32);
+ let mut _10: (u32, u32);
+ let mut _11: (u32, u32);
+ let mut _12: (u32, u32);
+ let mut _13: (u32, u32);
+ let mut _14: (u32, u32);
+ let mut _15: (u32, u32);
+ let mut _16: (u32, u32);
+ let mut _17: (u32, u32);
+ let mut _18: (u32, u32);
+ let mut _19: (u32, u32);
+ let mut _20: (u32, u32);
+ let mut _21: (u32, u32);
+ let mut _22: (u32, u32);
+ let mut _23: (u32, u32);
+ let mut _24: (u32, u32);
+ let mut _25: (u32, u32);
+ let mut _26: (u32, u32);
+ let mut _27: (u32, u32);
+ let mut _28: (u32, u32);
+ let mut _29: (u32, u32);
+ let mut _30: (u32, u32);
+ let mut _31: (u32, u32);
+ let mut _32: (u32, u32);
+ let mut _33: (u32, u32);
+ let mut _34: (u32, u32);
+ let mut _35: (u32, u32);
+ let mut _36: (u32, u32);
+ let mut _37: (u32, u32);
+ let mut _38: (u32, u32);
+ let mut _39: (u32, u32);
+ let mut _40: (u32, u32);
+ let mut _41: (u32, u32);
+ let mut _42: (u32, u32);
+ let mut _43: (u32, u32);
+ let mut _44: (u32, u32);
+ let mut _45: (u32, u32);
+ let mut _46: (u32, u32);
+ let mut _47: (u32, u32);
+ let mut _48: (u32, u32);
bb0: {
- StorageLive(_1); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:28: +18:2
- StorageLive(_2); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:29: +18:2
- StorageLive(_3); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
- StorageLive(_4); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
- StorageLive(_5); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
- StorageLive(_6); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:12: +17:6
- StorageLive(_7); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:9: +3:15
- _7 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:9: +3:15
- StorageLive(_8); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:17: +3:23
- _8 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:17: +3:23
- StorageLive(_9); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:25: +3:31
- _9 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:25: +3:31
- StorageLive(_10); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:9: +4:15
- _10 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:9: +4:15
- StorageLive(_11); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:17: +4:23
- _11 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:17: +4:23
- StorageLive(_12); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:25: +4:31
- _12 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:25: +4:31
- StorageLive(_13); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:9: +5:15
- _13 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:9: +5:15
- StorageLive(_14); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:17: +5:23
- _14 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:17: +5:23
- StorageLive(_15); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:25: +5:31
- _15 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:25: +5:31
- StorageLive(_16); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:9: +6:15
- _16 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:9: +6:15
- StorageLive(_17); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:17: +6:23
- _17 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:17: +6:23
- StorageLive(_18); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:25: +6:31
- _18 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:25: +6:31
- StorageLive(_19); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:9: +7:15
- _19 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:9: +7:15
- StorageLive(_20); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:17: +7:23
- _20 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:17: +7:23
- StorageLive(_21); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:25: +7:31
- _21 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:25: +7:31
- StorageLive(_22); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:9: +8:15
- _22 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:9: +8:15
- StorageLive(_23); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:17: +8:23
- _23 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:17: +8:23
- StorageLive(_24); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:25: +8:31
- _24 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:25: +8:31
- StorageLive(_25); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:9: +9:15
- _25 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:9: +9:15
- StorageLive(_26); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:17: +9:23
- _26 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:17: +9:23
- StorageLive(_27); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:25: +9:31
- _27 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:25: +9:31
- StorageLive(_28); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:9: +10:15
- _28 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:9: +10:15
- StorageLive(_29); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:17: +10:23
- _29 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:17: +10:23
- StorageLive(_30); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:25: +10:31
- _30 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:25: +10:31
- StorageLive(_31); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:9: +11:15
- _31 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:9: +11:15
- StorageLive(_32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:17: +11:23
- _32 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:17: +11:23
- StorageLive(_33); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:25: +11:31
- _33 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:25: +11:31
- StorageLive(_34); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:9: +12:15
- _34 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:9: +12:15
- StorageLive(_35); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:17: +12:23
- _35 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:17: +12:23
- StorageLive(_36); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:25: +12:31
- _36 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:25: +12:31
- StorageLive(_37); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:9: +13:15
- _37 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:9: +13:15
- StorageLive(_38); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:17: +13:23
- _38 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:17: +13:23
- StorageLive(_39); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:25: +13:31
- _39 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:25: +13:31
- StorageLive(_40); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:9: +14:15
- _40 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:9: +14:15
- StorageLive(_41); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:17: +14:23
- _41 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:17: +14:23
- StorageLive(_42); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:25: +14:31
- _42 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:25: +14:31
- StorageLive(_43); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:9: +15:15
- _43 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:9: +15:15
- StorageLive(_44); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:17: +15:23
- _44 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:17: +15:23
- StorageLive(_45); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:25: +15:31
- _45 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:25: +15:31
- StorageLive(_46); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:9: +16:15
- _46 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:9: +16:15
- StorageLive(_47); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:17: +16:23
- _47 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:17: +16:23
- StorageLive(_48); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:25: +16:31
- _48 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:25: +16:31
- _6 = [move _7, move _8, move _9, move _10, move _11, move _12, move _13, move _14, move _15, move _16, move _17, move _18, move _19, move _20, move _21, move _22, move _23, move _24, move _25, move _26, move _27, move _28, move _29, move _30, move _31, move _32, move _33, move _34, move _35, move _36, move _37, move _38, move _39, move _40, move _41, move _42, move _43, move _44, move _45, move _46, move _47, move _48]; // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:12: +17:6
- StorageDead(_48); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_47); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_46); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_45); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_44); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_43); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_42); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_41); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_40); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_39); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_38); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_37); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_36); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_35); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_34); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_33); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_31); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_30); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_29); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_28); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_27); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_26); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_25); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_24); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_23); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_22); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_21); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_20); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_19); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_18); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_17); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_16); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_15); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_14); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_13); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_12); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_11); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_10); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_9); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_8); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- StorageDead(_7); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- _5 = &_6; // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
- _4 = &(*_5); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
- _3 = move _4 as &[(u32, u32)] (Pointer(Unsize)); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
- StorageDead(_4); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
- _2 = Foo { tup: const "hi", data: move _3 }; // scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:29: +18:2
- // mir::Constant
- // + span: $DIR/storage_live_dead_in_statics.rs:6:10: 6:14
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- StorageDead(_3); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+18:1: +18:2
- _1 = &_2; // scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:28: +18:2
- _0 = &(*_1); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:28: +18:2
- StorageDead(_5); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+18:1: +18:2
- StorageDead(_1); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+18:1: +18:2
- return; // scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:1: +18:3
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = (const 0_u32, const 1_u32);
+ StorageLive(_8);
+ _8 = (const 0_u32, const 2_u32);
+ StorageLive(_9);
+ _9 = (const 0_u32, const 3_u32);
+ StorageLive(_10);
+ _10 = (const 0_u32, const 1_u32);
+ StorageLive(_11);
+ _11 = (const 0_u32, const 2_u32);
+ StorageLive(_12);
+ _12 = (const 0_u32, const 3_u32);
+ StorageLive(_13);
+ _13 = (const 0_u32, const 1_u32);
+ StorageLive(_14);
+ _14 = (const 0_u32, const 2_u32);
+ StorageLive(_15);
+ _15 = (const 0_u32, const 3_u32);
+ StorageLive(_16);
+ _16 = (const 0_u32, const 1_u32);
+ StorageLive(_17);
+ _17 = (const 0_u32, const 2_u32);
+ StorageLive(_18);
+ _18 = (const 0_u32, const 3_u32);
+ StorageLive(_19);
+ _19 = (const 0_u32, const 1_u32);
+ StorageLive(_20);
+ _20 = (const 0_u32, const 2_u32);
+ StorageLive(_21);
+ _21 = (const 0_u32, const 3_u32);
+ StorageLive(_22);
+ _22 = (const 0_u32, const 1_u32);
+ StorageLive(_23);
+ _23 = (const 0_u32, const 2_u32);
+ StorageLive(_24);
+ _24 = (const 0_u32, const 3_u32);
+ StorageLive(_25);
+ _25 = (const 0_u32, const 1_u32);
+ StorageLive(_26);
+ _26 = (const 0_u32, const 2_u32);
+ StorageLive(_27);
+ _27 = (const 0_u32, const 3_u32);
+ StorageLive(_28);
+ _28 = (const 0_u32, const 1_u32);
+ StorageLive(_29);
+ _29 = (const 0_u32, const 2_u32);
+ StorageLive(_30);
+ _30 = (const 0_u32, const 3_u32);
+ StorageLive(_31);
+ _31 = (const 0_u32, const 1_u32);
+ StorageLive(_32);
+ _32 = (const 0_u32, const 2_u32);
+ StorageLive(_33);
+ _33 = (const 0_u32, const 3_u32);
+ StorageLive(_34);
+ _34 = (const 0_u32, const 1_u32);
+ StorageLive(_35);
+ _35 = (const 0_u32, const 2_u32);
+ StorageLive(_36);
+ _36 = (const 0_u32, const 3_u32);
+ StorageLive(_37);
+ _37 = (const 0_u32, const 1_u32);
+ StorageLive(_38);
+ _38 = (const 0_u32, const 2_u32);
+ StorageLive(_39);
+ _39 = (const 0_u32, const 3_u32);
+ StorageLive(_40);
+ _40 = (const 0_u32, const 1_u32);
+ StorageLive(_41);
+ _41 = (const 0_u32, const 2_u32);
+ StorageLive(_42);
+ _42 = (const 0_u32, const 3_u32);
+ StorageLive(_43);
+ _43 = (const 0_u32, const 1_u32);
+ StorageLive(_44);
+ _44 = (const 0_u32, const 2_u32);
+ StorageLive(_45);
+ _45 = (const 0_u32, const 3_u32);
+ StorageLive(_46);
+ _46 = (const 0_u32, const 1_u32);
+ StorageLive(_47);
+ _47 = (const 0_u32, const 2_u32);
+ StorageLive(_48);
+ _48 = (const 0_u32, const 3_u32);
+ _6 = [move _7, move _8, move _9, move _10, move _11, move _12, move _13, move _14, move _15, move _16, move _17, move _18, move _19, move _20, move _21, move _22, move _23, move _24, move _25, move _26, move _27, move _28, move _29, move _30, move _31, move _32, move _33, move _34, move _35, move _36, move _37, move _38, move _39, move _40, move _41, move _42, move _43, move _44, move _45, move _46, move _47, move _48];
+ StorageDead(_48);
+ StorageDead(_47);
+ StorageDead(_46);
+ StorageDead(_45);
+ StorageDead(_44);
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageDead(_41);
+ StorageDead(_40);
+ StorageDead(_39);
+ StorageDead(_38);
+ StorageDead(_37);
+ StorageDead(_36);
+ StorageDead(_35);
+ StorageDead(_34);
+ StorageDead(_33);
+ StorageDead(_32);
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageDead(_29);
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageDead(_26);
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_19);
+ StorageDead(_18);
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ _5 = &_6;
+ _4 = &(*_5);
+ _3 = move _4 as &[(u32, u32)] (PointerCoercion(Unsize));
+ StorageDead(_4);
+ _2 = Foo { tup: const "hi", data: move _3 };
+ StorageDead(_3);
+ _1 = &_2;
+ _0 = &(*_1);
+ StorageDead(_5);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/building/storage_live_dead_in_statics.rs b/tests/mir-opt/building/storage_live_dead_in_statics.rs
index 79f709148..1f5692118 100644
--- a/tests/mir-opt/building/storage_live_dead_in_statics.rs
+++ b/tests/mir-opt/building/storage_live_dead_in_statics.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Check that when we compile the static `XXX` into MIR, we do not
// generate `StorageStart` or `StorageEnd` statements.
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 54f0ea2d8..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
@@ -1,23 +1,23 @@
// MIR for `move_out_by_subslice` after built
fn move_out_by_subslice() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/uniform_array_move_out.rs:+0:27: +0:27
- let _1: [std::boxed::Box<i32>; 2]; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
- let mut _2: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- let mut _3: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- let mut _4: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- let mut _5: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- let mut _6: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- let mut _7: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- let mut _8: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- let mut _9: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- let mut _10: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- let mut _11: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
+ let mut _0: ();
+ let _1: [std::boxed::Box<i32>; 2];
+ let mut _2: std::boxed::Box<i32>;
+ let mut _3: usize;
+ let mut _4: usize;
+ let mut _5: *mut u8;
+ let mut _6: std::boxed::Box<i32>;
+ let mut _7: std::boxed::Box<i32>;
+ let mut _8: usize;
+ let mut _9: usize;
+ let mut _10: *mut u8;
+ let mut _11: std::boxed::Box<i32>;
scope 1 {
- debug a => _1; // in scope 1 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
- let _12: [std::boxed::Box<i32>; 2]; // in scope 1 at $DIR/uniform_array_move_out.rs:+7:10: +7:12
+ debug a => _1;
+ let _12: [std::boxed::Box<i32>; 2];
scope 4 {
- debug _y => _12; // in scope 4 at $DIR/uniform_array_move_out.rs:+7:10: +7:12
+ debug _y => _12;
}
}
scope 2 {
@@ -26,87 +26,81 @@ fn move_out_by_subslice() -> () {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- _3 = SizeOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- _4 = AlignOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12]; // scope 2 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- // mir::Constant
- // + span: $DIR/uniform_array_move_out.rs:18:9: 18:20
- // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
+ StorageLive(_1);
+ StorageLive(_2);
+ _3 = SizeOf(i32);
+ _4 = AlignOf(i32);
+ _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12];
}
bb1: {
- StorageLive(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- _6 = ShallowInitBox(move _5, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- (*_6) = const 1_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+3:18: +3:19
- _2 = move _6; // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- drop(_6) -> [return: bb2, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+3:19: +3:20
+ StorageLive(_6);
+ _6 = ShallowInitBox(move _5, i32);
+ (*_6) = const 1_i32;
+ _2 = move _6;
+ drop(_6) -> [return: bb2, unwind: bb11];
}
bb2: {
- StorageDead(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+3:19: +3:20
- StorageLive(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- _8 = SizeOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- _9 = AlignOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11]; // scope 3 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- // mir::Constant
- // + span: $DIR/uniform_array_move_out.rs:20:9: 20:20
- // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
+ StorageDead(_6);
+ StorageLive(_7);
+ _8 = SizeOf(i32);
+ _9 = AlignOf(i32);
+ _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11];
}
bb3: {
- StorageLive(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- _11 = ShallowInitBox(move _10, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- (*_11) = const 2_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+5:18: +5:19
- _7 = move _11; // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- drop(_11) -> [return: bb4, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:+5:19: +5:20
+ StorageLive(_11);
+ _11 = ShallowInitBox(move _10, i32);
+ (*_11) = const 2_i32;
+ _7 = move _11;
+ drop(_11) -> [return: bb4, unwind: bb10];
}
bb4: {
- StorageDead(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+5:19: +5:20
- _1 = [move _2, move _7]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:13: +6:6
- drop(_7) -> [return: bb5, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6
+ StorageDead(_11);
+ _1 = [move _2, move _7];
+ drop(_7) -> [return: bb5, unwind: bb11];
}
bb5: {
- StorageDead(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6
- drop(_2) -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6
+ StorageDead(_7);
+ drop(_2) -> [return: bb6, unwind: bb12];
}
bb6: {
- StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6
- FakeRead(ForLet(None), _1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
- PlaceMention(_1); // scope 1 at $DIR/uniform_array_move_out.rs:+7:21: +7:22
- StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+7:10: +7:12
- _12 = move _1[0..2]; // scope 1 at $DIR/uniform_array_move_out.rs:+7:10: +7:12
- _0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:+0:27: +8:2
- drop(_12) -> [return: bb7, unwind: bb9]; // scope 1 at $DIR/uniform_array_move_out.rs:+8:1: +8:2
+ StorageDead(_2);
+ FakeRead(ForLet(None), _1);
+ PlaceMention(_1);
+ StorageLive(_12);
+ _12 = move _1[0..2];
+ _0 = const ();
+ drop(_12) -> [return: bb7, unwind: bb9];
}
bb7: {
- StorageDead(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+8:1: +8:2
- drop(_1) -> [return: bb8, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+8:1: +8:2
+ StorageDead(_12);
+ drop(_1) -> [return: bb8, unwind: bb12];
}
bb8: {
- StorageDead(_1); // scope 0 at $DIR/uniform_array_move_out.rs:+8:1: +8:2
- return; // scope 0 at $DIR/uniform_array_move_out.rs:+8:2: +8:2
+ StorageDead(_1);
+ return;
}
bb9 (cleanup): {
- drop(_1) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/uniform_array_move_out.rs:+8:1: +8:2
+ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
}
bb10 (cleanup): {
- drop(_7) -> [return: bb11, unwind terminate]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6
+ drop(_7) -> [return: bb11, unwind terminate(cleanup)];
}
bb11 (cleanup): {
- drop(_2) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
- resume; // scope 0 at $DIR/uniform_array_move_out.rs:+0:1: +8:2
+ resume;
}
}
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 5090a4ba6..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
@@ -1,23 +1,23 @@
// MIR for `move_out_from_end` after built
fn move_out_from_end() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/uniform_array_move_out.rs:+0:24: +0:24
- let _1: [std::boxed::Box<i32>; 2]; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
- let mut _2: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- let mut _3: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- let mut _4: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- let mut _5: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- let mut _6: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- let mut _7: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- let mut _8: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- let mut _9: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- let mut _10: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- let mut _11: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
+ let mut _0: ();
+ let _1: [std::boxed::Box<i32>; 2];
+ let mut _2: std::boxed::Box<i32>;
+ let mut _3: usize;
+ let mut _4: usize;
+ let mut _5: *mut u8;
+ let mut _6: std::boxed::Box<i32>;
+ let mut _7: std::boxed::Box<i32>;
+ let mut _8: usize;
+ let mut _9: usize;
+ let mut _10: *mut u8;
+ let mut _11: std::boxed::Box<i32>;
scope 1 {
- debug a => _1; // in scope 1 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
- let _12: std::boxed::Box<i32>; // in scope 1 at $DIR/uniform_array_move_out.rs:+7:14: +7:16
+ debug a => _1;
+ let _12: std::boxed::Box<i32>;
scope 4 {
- debug _y => _12; // in scope 4 at $DIR/uniform_array_move_out.rs:+7:14: +7:16
+ debug _y => _12;
}
}
scope 2 {
@@ -26,87 +26,81 @@ fn move_out_from_end() -> () {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- _3 = SizeOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- _4 = AlignOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12]; // scope 2 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- // mir::Constant
- // + span: $DIR/uniform_array_move_out.rs:7:9: 7:20
- // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
+ StorageLive(_1);
+ StorageLive(_2);
+ _3 = SizeOf(i32);
+ _4 = AlignOf(i32);
+ _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12];
}
bb1: {
- StorageLive(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- _6 = ShallowInitBox(move _5, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- (*_6) = const 1_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+3:18: +3:19
- _2 = move _6; // scope 0 at $DIR/uniform_array_move_out.rs:+3:9: +3:20
- drop(_6) -> [return: bb2, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+3:19: +3:20
+ StorageLive(_6);
+ _6 = ShallowInitBox(move _5, i32);
+ (*_6) = const 1_i32;
+ _2 = move _6;
+ drop(_6) -> [return: bb2, unwind: bb11];
}
bb2: {
- StorageDead(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+3:19: +3:20
- StorageLive(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- _8 = SizeOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- _9 = AlignOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11]; // scope 3 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- // mir::Constant
- // + span: $DIR/uniform_array_move_out.rs:9:9: 9:20
- // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
+ StorageDead(_6);
+ StorageLive(_7);
+ _8 = SizeOf(i32);
+ _9 = AlignOf(i32);
+ _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11];
}
bb3: {
- StorageLive(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- _11 = ShallowInitBox(move _10, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- (*_11) = const 2_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+5:18: +5:19
- _7 = move _11; // scope 0 at $DIR/uniform_array_move_out.rs:+5:9: +5:20
- drop(_11) -> [return: bb4, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:+5:19: +5:20
+ StorageLive(_11);
+ _11 = ShallowInitBox(move _10, i32);
+ (*_11) = const 2_i32;
+ _7 = move _11;
+ drop(_11) -> [return: bb4, unwind: bb10];
}
bb4: {
- StorageDead(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+5:19: +5:20
- _1 = [move _2, move _7]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:13: +6:6
- drop(_7) -> [return: bb5, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6
+ StorageDead(_11);
+ _1 = [move _2, move _7];
+ drop(_7) -> [return: bb5, unwind: bb11];
}
bb5: {
- StorageDead(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6
- drop(_2) -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6
+ StorageDead(_7);
+ drop(_2) -> [return: bb6, unwind: bb12];
}
bb6: {
- StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6
- FakeRead(ForLet(None), _1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
- PlaceMention(_1); // scope 1 at $DIR/uniform_array_move_out.rs:+7:20: +7:21
- StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+7:14: +7:16
- _12 = move _1[1 of 2]; // scope 1 at $DIR/uniform_array_move_out.rs:+7:14: +7:16
- _0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:+0:24: +8:2
- drop(_12) -> [return: bb7, unwind: bb9]; // scope 1 at $DIR/uniform_array_move_out.rs:+8:1: +8:2
+ StorageDead(_2);
+ FakeRead(ForLet(None), _1);
+ PlaceMention(_1);
+ StorageLive(_12);
+ _12 = move _1[1 of 2];
+ _0 = const ();
+ drop(_12) -> [return: bb7, unwind: bb9];
}
bb7: {
- StorageDead(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+8:1: +8:2
- drop(_1) -> [return: bb8, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+8:1: +8:2
+ StorageDead(_12);
+ drop(_1) -> [return: bb8, unwind: bb12];
}
bb8: {
- StorageDead(_1); // scope 0 at $DIR/uniform_array_move_out.rs:+8:1: +8:2
- return; // scope 0 at $DIR/uniform_array_move_out.rs:+8:2: +8:2
+ StorageDead(_1);
+ return;
}
bb9 (cleanup): {
- drop(_1) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/uniform_array_move_out.rs:+8:1: +8:2
+ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
}
bb10 (cleanup): {
- drop(_7) -> [return: bb11, unwind terminate]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6
+ drop(_7) -> [return: bb11, unwind terminate(cleanup)];
}
bb11 (cleanup): {
- drop(_2) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/uniform_array_move_out.rs:+6:5: +6:6
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
- resume; // scope 0 at $DIR/uniform_array_move_out.rs:+0:1: +8:2
+ resume;
}
}
diff --git a/tests/mir-opt/building/uniform_array_move_out.rs b/tests/mir-opt/building/uniform_array_move_out.rs
index 4ba107c87..068289161 100644
--- a/tests/mir-opt/building/uniform_array_move_out.rs
+++ b/tests/mir-opt/building/uniform_array_move_out.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(stmt_expr_attributes, rustc_attrs)]
// EMIT_MIR uniform_array_move_out.move_out_from_end.built.after.mir
diff --git a/tests/mir-opt/building/while_storage.rs b/tests/mir-opt/building/while_storage.rs
new file mode 100644
index 000000000..b06c1639c
--- /dev/null
+++ b/tests/mir-opt/building/while_storage.rs
@@ -0,0 +1,60 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// Test that we correctly generate StorageDead statements for while loop
+// conditions on all branches
+// compile-flags: -Zmir-opt-level=0
+
+fn get_bool(c: bool) -> bool {
+ c
+}
+
+// EMIT_MIR while_storage.while_loop.PreCodegen.after.mir
+fn while_loop(c: bool) {
+ // CHECK-LABEL: fn while_loop(
+ // CHECK: bb0: {
+ // CHECK-NEXT: goto -> bb1;
+ // CHECK: bb1: {
+ // CHECK-NEXT: StorageLive(_3);
+ // CHECK-NEXT: StorageLive(_2);
+ // CHECK-NEXT: _2 = _1;
+ // CHECK-NEXT: _3 = get_bool(move _2) -> [return: bb2, unwind
+ // CHECK: bb2: {
+ // CHECK-NEXT: switchInt(move _3) -> [0: bb3, otherwise: bb4];
+ // CHECK: bb3: {
+ // CHECK-NEXT: StorageDead(_2);
+ // CHECK-NEXT: StorageLive(_9);
+ // CHECK-NEXT: _0 = const ();
+ // CHECK-NEXT: StorageDead(_9);
+ // CHECK-NEXT: goto -> bb8;
+ // CHECK: bb4: {
+ // CHECK-NEXT: StorageDead(_2);
+ // CHECK-NEXT: StorageLive(_5);
+ // CHECK-NEXT: StorageLive(_4);
+ // CHECK-NEXT: _4 = _1;
+ // CHECK-NEXT: _5 = get_bool(move _4) -> [return: bb5, unwind
+ // CHECK: bb5: {
+ // CHECK-NEXT: switchInt(move _5) -> [0: bb6, otherwise: bb7];
+ // CHECK: bb6: {
+ // CHECK-NEXT: StorageDead(_4);
+ // CHECK-NEXT: _6 = const ();
+ // CHECK-NEXT: StorageDead(_5);
+ // CHECK-NEXT: StorageDead(_3);
+ // CHECK-NEXT: goto -> bb1;
+ // CHECK: bb7: {
+ // CHECK-NEXT: StorageDead(_4);
+ // CHECK-NEXT: _0 = const ();
+ // CHECK-NEXT: StorageDead(_5);
+ // CHECK-NEXT: goto -> bb8;
+ // CHECK: bb8: {
+ // CHECK-NEXT: StorageDead(_3);
+ // CHECK-NEXT: return;
+
+ while get_bool(c) {
+ if get_bool(c) {
+ break;
+ }
+ }
+}
+
+fn main() {
+ while_loop(false);
+}
diff --git a/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..26c82edf2
--- /dev/null
+++ b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,70 @@
+// MIR for `while_loop` after PreCodegen
+
+fn while_loop(_1: bool) -> () {
+ debug c => _1;
+ let mut _0: ();
+ let mut _2: bool;
+ let mut _3: bool;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: ();
+ let mut _7: !;
+ let mut _8: !;
+ let _9: ();
+ let mut _10: !;
+
+ bb0: {
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageLive(_3);
+ StorageLive(_2);
+ _2 = _1;
+ _3 = get_bool(move _2) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ switchInt(move _3) -> [0: bb3, otherwise: bb4];
+ }
+
+ bb3: {
+ StorageDead(_2);
+ StorageLive(_9);
+ _0 = const ();
+ StorageDead(_9);
+ goto -> bb8;
+ }
+
+ bb4: {
+ StorageDead(_2);
+ StorageLive(_5);
+ StorageLive(_4);
+ _4 = _1;
+ _5 = get_bool(move _4) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ switchInt(move _5) -> [0: bb6, otherwise: bb7];
+ }
+
+ bb6: {
+ StorageDead(_4);
+ _6 = const ();
+ StorageDead(_5);
+ StorageDead(_3);
+ goto -> bb1;
+ }
+
+ bb7: {
+ StorageDead(_4);
+ _0 = const ();
+ StorageDead(_5);
+ goto -> bb8;
+ }
+
+ bb8: {
+ StorageDead(_3);
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 000000000..1bb720748
--- /dev/null
+++ b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,70 @@
+// MIR for `while_loop` after PreCodegen
+
+fn while_loop(_1: bool) -> () {
+ debug c => _1;
+ let mut _0: ();
+ let mut _2: bool;
+ let mut _3: bool;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: ();
+ let mut _7: !;
+ let mut _8: !;
+ let _9: ();
+ let mut _10: !;
+
+ bb0: {
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageLive(_3);
+ StorageLive(_2);
+ _2 = _1;
+ _3 = get_bool(move _2) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ switchInt(move _3) -> [0: bb3, otherwise: bb4];
+ }
+
+ bb3: {
+ StorageDead(_2);
+ StorageLive(_9);
+ _0 = const ();
+ StorageDead(_9);
+ goto -> bb8;
+ }
+
+ bb4: {
+ StorageDead(_2);
+ StorageLive(_5);
+ StorageLive(_4);
+ _4 = _1;
+ _5 = get_bool(move _4) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ switchInt(move _5) -> [0: bb6, otherwise: bb7];
+ }
+
+ bb6: {
+ StorageDead(_4);
+ _6 = const ();
+ StorageDead(_5);
+ StorageDead(_3);
+ goto -> bb1;
+ }
+
+ bb7: {
+ StorageDead(_4);
+ _0 = const ();
+ StorageDead(_5);
+ goto -> bb8;
+ }
+
+ bb8: {
+ StorageDead(_3);
+ return;
+ }
+}
diff --git a/tests/mir-opt/byte_slice.main.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/byte_slice.main.SimplifyCfg-elaborate-drops.after.mir
index 73f5655a1..09a65e6e6 100644
--- a/tests/mir-opt/byte_slice.main.SimplifyCfg-elaborate-drops.after.mir
+++ b/tests/mir-opt/byte_slice.main.SimplifyCfg-elaborate-drops.after.mir
@@ -1,31 +1,28 @@
// MIR for `main` after SimplifyCfg-elaborate-drops
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/byte_slice.rs:+0:11: +0:11
- let _1: &[u8; 3]; // in scope 0 at $DIR/byte_slice.rs:+1:9: +1:10
+ let mut _0: ();
+ let _1: &[u8; 3];
scope 1 {
- debug x => _1; // in scope 1 at $DIR/byte_slice.rs:+1:9: +1:10
- let _2: [u8; 2]; // in scope 1 at $DIR/byte_slice.rs:+2:9: +2:10
+ debug x => _1;
+ let _2: [u8; 2];
scope 2 {
- debug y => _2; // in scope 2 at $DIR/byte_slice.rs:+2:9: +2:10
+ debug y => _2;
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/byte_slice.rs:+1:9: +1:10
- _1 = const b"foo"; // scope 0 at $DIR/byte_slice.rs:+1:13: +1:19
- // mir::Constant
- // + span: $DIR/byte_slice.rs:5:13: 5:19
- // + literal: Const { ty: &[u8; 3], val: Value(Scalar(alloc1)) }
- StorageLive(_2); // scope 1 at $DIR/byte_slice.rs:+2:9: +2:10
- _2 = [const 5_u8, const 120_u8]; // scope 1 at $DIR/byte_slice.rs:+2:13: +2:24
- _0 = const (); // scope 0 at $DIR/byte_slice.rs:+0:11: +3:2
- StorageDead(_2); // scope 1 at $DIR/byte_slice.rs:+3:1: +3:2
- StorageDead(_1); // scope 0 at $DIR/byte_slice.rs:+3:1: +3:2
- return; // scope 0 at $DIR/byte_slice.rs:+3:2: +3:2
+ StorageLive(_1);
+ _1 = const b"foo";
+ StorageLive(_2);
+ _2 = [const 5_u8, const 120_u8];
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
-alloc1 (size: 3, align: 1) {
+ALLOC0 (size: 3, align: 1) {
66 6f 6f │ foo
}
diff --git a/tests/mir-opt/byte_slice.rs b/tests/mir-opt/byte_slice.rs
index 48e9c48c1..813d9ccfd 100644
--- a/tests/mir-opt/byte_slice.rs
+++ b/tests/mir-opt/byte_slice.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z mir-opt-level=0
// EMIT_MIR byte_slice.main.SimplifyCfg-elaborate-drops.after.mir
diff --git a/tests/mir-opt/casts.redundant.InstSimplify.diff b/tests/mir-opt/casts.redundant.InstSimplify.diff
deleted file mode 100644
index a641b69de..000000000
--- a/tests/mir-opt/casts.redundant.InstSimplify.diff
+++ /dev/null
@@ -1,25 +0,0 @@
-- // MIR for `redundant` before InstSimplify
-+ // MIR for `redundant` after InstSimplify
-
- fn redundant(_1: *const &u8) -> *const &u8 {
- debug x => _1; // in scope 0 at $DIR/casts.rs:+0:30: +0:31
- let mut _0: *const &u8; // return place in scope 0 at $DIR/casts.rs:+0:51: +0:64
- let mut _2: *const &u8; // in scope 0 at $DIR/casts.rs:+1:5: +1:55
- let mut _3: *const &u8; // in scope 0 at $DIR/casts.rs:+1:36: +1:37
- scope 1 (inlined generic_cast::<&u8, &u8>) { // at $DIR/casts.rs:6:5: 6:38
- debug x => _3; // in scope 1 at $DIR/casts.rs:10:23: 10:24
- }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/casts.rs:+1:5: +1:55
- StorageLive(_3); // scope 0 at $DIR/casts.rs:+1:36: +1:37
- _3 = _1; // scope 0 at $DIR/casts.rs:+1:36: +1:37
-- _2 = _3 as *const &u8 (PtrToPtr); // scope 1 at $DIR/casts.rs:11:5: 11:18
-+ _2 = _3; // scope 1 at $DIR/casts.rs:11:5: 11:18
- StorageDead(_3); // scope 0 at $DIR/casts.rs:+1:37: +1:38
- _0 = _2; // scope 0 at $DIR/casts.rs:+1:5: +1:55
- StorageDead(_2); // scope 0 at $DIR/casts.rs:+2:1: +2:2
- return; // scope 0 at $DIR/casts.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/casts.redundant.PreCodegen.after.mir b/tests/mir-opt/casts.redundant.PreCodegen.after.mir
deleted file mode 100644
index 21a470ea3..000000000
--- a/tests/mir-opt/casts.redundant.PreCodegen.after.mir
+++ /dev/null
@@ -1,14 +0,0 @@
-// MIR for `redundant` after PreCodegen
-
-fn redundant(_1: *const &u8) -> *const &u8 {
- debug x => _1; // in scope 0 at $DIR/casts.rs:+0:30: +0:31
- let mut _0: *const &u8; // return place in scope 0 at $DIR/casts.rs:+0:51: +0:64
- scope 1 (inlined generic_cast::<&u8, &u8>) { // at $DIR/casts.rs:6:5: 6:38
- debug x => _1; // in scope 1 at $DIR/casts.rs:10:23: 10:24
- }
-
- bb0: {
- _0 = _1; // scope 0 at $DIR/casts.rs:+1:5: +1:55
- return; // scope 0 at $DIR/casts.rs:+2:2: +2:2
- }
-}
diff --git a/tests/mir-opt/casts.roundtrip.PreCodegen.after.mir b/tests/mir-opt/casts.roundtrip.PreCodegen.after.mir
deleted file mode 100644
index 0c793984c..000000000
--- a/tests/mir-opt/casts.roundtrip.PreCodegen.after.mir
+++ /dev/null
@@ -1,15 +0,0 @@
-// MIR for `roundtrip` after PreCodegen
-
-fn roundtrip(_1: *const u8) -> *const u8 {
- debug x => _1; // in scope 0 at $DIR/casts.rs:+0:18: +0:19
- let mut _0: *const u8; // return place in scope 0 at $DIR/casts.rs:+0:35: +0:44
- let mut _2: *mut u8; // in scope 0 at $DIR/casts.rs:+1:5: +1:17
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/casts.rs:+1:5: +1:17
- _2 = _1 as *mut u8 (PtrToPtr); // scope 0 at $DIR/casts.rs:+1:5: +1:17
- _0 = move _2 as *const u8 (Pointer(MutToConstPointer)); // scope 0 at $DIR/casts.rs:+1:5: +1:17
- StorageDead(_2); // scope 0 at $DIR/casts.rs:+1:16: +1:17
- return; // scope 0 at $DIR/casts.rs:+2:2: +2:2
- }
-}
diff --git a/tests/mir-opt/casts.rs b/tests/mir-opt/casts.rs
deleted file mode 100644
index 413b0e09d..000000000
--- a/tests/mir-opt/casts.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#![crate_type = "lib"]
-
-// EMIT_MIR casts.redundant.InstSimplify.diff
-// EMIT_MIR casts.redundant.PreCodegen.after.mir
-pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 {
- generic_cast::<&'a u8, &'b u8>(x) as *const &'a u8
-}
-
-#[inline]
-fn generic_cast<T, U>(x: *const T) -> *const U {
- x as *const U
-}
-
-// EMIT_MIR casts.roundtrip.PreCodegen.after.mir
-pub fn roundtrip(x: *const u8) -> *const u8 {
- x as *mut u8 as *const u8
-}
diff --git a/tests/mir-opt/combine_array_len.norm2.InstSimplify.diff b/tests/mir-opt/combine_array_len.norm2.InstSimplify.diff
deleted file mode 100644
index 0777007ce..000000000
--- a/tests/mir-opt/combine_array_len.norm2.InstSimplify.diff
+++ /dev/null
@@ -1,77 +0,0 @@
-- // MIR for `norm2` before InstSimplify
-+ // MIR for `norm2` after InstSimplify
-
- fn norm2(_1: [f32; 2]) -> f32 {
- debug x => _1; // in scope 0 at $DIR/combine_array_len.rs:+0:10: +0:11
- let mut _0: f32; // return place in scope 0 at $DIR/combine_array_len.rs:+0:26: +0:29
- let _2: f32; // in scope 0 at $DIR/combine_array_len.rs:+1:9: +1:10
- let _3: usize; // in scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16
- let mut _4: usize; // in scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
- let mut _5: bool; // in scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
- let _7: usize; // in scope 0 at $DIR/combine_array_len.rs:+2:15: +2:16
- let mut _8: usize; // in scope 0 at $DIR/combine_array_len.rs:+2:13: +2:17
- let mut _9: bool; // in scope 0 at $DIR/combine_array_len.rs:+2:13: +2:17
- let mut _10: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:5: +3:8
- let mut _11: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:5: +3:6
- let mut _12: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:7: +3:8
- let mut _13: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:11: +3:14
- let mut _14: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:11: +3:12
- let mut _15: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:13: +3:14
- scope 1 {
- debug a => _2; // in scope 1 at $DIR/combine_array_len.rs:+1:9: +1:10
- let _6: f32; // in scope 1 at $DIR/combine_array_len.rs:+2:9: +2:10
- scope 2 {
- debug b => _6; // in scope 2 at $DIR/combine_array_len.rs:+2:9: +2:10
- }
- }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/combine_array_len.rs:+1:9: +1:10
- StorageLive(_3); // scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16
- _3 = const 0_usize; // scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16
-- _4 = Len(_1); // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
-+ _4 = const 2_usize; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
- _5 = Lt(_3, _4); // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
- }
-
- bb1: {
- _2 = _1[_3]; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
- StorageDead(_3); // scope 0 at $DIR/combine_array_len.rs:+1:17: +1:18
- StorageLive(_6); // scope 1 at $DIR/combine_array_len.rs:+2:9: +2:10
- StorageLive(_7); // scope 1 at $DIR/combine_array_len.rs:+2:15: +2:16
- _7 = const 1_usize; // scope 1 at $DIR/combine_array_len.rs:+2:15: +2:16
-- _8 = Len(_1); // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17
-+ _8 = const 2_usize; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17
- _9 = Lt(_7, _8); // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17
- assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb2; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17
- }
-
- bb2: {
- _6 = _1[_7]; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17
- StorageDead(_7); // scope 1 at $DIR/combine_array_len.rs:+2:17: +2:18
- StorageLive(_10); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:8
- StorageLive(_11); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:6
- _11 = _2; // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:6
- StorageLive(_12); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8
- _12 = _2; // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8
- _10 = Mul(move _11, move _12); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:8
- StorageDead(_12); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8
- StorageDead(_11); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8
- StorageLive(_13); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:14
- StorageLive(_14); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:12
- _14 = _6; // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:12
- StorageLive(_15); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
- _15 = _6; // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
- _13 = Mul(move _14, move _15); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:14
- StorageDead(_15); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
- StorageDead(_14); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
- _0 = Add(move _10, move _13); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:14
- StorageDead(_13); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
- StorageDead(_10); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
- StorageDead(_6); // scope 1 at $DIR/combine_array_len.rs:+4:1: +4:2
- StorageDead(_2); // scope 0 at $DIR/combine_array_len.rs:+4:1: +4:2
- return; // scope 0 at $DIR/combine_array_len.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff
deleted file mode 100644
index bb0811a7a..000000000
--- a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff
+++ /dev/null
@@ -1,82 +0,0 @@
-- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone` before InstSimplify
-+ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone` after InstSimplify
-
- fn <impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone(_1: &MyThing<T>) -> MyThing<T> {
- debug self => _1; // in scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15
- let mut _0: MyThing<T>; // return place in scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15
- let mut _2: T; // in scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
- let mut _3: &T; // in scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
- let _4: &T; // in scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
- let mut _5: u64; // in scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
- let mut _6: &u64; // in scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
- let _7: &u64; // in scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
- let mut _8: [f32; 3]; // in scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
- let mut _9: &[f32; 3]; // in scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
- let _10: &[f32; 3]; // in scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
- StorageLive(_3); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
- StorageLive(_4); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
- _4 = &((*_1).0: T); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
-- _3 = &(*_4); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
-+ _3 = _4; // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
- _2 = <T as Clone>::clone(move _3) -> bb1; // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
- // mir::Constant
- // + span: $DIR/combine_clone_of_primitives.rs:8:5: 8:9
- // + literal: Const { ty: for<'a> fn(&'a T) -> T {<T as Clone>::clone}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_3); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:8: 8:9
- StorageLive(_5); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
- StorageLive(_6); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
- StorageLive(_7); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
- _7 = &((*_1).1: u64); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
-- _6 = &(*_7); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
-- _5 = <u64 as Clone>::clone(move _6) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
-- // mir::Constant
-- // + span: $DIR/combine_clone_of_primitives.rs:9:5: 9:11
-- // + literal: Const { ty: for<'a> fn(&'a u64) -> u64 {<u64 as Clone>::clone}, val: Value(<ZST>) }
-+ _6 = _7; // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
-+ _5 = (*_6); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
-+ goto -> bb2; // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
- }
-
- bb2: {
- StorageDead(_6); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:10: 9:11
- StorageLive(_8); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
- StorageLive(_9); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
- StorageLive(_10); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
- _10 = &((*_1).2: [f32; 3]); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
-- _9 = &(*_10); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
-- _8 = <[f32; 3] as Clone>::clone(move _9) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
-- // mir::Constant
-- // + span: $DIR/combine_clone_of_primitives.rs:10:5: 10:16
-- // + literal: Const { ty: for<'a> fn(&'a [f32; 3]) -> [f32; 3] {<[f32; 3] as Clone>::clone}, val: Value(<ZST>) }
-+ _9 = _10; // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
-+ _8 = (*_9); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
-+ goto -> bb3; // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
- }
-
- bb3: {
- StorageDead(_9); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:15: 10:16
- _0 = MyThing::<T> { v: move _2, i: move _5, a: move _8 }; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15
- StorageDead(_8); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15
- StorageDead(_5); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15
- StorageDead(_2); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15
- StorageDead(_10); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15
- StorageDead(_7); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15
- StorageDead(_4); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15
- return; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:15: +0:15
- }
-
- bb4 (cleanup): {
- drop(_2) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15
- }
-
- bb5 (cleanup): {
- resume; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15
- }
- }
-
diff --git a/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff b/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff
deleted file mode 100644
index 15117ea89..000000000
--- a/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff
+++ /dev/null
@@ -1,90 +0,0 @@
-- // MIR for `adt_transmutes` before InstSimplify
-+ // MIR for `adt_transmutes` after InstSimplify
-
- fn adt_transmutes() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:32: +0:32
- let _1: u8; // in scope 0 at $DIR/combine_transmutes.rs:+1:9: +1:11
- let mut _2: std::option::Option<std::num::NonZeroU8>; // in scope 0 at $DIR/combine_transmutes.rs:+1:28: +1:58
- let mut _4: std::num::Wrapping<i16>; // in scope 0 at $DIR/combine_transmutes.rs:+2:29: +2:54
- let mut _6: std::num::Wrapping<i16>; // in scope 0 at $DIR/combine_transmutes.rs:+3:29: +3:54
- let mut _8: Union32; // in scope 0 at $DIR/combine_transmutes.rs:+4:29: +4:47
- let mut _10: Union32; // in scope 0 at $DIR/combine_transmutes.rs:+5:29: +5:47
- let mut _12: std::mem::MaybeUninit<std::string::String>; // in scope 0 at $DIR/combine_transmutes.rs:+6:46: +6:77
- scope 1 {
- debug _a => _1; // in scope 1 at $DIR/combine_transmutes.rs:+1:9: +1:11
- let _3: i16; // in scope 1 at $DIR/combine_transmutes.rs:+2:9: +2:11
- scope 2 {
- debug _a => _3; // in scope 2 at $DIR/combine_transmutes.rs:+2:9: +2:11
- let _5: u16; // in scope 2 at $DIR/combine_transmutes.rs:+3:9: +3:11
- scope 3 {
- debug _a => _5; // in scope 3 at $DIR/combine_transmutes.rs:+3:9: +3:11
- let _7: u32; // in scope 3 at $DIR/combine_transmutes.rs:+4:9: +4:11
- scope 4 {
- debug _a => _7; // in scope 4 at $DIR/combine_transmutes.rs:+4:9: +4:11
- let _9: i32; // in scope 4 at $DIR/combine_transmutes.rs:+5:9: +5:11
- scope 5 {
- debug _a => _9; // in scope 5 at $DIR/combine_transmutes.rs:+5:9: +5:11
- let _11: std::mem::ManuallyDrop<std::string::String>; // in scope 5 at $DIR/combine_transmutes.rs:+6:9: +6:11
- scope 6 {
- debug _a => _11; // in scope 6 at $DIR/combine_transmutes.rs:+6:9: +6:11
- }
- }
- }
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/combine_transmutes.rs:+1:9: +1:11
- StorageLive(_2); // scope 0 at $DIR/combine_transmutes.rs:+1:28: +1:58
- _2 = Option::<NonZeroU8>::Some(const _); // scope 0 at $DIR/combine_transmutes.rs:+1:28: +1:58
- // mir::Constant
- // + span: $DIR/combine_transmutes.rs:35:33: 35:57
- // + literal: Const { ty: NonZeroU8, val: Unevaluated(NonZeroU8::MAX, [], None) }
- _1 = move _2 as u8 (Transmute); // scope 0 at $DIR/combine_transmutes.rs:+1:18: +1:59
- StorageDead(_2); // scope 0 at $DIR/combine_transmutes.rs:+1:58: +1:59
- StorageLive(_3); // scope 1 at $DIR/combine_transmutes.rs:+2:9: +2:11
- StorageLive(_4); // scope 1 at $DIR/combine_transmutes.rs:+2:29: +2:54
- _4 = Wrapping::<i16>(const 0_i16); // scope 1 at $DIR/combine_transmutes.rs:+2:29: +2:54
-- _3 = move _4 as i16 (Transmute); // scope 1 at $DIR/combine_transmutes.rs:+2:19: +2:55
-+ _3 = move (_4.0: i16); // scope 1 at $DIR/combine_transmutes.rs:+2:19: +2:55
- StorageDead(_4); // scope 1 at $DIR/combine_transmutes.rs:+2:54: +2:55
- StorageLive(_5); // scope 2 at $DIR/combine_transmutes.rs:+3:9: +3:11
- StorageLive(_6); // scope 2 at $DIR/combine_transmutes.rs:+3:29: +3:54
- _6 = Wrapping::<i16>(const 0_i16); // scope 2 at $DIR/combine_transmutes.rs:+3:29: +3:54
- _5 = move _6 as u16 (Transmute); // scope 2 at $DIR/combine_transmutes.rs:+3:19: +3:55
- StorageDead(_6); // scope 2 at $DIR/combine_transmutes.rs:+3:54: +3:55
- StorageLive(_7); // scope 3 at $DIR/combine_transmutes.rs:+4:9: +4:11
- StorageLive(_8); // scope 3 at $DIR/combine_transmutes.rs:+4:29: +4:47
- _8 = Union32 { u32: const 0_i32 }; // scope 3 at $DIR/combine_transmutes.rs:+4:29: +4:47
- _7 = move _8 as u32 (Transmute); // scope 3 at $DIR/combine_transmutes.rs:+4:19: +4:48
- StorageDead(_8); // scope 3 at $DIR/combine_transmutes.rs:+4:47: +4:48
- StorageLive(_9); // scope 4 at $DIR/combine_transmutes.rs:+5:9: +5:11
- StorageLive(_10); // scope 4 at $DIR/combine_transmutes.rs:+5:29: +5:47
- _10 = Union32 { u32: const 0_u32 }; // scope 4 at $DIR/combine_transmutes.rs:+5:29: +5:47
- _9 = move _10 as i32 (Transmute); // scope 4 at $DIR/combine_transmutes.rs:+5:19: +5:48
- StorageDead(_10); // scope 4 at $DIR/combine_transmutes.rs:+5:47: +5:48
- StorageLive(_11); // scope 5 at $DIR/combine_transmutes.rs:+6:9: +6:11
- StorageLive(_12); // scope 5 at $DIR/combine_transmutes.rs:+6:46: +6:77
- _12 = MaybeUninit::<String>::uninit() -> [return: bb1, unwind unreachable]; // scope 5 at $DIR/combine_transmutes.rs:+6:46: +6:77
- // mir::Constant
- // + span: $DIR/combine_transmutes.rs:40:46: 40:75
- // + user_ty: UserType(11)
- // + literal: Const { ty: fn() -> MaybeUninit<String> {MaybeUninit::<String>::uninit}, val: Value(<ZST>) }
- }
-
- bb1: {
-- _11 = move _12 as std::mem::ManuallyDrop<std::string::String> (Transmute); // scope 5 at $DIR/combine_transmutes.rs:+6:36: +6:78
-+ _11 = move (_12.1: std::mem::ManuallyDrop<std::string::String>); // scope 5 at $DIR/combine_transmutes.rs:+6:36: +6:78
- StorageDead(_12); // scope 5 at $DIR/combine_transmutes.rs:+6:77: +6:78
- _0 = const (); // scope 0 at $DIR/combine_transmutes.rs:+0:32: +7:2
- StorageDead(_11); // scope 5 at $DIR/combine_transmutes.rs:+7:1: +7:2
- StorageDead(_9); // scope 4 at $DIR/combine_transmutes.rs:+7:1: +7:2
- StorageDead(_7); // scope 3 at $DIR/combine_transmutes.rs:+7:1: +7:2
- StorageDead(_5); // scope 2 at $DIR/combine_transmutes.rs:+7:1: +7:2
- StorageDead(_3); // scope 1 at $DIR/combine_transmutes.rs:+7:1: +7:2
- StorageDead(_1); // scope 0 at $DIR/combine_transmutes.rs:+7:1: +7:2
- return; // scope 0 at $DIR/combine_transmutes.rs:+7:2: +7:2
- }
- }
-
diff --git a/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff b/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff
deleted file mode 100644
index 57d9f4b14..000000000
--- a/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff
+++ /dev/null
@@ -1,43 +0,0 @@
-- // MIR for `identity_transmutes` before InstSimplify
-+ // MIR for `identity_transmutes` after InstSimplify
-
- fn identity_transmutes() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:37: +0:37
- let _1: i32; // in scope 0 at $DIR/combine_transmutes.rs:+2:9: +2:11
- let mut _3: std::vec::Vec<i32>; // in scope 0 at $DIR/combine_transmutes.rs:+3:46: +3:56
- scope 1 {
- debug _a => _1; // in scope 1 at $DIR/combine_transmutes.rs:+2:9: +2:11
- let _2: std::vec::Vec<i32>; // in scope 1 at $DIR/combine_transmutes.rs:+3:9: +3:11
- scope 2 {
- debug _a => _2; // in scope 2 at $DIR/combine_transmutes.rs:+3:9: +3:11
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/combine_transmutes.rs:+2:9: +2:11
-- _1 = const 1_i32 as i32 (Transmute); // scope 0 at $DIR/combine_transmutes.rs:+2:14: +2:38
-+ _1 = const 1_i32; // scope 0 at $DIR/combine_transmutes.rs:+2:14: +2:38
- StorageLive(_2); // scope 1 at $DIR/combine_transmutes.rs:+3:9: +3:11
- StorageLive(_3); // scope 1 at $DIR/combine_transmutes.rs:+3:46: +3:56
- _3 = Vec::<i32>::new() -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/combine_transmutes.rs:+3:46: +3:56
- // mir::Constant
- // + span: $DIR/combine_transmutes.rs:15:46: 15:54
- // + user_ty: UserType(0)
- // + literal: Const { ty: fn() -> Vec<i32> {Vec::<i32>::new}, val: Value(<ZST>) }
- }
-
- bb1: {
-- _2 = move _3 as std::vec::Vec<i32> (Transmute); // scope 1 at $DIR/combine_transmutes.rs:+3:14: +3:57
-+ _2 = move _3; // scope 1 at $DIR/combine_transmutes.rs:+3:14: +3:57
- StorageDead(_3); // scope 1 at $DIR/combine_transmutes.rs:+3:56: +3:57
- _0 = const (); // scope 0 at $DIR/combine_transmutes.rs:+0:37: +4:2
- drop(_2) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/combine_transmutes.rs:+4:1: +4:2
- }
-
- bb2: {
- StorageDead(_2); // scope 1 at $DIR/combine_transmutes.rs:+4:1: +4:2
- StorageDead(_1); // scope 0 at $DIR/combine_transmutes.rs:+4:1: +4:2
- return; // scope 0 at $DIR/combine_transmutes.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff b/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff
deleted file mode 100644
index ec7c982c1..000000000
--- a/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff
+++ /dev/null
@@ -1,24 +0,0 @@
-- // MIR for `integer_transmutes` before InstSimplify
-+ // MIR for `integer_transmutes` after InstSimplify
-
- fn integer_transmutes() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:36: +0:36
- let mut _1: u32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _2: i64; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _3: i64; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _4: u32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _5: usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-
- bb0: {
-- _1 = const 1_i32 as u32 (Transmute); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-+ _1 = const 1_i32 as u32 (IntToInt); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _2 = const 1_i32 as i64 (Transmute); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-- _3 = const 1_u64 as i64 (Transmute); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-+ _3 = const 1_u64 as i64 (IntToInt); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _4 = const 1_u64 as u32 (Transmute); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-- _5 = const 1_isize as usize (Transmute); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-+ _5 = const 1_isize as usize (IntToInt); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- return; // scope 0 at $DIR/combine_transmutes.rs:+8:13: +8:21
- }
- }
-
diff --git a/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir
index 169e99dee..9cc4c7c4d 100644
--- a/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir
+++ b/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir
@@ -1,62 +1,59 @@
// MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/const_allocation.rs:+0:11: +0:11
- let _1: &[(std::option::Option<i32>, &[&str])]; // in scope 0 at $DIR/const_allocation.rs:+1:5: +1:8
- let mut _2: &&[(std::option::Option<i32>, &[&str])]; // in scope 0 at $DIR/const_allocation.rs:+1:5: +1:8
+ let mut _0: ();
+ let _1: &[(std::option::Option<i32>, &[&str])];
+ let mut _2: &&[(std::option::Option<i32>, &[&str])];
bb0: {
- StorageLive(_1); // scope 0 at $DIR/const_allocation.rs:+1:5: +1:8
- StorageLive(_2); // scope 0 at $DIR/const_allocation.rs:+1:5: +1:8
- _2 = const {alloc1: &&[(Option<i32>, &[&str])]}; // scope 0 at $DIR/const_allocation.rs:+1:5: +1:8
- // mir::Constant
- // + span: $DIR/const_allocation.rs:9:5: 9:8
- // + literal: Const { ty: &&[(Option<i32>, &[&str])], val: Value(Scalar(alloc1)) }
- _1 = (*_2); // scope 0 at $DIR/const_allocation.rs:+1:5: +1:8
- StorageDead(_2); // scope 0 at $DIR/const_allocation.rs:+1:8: +1:9
- StorageDead(_1); // scope 0 at $DIR/const_allocation.rs:+1:8: +1:9
- _0 = const (); // scope 0 at $DIR/const_allocation.rs:+0:11: +2:2
- return; // scope 0 at $DIR/const_allocation.rs:+2:2: +2:2
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const {ALLOC9: &&[(Option<i32>, &[&str])]};
+ _1 = (*_2);
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
}
}
-alloc1 (static: FOO, size: 8, align: 4) {
- ╾─alloc19─╼ 03 00 00 00 │ ╾──╼....
+ALLOC9 (static: FOO, size: 8, align: 4) {
+ ╾ALLOC0<imm>╼ 03 00 00 00 │ ╾──╼....
}
-alloc19 (size: 48, align: 4) {
- 0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc6──╼ 00 00 00 00 │ ....░░░░╾──╼....
- 0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc9──╼ 02 00 00 00 │ ....░░░░╾──╼....
- 0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc14─╼ 03 00 00 00 │ ....*...╾──╼....
+ALLOC0 (size: 48, align: 4) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC1<imm>╼ 00 00 00 00 │ ....░░░░╾──╼....
+ 0x10 │ 00 00 00 00 __ __ __ __ ╾ALLOC2<imm>╼ 02 00 00 00 │ ....░░░░╾──╼....
+ 0x20 │ 01 00 00 00 2a 00 00 00 ╾ALLOC3<imm>╼ 03 00 00 00 │ ....*...╾──╼....
}
-alloc6 (size: 0, align: 4) {}
+ALLOC1 (size: 0, align: 4) {}
-alloc9 (size: 16, align: 4) {
- ╾─alloc10─╼ 03 00 00 00 ╾─alloc11─╼ 03 00 00 00 │ ╾──╼....╾──╼....
+ALLOC2 (size: 16, align: 4) {
+ ╾ALLOC4<imm>╼ 03 00 00 00 ╾ALLOC5<imm>╼ 03 00 00 00 │ ╾──╼....╾──╼....
}
-alloc10 (size: 3, align: 1) {
+ALLOC4 (size: 3, align: 1) {
66 6f 6f │ foo
}
-alloc11 (size: 3, align: 1) {
+ALLOC5 (size: 3, align: 1) {
62 61 72 │ bar
}
-alloc14 (size: 24, align: 4) {
- 0x00 │ ╾─alloc15─╼ 03 00 00 00 ╾─alloc16─╼ 03 00 00 00 │ ╾──╼....╾──╼....
- 0x10 │ ╾─alloc17─╼ 04 00 00 00 │ ╾──╼....
+ALLOC3 (size: 24, align: 4) {
+ 0x00 │ ╾ALLOC6<imm>╼ 03 00 00 00 ╾ALLOC7<imm>╼ 03 00 00 00 │ ╾──╼....╾──╼....
+ 0x10 │ ╾ALLOC8<imm>╼ 04 00 00 00 │ ╾──╼....
}
-alloc15 (size: 3, align: 1) {
+ALLOC6 (size: 3, align: 1) {
6d 65 68 │ meh
}
-alloc16 (size: 3, align: 1) {
+ALLOC7 (size: 3, align: 1) {
6d 6f 70 │ mop
}
-alloc17 (size: 4, align: 1) {
+ALLOC8 (size: 4, align: 1) {
6d c3 b6 70 │ m..p
}
diff --git a/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir
index db1f96488..faa9d20f2 100644
--- a/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir
+++ b/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir
@@ -1,66 +1,63 @@
// MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/const_allocation.rs:+0:11: +0:11
- let _1: &[(std::option::Option<i32>, &[&str])]; // in scope 0 at $DIR/const_allocation.rs:+1:5: +1:8
- let mut _2: &&[(std::option::Option<i32>, &[&str])]; // in scope 0 at $DIR/const_allocation.rs:+1:5: +1:8
+ let mut _0: ();
+ let _1: &[(std::option::Option<i32>, &[&str])];
+ let mut _2: &&[(std::option::Option<i32>, &[&str])];
bb0: {
- StorageLive(_1); // scope 0 at $DIR/const_allocation.rs:+1:5: +1:8
- StorageLive(_2); // scope 0 at $DIR/const_allocation.rs:+1:5: +1:8
- _2 = const {alloc1: &&[(Option<i32>, &[&str])]}; // scope 0 at $DIR/const_allocation.rs:+1:5: +1:8
- // mir::Constant
- // + span: $DIR/const_allocation.rs:9:5: 9:8
- // + literal: Const { ty: &&[(Option<i32>, &[&str])], val: Value(Scalar(alloc1)) }
- _1 = (*_2); // scope 0 at $DIR/const_allocation.rs:+1:5: +1:8
- StorageDead(_2); // scope 0 at $DIR/const_allocation.rs:+1:8: +1:9
- StorageDead(_1); // scope 0 at $DIR/const_allocation.rs:+1:8: +1:9
- _0 = const (); // scope 0 at $DIR/const_allocation.rs:+0:11: +2:2
- return; // scope 0 at $DIR/const_allocation.rs:+2:2: +2:2
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const {ALLOC9: &&[(Option<i32>, &[&str])]};
+ _1 = (*_2);
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
}
}
-alloc1 (static: FOO, size: 16, align: 8) {
- ╾───────alloc19───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ALLOC9 (static: FOO, size: 16, align: 8) {
+ ╾ALLOC0<imm>╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
}
-alloc19 (size: 72, align: 8) {
- 0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc6────────╼ │ ....░░░░╾──────╼
+ALLOC0 (size: 72, align: 8) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC1<imm>╼ │ ....░░░░╾──────╼
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
- 0x20 │ ╾───────alloc9────────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc14───────╼ │ ....*...╾──────╼
+ 0x20 │ ╾ALLOC2<imm>╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x30 │ 01 00 00 00 2a 00 00 00 ╾ALLOC3<imm>╼ │ ....*...╾──────╼
0x40 │ 03 00 00 00 00 00 00 00 │ ........
}
-alloc6 (size: 0, align: 8) {}
+ALLOC1 (size: 0, align: 8) {}
-alloc9 (size: 32, align: 8) {
- 0x00 │ ╾───────alloc10───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x10 │ ╾───────alloc11───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ALLOC2 (size: 32, align: 8) {
+ 0x00 │ ╾ALLOC4<imm>╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x10 │ ╾ALLOC5<imm>╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
}
-alloc10 (size: 3, align: 1) {
+ALLOC4 (size: 3, align: 1) {
66 6f 6f │ foo
}
-alloc11 (size: 3, align: 1) {
+ALLOC5 (size: 3, align: 1) {
62 61 72 │ bar
}
-alloc14 (size: 48, align: 8) {
- 0x00 │ ╾───────alloc15───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x10 │ ╾───────alloc16───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x20 │ ╾───────alloc17───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
+ALLOC3 (size: 48, align: 8) {
+ 0x00 │ ╾ALLOC6<imm>╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x10 │ ╾ALLOC7<imm>╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x20 │ ╾ALLOC8<imm>╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
}
-alloc15 (size: 3, align: 1) {
+ALLOC6 (size: 3, align: 1) {
6d 65 68 │ meh
}
-alloc16 (size: 3, align: 1) {
+ALLOC7 (size: 3, align: 1) {
6d 6f 70 │ mop
}
-alloc17 (size: 4, align: 1) {
+ALLOC8 (size: 4, align: 1) {
6d c3 b6 70 │ m..p
}
diff --git a/tests/mir-opt/const_allocation.rs b/tests/mir-opt/const_allocation.rs
index 91a2455eb..577c61aeb 100644
--- a/tests/mir-opt/const_allocation.rs
+++ b/tests/mir-opt/const_allocation.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir
index 999acb48a..898835b46 100644
--- a/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir
+++ b/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir
@@ -1,61 +1,58 @@
// MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/const_allocation2.rs:+0:11: +0:11
- let _1: &[(std::option::Option<i32>, &[&u8])]; // in scope 0 at $DIR/const_allocation2.rs:+1:5: +1:8
- let mut _2: &&[(std::option::Option<i32>, &[&u8])]; // in scope 0 at $DIR/const_allocation2.rs:+1:5: +1:8
+ let mut _0: ();
+ let _1: &[(std::option::Option<i32>, &[&u8])];
+ let mut _2: &&[(std::option::Option<i32>, &[&u8])];
bb0: {
- StorageLive(_1); // scope 0 at $DIR/const_allocation2.rs:+1:5: +1:8
- StorageLive(_2); // scope 0 at $DIR/const_allocation2.rs:+1:5: +1:8
- _2 = const {alloc1: &&[(Option<i32>, &[&u8])]}; // scope 0 at $DIR/const_allocation2.rs:+1:5: +1:8
- // mir::Constant
- // + span: $DIR/const_allocation2.rs:6:5: 6:8
- // + literal: Const { ty: &&[(Option<i32>, &[&u8])], val: Value(Scalar(alloc1)) }
- _1 = (*_2); // scope 0 at $DIR/const_allocation2.rs:+1:5: +1:8
- StorageDead(_2); // scope 0 at $DIR/const_allocation2.rs:+1:8: +1:9
- StorageDead(_1); // scope 0 at $DIR/const_allocation2.rs:+1:8: +1:9
- _0 = const (); // scope 0 at $DIR/const_allocation2.rs:+0:11: +2:2
- return; // scope 0 at $DIR/const_allocation2.rs:+2:2: +2:2
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const {ALLOC9: &&[(Option<i32>, &[&u8])]};
+ _1 = (*_2);
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
}
}
-alloc1 (static: FOO, size: 8, align: 4) {
- ╾─alloc23─╼ 03 00 00 00 │ ╾──╼....
+ALLOC9 (static: FOO, size: 8, align: 4) {
+ ╾ALLOC0<imm>╼ 03 00 00 00 │ ╾──╼....
}
-alloc23 (size: 48, align: 4) {
- 0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc10─╼ 00 00 00 00 │ ....░░░░╾──╼....
- 0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc15─╼ 02 00 00 00 │ ....░░░░╾──╼....
- 0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc21─╼ 03 00 00 00 │ ....*...╾──╼....
+ALLOC0 (size: 48, align: 4) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC1<imm>╼ 00 00 00 00 │ ....░░░░╾──╼....
+ 0x10 │ 00 00 00 00 __ __ __ __ ╾ALLOC2<imm>╼ 02 00 00 00 │ ....░░░░╾──╼....
+ 0x20 │ 01 00 00 00 2a 00 00 00 ╾ALLOC3<imm>╼ 03 00 00 00 │ ....*...╾──╼....
}
-alloc10 (size: 0, align: 4) {}
+ALLOC1 (size: 0, align: 4) {}
-alloc15 (size: 8, align: 4) {
- ╾─alloc13─╼ ╾─alloc14─╼ │ ╾──╼╾──╼
+ALLOC2 (size: 8, align: 4) {
+ ╾ALLOC4<imm>╼ ╾ALLOC5<imm>╼ │ ╾──╼╾──╼
}
-alloc13 (size: 1, align: 1) {
+ALLOC4 (size: 1, align: 1) {
05 │ .
}
-alloc14 (size: 1, align: 1) {
+ALLOC5 (size: 1, align: 1) {
06 │ .
}
-alloc21 (size: 12, align: 4) {
- ╾─a18+0x3─╼ ╾─alloc19─╼ ╾─a20+0x2─╼ │ ╾──╼╾──╼╾──╼
+ALLOC3 (size: 12, align: 4) {
+ ╾ALLOC6+0x3<imm>╼ ╾ALLOC7<imm>╼ ╾ALLOC8+0x2<imm>╼ │ ╾──╼╾──╼╾──╼
}
-alloc18 (size: 4, align: 1) {
+ALLOC6 (size: 4, align: 1) {
2a 45 15 6f │ *E.o
}
-alloc19 (size: 1, align: 1) {
+ALLOC7 (size: 1, align: 1) {
2a │ *
}
-alloc20 (size: 4, align: 1) {
+ALLOC8 (size: 4, align: 1) {
2a 45 15 6f │ *E.o
}
diff --git a/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir
index 30311890e..f5352c2ae 100644
--- a/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir
+++ b/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir
@@ -1,64 +1,61 @@
// MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/const_allocation2.rs:+0:11: +0:11
- let _1: &[(std::option::Option<i32>, &[&u8])]; // in scope 0 at $DIR/const_allocation2.rs:+1:5: +1:8
- let mut _2: &&[(std::option::Option<i32>, &[&u8])]; // in scope 0 at $DIR/const_allocation2.rs:+1:5: +1:8
+ let mut _0: ();
+ let _1: &[(std::option::Option<i32>, &[&u8])];
+ let mut _2: &&[(std::option::Option<i32>, &[&u8])];
bb0: {
- StorageLive(_1); // scope 0 at $DIR/const_allocation2.rs:+1:5: +1:8
- StorageLive(_2); // scope 0 at $DIR/const_allocation2.rs:+1:5: +1:8
- _2 = const {alloc1: &&[(Option<i32>, &[&u8])]}; // scope 0 at $DIR/const_allocation2.rs:+1:5: +1:8
- // mir::Constant
- // + span: $DIR/const_allocation2.rs:6:5: 6:8
- // + literal: Const { ty: &&[(Option<i32>, &[&u8])], val: Value(Scalar(alloc1)) }
- _1 = (*_2); // scope 0 at $DIR/const_allocation2.rs:+1:5: +1:8
- StorageDead(_2); // scope 0 at $DIR/const_allocation2.rs:+1:8: +1:9
- StorageDead(_1); // scope 0 at $DIR/const_allocation2.rs:+1:8: +1:9
- _0 = const (); // scope 0 at $DIR/const_allocation2.rs:+0:11: +2:2
- return; // scope 0 at $DIR/const_allocation2.rs:+2:2: +2:2
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const {ALLOC9: &&[(Option<i32>, &[&u8])]};
+ _1 = (*_2);
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
}
}
-alloc1 (static: FOO, size: 16, align: 8) {
- ╾───────alloc23───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ALLOC9 (static: FOO, size: 16, align: 8) {
+ ╾ALLOC0<imm>╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
}
-alloc23 (size: 72, align: 8) {
- 0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc10───────╼ │ ....░░░░╾──────╼
+ALLOC0 (size: 72, align: 8) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC1<imm>╼ │ ....░░░░╾──────╼
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
- 0x20 │ ╾───────alloc15───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc21───────╼ │ ....*...╾──────╼
+ 0x20 │ ╾ALLOC2<imm>╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x30 │ 01 00 00 00 2a 00 00 00 ╾ALLOC3<imm>╼ │ ....*...╾──────╼
0x40 │ 03 00 00 00 00 00 00 00 │ ........
}
-alloc10 (size: 0, align: 8) {}
+ALLOC1 (size: 0, align: 8) {}
-alloc15 (size: 16, align: 8) {
- ╾───────alloc13───────╼ ╾───────alloc14───────╼ │ ╾──────╼╾──────╼
+ALLOC2 (size: 16, align: 8) {
+ ╾ALLOC4<imm>╼ ╾ALLOC5<imm>╼ │ ╾──────╼╾──────╼
}
-alloc13 (size: 1, align: 1) {
+ALLOC4 (size: 1, align: 1) {
05 │ .
}
-alloc14 (size: 1, align: 1) {
+ALLOC5 (size: 1, align: 1) {
06 │ .
}
-alloc21 (size: 24, align: 8) {
- 0x00 │ ╾─────alloc18+0x3─────╼ ╾───────alloc19───────╼ │ ╾──────╼╾──────╼
- 0x10 │ ╾─────alloc20+0x2─────╼ │ ╾──────╼
+ALLOC3 (size: 24, align: 8) {
+ 0x00 │ ╾ALLOC6+0x3<imm>╼ ╾ALLOC7<imm>╼ │ ╾──────╼╾──────╼
+ 0x10 │ ╾ALLOC8+0x2<imm>╼ │ ╾──────╼
}
-alloc18 (size: 4, align: 1) {
+ALLOC6 (size: 4, align: 1) {
2a 45 15 6f │ *E.o
}
-alloc19 (size: 1, align: 1) {
+ALLOC7 (size: 1, align: 1) {
2a │ *
}
-alloc20 (size: 4, align: 1) {
+ALLOC8 (size: 4, align: 1) {
2a 45 15 6f │ *E.o
}
diff --git a/tests/mir-opt/const_allocation2.rs b/tests/mir-opt/const_allocation2.rs
index f2870aa47..0fcfaad84 100644
--- a/tests/mir-opt/const_allocation2.rs
+++ b/tests/mir-opt/const_allocation2.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir
index d592e59fa..624047f5b 100644
--- a/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir
+++ b/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir
@@ -1,50 +1,47 @@
// MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/const_allocation3.rs:+0:11: +0:11
- let _1: &Packed; // in scope 0 at $DIR/const_allocation3.rs:+1:5: +1:8
- let mut _2: &&Packed; // in scope 0 at $DIR/const_allocation3.rs:+1:5: +1:8
+ let mut _0: ();
+ let _1: &Packed;
+ let mut _2: &&Packed;
bb0: {
- StorageLive(_1); // scope 0 at $DIR/const_allocation3.rs:+1:5: +1:8
- StorageLive(_2); // scope 0 at $DIR/const_allocation3.rs:+1:5: +1:8
- _2 = const {alloc1: &&Packed}; // scope 0 at $DIR/const_allocation3.rs:+1:5: +1:8
- // mir::Constant
- // + span: $DIR/const_allocation3.rs:6:5: 6:8
- // + literal: Const { ty: &&Packed, val: Value(Scalar(alloc1)) }
- _1 = (*_2); // scope 0 at $DIR/const_allocation3.rs:+1:5: +1:8
- StorageDead(_2); // scope 0 at $DIR/const_allocation3.rs:+1:8: +1:9
- StorageDead(_1); // scope 0 at $DIR/const_allocation3.rs:+1:8: +1:9
- _0 = const (); // scope 0 at $DIR/const_allocation3.rs:+0:11: +2:2
- return; // scope 0 at $DIR/const_allocation3.rs:+2:2: +2:2
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const {ALLOC4: &&Packed};
+ _1 = (*_2);
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
}
}
-alloc1 (static: FOO, size: 4, align: 4) {
- ╾─alloc12─╼ │ ╾──╼
+ALLOC4 (static: FOO, size: 4, align: 4) {
+ ╾ALLOC0<imm>╼ │ ╾──╼
}
-alloc12 (size: 168, align: 1) {
+ALLOC0 (size: 168, align: 1) {
0x00 │ ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab │ ................
- 0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾─alloc7──╼ │ ............╾──╼
+ 0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾ALLOC1<imm>╼ │ ............╾──╼
0x20 │ 01 ef cd ab 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x30 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x40 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x50 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x60 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x70 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
- 0x80 │ 00 00 00 00 00 00 00 00 00 00 ╾─alloc9──╼ 00 00 │ ..........╾──╼..
- 0x90 │ ╾a10+0x63─╼ 00 00 00 00 00 00 00 00 00 00 00 00 │ ╾──╼............
+ 0x80 │ 00 00 00 00 00 00 00 00 00 00 ╾ALLOC2╼ 00 00 │ ..........╾──╼..
+ 0x90 │ ╾ALLOC3+0x63<imm>╼ 00 00 00 00 00 00 00 00 00 00 00 00 │ ╾──╼............
0xa0 │ 00 00 00 00 00 00 00 00 │ ........
}
-alloc7 (size: 4, align: 4) {
+ALLOC1 (size: 4, align: 4) {
2a 00 00 00 │ *...
}
-alloc9 (fn: main)
+ALLOC2 (fn: main)
-alloc10 (size: 100, align: 1) {
+ALLOC3 (size: 100, align: 1) {
0x00 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x20 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
diff --git a/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir
index ca53b28be..cdd4758e1 100644
--- a/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir
+++ b/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir
@@ -1,32 +1,29 @@
// MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/const_allocation3.rs:+0:11: +0:11
- let _1: &Packed; // in scope 0 at $DIR/const_allocation3.rs:+1:5: +1:8
- let mut _2: &&Packed; // in scope 0 at $DIR/const_allocation3.rs:+1:5: +1:8
+ let mut _0: ();
+ let _1: &Packed;
+ let mut _2: &&Packed;
bb0: {
- StorageLive(_1); // scope 0 at $DIR/const_allocation3.rs:+1:5: +1:8
- StorageLive(_2); // scope 0 at $DIR/const_allocation3.rs:+1:5: +1:8
- _2 = const {alloc1: &&Packed}; // scope 0 at $DIR/const_allocation3.rs:+1:5: +1:8
- // mir::Constant
- // + span: $DIR/const_allocation3.rs:6:5: 6:8
- // + literal: Const { ty: &&Packed, val: Value(Scalar(alloc1)) }
- _1 = (*_2); // scope 0 at $DIR/const_allocation3.rs:+1:5: +1:8
- StorageDead(_2); // scope 0 at $DIR/const_allocation3.rs:+1:8: +1:9
- StorageDead(_1); // scope 0 at $DIR/const_allocation3.rs:+1:8: +1:9
- _0 = const (); // scope 0 at $DIR/const_allocation3.rs:+0:11: +2:2
- return; // scope 0 at $DIR/const_allocation3.rs:+2:2: +2:2
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const {ALLOC2: &&Packed};
+ _1 = (*_2);
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
}
}
-alloc1 (static: FOO, size: 8, align: 8) {
- ╾───────alloc12───────╼ │ ╾──────╼
+ALLOC2 (static: FOO, size: 8, align: 8) {
+ ╾ALLOC0<imm>╼ │ ╾──────╼
}
-alloc12 (size: 180, align: 1) {
+ALLOC0 (size: 180, align: 1) {
0x00 │ ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab │ ................
- 0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾──alloc7── │ ............╾───
+ 0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾ALLOC3<imm> (8 ptr bytes) │ ............╾───
0x20 │ ──────────╼ 01 ef cd ab 00 00 00 00 00 00 00 00 │ ───╼............
0x30 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x40 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
@@ -34,18 +31,18 @@ alloc12 (size: 180, align: 1) {
0x60 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x70 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x80 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ╾──── │ ..............╾─
- 0x90 │ ─────alloc9─────╼ 00 00 ╾────alloc10+0x63─────╼ │ ─────╼..╾──────╼
+ 0x90 │ ─────ALLOC4─────╼ 00 00 ╾ALLOC1+0x63<imm>╼ │ ─────╼..╾──────╼
0xa0 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0xb0 │ 00 00 00 00 │ ....
}
-alloc7 (size: 4, align: 4) {
+ALLOC3 (size: 4, align: 4) {
2a 00 00 00 │ *...
}
-alloc9 (fn: main)
+ALLOC4 (fn: main)
-alloc10 (size: 100, align: 1) {
+ALLOC1 (size: 100, align: 1) {
0x00 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x20 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
diff --git a/tests/mir-opt/const_allocation3.rs b/tests/mir-opt/const_allocation3.rs
index da3fd089b..b8c9f5097 100644
--- a/tests/mir-opt/const_allocation3.rs
+++ b/tests/mir-opt/const_allocation3.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
index f1f53a481..87c072795 100644
--- a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
+++ b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
@@ -2,49 +2,47 @@
+ // MIR for `main` after ConstDebugInfo
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/const_debuginfo.rs:+0:11: +0:11
- let _1: u8; // in scope 0 at $DIR/const_debuginfo.rs:+1:9: +1:10
- let mut _5: u8; // in scope 0 at $DIR/const_debuginfo.rs:+4:15: +4:20
- let mut _6: u8; // in scope 0 at $DIR/const_debuginfo.rs:+4:15: +4:16
- let mut _7: u8; // in scope 0 at $DIR/const_debuginfo.rs:+4:19: +4:20
- let mut _8: u8; // in scope 0 at $DIR/const_debuginfo.rs:+4:23: +4:24
- let mut _12: u32; // in scope 0 at $DIR/const_debuginfo.rs:+13:13: +13:16
- let mut _13: u32; // in scope 0 at $DIR/const_debuginfo.rs:+13:19: +13:22
+ let mut _0: ();
+ let _1: u8;
+ let mut _5: u8;
+ let mut _6: u8;
+ let mut _7: u8;
+ let mut _8: u8;
+ let mut _14: u32;
+ let mut _15: u32;
scope 1 {
-- debug x => _1; // in scope 1 at $DIR/const_debuginfo.rs:+1:9: +1:10
-+ debug x => const 1_u8; // in scope 1 at $DIR/const_debuginfo.rs:+1:9: +1:10
- let _2: u8; // in scope 1 at $DIR/const_debuginfo.rs:+2:9: +2:10
+- debug x => _1;
++ debug x => const 1_u8;
+ let _2: u8;
scope 2 {
-- debug y => _2; // in scope 2 at $DIR/const_debuginfo.rs:+2:9: +2:10
-+ debug y => const 2_u8; // in scope 2 at $DIR/const_debuginfo.rs:+2:9: +2:10
- let _3: u8; // in scope 2 at $DIR/const_debuginfo.rs:+3:9: +3:10
+- debug y => _2;
++ debug y => const 2_u8;
+ let _3: u8;
scope 3 {
-- debug z => _3; // in scope 3 at $DIR/const_debuginfo.rs:+3:9: +3:10
-+ debug z => const 3_u8; // in scope 3 at $DIR/const_debuginfo.rs:+3:9: +3:10
- let _4: u8; // in scope 3 at $DIR/const_debuginfo.rs:+4:9: +4:12
+- debug z => _3;
++ debug z => const 3_u8;
+ let _4: u8;
scope 4 {
-- debug sum => _4; // in scope 4 at $DIR/const_debuginfo.rs:+4:9: +4:12
-+ debug sum => const 6_u8; // in scope 4 at $DIR/const_debuginfo.rs:+4:9: +4:12
- let _9: &str; // in scope 4 at $DIR/const_debuginfo.rs:+6:9: +6:10
+- debug sum => _4;
++ debug sum => const 6_u8;
+ let _9: &str;
scope 5 {
-- debug s => _9; // in scope 5 at $DIR/const_debuginfo.rs:+6:9: +6:10
-+ debug s => const "hello, world!"; // in scope 5 at $DIR/const_debuginfo.rs:+6:9: +6:10
- let _14: bool; // in scope 5 at $DIR/const_debuginfo.rs:+8:9: +8:10
- let _15: bool; // in scope 5 at $DIR/const_debuginfo.rs:+8:9: +8:10
- let _16: u32; // in scope 5 at $DIR/const_debuginfo.rs:+8:9: +8:10
+- debug s => _9;
++ debug s => const "hello, world!";
+ let _10: (bool, bool, u32);
scope 6 {
- debug f => (bool, bool, u32){ .0 => _14, .1 => _15, .2 => _16, }; // in scope 6 at $DIR/const_debuginfo.rs:+8:9: +8:10
- let _10: std::option::Option<u16>; // in scope 6 at $DIR/const_debuginfo.rs:+10:9: +10:10
+ debug f => _10;
+ let _11: std::option::Option<u16>;
scope 7 {
- debug o => _10; // in scope 7 at $DIR/const_debuginfo.rs:+10:9: +10:10
- let _17: u32; // in scope 7 at $DIR/const_debuginfo.rs:+12:9: +12:10
- let _18: u32; // in scope 7 at $DIR/const_debuginfo.rs:+12:9: +12:10
+ debug o => _11;
+ let _12: Point;
scope 8 {
- debug p => Point{ .0 => _17, .1 => _18, }; // in scope 8 at $DIR/const_debuginfo.rs:+12:9: +12:10
- let _11: u32; // in scope 8 at $DIR/const_debuginfo.rs:+13:9: +13:10
+- debug p => _12;
++ debug p => const Point {{ x: 32_u32, y: 32_u32 }};
+ let _13: u32;
scope 9 {
-- debug a => _11; // in scope 9 at $DIR/const_debuginfo.rs:+13:9: +13:10
-+ debug a => const 64_u32; // in scope 9 at $DIR/const_debuginfo.rs:+13:9: +13:10
+- debug a => _13;
++ debug a => const 64_u32;
}
}
}
@@ -56,39 +54,57 @@
}
bb0: {
- _1 = const 1_u8; // scope 0 at $DIR/const_debuginfo.rs:+1:13: +1:16
- _2 = const 2_u8; // scope 1 at $DIR/const_debuginfo.rs:+2:13: +2:16
- _3 = const 3_u8; // scope 2 at $DIR/const_debuginfo.rs:+3:13: +3:16
- StorageLive(_4); // scope 3 at $DIR/const_debuginfo.rs:+4:9: +4:12
- StorageLive(_5); // scope 3 at $DIR/const_debuginfo.rs:+4:15: +4:20
- _5 = const 3_u8; // scope 3 at $DIR/const_debuginfo.rs:+4:15: +4:20
- _4 = const 6_u8; // scope 3 at $DIR/const_debuginfo.rs:+4:15: +4:24
- StorageDead(_5); // scope 3 at $DIR/const_debuginfo.rs:+4:23: +4:24
- StorageLive(_9); // scope 4 at $DIR/const_debuginfo.rs:+6:9: +6:10
- _9 = const "hello, world!"; // scope 4 at $DIR/const_debuginfo.rs:+6:13: +6:28
- // mir::Constant
- // + span: $DIR/const_debuginfo.rs:14:13: 14:28
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- StorageLive(_14); // scope 5 at $DIR/const_debuginfo.rs:+8:9: +8:10
- StorageLive(_15); // scope 5 at $DIR/const_debuginfo.rs:+8:9: +8:10
- StorageLive(_16); // scope 5 at $DIR/const_debuginfo.rs:+8:9: +8:10
- _14 = const true; // scope 5 at $DIR/const_debuginfo.rs:+8:13: +8:34
- _15 = const false; // scope 5 at $DIR/const_debuginfo.rs:+8:13: +8:34
- _16 = const 123_u32; // scope 5 at $DIR/const_debuginfo.rs:+8:13: +8:34
- StorageLive(_10); // scope 6 at $DIR/const_debuginfo.rs:+10:9: +10:10
- _10 = Option::<u16>::Some(const 99_u16); // scope 6 at $DIR/const_debuginfo.rs:+10:13: +10:24
- _17 = const 32_u32; // scope 7 at $DIR/const_debuginfo.rs:+12:13: +12:35
- _18 = const 32_u32; // scope 7 at $DIR/const_debuginfo.rs:+12:13: +12:35
- StorageLive(_11); // scope 8 at $DIR/const_debuginfo.rs:+13:9: +13:10
- _11 = const 64_u32; // scope 8 at $DIR/const_debuginfo.rs:+13:13: +13:22
- StorageDead(_11); // scope 8 at $DIR/const_debuginfo.rs:+14:1: +14:2
- StorageDead(_10); // scope 6 at $DIR/const_debuginfo.rs:+14:1: +14:2
- StorageDead(_14); // scope 5 at $DIR/const_debuginfo.rs:+14:1: +14:2
- StorageDead(_15); // scope 5 at $DIR/const_debuginfo.rs:+14:1: +14:2
- StorageDead(_16); // scope 5 at $DIR/const_debuginfo.rs:+14:1: +14:2
- StorageDead(_9); // scope 4 at $DIR/const_debuginfo.rs:+14:1: +14:2
- StorageDead(_4); // scope 3 at $DIR/const_debuginfo.rs:+14:1: +14:2
- return; // scope 0 at $DIR/const_debuginfo.rs:+14:2: +14:2
+ StorageLive(_1);
+ _1 = const 1_u8;
+ StorageLive(_2);
+ _2 = const 2_u8;
+ StorageLive(_3);
+ _3 = const 3_u8;
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = const 1_u8;
+ StorageLive(_7);
+ _7 = const 2_u8;
+ _5 = const 3_u8;
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_8);
+ _8 = const 3_u8;
+ _4 = const 6_u8;
+ StorageDead(_8);
+ StorageDead(_5);
+ StorageLive(_9);
+ _9 = const "hello, world!";
+ StorageLive(_10);
+ _10 = (const true, const false, const 123_u32);
+ StorageLive(_11);
+ _11 = Option::<u16>::Some(const 99_u16);
+ StorageLive(_12);
+ _12 = const Point {{ x: 32_u32, y: 32_u32 }};
+ StorageLive(_13);
+ StorageLive(_14);
+ _14 = const 32_u32;
+ StorageLive(_15);
+ _15 = const 32_u32;
+ _13 = const 64_u32;
+ StorageDead(_15);
+ StorageDead(_14);
+ _0 = const ();
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
+ ALLOC0 (size: 8, align: 4) {
+ 20 00 00 00 20 00 00 00 │ ... ...
+ }
+
diff --git a/tests/mir-opt/const_debuginfo.rs b/tests/mir-opt/const_debuginfo.rs
index a188da385..0e5ac4b8b 100644
--- a/tests/mir-opt/const_debuginfo.rs
+++ b/tests/mir-opt/const_debuginfo.rs
@@ -1,11 +1,23 @@
-// compile-flags: -C overflow-checks=no -Zunsound-mir-opts
+// unit-test: ConstDebugInfo
+// compile-flags: -C overflow-checks=no -Zmir-enable-passes=+ConstProp
struct Point {
x: u32,
y: u32,
}
+// EMIT_MIR const_debuginfo.main.ConstDebugInfo.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => const 1_u8;
+ // CHECK: debug y => const 2_u8;
+ // CHECK: debug z => const 3_u8;
+ // CHECK: debug sum => const 6_u8;
+ // CHECK: debug s => const "hello, world!";
+ // CHECK: debug f => {{_.*}};
+ // CHECK: debug o => {{_.*}};
+ // CHECK: debug p => const Point
+ // CHECK: debug a => const 64_u32;
let x = 1u8;
let y = 2u8;
let z = 3u8;
@@ -20,5 +32,3 @@ fn main() {
let p = Point { x: 32, y: 32 };
let a = p.x + p.y;
}
-
-// EMIT_MIR const_debuginfo.main.ConstDebugInfo.diff
diff --git a/tests/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff b/tests/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff
index a717d1bbd..43bdb4311 100644
--- a/tests/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff
+++ b/tests/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff
@@ -2,51 +2,49 @@
+ // MIR for `issue_77355_opt` after ConstGoto
fn issue_77355_opt(_1: Foo) -> u64 {
- debug num => _1; // in scope 0 at $DIR/const_goto.rs:+0:20: +0:23
- let mut _0: u64; // return place in scope 0 at $DIR/const_goto.rs:+0:33: +0:36
-- let mut _2: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-- let mut _3: isize; // in scope 0 at $DIR/const_goto.rs:+1:22: +1:28
-+ let mut _2: isize; // in scope 0 at $DIR/const_goto.rs:+1:22: +1:28
+ debug num => _1;
+ let mut _0: u64;
+- let mut _2: bool;
+- let mut _3: isize;
++ let mut _2: isize;
bb0: {
-- StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-- _3 = discriminant(_1); // scope 0 at $DIR/const_goto.rs:+1:17: +1:20
-- switchInt(move _3) -> [1: bb2, 2: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-+ _2 = discriminant(_1); // scope 0 at $DIR/const_goto.rs:+1:17: +1:20
-+ switchInt(move _2) -> [1: bb2, 2: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+- StorageLive(_2);
+- _3 = discriminant(_1);
+- switchInt(move _3) -> [1: bb2, 2: bb2, otherwise: bb1];
++ _2 = discriminant(_1);
++ switchInt(move _2) -> [1: bb2, 2: bb2, otherwise: bb1];
}
bb1: {
-- _2 = const false; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-+ _0 = const 42_u64; // scope 0 at $DIR/const_goto.rs:+1:53: +1:55
-+ goto -> bb3; // scope 0 at $DIR/const_goto.rs:+1:5: +1:57
+- _2 = const false;
++ _0 = const 42_u64;
+ goto -> bb3;
}
bb2: {
-- _2 = const true; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+- _2 = const true;
++ _0 = const 23_u64;
+ goto -> bb3;
+ }
+
+ bb3: {
+- switchInt(move _2) -> [0: bb5, otherwise: bb4];
- }
-
-- bb3: {
-- switchInt(move _2) -> [0: bb5, otherwise: bb4]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+- bb4: {
+- _0 = const 23_u64;
+- goto -> bb6;
- }
-
-- bb4: {
- _0 = const 23_u64; // scope 0 at $DIR/const_goto.rs:+1:41: +1:43
-- goto -> bb6; // scope 0 at $DIR/const_goto.rs:+1:5: +1:57
-+ goto -> bb3; // scope 0 at $DIR/const_goto.rs:+1:5: +1:57
- }
-
- bb5: {
-- _0 = const 42_u64; // scope 0 at $DIR/const_goto.rs:+1:53: +1:55
-- goto -> bb6; // scope 0 at $DIR/const_goto.rs:+1:5: +1:57
+- _0 = const 42_u64;
+- goto -> bb6;
- }
-
- bb6: {
-- StorageDead(_2); // scope 0 at $DIR/const_goto.rs:+1:56: +1:57
-+ bb3: {
- return; // scope 0 at $DIR/const_goto.rs:+2:2: +2:2
+- StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/const_goto.rs b/tests/mir-opt/const_goto.rs
index 6f84f186b..93cb71c3a 100644
--- a/tests/mir-opt/const_goto.rs
+++ b/tests/mir-opt/const_goto.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstGoto
pub enum Foo {
diff --git a/tests/mir-opt/const_goto_const_eval_fail.f.ConstGoto.diff b/tests/mir-opt/const_goto_const_eval_fail.f.ConstGoto.diff
index 24be8c9b8..84a13f28a 100644
--- a/tests/mir-opt/const_goto_const_eval_fail.f.ConstGoto.diff
+++ b/tests/mir-opt/const_goto_const_eval_fail.f.ConstGoto.diff
@@ -2,50 +2,50 @@
+ // MIR for `f` after ConstGoto
fn f() -> u64 {
- let mut _0: u64; // return place in scope 0 at $DIR/const_goto_const_eval_fail.rs:+0:44: +0:47
- let mut _1: bool; // in scope 0 at $DIR/const_goto_const_eval_fail.rs:+1:11: +6:6
- let mut _2: i32; // in scope 0 at $DIR/const_goto_const_eval_fail.rs:+2:15: +2:16
+ let mut _0: u64;
+ let mut _1: bool;
+ let mut _2: i32;
bb0: {
- StorageLive(_1); // scope 0 at $DIR/const_goto_const_eval_fail.rs:+1:11: +6:6
- StorageLive(_2); // scope 0 at $DIR/const_goto_const_eval_fail.rs:+2:15: +2:16
- _2 = const A; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+2:15: +2:16
- switchInt(_2) -> [1: bb2, 2: bb2, 3: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+2:9: +2:16
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const A;
+ switchInt(_2) -> [1: bb2, 2: bb2, 3: bb2, otherwise: bb1];
}
bb1: {
- _1 = const true; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+4:18: +4:22
- goto -> bb3; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+4:18: +4:22
+ _1 = const true;
+ goto -> bb3;
}
bb2: {
- _1 = const B; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+3:26: +3:27
-- goto -> bb3; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+3:26: +3:27
-+ switchInt(_1) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+1:5: +6:6
+ _1 = const B;
+- goto -> bb3;
++ switchInt(_1) -> [0: bb4, otherwise: bb3];
}
bb3: {
-- switchInt(_1) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+1:5: +6:6
+- switchInt(_1) -> [0: bb5, otherwise: bb4];
- }
-
- bb4: {
- _0 = const 2_u64; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+8:17: +8:18
-- goto -> bb6; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+8:17: +8:18
-+ goto -> bb5; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+8:17: +8:18
+ _0 = const 2_u64;
+- goto -> bb6;
++ goto -> bb5;
}
- bb5: {
+ bb4: {
- _0 = const 1_u64; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+7:18: +7:19
-- goto -> bb6; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+7:18: +7:19
-+ goto -> bb5; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+7:18: +7:19
+ _0 = const 1_u64;
+- goto -> bb6;
++ goto -> bb5;
}
- bb6: {
+ bb5: {
- StorageDead(_2); // scope 0 at $DIR/const_goto_const_eval_fail.rs:+10:1: +10:2
- StorageDead(_1); // scope 0 at $DIR/const_goto_const_eval_fail.rs:+10:1: +10:2
- return; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+10:2: +10:2
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/const_goto_const_eval_fail.rs b/tests/mir-opt/const_goto_const_eval_fail.rs
index 3b85fe6ab..869f91600 100644
--- a/tests/mir-opt/const_goto_const_eval_fail.rs
+++ b/tests/mir-opt/const_goto_const_eval_fail.rs
@@ -1,6 +1,9 @@
+// skip-filecheck
#![feature(min_const_generics)]
#![crate_type = "lib"]
+// compile-flags: -Zunsound-mir-opts
+
// If const eval fails, then don't crash
// EMIT_MIR const_goto_const_eval_fail.f.ConstGoto.diff
pub fn f<const A: i32, const B: bool>() -> u64 {
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 4dc98f856..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
@@ -2,102 +2,101 @@
+ // MIR for `match_nested_if` after ConstGoto
fn match_nested_if() -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/const_goto_storage.rs:+0:25: +0:29
- let _1: bool; // in scope 0 at $DIR/const_goto_storage.rs:+1:9: +1:12
-- let mut _2: (); // in scope 0 at $DIR/const_goto_storage.rs:+1:21: +1:23
-- let mut _3: bool; // in scope 0 at $DIR/const_goto_storage.rs:+2:15: +6:10
-- let mut _4: bool; // in scope 0 at $DIR/const_goto_storage.rs:+2:18: +2:76
-- let mut _5: bool; // in scope 0 at $DIR/const_goto_storage.rs:+2:21: +2:52
-- let mut _6: bool; // in scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
-+ let mut _2: bool; // in scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
+ let mut _0: bool;
+ let _1: bool;
+- let mut _2: ();
+- let mut _3: bool;
+- let mut _4: bool;
+- let mut _5: bool;
+- let mut _6: bool;
++ let mut _2: bool;
scope 1 {
- debug val => _1; // in scope 1 at $DIR/const_goto_storage.rs:+1:9: +1:12
+ debug val => _1;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/const_goto_storage.rs:+1:9: +1:12
-- StorageLive(_2); // scope 0 at $DIR/const_goto_storage.rs:+1:21: +1:23
-- _2 = (); // scope 0 at $DIR/const_goto_storage.rs:+1:21: +1:23
-- StorageLive(_3); // scope 0 at $DIR/const_goto_storage.rs:+2:15: +6:10
-- StorageLive(_4); // scope 0 at $DIR/const_goto_storage.rs:+2:18: +2:76
-- StorageLive(_5); // scope 0 at $DIR/const_goto_storage.rs:+2:21: +2:52
-- StorageLive(_6); // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
-- _6 = const true; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
-- switchInt(move _6) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
-+ StorageLive(_2); // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
-+ _2 = const true; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
-+ switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = ();
+- StorageLive(_3);
+- StorageLive(_4);
+- StorageLive(_5);
+- StorageLive(_6);
+- _6 = const true;
+- switchInt(move _6) -> [0: bb2, otherwise: bb1];
++ _2 = const true;
++ switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
-- _5 = const true; // scope 0 at $DIR/const_goto_storage.rs:+2:31: +2:35
-- goto -> bb3; // scope 0 at $DIR/const_goto_storage.rs:+2:21: +2:52
-- }
--
-- bb2: {
-- _5 = const false; // scope 0 at $DIR/const_goto_storage.rs:+2:45: +2:50
-- goto -> bb3; // scope 0 at $DIR/const_goto_storage.rs:+2:21: +2:52
-- }
--
-- bb3: {
-- StorageDead(_6); // scope 0 at $DIR/const_goto_storage.rs:+2:51: +2:52
-- switchInt(move _5) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto_storage.rs:+2:21: +2:52
+- _5 = const true;
++ StorageDead(_2);
++ _1 = const true;
+ goto -> bb3;
+ }
+
+ bb2: {
+- _5 = const false;
++ StorageDead(_2);
++ _1 = const false;
+ goto -> bb3;
+ }
+
+ bb3: {
+- switchInt(move _5) -> [0: bb5, otherwise: bb4];
- }
-
- bb4: {
-- _4 = const true; // scope 0 at $DIR/const_goto_storage.rs:+2:55: +2:59
-- goto -> bb6; // scope 0 at $DIR/const_goto_storage.rs:+2:18: +2:76
+- StorageDead(_6);
+- _4 = const true;
+- goto -> bb6;
- }
-
- bb5: {
-- _4 = const false; // scope 0 at $DIR/const_goto_storage.rs:+2:69: +2:74
-- goto -> bb6; // scope 0 at $DIR/const_goto_storage.rs:+2:18: +2:76
+- StorageDead(_6);
+- _4 = const false;
+- goto -> bb6;
- }
-
- bb6: {
-- StorageDead(_5); // scope 0 at $DIR/const_goto_storage.rs:+2:75: +2:76
-- switchInt(move _4) -> [0: bb8, otherwise: bb7]; // scope 0 at $DIR/const_goto_storage.rs:+2:18: +2:76
+- switchInt(move _4) -> [0: bb8, otherwise: bb7];
- }
-
- bb7: {
-- _3 = const true; // scope 0 at $DIR/const_goto_storage.rs:+3:13: +3:17
-- goto -> bb9; // scope 0 at $DIR/const_goto_storage.rs:+2:15: +6:10
+- StorageDead(_5);
+- _3 = const true;
+- goto -> bb9;
- }
-
- bb8: {
-- _3 = const false; // scope 0 at $DIR/const_goto_storage.rs:+5:13: +5:18
-- goto -> bb9; // scope 0 at $DIR/const_goto_storage.rs:+2:15: +6:10
+- StorageDead(_5);
+- _3 = const false;
+- goto -> bb9;
- }
-
- bb9: {
-- switchInt(move _3) -> [0: bb11, otherwise: bb10]; // scope 0 at $DIR/const_goto_storage.rs:+2:15: +6:10
+- switchInt(move _3) -> [0: bb11, otherwise: bb10];
- }
-
- bb10: {
-- StorageDead(_4); // scope 0 at $DIR/const_goto_storage.rs:+6:9: +6:10
-- StorageDead(_3); // scope 0 at $DIR/const_goto_storage.rs:+6:9: +6:10
-+ StorageDead(_2); // scope 0 at $DIR/const_goto_storage.rs:+2:51: +2:52
- _1 = const true; // scope 0 at $DIR/const_goto_storage.rs:+8:17: +8:21
-- goto -> bb12; // scope 0 at $DIR/const_goto_storage.rs:+8:17: +8:21
-+ goto -> bb3; // scope 0 at $DIR/const_goto_storage.rs:+8:17: +8:21
- }
-
+- StorageDead(_4);
+- StorageDead(_3);
+- _1 = const true;
+- goto -> bb12;
+- }
+-
- bb11: {
-- StorageDead(_4); // scope 0 at $DIR/const_goto_storage.rs:+6:9: +6:10
-- StorageDead(_3); // scope 0 at $DIR/const_goto_storage.rs:+6:9: +6:10
-+ bb2: {
-+ StorageDead(_2); // scope 0 at $DIR/const_goto_storage.rs:+2:51: +2:52
- _1 = const false; // scope 0 at $DIR/const_goto_storage.rs:+10:14: +10:19
-- goto -> bb12; // scope 0 at $DIR/const_goto_storage.rs:+10:14: +10:19
-+ goto -> bb3; // scope 0 at $DIR/const_goto_storage.rs:+10:14: +10:19
- }
-
+- StorageDead(_4);
+- StorageDead(_3);
+- _1 = const false;
+- goto -> bb12;
+- }
+-
- bb12: {
-- StorageDead(_2); // scope 0 at $DIR/const_goto_storage.rs:+11:6: +11:7
-+ bb3: {
- _0 = _1; // scope 1 at $DIR/const_goto_storage.rs:+12:5: +12:8
- StorageDead(_1); // scope 0 at $DIR/const_goto_storage.rs:+13:1: +13:2
- return; // scope 0 at $DIR/const_goto_storage.rs:+13:2: +13:2
+- StorageDead(_2);
+ _0 = _1;
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/const_goto_storage.rs b/tests/mir-opt/const_goto_storage.rs
index 459599c73..9d43da239 100644
--- a/tests/mir-opt/const_goto_storage.rs
+++ b/tests/mir-opt/const_goto_storage.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstGoto
// EMIT_MIR const_goto_storage.match_nested_if.ConstGoto.diff
diff --git a/tests/mir-opt/const_promotion_extern_static.BAR-promoted[0].SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/const_promotion_extern_static.BAR-promoted[0].SimplifyCfg-elaborate-drops.after.mir
index 028480bdc..960b98224 100644
--- a/tests/mir-opt/const_promotion_extern_static.BAR-promoted[0].SimplifyCfg-elaborate-drops.after.mir
+++ b/tests/mir-opt/const_promotion_extern_static.BAR-promoted[0].SimplifyCfg-elaborate-drops.after.mir
@@ -1,23 +1,20 @@
// MIR for `BAR::promoted[0]` after SimplifyCfg-elaborate-drops
promoted[0] in BAR: &[&i32; 1] = {
- let mut _0: &[&i32; 1]; // return place in scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:44
- let mut _1: [&i32; 1]; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:35
- let mut _2: &i32; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:32: +0:34
- let mut _3: &i32; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:33: +0:34
+ let mut _0: &[&i32; 1];
+ let mut _1: [&i32; 1];
+ let mut _2: &i32;
+ let mut _3: &i32;
bb0: {
- _3 = const {alloc1: &i32}; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:33: +0:34
- // mir::Constant
- // + span: $DIR/const_promotion_extern_static.rs:9:33: 9:34
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) }
- _2 = &(*_3); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:32: +0:34
- _1 = [move _2]; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:35
- _0 = &_1; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:44
- return; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:44
+ _3 = const {ALLOC0: &i32};
+ _2 = &(*_3);
+ _1 = [move _2];
+ _0 = &_1;
+ return;
}
}
-alloc1 (static: Y, size: 4, align: 4) {
+ALLOC0 (static: Y, size: 4, align: 4) {
2a 00 00 00 │ *...
}
diff --git a/tests/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff b/tests/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff
index 2ef437811..4a93db3fc 100644
--- a/tests/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff
+++ b/tests/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff
@@ -2,53 +2,45 @@
+ // MIR for `BAR` after PromoteTemps
static mut BAR: *const &i32 = {
- let mut _0: *const &i32; // return place in scope 0 at $DIR/const_promotion_extern_static.rs:+0:17: +0:28
- let mut _1: &[&i32]; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:44
- let mut _2: &[&i32; 1]; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:44
- let _3: [&i32; 1]; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:35
- let mut _4: &i32; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:32: +0:34
- let _5: &i32; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:33: +0:34
-+ let mut _6: &[&i32; 1]; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:44
+ let mut _0: *const &i32;
+ let mut _1: &[&i32];
+ let mut _2: &[&i32; 1];
+ let _3: [&i32; 1];
+ let mut _4: &i32;
+ let _5: &i32;
++ let mut _6: &[&i32; 1];
bb0: {
- StorageLive(_1); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:44
- StorageLive(_2); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:44
-- StorageLive(_3); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:35
-- StorageLive(_4); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:32: +0:34
-- StorageLive(_5); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:33: +0:34
-- _5 = const {alloc1: &i32}; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:33: +0:34
-+ _6 = const _; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:44
- // mir::Constant
-- // + span: $DIR/const_promotion_extern_static.rs:9:33: 9:34
-- // + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) }
-- _4 = &(*_5); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:32: +0:34
-- _3 = [move _4]; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:35
-- _2 = &_3; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:44
-+ // + span: $DIR/const_promotion_extern_static.rs:9:31: 9:44
-+ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(BAR, [], Some(promoted[0])) }
-+ _2 = &(*_6); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:44
- _1 = move _2 as &[&i32] (Pointer(Unsize)); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:44
-- StorageDead(_4); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:34: +0:35
- StorageDead(_2); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:34: +0:35
- _0 = core::slice::<impl [&i32]>::as_ptr(move _1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:44
- // mir::Constant
- // + span: $DIR/const_promotion_extern_static.rs:9:36: 9:42
- // + literal: Const { ty: for<'a> fn(&'a [&i32]) -> *const &i32 {core::slice::<impl [&i32]>::as_ptr}, val: Value(<ZST>) }
+ StorageLive(_1);
+ StorageLive(_2);
+- StorageLive(_3);
+- StorageLive(_4);
+- StorageLive(_5);
+- _5 = const {ALLOC0: &i32};
+- _4 = &(*_5);
+- _3 = [move _4];
+- _2 = &_3;
++ _6 = const _;
++ _2 = &(*_6);
+ _1 = move _2 as &[&i32] (PointerCoercion(Unsize));
+- StorageDead(_4);
+ StorageDead(_2);
+ _0 = core::slice::<impl [&i32]>::as_ptr(move _1) -> [return: bb1, unwind: bb2];
}
bb1: {
-- StorageDead(_5); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:43: +0:44
-- StorageDead(_3); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:43: +0:44
- StorageDead(_1); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:43: +0:44
- return; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:1: +0:45
+- StorageDead(_5);
+- StorageDead(_3);
+ StorageDead(_1);
+ return;
}
bb2 (cleanup): {
- resume; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:1: +0:45
+ resume;
}
- }
-
-- alloc1 (static: Y, size: 4, align: 4) {
+- ALLOC0 (static: Y, size: 4, align: 4) {
- 2a 00 00 00 │ *...
}
diff --git a/tests/mir-opt/const_promotion_extern_static.BOP.built.after.mir b/tests/mir-opt/const_promotion_extern_static.BOP.built.after.mir
index 476fc49a1..ff80d5eed 100644
--- a/tests/mir-opt/const_promotion_extern_static.BOP.built.after.mir
+++ b/tests/mir-opt/const_promotion_extern_static.BOP.built.after.mir
@@ -1,17 +1,17 @@
// MIR for `BOP` after built
static BOP: &i32 = {
- let mut _0: &i32; // return place in scope 0 at $DIR/const_promotion_extern_static.rs:+0:13: +0:17
- let _1: &i32; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:20: +0:23
- let _2: i32; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:21: +0:23
+ let mut _0: &i32;
+ let _1: &i32;
+ let _2: i32;
bb0: {
- StorageLive(_1); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:20: +0:23
- StorageLive(_2); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:21: +0:23
- _2 = const 13_i32; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:21: +0:23
- _1 = &_2; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:20: +0:23
- _0 = &(*_1); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:20: +0:23
- StorageDead(_1); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:22: +0:23
- return; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:1: +0:24
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const 13_i32;
+ _1 = &_2;
+ _0 = &(*_1);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir
index 41657b53f..a9c054427 100644
--- a/tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir
+++ b/tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir
@@ -1,21 +1,18 @@
// MIR for `FOO::promoted[0]` after SimplifyCfg-elaborate-drops
promoted[0] in FOO: &[&i32; 1] = {
- let mut _0: &[&i32; 1]; // return place in scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
- let mut _1: [&i32; 1]; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:46
- let mut _2: &i32; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:32: +0:45
- let mut _3: *const i32; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
+ let mut _0: &[&i32; 1];
+ let mut _1: [&i32; 1];
+ let mut _2: &i32;
+ let mut _3: *const i32;
bb0: {
- _3 = const {alloc3: *const i32}; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
- // mir::Constant
- // + span: $DIR/const_promotion_extern_static.rs:13:42: 13:43
- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) }
- _2 = &(*_3); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:41: +0:43
- _1 = [move _2]; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:46
- _0 = &_1; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
- return; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
+ _3 = const {ALLOC0: *const i32};
+ _2 = &(*_3);
+ _1 = [move _2];
+ _0 = &_1;
+ return;
}
}
-alloc3 (extern static: X)
+ALLOC0 (extern static: X)
diff --git a/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff b/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff
index 25ba0face..21d21b0ee 100644
--- a/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff
+++ b/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff
@@ -2,53 +2,45 @@
+ // MIR for `FOO` after PromoteTemps
static mut FOO: *const &i32 = {
- let mut _0: *const &i32; // return place in scope 0 at $DIR/const_promotion_extern_static.rs:+0:17: +0:28
- let mut _1: &[&i32]; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
- let mut _2: &[&i32; 1]; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
- let _3: [&i32; 1]; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:46
- let mut _4: &i32; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:32: +0:45
- let _5: *const i32; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
-+ let mut _6: &[&i32; 1]; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
+ let mut _0: *const &i32;
+ let mut _1: &[&i32];
+ let mut _2: &[&i32; 1];
+ let _3: [&i32; 1];
+ let mut _4: &i32;
+ let _5: *const i32;
++ let mut _6: &[&i32; 1];
scope 1 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
- StorageLive(_2); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
-- StorageLive(_3); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:46
-- StorageLive(_4); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:32: +0:45
-- StorageLive(_5); // scope 1 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
-- _5 = const {alloc3: *const i32}; // scope 1 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
-+ _6 = const _; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
- // mir::Constant
-- // + span: $DIR/const_promotion_extern_static.rs:13:42: 13:43
-- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) }
-- _4 = &(*_5); // scope 1 at $DIR/const_promotion_extern_static.rs:+0:41: +0:43
-- _3 = [move _4]; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:46
-- _2 = &_3; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
-+ // + span: $DIR/const_promotion_extern_static.rs:13:31: 13:55
-+ // + literal: Const { ty: &[&i32; 1], val: Unevaluated(FOO, [], Some(promoted[0])) }
-+ _2 = &(*_6); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
- _1 = move _2 as &[&i32] (Pointer(Unsize)); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
-- StorageDead(_4); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:45: +0:46
- StorageDead(_2); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:45: +0:46
- _0 = core::slice::<impl [&i32]>::as_ptr(move _1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
- // mir::Constant
- // + span: $DIR/const_promotion_extern_static.rs:13:47: 13:53
- // + literal: Const { ty: for<'a> fn(&'a [&i32]) -> *const &i32 {core::slice::<impl [&i32]>::as_ptr}, val: Value(<ZST>) }
+ StorageLive(_1);
+ StorageLive(_2);
+- StorageLive(_3);
+- StorageLive(_4);
+- StorageLive(_5);
+- _5 = const {ALLOC0: *const i32};
+- _4 = &(*_5);
+- _3 = [move _4];
+- _2 = &_3;
++ _6 = const _;
++ _2 = &(*_6);
+ _1 = move _2 as &[&i32] (PointerCoercion(Unsize));
+- StorageDead(_4);
+ StorageDead(_2);
+ _0 = core::slice::<impl [&i32]>::as_ptr(move _1) -> [return: bb1, unwind: bb2];
}
bb1: {
-- StorageDead(_5); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:54: +0:55
-- StorageDead(_3); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:54: +0:55
- StorageDead(_1); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:54: +0:55
- return; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:1: +0:56
+- StorageDead(_5);
+- StorageDead(_3);
+ StorageDead(_1);
+ return;
}
bb2 (cleanup): {
- resume; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:1: +0:56
+ resume;
}
}
-
-- alloc3 (extern static: X)
+- ALLOC0 (extern static: X)
diff --git a/tests/mir-opt/const_promotion_extern_static.rs b/tests/mir-opt/const_promotion_extern_static.rs
index e4261cfe5..edc3a5223 100644
--- a/tests/mir-opt/const_promotion_extern_static.rs
+++ b/tests/mir-opt/const_promotion_extern_static.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// ignore-endian-big
extern "C" {
static X: i32;
diff --git a/tests/mir-opt/const_prop/address_of_pair.fn0.ConstProp.diff b/tests/mir-opt/const_prop/address_of_pair.fn0.ConstProp.diff
index d50b12044..6b96c24d4 100644
--- a/tests/mir-opt/const_prop/address_of_pair.fn0.ConstProp.diff
+++ b/tests/mir-opt/const_prop/address_of_pair.fn0.ConstProp.diff
@@ -2,45 +2,45 @@
+ // MIR for `fn0` after ConstProp
fn fn0() -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/address_of_pair.rs:+0:17: +0:21
- let mut _1: !; // in scope 0 at $DIR/address_of_pair.rs:+0:22: +9:2
- let mut _2: (i32, bool); // in scope 0 at $DIR/address_of_pair.rs:+1:9: +1:17
- let _4: (); // in scope 0 at $DIR/address_of_pair.rs:+4:5: +6:6
- let mut _6: bool; // in scope 0 at $DIR/address_of_pair.rs:+7:16: +7:22
+ let mut _0: bool;
+ let mut _1: !;
+ let mut _2: (i32, bool);
+ let _4: ();
+ let mut _6: bool;
scope 1 {
- debug pair => _2; // in scope 1 at $DIR/address_of_pair.rs:+1:9: +1:17
- let _3: *mut bool; // in scope 1 at $DIR/address_of_pair.rs:+2:9: +2:12
+ debug pair => _2;
+ let _3: *mut bool;
scope 2 {
- debug ptr => _3; // in scope 2 at $DIR/address_of_pair.rs:+2:9: +2:12
- let _5: bool; // in scope 2 at $DIR/address_of_pair.rs:+7:9: +7:12
+ debug ptr => _3;
+ let _5: bool;
scope 3 {
}
scope 4 {
- debug ret => _5; // in scope 4 at $DIR/address_of_pair.rs:+7:9: +7:12
+ debug ret => _5;
}
}
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/address_of_pair.rs:+1:9: +1:17
- _2 = (const 1_i32, const false); // scope 0 at $DIR/address_of_pair.rs:+1:20: +1:30
- StorageLive(_3); // scope 1 at $DIR/address_of_pair.rs:+2:9: +2:12
- _3 = &raw mut (_2.1: bool); // scope 1 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- _2 = (const 1_i32, const false); // scope 2 at $DIR/address_of_pair.rs:+3:5: +3:22
- StorageLive(_4); // scope 2 at $DIR/address_of_pair.rs:+4:5: +6:6
- (*_3) = const true; // scope 3 at $DIR/address_of_pair.rs:+5:9: +5:20
- _4 = const (); // scope 3 at $DIR/address_of_pair.rs:+4:5: +6:6
- StorageDead(_4); // scope 2 at $DIR/address_of_pair.rs:+6:5: +6:6
- StorageLive(_5); // scope 2 at $DIR/address_of_pair.rs:+7:9: +7:12
- StorageLive(_6); // scope 2 at $DIR/address_of_pair.rs:+7:16: +7:22
- _6 = (_2.1: bool); // scope 2 at $DIR/address_of_pair.rs:+7:16: +7:22
- _5 = Not(move _6); // scope 2 at $DIR/address_of_pair.rs:+7:15: +7:22
- StorageDead(_6); // scope 2 at $DIR/address_of_pair.rs:+7:21: +7:22
- _0 = _5; // scope 4 at $DIR/address_of_pair.rs:+8:12: +8:15
- StorageDead(_5); // scope 2 at $DIR/address_of_pair.rs:+9:1: +9:2
- StorageDead(_3); // scope 1 at $DIR/address_of_pair.rs:+9:1: +9:2
- StorageDead(_2); // scope 0 at $DIR/address_of_pair.rs:+9:1: +9:2
- return; // scope 0 at $DIR/address_of_pair.rs:+9:2: +9:2
+ StorageLive(_2);
+ _2 = (const 1_i32, const false);
+ StorageLive(_3);
+ _3 = &raw mut (_2.1: bool);
+ _2 = (const 1_i32, const false);
+ StorageLive(_4);
+ (*_3) = const true;
+ _4 = const ();
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = (_2.1: bool);
+ _5 = Not(move _6);
+ StorageDead(_6);
+ _0 = _5;
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/address_of_pair.rs b/tests/mir-opt/const_prop/address_of_pair.rs
index 43dc9bae6..730ebe2ca 100644
--- a/tests/mir-opt/const_prop/address_of_pair.rs
+++ b/tests/mir-opt/const_prop/address_of_pair.rs
@@ -2,6 +2,20 @@
// EMIT_MIR address_of_pair.fn0.ConstProp.diff
pub fn fn0() -> bool {
+ // CHECK-LABEL: fn fn0(
+ // CHECK: debug pair => [[pair:_.*]];
+ // CHECK: debug ptr => [[ptr:_.*]];
+ // CHECK: debug ret => [[ret:_.*]];
+ // CHECK: (*[[ptr]]) = const true;
+ // CHECK-NOT: = const false;
+ // CHECK-NOT: = const true;
+ // CHECK: [[tmp:_.*]] = ([[pair]].1: bool);
+ // CHECK-NOT: = const false;
+ // CHECK-NOT: = const true;
+ // CHECK: [[ret]] = Not(move [[tmp]]);
+ // CHECK-NOT: = const false;
+ // CHECK-NOT: = const true;
+ // CHECK: _0 = [[ret]];
let mut pair = (1, false);
let ptr = core::ptr::addr_of_mut!(pair.1);
pair = (1, false);
diff --git a/tests/mir-opt/const_prop/aggregate.foo.ConstProp.diff b/tests/mir-opt/const_prop/aggregate.foo.ConstProp.diff
deleted file mode 100644
index 6ac460db8..000000000
--- a/tests/mir-opt/const_prop/aggregate.foo.ConstProp.diff
+++ /dev/null
@@ -1,55 +0,0 @@
-- // MIR for `foo` before ConstProp
-+ // MIR for `foo` after ConstProp
-
- fn foo(_1: u8) -> () {
- debug x => _1; // in scope 0 at $DIR/aggregate.rs:+0:8: +0:9
- let mut _0: (); // return place in scope 0 at $DIR/aggregate.rs:+0:15: +0:15
- let _2: i32; // in scope 0 at $DIR/aggregate.rs:+2:9: +2:14
- let mut _3: i32; // in scope 0 at $DIR/aggregate.rs:+2:17: +2:25
- let mut _4: (i32, u8); // in scope 0 at $DIR/aggregate.rs:+2:17: +2:23
- let mut _5: u8; // in scope 0 at $DIR/aggregate.rs:+2:21: +2:22
- let mut _7: i32; // in scope 0 at $DIR/aggregate.rs:+3:18: +3:26
- let mut _8: (u8, i32); // in scope 0 at $DIR/aggregate.rs:+3:18: +3:24
- let mut _9: u8; // in scope 0 at $DIR/aggregate.rs:+3:19: +3:20
- scope 1 {
- debug first => _2; // in scope 1 at $DIR/aggregate.rs:+2:9: +2:14
- let _6: i32; // in scope 1 at $DIR/aggregate.rs:+3:9: +3:15
- scope 2 {
- debug second => _6; // in scope 2 at $DIR/aggregate.rs:+3:9: +3:15
- }
- }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/aggregate.rs:+2:9: +2:14
- StorageLive(_3); // scope 0 at $DIR/aggregate.rs:+2:17: +2:25
- StorageLive(_4); // scope 0 at $DIR/aggregate.rs:+2:17: +2:23
- StorageLive(_5); // scope 0 at $DIR/aggregate.rs:+2:21: +2:22
- _5 = _1; // scope 0 at $DIR/aggregate.rs:+2:21: +2:22
- _4 = (const 0_i32, move _5); // scope 0 at $DIR/aggregate.rs:+2:17: +2:23
- StorageDead(_5); // scope 0 at $DIR/aggregate.rs:+2:22: +2:23
-- _3 = (_4.0: i32); // scope 0 at $DIR/aggregate.rs:+2:17: +2:25
-- _2 = Add(move _3, const 1_i32); // scope 0 at $DIR/aggregate.rs:+2:17: +2:29
-+ _3 = const 0_i32; // scope 0 at $DIR/aggregate.rs:+2:17: +2:25
-+ _2 = const 1_i32; // scope 0 at $DIR/aggregate.rs:+2:17: +2:29
- StorageDead(_3); // scope 0 at $DIR/aggregate.rs:+2:28: +2:29
- StorageDead(_4); // scope 0 at $DIR/aggregate.rs:+2:29: +2:30
- StorageLive(_6); // scope 1 at $DIR/aggregate.rs:+3:9: +3:15
- StorageLive(_7); // scope 1 at $DIR/aggregate.rs:+3:18: +3:26
- StorageLive(_8); // scope 1 at $DIR/aggregate.rs:+3:18: +3:24
- StorageLive(_9); // scope 1 at $DIR/aggregate.rs:+3:19: +3:20
- _9 = _1; // scope 1 at $DIR/aggregate.rs:+3:19: +3:20
- _8 = (move _9, const 1_i32); // scope 1 at $DIR/aggregate.rs:+3:18: +3:24
- StorageDead(_9); // scope 1 at $DIR/aggregate.rs:+3:23: +3:24
-- _7 = (_8.1: i32); // scope 1 at $DIR/aggregate.rs:+3:18: +3:26
-- _6 = Add(move _7, const 2_i32); // scope 1 at $DIR/aggregate.rs:+3:18: +3:30
-+ _7 = const 1_i32; // scope 1 at $DIR/aggregate.rs:+3:18: +3:26
-+ _6 = const 3_i32; // scope 1 at $DIR/aggregate.rs:+3:18: +3:30
- StorageDead(_7); // scope 1 at $DIR/aggregate.rs:+3:29: +3:30
- StorageDead(_8); // scope 1 at $DIR/aggregate.rs:+3:30: +3:31
- _0 = const (); // scope 0 at $DIR/aggregate.rs:+0:15: +4:2
- StorageDead(_6); // scope 1 at $DIR/aggregate.rs:+4:1: +4:2
- StorageDead(_2); // scope 0 at $DIR/aggregate.rs:+4:1: +4:2
- return; // scope 0 at $DIR/aggregate.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..5e2db148d
--- /dev/null
+++ b/tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-abort.diff
@@ -0,0 +1,55 @@
+- // MIR for `foo` before ConstProp
++ // MIR for `foo` after ConstProp
+
+ fn foo(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: i32;
+ let mut _3: i32;
+ let mut _4: (i32, u8);
+ let mut _5: u8;
+ let mut _7: i32;
+ let mut _8: (u8, i32);
+ let mut _9: u8;
+ scope 1 {
+ debug first => _2;
+ let _6: i32;
+ scope 2 {
+ debug second => _6;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ _4 = (const 0_i32, move _5);
+ StorageDead(_5);
+- _3 = (_4.0: i32);
+- _2 = Add(move _3, const 1_i32);
++ _3 = const 0_i32;
++ _2 = const 1_i32;
+ StorageDead(_3);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = _1;
+ _8 = (move _9, const 1_i32);
+ StorageDead(_9);
+- _7 = (_8.1: i32);
+- _6 = Add(move _7, const 2_i32);
++ _7 = const 1_i32;
++ _6 = const 3_i32;
+ StorageDead(_7);
+ StorageDead(_8);
+ _0 = const ();
+ StorageDead(_6);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-unwind.diff
new file mode 100644
index 000000000..5e2db148d
--- /dev/null
+++ b/tests/mir-opt/const_prop/aggregate.foo.ConstProp.panic-unwind.diff
@@ -0,0 +1,55 @@
+- // MIR for `foo` before ConstProp
++ // MIR for `foo` after ConstProp
+
+ fn foo(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: i32;
+ let mut _3: i32;
+ let mut _4: (i32, u8);
+ let mut _5: u8;
+ let mut _7: i32;
+ let mut _8: (u8, i32);
+ let mut _9: u8;
+ scope 1 {
+ debug first => _2;
+ let _6: i32;
+ scope 2 {
+ debug second => _6;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ _4 = (const 0_i32, move _5);
+ StorageDead(_5);
+- _3 = (_4.0: i32);
+- _2 = Add(move _3, const 1_i32);
++ _3 = const 0_i32;
++ _2 = const 1_i32;
+ StorageDead(_3);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = _1;
+ _8 = (move _9, const 1_i32);
+ StorageDead(_9);
+- _7 = (_8.1: i32);
+- _6 = Add(move _7, const 2_i32);
++ _7 = const 1_i32;
++ _6 = const 3_i32;
+ StorageDead(_7);
+ StorageDead(_8);
+ _0 = const ();
+ StorageDead(_6);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/aggregate.foo.PreCodegen.after.mir b/tests/mir-opt/const_prop/aggregate.foo.PreCodegen.after.mir
deleted file mode 100644
index 2ef6d74e5..000000000
--- a/tests/mir-opt/const_prop/aggregate.foo.PreCodegen.after.mir
+++ /dev/null
@@ -1,49 +0,0 @@
-// MIR for `foo` after PreCodegen
-
-fn foo(_1: u8) -> () {
- debug x => _1; // in scope 0 at $DIR/aggregate.rs:+0:8: +0:9
- let mut _0: (); // return place in scope 0 at $DIR/aggregate.rs:+0:15: +0:15
- let _2: i32; // in scope 0 at $DIR/aggregate.rs:+2:9: +2:14
- let mut _3: i32; // in scope 0 at $DIR/aggregate.rs:+2:17: +2:25
- let mut _4: (i32, u8); // in scope 0 at $DIR/aggregate.rs:+2:17: +2:23
- let mut _5: u8; // in scope 0 at $DIR/aggregate.rs:+2:21: +2:22
- let mut _7: i32; // in scope 0 at $DIR/aggregate.rs:+3:18: +3:26
- let mut _8: (u8, i32); // in scope 0 at $DIR/aggregate.rs:+3:18: +3:24
- let mut _9: u8; // in scope 0 at $DIR/aggregate.rs:+3:19: +3:20
- scope 1 {
- debug first => _2; // in scope 1 at $DIR/aggregate.rs:+2:9: +2:14
- let _6: i32; // in scope 1 at $DIR/aggregate.rs:+3:9: +3:15
- scope 2 {
- debug second => _6; // in scope 2 at $DIR/aggregate.rs:+3:9: +3:15
- }
- }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/aggregate.rs:+2:9: +2:14
- StorageLive(_3); // scope 0 at $DIR/aggregate.rs:+2:17: +2:25
- StorageLive(_4); // scope 0 at $DIR/aggregate.rs:+2:17: +2:23
- StorageLive(_5); // scope 0 at $DIR/aggregate.rs:+2:21: +2:22
- _5 = _1; // scope 0 at $DIR/aggregate.rs:+2:21: +2:22
- _4 = (const 0_i32, move _5); // scope 0 at $DIR/aggregate.rs:+2:17: +2:23
- StorageDead(_5); // scope 0 at $DIR/aggregate.rs:+2:22: +2:23
- _3 = const 0_i32; // scope 0 at $DIR/aggregate.rs:+2:17: +2:25
- _2 = const 1_i32; // scope 0 at $DIR/aggregate.rs:+2:17: +2:29
- StorageDead(_3); // scope 0 at $DIR/aggregate.rs:+2:28: +2:29
- StorageDead(_4); // scope 0 at $DIR/aggregate.rs:+2:29: +2:30
- StorageLive(_6); // scope 1 at $DIR/aggregate.rs:+3:9: +3:15
- StorageLive(_7); // scope 1 at $DIR/aggregate.rs:+3:18: +3:26
- StorageLive(_8); // scope 1 at $DIR/aggregate.rs:+3:18: +3:24
- StorageLive(_9); // scope 1 at $DIR/aggregate.rs:+3:19: +3:20
- _9 = _1; // scope 1 at $DIR/aggregate.rs:+3:19: +3:20
- _8 = (move _9, const 1_i32); // scope 1 at $DIR/aggregate.rs:+3:18: +3:24
- StorageDead(_9); // scope 1 at $DIR/aggregate.rs:+3:23: +3:24
- _7 = const 1_i32; // scope 1 at $DIR/aggregate.rs:+3:18: +3:26
- _6 = const 3_i32; // scope 1 at $DIR/aggregate.rs:+3:18: +3:30
- StorageDead(_7); // scope 1 at $DIR/aggregate.rs:+3:29: +3:30
- StorageDead(_8); // scope 1 at $DIR/aggregate.rs:+3:30: +3:31
- _0 = const (); // scope 0 at $DIR/aggregate.rs:+0:15: +4:2
- StorageDead(_6); // scope 1 at $DIR/aggregate.rs:+4:1: +4:2
- StorageDead(_2); // scope 0 at $DIR/aggregate.rs:+4:1: +4:2
- return; // scope 0 at $DIR/aggregate.rs:+4:2: +4:2
- }
-}
diff --git a/tests/mir-opt/const_prop/aggregate.main.ConstProp.diff b/tests/mir-opt/const_prop/aggregate.main.ConstProp.diff
deleted file mode 100644
index 041197266..000000000
--- a/tests/mir-opt/const_prop/aggregate.main.ConstProp.diff
+++ /dev/null
@@ -1,44 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/aggregate.rs:+0:11: +0:11
- let _1: u8; // in scope 0 at $DIR/aggregate.rs:+1:9: +1:10
- let mut _2: u8; // in scope 0 at $DIR/aggregate.rs:+1:13: +1:24
- let mut _3: (i32, u8, i32); // in scope 0 at $DIR/aggregate.rs:+1:13: +1:22
- let _4: (); // in scope 0 at $DIR/aggregate.rs:+2:5: +2:11
- let mut _5: u8; // in scope 0 at $DIR/aggregate.rs:+2:9: +2:10
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/aggregate.rs:+1:9: +1:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/aggregate.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/aggregate.rs:+1:13: +1:24
- StorageLive(_3); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22
- _3 = (const 0_i32, const 1_u8, const 2_i32); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22
-- _2 = (_3.1: u8); // scope 0 at $DIR/aggregate.rs:+1:13: +1:24
-- _1 = Add(move _2, const 0_u8); // scope 0 at $DIR/aggregate.rs:+1:13: +1:28
-+ _2 = const 1_u8; // scope 0 at $DIR/aggregate.rs:+1:13: +1:24
-+ _1 = const 1_u8; // scope 0 at $DIR/aggregate.rs:+1:13: +1:28
- StorageDead(_2); // scope 0 at $DIR/aggregate.rs:+1:27: +1:28
- StorageDead(_3); // scope 0 at $DIR/aggregate.rs:+1:28: +1:29
- StorageLive(_4); // scope 1 at $DIR/aggregate.rs:+2:5: +2:11
- StorageLive(_5); // scope 1 at $DIR/aggregate.rs:+2:9: +2:10
-- _5 = _1; // scope 1 at $DIR/aggregate.rs:+2:9: +2:10
-+ _5 = const 1_u8; // scope 1 at $DIR/aggregate.rs:+2:9: +2:10
- _4 = foo(move _5) -> bb1; // scope 1 at $DIR/aggregate.rs:+2:5: +2:11
- // mir::Constant
- // + span: $DIR/aggregate.rs:9:5: 9:8
- // + literal: Const { ty: fn(u8) {foo}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_5); // scope 1 at $DIR/aggregate.rs:+2:10: +2:11
- StorageDead(_4); // scope 1 at $DIR/aggregate.rs:+2:11: +2:12
- _0 = const (); // scope 0 at $DIR/aggregate.rs:+0:11: +3:2
- StorageDead(_1); // scope 0 at $DIR/aggregate.rs:+3:1: +3:2
- return; // scope 0 at $DIR/aggregate.rs:+3:2: +3:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..a4911a6d4
--- /dev/null
+++ b/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff
@@ -0,0 +1,42 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u8;
+ let mut _2: u8;
+ let mut _3: (i32, u8, i32);
+ let _4: ();
+ let mut _5: u8;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = (const 0_i32, const 1_u8, const 2_i32);
+- _2 = (_3.1: u8);
+- _1 = Add(move _2, const 0_u8);
++ _2 = const 1_u8;
++ _1 = const 1_u8;
+ StorageDead(_2);
+ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+- _5 = _1;
+- _4 = foo(move _5) -> [return: bb1, unwind unreachable];
++ _5 = const 1_u8;
++ _4 = foo(const 1_u8) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff
new file mode 100644
index 000000000..b8b9fa5cc
--- /dev/null
+++ b/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,42 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u8;
+ let mut _2: u8;
+ let mut _3: (i32, u8, i32);
+ let _4: ();
+ let mut _5: u8;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = (const 0_i32, const 1_u8, const 2_i32);
+- _2 = (_3.1: u8);
+- _1 = Add(move _2, const 0_u8);
++ _2 = const 1_u8;
++ _1 = const 1_u8;
+ StorageDead(_2);
+ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+- _5 = _1;
+- _4 = foo(move _5) -> [return: bb1, unwind continue];
++ _5 = const 1_u8;
++ _4 = foo(const 1_u8) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir b/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir
deleted file mode 100644
index 05d4bf8b5..000000000
--- a/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.mir
+++ /dev/null
@@ -1,39 +0,0 @@
-// MIR for `main` after PreCodegen
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/aggregate.rs:+0:11: +0:11
- let _1: u8; // in scope 0 at $DIR/aggregate.rs:+1:9: +1:10
- let mut _2: u8; // in scope 0 at $DIR/aggregate.rs:+1:13: +1:24
- let mut _3: (i32, u8, i32); // in scope 0 at $DIR/aggregate.rs:+1:13: +1:22
- let _4: (); // in scope 0 at $DIR/aggregate.rs:+2:5: +2:11
- let mut _5: u8; // in scope 0 at $DIR/aggregate.rs:+2:9: +2:10
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/aggregate.rs:+1:9: +1:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/aggregate.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/aggregate.rs:+1:13: +1:24
- StorageLive(_3); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22
- _3 = (const 0_i32, const 1_u8, const 2_i32); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22
- _2 = const 1_u8; // scope 0 at $DIR/aggregate.rs:+1:13: +1:24
- _1 = const 1_u8; // scope 0 at $DIR/aggregate.rs:+1:13: +1:28
- StorageDead(_2); // scope 0 at $DIR/aggregate.rs:+1:27: +1:28
- StorageDead(_3); // scope 0 at $DIR/aggregate.rs:+1:28: +1:29
- StorageLive(_4); // scope 1 at $DIR/aggregate.rs:+2:5: +2:11
- StorageLive(_5); // scope 1 at $DIR/aggregate.rs:+2:9: +2:10
- _5 = const 1_u8; // scope 1 at $DIR/aggregate.rs:+2:9: +2:10
- _4 = foo(move _5) -> bb1; // scope 1 at $DIR/aggregate.rs:+2:5: +2:11
- // mir::Constant
- // + span: $DIR/aggregate.rs:9:5: 9:8
- // + literal: Const { ty: fn(u8) {foo}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_5); // scope 1 at $DIR/aggregate.rs:+2:10: +2:11
- StorageDead(_4); // scope 1 at $DIR/aggregate.rs:+2:11: +2:12
- _0 = const (); // scope 0 at $DIR/aggregate.rs:+0:11: +3:2
- StorageDead(_1); // scope 0 at $DIR/aggregate.rs:+3:1: +3:2
- return; // scope 0 at $DIR/aggregate.rs:+3:2: +3:2
- }
-}
diff --git a/tests/mir-opt/const_prop/aggregate.rs b/tests/mir-opt/const_prop/aggregate.rs
index ed5a4ab59..fa716b084 100644
--- a/tests/mir-opt/const_prop/aggregate.rs
+++ b/tests/mir-opt/const_prop/aggregate.rs
@@ -1,18 +1,29 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -O
// EMIT_MIR aggregate.main.ConstProp.diff
-// EMIT_MIR aggregate.main.PreCodegen.after.mir
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK-NOT: = Add(
+ // CHECK: [[x]] = const 1_u8;
+ // CHECK-NOT: = Add(
+ // CHECK: foo(const 1_u8)
let x = (0, 1, 2).1 + 0;
foo(x);
}
+// Verify that we still propagate if part of the aggregate is not known.
// EMIT_MIR aggregate.foo.ConstProp.diff
-// EMIT_MIR aggregate.foo.PreCodegen.after.mir
fn foo(x: u8) {
- // Verify that we still propagate if part of the aggregate is not known.
+ // CHECK-LABEL: fn foo(
+ // CHECK: debug first => [[first:_.*]];
+ // CHECK: debug second => [[second:_.*]];
+ // CHECK-NOT: = Add(
+ // CHECK: [[first]] = const 1_i32;
+ // CHECK-NOT: = Add(
+ // CHECK: [[second]] = const 3_i32;
let first = (0, x).0 + 1;
let second = (x, 1).1 + 2;
}
diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.diff
deleted file mode 100644
index 439b2a3e1..000000000
--- a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.diff
+++ /dev/null
@@ -1,39 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:+0:11: +0:11
- let _1: u32; // in scope 0 at $DIR/array_index.rs:+1:9: +1:10
- let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:+1:18: +1:30
- let _3: usize; // in scope 0 at $DIR/array_index.rs:+1:31: +1:32
- let mut _4: usize; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33
- let mut _5: bool; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/array_index.rs:+1:9: +1:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/array_index.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:30
- _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; // scope 0 at $DIR/array_index.rs:+1:18: +1:30
- StorageLive(_3); // scope 0 at $DIR/array_index.rs:+1:31: +1:32
- _3 = const 2_usize; // scope 0 at $DIR/array_index.rs:+1:31: +1:32
-- _4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
-- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
-- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
-+ _4 = const 4_usize; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
-+ _5 = const true; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
-+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
- }
-
- bb1: {
-- _1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
-+ _1 = const 2_u32; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
- StorageDead(_3); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
- StorageDead(_2); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
- _0 = const (); // scope 0 at $DIR/array_index.rs:+0:11: +2:2
- StorageDead(_1); // scope 0 at $DIR/array_index.rs:+2:1: +2:2
- return; // scope 0 at $DIR/array_index.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..b2f58f8f7
--- /dev/null
+++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ 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 = const 2_u32;
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..f9e3f8f17
--- /dev/null
+++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ 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 = const 2_u32;
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.diff
deleted file mode 100644
index 439b2a3e1..000000000
--- a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.diff
+++ /dev/null
@@ -1,39 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:+0:11: +0:11
- let _1: u32; // in scope 0 at $DIR/array_index.rs:+1:9: +1:10
- let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:+1:18: +1:30
- let _3: usize; // in scope 0 at $DIR/array_index.rs:+1:31: +1:32
- let mut _4: usize; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33
- let mut _5: bool; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/array_index.rs:+1:9: +1:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/array_index.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:30
- _2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; // scope 0 at $DIR/array_index.rs:+1:18: +1:30
- StorageLive(_3); // scope 0 at $DIR/array_index.rs:+1:31: +1:32
- _3 = const 2_usize; // scope 0 at $DIR/array_index.rs:+1:31: +1:32
-- _4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
-- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
-- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
-+ _4 = const 4_usize; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
-+ _5 = const true; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
-+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
- }
-
- bb1: {
-- _1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
-+ _1 = const 2_u32; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
- StorageDead(_3); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
- StorageDead(_2); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
- _0 = const (); // scope 0 at $DIR/array_index.rs:+0:11: +2:2
- StorageDead(_1); // scope 0 at $DIR/array_index.rs:+2:1: +2:2
- return; // scope 0 at $DIR/array_index.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..b2f58f8f7
--- /dev/null
+++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ 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 = const 2_u32;
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..f9e3f8f17
--- /dev/null
+++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ 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 = const 2_u32;
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/array_index.rs b/tests/mir-opt/const_prop/array_index.rs
index f36cf2213..c4c46d78f 100644
--- a/tests/mir-opt/const_prop/array_index.rs
+++ b/tests/mir-opt/const_prop/array_index.rs
@@ -1,8 +1,11 @@
-// ignore-wasm32 compiled with panic=abort by default
// unit-test: ConstProp
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR array_index.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: [[x]] = const 2_u32;
let x: u32 = [0, 1, 2, 3][2];
}
diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.diff
deleted file mode 100644
index 900061a48..000000000
--- a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.diff
+++ /dev/null
@@ -1,53 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/bad_op_div_by_zero.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+1:9: +1:10
- let mut _3: i32; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
- let mut _4: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
- let mut _5: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
- let mut _6: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
- let mut _7: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
- scope 1 {
- debug y => _1; // in scope 1 at $DIR/bad_op_div_by_zero.rs:+1:9: +1:10
- let _2: i32; // in scope 1 at $DIR/bad_op_div_by_zero.rs:+2:9: +2:11
- scope 2 {
- debug _z => _2; // in scope 2 at $DIR/bad_op_div_by_zero.rs:+2:9: +2:11
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/bad_op_div_by_zero.rs:+1:9: +1:10
- _1 = const 0_i32; // scope 0 at $DIR/bad_op_div_by_zero.rs:+1:13: +1:14
- StorageLive(_2); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:9: +2:11
- StorageLive(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
-- _3 = _1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
-- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
-- assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
-+ _3 = const 0_i32; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
-+ _4 = const true; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
-+ assert(!const true, "attempt to divide `{}` by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
- }
-
- bb1: {
-- _5 = Eq(_3, const -1_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
-- _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
-- _7 = BitAnd(move _5, move _6); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
-- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
-+ _5 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
-+ _6 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
-+ _7 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
-+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
- }
-
- bb2: {
- _2 = Div(const 1_i32, move _3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
- StorageDead(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
- _0 = const (); // scope 0 at $DIR/bad_op_div_by_zero.rs:+0:11: +3:2
- StorageDead(_2); // scope 1 at $DIR/bad_op_div_by_zero.rs:+3:1: +3:2
- StorageDead(_1); // scope 0 at $DIR/bad_op_div_by_zero.rs:+3:1: +3:2
- return; // scope 0 at $DIR/bad_op_div_by_zero.rs:+3:2: +3:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..cead70110
--- /dev/null
+++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff
@@ -0,0 +1,54 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _3: i32;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: bool;
+ let mut _7: bool;
+ scope 1 {
+ debug y => _1;
+ let _2: i32;
+ scope 2 {
+ debug _z => _2;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 0_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = _1;
+- _4 = Eq(_3, const 0_i32);
+- assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind unreachable];
++ _3 = const 0_i32;
++ _4 = const true;
++ assert(!const true, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _5 = Eq(_3, const -1_i32);
+- _6 = Eq(const 1_i32, const i32::MIN);
+- _7 = BitAnd(move _5, move _6);
+- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable];
++ _5 = const false;
++ _6 = const false;
++ _7 = const false;
++ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32) -> [success: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- _2 = Div(const 1_i32, move _3);
++ _2 = Div(const 1_i32, const 0_i32);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff
new file mode 100644
index 000000000..c9c4ba854
--- /dev/null
+++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,54 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _3: i32;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: bool;
+ let mut _7: bool;
+ scope 1 {
+ debug y => _1;
+ let _2: i32;
+ scope 2 {
+ debug _z => _2;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 0_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = _1;
+- _4 = Eq(_3, const 0_i32);
+- assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind continue];
++ _3 = const 0_i32;
++ _4 = const true;
++ assert(!const true, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _5 = Eq(_3, const -1_i32);
+- _6 = Eq(const 1_i32, const i32::MIN);
+- _7 = BitAnd(move _5, move _6);
+- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind continue];
++ _5 = const false;
++ _6 = const false;
++ _7 = const false;
++ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32) -> [success: bb2, unwind continue];
+ }
+
+ bb2: {
+- _2 = Div(const 1_i32, move _3);
++ _2 = Div(const 1_i32, const 0_i32);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs
index 38f1a993d..0e8765a07 100644
--- a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs
+++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs
@@ -1,8 +1,15 @@
-// ignore-wasm32 compiled with panic=abort by default
// unit-test: ConstProp
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
// EMIT_MIR bad_op_div_by_zero.main.ConstProp.diff
#[allow(unconditional_panic)]
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug y => [[y:_.*]];
+ // CHECK: debug _z => [[z:_.*]];
+ // CHECK: assert(!const true, "attempt to divide `{}` by zero", const 1_i32)
+ // CHECK: assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32)
+ // CHECK: [[z]] = Div(const 1_i32, const 0_i32);
let y = 0;
let _z = 1 / y;
}
diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff
deleted file mode 100644
index 85d6b5e3d..000000000
--- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff
+++ /dev/null
@@ -1,53 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/bad_op_mod_by_zero.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10
- let mut _3: i32; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
- let mut _4: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
- let mut _5: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
- let mut _6: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
- let mut _7: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
- scope 1 {
- debug y => _1; // in scope 1 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10
- let _2: i32; // in scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11
- scope 2 {
- debug _z => _2; // in scope 2 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10
- _1 = const 0_i32; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:13: +1:14
- StorageLive(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11
- StorageLive(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
-- _3 = _1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
-- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
-- assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
-+ _3 = const 0_i32; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
-+ _4 = const true; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
-+ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
- }
-
- bb1: {
-- _5 = Eq(_3, const -1_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
-- _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
-- _7 = BitAnd(move _5, move _6); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
-- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
-+ _5 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
-+ _6 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
-+ _7 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
-+ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
- }
-
- bb2: {
- _2 = Rem(const 1_i32, move _3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
- StorageDead(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
- _0 = const (); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+0:11: +3:2
- StorageDead(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+3:1: +3:2
- StorageDead(_1); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+3:1: +3:2
- return; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+3:2: +3:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..2666fd9eb
--- /dev/null
+++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff
@@ -0,0 +1,54 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _3: i32;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: bool;
+ let mut _7: bool;
+ scope 1 {
+ debug y => _1;
+ let _2: i32;
+ scope 2 {
+ debug _z => _2;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 0_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = _1;
+- _4 = Eq(_3, const 0_i32);
+- assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> [success: bb1, unwind unreachable];
++ _3 = const 0_i32;
++ _4 = const true;
++ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _5 = Eq(_3, const -1_i32);
+- _6 = Eq(const 1_i32, const i32::MIN);
+- _7 = BitAnd(move _5, move _6);
+- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable];
++ _5 = const false;
++ _6 = const false;
++ _7 = const false;
++ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, const 0_i32) -> [success: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- _2 = Rem(const 1_i32, move _3);
++ _2 = Rem(const 1_i32, const 0_i32);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff
new file mode 100644
index 000000000..679df90f1
--- /dev/null
+++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,54 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _3: i32;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: bool;
+ let mut _7: bool;
+ scope 1 {
+ debug y => _1;
+ let _2: i32;
+ scope 2 {
+ debug _z => _2;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 0_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = _1;
+- _4 = Eq(_3, const 0_i32);
+- assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> [success: bb1, unwind continue];
++ _3 = const 0_i32;
++ _4 = const true;
++ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _5 = Eq(_3, const -1_i32);
+- _6 = Eq(const 1_i32, const i32::MIN);
+- _7 = BitAnd(move _5, move _6);
+- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind continue];
++ _5 = const false;
++ _6 = const false;
++ _7 = const false;
++ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, const 0_i32) -> [success: bb2, unwind continue];
+ }
+
+ bb2: {
+- _2 = Rem(const 1_i32, move _3);
++ _2 = Rem(const 1_i32, const 0_i32);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs
index 93d558250..d895d9e21 100644
--- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs
+++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs
@@ -1,8 +1,16 @@
// unit-test: ConstProp
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
// EMIT_MIR bad_op_mod_by_zero.main.ConstProp.diff
#[allow(unconditional_panic)]
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug y => [[y:_.*]];
+ // CHECK: debug _z => [[z:_.*]];
+ // CHECK: assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of
+ // zero", const 1_i32)
+ // CHECK: assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, const 0_i32)
+ // CHECK: [[z]] = Rem(const 1_i32, const 0_i32);
let y = 0;
let _z = 1 % y;
}
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff
deleted file mode 100644
index d72675c2d..000000000
--- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff
+++ /dev/null
@@ -1,57 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+0:11: +0:11
- let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
- let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:26: +1:35
- let _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
- let mut _7: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- let mut _8: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- let mut _9: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- scope 1 {
- debug a => _1; // in scope 1 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
- scope 2 {
- let _5: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
- scope 3 {
- debug _b => _5; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- _9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- // mir::Constant
- // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:9:25: 9:35
- // + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) }
- _3 = &(*_9); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- _2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- _1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- StorageDead(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:34: +1:35
- StorageDead(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:35: +1:36
- StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
- StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
- _6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
- _7 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-+ _8 = const false; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-+ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- }
-
- bb1: {
-- _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-+ _5 = (*_1)[3 of 4]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26
- _0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6
- StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6
- StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:1: +5:2
- return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..e443c8991
--- /dev/null
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff
@@ -0,0 +1,54 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: *const [i32];
+ let mut _2: *const [i32; 3];
+ let _3: &[i32; 3];
+ let _4: [i32; 3];
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: bool;
+ let mut _9: &[i32; 3];
+ scope 1 {
+ debug a => _1;
+ scope 2 {
+ let _5: i32;
+ scope 3 {
+ debug _b => _5;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _9 = const _;
+ _3 = &(*_9);
+ _2 = &raw const (*_3);
+ _1 = move _2 as *const [i32] (PointerCoercion(Unsize));
+ StorageDead(_2);
+ StorageDead(_3);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = 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 = 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: {
+- _5 = (*_1)[_6];
++ _5 = (*_1)[3 of 4];
+ StorageDead(_6);
+ _0 = const ();
+ StorageDead(_5);
+ StorageDead(_1);
+ return;
+ }
+ }
+
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
new file mode 100644
index 000000000..592f43f47
--- /dev/null
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,54 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: *const [i32];
+ let mut _2: *const [i32; 3];
+ let _3: &[i32; 3];
+ let _4: [i32; 3];
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: bool;
+ let mut _9: &[i32; 3];
+ scope 1 {
+ debug a => _1;
+ scope 2 {
+ let _5: i32;
+ scope 3 {
+ debug _b => _5;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _9 = const _;
+ _3 = &(*_9);
+ _2 = &raw const (*_3);
+ _1 = move _2 as *const [i32] (PointerCoercion(Unsize));
+ StorageDead(_2);
+ StorageDead(_3);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = 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 = 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: {
+- _5 = (*_1)[_6];
++ _5 = (*_1)[3 of 4];
+ StorageDead(_6);
+ _0 = const ();
+ StorageDead(_5);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff
deleted file mode 100644
index d72675c2d..000000000
--- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff
+++ /dev/null
@@ -1,57 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+0:11: +0:11
- let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
- let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:26: +1:35
- let _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
- let mut _7: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- let mut _8: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- let mut _9: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- scope 1 {
- debug a => _1; // in scope 1 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
- scope 2 {
- let _5: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
- scope 3 {
- debug _b => _5; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- _9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- // mir::Constant
- // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:9:25: 9:35
- // + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) }
- _3 = &(*_9); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- _2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- _1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- StorageDead(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:34: +1:35
- StorageDead(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:35: +1:36
- StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
- StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
- _6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
- _7 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-+ _8 = const false; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-+ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- }
-
- bb1: {
-- _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-+ _5 = (*_1)[3 of 4]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26
- _0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6
- StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6
- StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:1: +5:2
- return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..e443c8991
--- /dev/null
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff
@@ -0,0 +1,54 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: *const [i32];
+ let mut _2: *const [i32; 3];
+ let _3: &[i32; 3];
+ let _4: [i32; 3];
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: bool;
+ let mut _9: &[i32; 3];
+ scope 1 {
+ debug a => _1;
+ scope 2 {
+ let _5: i32;
+ scope 3 {
+ debug _b => _5;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _9 = const _;
+ _3 = &(*_9);
+ _2 = &raw const (*_3);
+ _1 = move _2 as *const [i32] (PointerCoercion(Unsize));
+ StorageDead(_2);
+ StorageDead(_3);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = 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 = 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: {
+- _5 = (*_1)[_6];
++ _5 = (*_1)[3 of 4];
+ StorageDead(_6);
+ _0 = const ();
+ StorageDead(_5);
+ StorageDead(_1);
+ return;
+ }
+ }
+
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
new file mode 100644
index 000000000..592f43f47
--- /dev/null
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,54 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: *const [i32];
+ let mut _2: *const [i32; 3];
+ let _3: &[i32; 3];
+ let _4: [i32; 3];
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: bool;
+ let mut _9: &[i32; 3];
+ scope 1 {
+ debug a => _1;
+ scope 2 {
+ let _5: i32;
+ scope 3 {
+ debug _b => _5;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _9 = const _;
+ _3 = &(*_9);
+ _2 = &raw const (*_3);
+ _1 = move _2 as *const [i32] (PointerCoercion(Unsize));
+ StorageDead(_2);
+ StorageDead(_3);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = 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 = 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: {
+- _5 = (*_1)[_6];
++ _5 = (*_1)[3 of 4];
+ StorageDead(_6);
+ _0 = const ();
+ StorageDead(_5);
+ StorageDead(_1);
+ return;
+ }
+ }
+
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 ef148d16d..266105c11 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,11 +1,14 @@
// unit-test: ConstProp
-// ignore-wasm32 compiled with panic=abort by default
-// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen
-
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
// EMIT_MIR bad_op_unsafe_oob_for_slices.main.ConstProp.diff
#[allow(unconditional_panic)]
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug a => [[a:_.*]];
+ // CHECK: debug _b => [[b:_.*]];
+ // CHECK: [[b]] = (*[[a]])[3 of 4];
let a: *const [_] = &[1, 2, 3];
unsafe {
let _b = (*a)[3];
diff --git a/tests/mir-opt/const_prop/boolean_identities.rs b/tests/mir-opt/const_prop/boolean_identities.rs
index c7b609949..2aa038034 100644
--- a/tests/mir-opt/const_prop/boolean_identities.rs
+++ b/tests/mir-opt/const_prop/boolean_identities.rs
@@ -1,9 +1,16 @@
// unit-test: ConstProp
-// compile-flags: -O -Zmir-opt-level=4
// EMIT_MIR boolean_identities.test.ConstProp.diff
pub fn test(x: bool, y: bool) -> bool {
- (y | true) & (x & false)
+ // CHECK-LABEL: fn test(
+ // CHECK: debug a => [[a:_.*]];
+ // CHECK: debug b => [[b:_.*]];
+ // CHECK: [[a]] = const true;
+ // CHECK: [[b]] = const false;
+ // CHECK: _0 = const false;
+ let a = (y | true);
+ let b = (x & false);
+ a & b
}
fn main() {
diff --git a/tests/mir-opt/const_prop/boolean_identities.test.ConstProp.diff b/tests/mir-opt/const_prop/boolean_identities.test.ConstProp.diff
index 549b4711e..41e1acdff 100644
--- a/tests/mir-opt/const_prop/boolean_identities.test.ConstProp.diff
+++ b/tests/mir-opt/const_prop/boolean_identities.test.ConstProp.diff
@@ -2,26 +2,48 @@
+ // MIR for `test` after ConstProp
fn test(_1: bool, _2: bool) -> bool {
- debug x => _1; // in scope 0 at $DIR/boolean_identities.rs:+0:13: +0:14
- debug y => _2; // in scope 0 at $DIR/boolean_identities.rs:+0:22: +0:23
- let mut _0: bool; // return place in scope 0 at $DIR/boolean_identities.rs:+0:34: +0:38
- let mut _3: bool; // in scope 0 at $DIR/boolean_identities.rs:+1:5: +1:15
- let mut _4: bool; // in scope 0 at $DIR/boolean_identities.rs:+1:6: +1:7
- let mut _5: bool; // in scope 0 at $DIR/boolean_identities.rs:+1:18: +1:29
- let mut _6: bool; // in scope 0 at $DIR/boolean_identities.rs:+1:19: +1:20
+ debug x => _1;
+ debug y => _2;
+ let mut _0: bool;
+ let _3: bool;
+ let mut _4: bool;
+ let mut _6: bool;
+ let mut _7: bool;
+ let mut _8: bool;
+ scope 1 {
+ debug a => _3;
+ let _5: bool;
+ scope 2 {
+ debug b => _5;
+ }
+ }
bb0: {
- StorageLive(_3); // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:15
-- _3 = BitOr(_2, const true); // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:15
-+ _3 = const true; // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:15
- StorageLive(_5); // scope 0 at $DIR/boolean_identities.rs:+1:18: +1:29
-- _5 = BitAnd(_1, const false); // scope 0 at $DIR/boolean_identities.rs:+1:18: +1:29
-- _0 = BitAnd(move _3, move _5); // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:29
-+ _5 = const false; // scope 0 at $DIR/boolean_identities.rs:+1:18: +1:29
-+ _0 = const false; // scope 0 at $DIR/boolean_identities.rs:+1:5: +1:29
- StorageDead(_5); // scope 0 at $DIR/boolean_identities.rs:+1:28: +1:29
- StorageDead(_3); // scope 0 at $DIR/boolean_identities.rs:+1:28: +1:29
- return; // scope 0 at $DIR/boolean_identities.rs:+2:2: +2:2
+ 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);
+ StorageLive(_7);
+- _7 = _3;
++ _7 = const true;
+ StorageLive(_8);
+- _8 = _5;
+- _0 = BitAnd(move _7, move _8);
++ _8 = const false;
++ _0 = const false;
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_3);
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/boxes.main.ConstProp.diff b/tests/mir-opt/const_prop/boxes.main.ConstProp.diff
deleted file mode 100644
index b0e86e753..000000000
--- a/tests/mir-opt/const_prop/boxes.main.ConstProp.diff
+++ /dev/null
@@ -1,60 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/boxes.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/boxes.rs:+1:9: +1:10
- let mut _2: i32; // in scope 0 at $DIR/boxes.rs:+1:13: +2:18
- let mut _3: std::boxed::Box<i32>; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18
- let mut _4: usize; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18
- let mut _5: usize; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18
- let mut _6: *mut u8; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18
- let mut _7: std::boxed::Box<i32>; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18
- let mut _8: *const i32; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18
- let mut _9: *const i32; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/boxes.rs:+1:9: +1:10
- }
- scope 2 {
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/boxes.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/boxes.rs:+1:13: +2:18
- StorageLive(_3); // scope 0 at $DIR/boxes.rs:+1:14: +2:18
-- _4 = SizeOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +2:18
-- _5 = AlignOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +2:18
-+ _4 = const 4_usize; // scope 2 at $DIR/boxes.rs:+1:14: +2:18
-+ _5 = const 4_usize; // scope 2 at $DIR/boxes.rs:+1:14: +2:18
- _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> bb1; // scope 2 at $DIR/boxes.rs:+1:14: +2:18
- // mir::Constant
- // + span: $DIR/boxes.rs:13:14: 14:18
- // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageLive(_7); // scope 0 at $DIR/boxes.rs:+1:14: +2:18
- _7 = ShallowInitBox(move _6, i32); // scope 0 at $DIR/boxes.rs:+1:14: +2:18
- _8 = (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); // scope 0 at $DIR/boxes.rs:+2:14: +2:16
- (*_8) = const 42_i32; // scope 0 at $DIR/boxes.rs:+2:14: +2:16
- _3 = move _7; // scope 0 at $DIR/boxes.rs:+1:14: +2:18
- StorageDead(_7); // scope 0 at $DIR/boxes.rs:+2:17: +2:18
- _9 = (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); // scope 0 at $DIR/boxes.rs:+1:13: +2:18
- _2 = (*_9); // scope 0 at $DIR/boxes.rs:+1:13: +2:18
- _1 = Add(move _2, const 0_i32); // scope 0 at $DIR/boxes.rs:+1:13: +3:12
- StorageDead(_2); // scope 0 at $DIR/boxes.rs:+3:11: +3:12
- drop(_3) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/boxes.rs:+3:12: +3:13
- }
-
- bb2: {
- StorageDead(_3); // scope 0 at $DIR/boxes.rs:+3:12: +3:13
- _0 = const (); // scope 0 at $DIR/boxes.rs:+0:11: +4:2
- StorageDead(_1); // scope 0 at $DIR/boxes.rs:+4:1: +4:2
- return; // scope 0 at $DIR/boxes.rs:+4:2: +4:2
- }
-
- bb3 (cleanup): {
- resume; // scope 0 at $DIR/boxes.rs:+0:1: +4:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..c9670a5ee
--- /dev/null
+++ b/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff
@@ -0,0 +1,54 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _2: i32;
+ let mut _3: std::boxed::Box<i32>;
+ let mut _4: usize;
+ let mut _5: usize;
+ let mut _6: *mut u8;
+ let mut _7: std::boxed::Box<i32>;
+ let mut _8: *const i32;
+ let mut _9: *const i32;
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+- _4 = SizeOf(i32);
+- _5 = AlignOf(i32);
+- _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb1, unwind unreachable];
++ _4 = const 4_usize;
++ _5 = const 4_usize;
++ _6 = alloc::alloc::exchange_malloc(const 4_usize, const 4_usize) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageLive(_7);
+ _7 = ShallowInitBox(move _6, i32);
+ _8 = (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
+ (*_8) = const 42_i32;
+ _3 = move _7;
+ StorageDead(_7);
+ _9 = (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
+ _2 = (*_9);
+ _1 = Add(move _2, const 0_i32);
+ StorageDead(_2);
+ drop(_3) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff
new file mode 100644
index 000000000..64fe72be5
--- /dev/null
+++ b/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,58 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _2: i32;
+ let mut _3: std::boxed::Box<i32>;
+ let mut _4: usize;
+ let mut _5: usize;
+ let mut _6: *mut u8;
+ let mut _7: std::boxed::Box<i32>;
+ let mut _8: *const i32;
+ let mut _9: *const i32;
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+- _4 = SizeOf(i32);
+- _5 = AlignOf(i32);
+- _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb1, unwind continue];
++ _4 = const 4_usize;
++ _5 = const 4_usize;
++ _6 = alloc::alloc::exchange_malloc(const 4_usize, const 4_usize) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageLive(_7);
+ _7 = ShallowInitBox(move _6, i32);
+ _8 = (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
+ (*_8) = const 42_i32;
+ _3 = move _7;
+ StorageDead(_7);
+ _9 = (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
+ _2 = (*_9);
+ _1 = Add(move _2, const 0_i32);
+ StorageDead(_2);
+ drop(_3) -> [return: bb2, unwind: bb3];
+ }
+
+ bb2: {
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+
+ bb3 (cleanup): {
+ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/boxes.rs b/tests/mir-opt/const_prop/boxes.rs
index 66e8c24d4..90a8e33e8 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
-// ignore-wasm32
-// ignore-wasm64
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![feature(rustc_attrs, stmt_expr_attributes)]
@@ -10,6 +8,11 @@
// EMIT_MIR boxes.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: (*{{_.*}}) = const 42_i32;
+ // CHECK: [[tmp:_.*]] = (*{{_.*}});
+ // CHECK: [[x]] = Add(move [[tmp]], const 0_i32);
let x = *(#[rustc_box]
Box::new(42))
+ 0;
diff --git a/tests/mir-opt/const_prop/cast.main.ConstProp.diff b/tests/mir-opt/const_prop/cast.main.ConstProp.diff
index 1d4dfc29f..c63adcf11 100644
--- a/tests/mir-opt/const_prop/cast.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/cast.main.ConstProp.diff
@@ -2,27 +2,27 @@
+ // MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/cast.rs:+0:11: +0:11
- let _1: u32; // in scope 0 at $DIR/cast.rs:+1:9: +1:10
+ let mut _0: ();
+ let _1: u32;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/cast.rs:+1:9: +1:10
- let _2: u8; // in scope 1 at $DIR/cast.rs:+3:9: +3:10
+ debug x => _1;
+ let _2: u8;
scope 2 {
- debug y => _2; // in scope 2 at $DIR/cast.rs:+3:9: +3:10
+ debug y => _2;
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/cast.rs:+1:9: +1:10
-- _1 = const 42_u8 as u32 (IntToInt); // scope 0 at $DIR/cast.rs:+1:13: +1:24
-+ _1 = const 42_u32; // scope 0 at $DIR/cast.rs:+1:13: +1:24
- StorageLive(_2); // scope 1 at $DIR/cast.rs:+3:9: +3:10
-- _2 = const 42_u32 as u8 (IntToInt); // scope 1 at $DIR/cast.rs:+3:13: +3:24
-+ _2 = const 42_u8; // scope 1 at $DIR/cast.rs:+3:13: +3:24
- _0 = const (); // scope 0 at $DIR/cast.rs:+0:11: +4:2
- StorageDead(_2); // scope 1 at $DIR/cast.rs:+4:1: +4:2
- StorageDead(_1); // scope 0 at $DIR/cast.rs:+4:1: +4:2
- return; // scope 0 at $DIR/cast.rs:+4:2: +4:2
+ StorageLive(_1);
+- _1 = const 42_u8 as u32 (IntToInt);
++ _1 = const 42_u32;
+ StorageLive(_2);
+- _2 = const 42_u32 as u8 (IntToInt);
++ _2 = const 42_u8;
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/cast.rs b/tests/mir-opt/const_prop/cast.rs
index 984086eda..b81c2740a 100644
--- a/tests/mir-opt/const_prop/cast.rs
+++ b/tests/mir-opt/const_prop/cast.rs
@@ -2,7 +2,11 @@
// EMIT_MIR cast.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: debug y => [[y:_.*]];
+ // CHECK: [[x]] = const 42_u32;
+ // CHECK: [[y]] = const 42_u8;
let x = 42u8 as u32;
-
let y = 42u32 as u8;
}
diff --git a/tests/mir-opt/const_prop/checked_add.main.ConstProp.diff b/tests/mir-opt/const_prop/checked_add.main.ConstProp.diff
deleted file mode 100644
index 96d0d2566..000000000
--- a/tests/mir-opt/const_prop/checked_add.main.ConstProp.diff
+++ /dev/null
@@ -1,28 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/checked_add.rs:+0:11: +0:11
- let _1: u32; // in scope 0 at $DIR/checked_add.rs:+1:9: +1:10
- let mut _2: (u32, bool); // in scope 0 at $DIR/checked_add.rs:+1:18: +1:23
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/checked_add.rs:+1:9: +1:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/checked_add.rs:+1:9: +1:10
-- _2 = CheckedAdd(const 1_u32, const 1_u32); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
-- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> bb1; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
-+ _2 = const (2_u32, false); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
-+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> bb1; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
- }
-
- bb1: {
-- _1 = move (_2.0: u32); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
-+ _1 = const 2_u32; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
- _0 = const (); // scope 0 at $DIR/checked_add.rs:+0:11: +2:2
- StorageDead(_1); // scope 0 at $DIR/checked_add.rs:+2:1: +2:2
- return; // scope 0 at $DIR/checked_add.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..5a958cc7a
--- /dev/null
+++ b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff
@@ -0,0 +1,32 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: (u32, bool);
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _2 = CheckedAdd(const 1_u32, const 1_u32);
+- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> [success: bb1, unwind unreachable];
++ _2 = const (2_u32, false);
++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = move (_2.0: u32);
++ _1 = const 2_u32;
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (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
new file mode 100644
index 000000000..ab48186ae
--- /dev/null
+++ b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,32 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: (u32, bool);
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _2 = CheckedAdd(const 1_u32, const 1_u32);
+- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> [success: bb1, unwind continue];
++ _2 = const (2_u32, false);
++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = move (_2.0: u32);
++ _1 = const 2_u32;
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 02 00 00 00 00 __ __ __ │ .....░░░
+ }
+
diff --git a/tests/mir-opt/const_prop/checked_add.rs b/tests/mir-opt/const_prop/checked_add.rs
index 007defd10..571a5cc4e 100644
--- a/tests/mir-opt/const_prop/checked_add.rs
+++ b/tests/mir-opt/const_prop/checked_add.rs
@@ -1,8 +1,12 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -C overflow-checks=on
// EMIT_MIR checked_add.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: assert(!const false,
+ // CHECK: [[x]] = const 2_u32;
let x: u32 = 1 + 1;
}
diff --git a/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff b/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff
deleted file mode 100644
index d75fae30b..000000000
--- a/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff
+++ /dev/null
@@ -1,44 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/const_prop_fails_gracefully.rs:+0:11: +0:11
- let _1: usize; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:9: +2:10
- let mut _2: *const i32; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:30
- let _3: &i32; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
- let _4: (); // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12
- let mut _5: usize; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/const_prop_fails_gracefully.rs:+2:9: +2:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:9: +2:10
- StorageLive(_2); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:30
- StorageLive(_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
- _3 = const _; // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
- // mir::Constant
- // + span: $DIR/const_prop_fails_gracefully.rs:9:13: 9:16
- // + literal: Const { ty: &i32, val: Unevaluated(FOO, [], None) }
- _2 = &raw const (*_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
- _1 = move _2 as usize (PointerExposeAddress); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:39
- StorageDead(_2); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:38: +2:39
- StorageDead(_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:39: +2:40
- StorageLive(_4); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12
- StorageLive(_5); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11
- _5 = _1; // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11
- _4 = read(move _5) -> bb1; // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12
- // mir::Constant
- // + span: $DIR/const_prop_fails_gracefully.rs:10:5: 10:9
- // + literal: Const { ty: fn(usize) {read}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_5); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:11: +3:12
- StorageDead(_4); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:12: +3:13
- _0 = const (); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+0:11: +4:2
- StorageDead(_1); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+4:1: +4:2
- return; // scope 0 at $DIR/const_prop_fails_gracefully.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs b/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs
deleted file mode 100644
index 44d487842..000000000
--- a/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// ignore-wasm32 compiled with panic=abort by default
-// unit-test: ConstProp
-#[inline(never)]
-fn read(_: usize) { }
-
-// EMIT_MIR const_prop_fails_gracefully.main.ConstProp.diff
-fn main() {
- const FOO: &i32 = &1;
- let x = FOO as *const i32 as usize;
- read(x);
-}
diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff
deleted file mode 100644
index 7e77c18d5..000000000
--- a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff
+++ /dev/null
@@ -1,31 +0,0 @@
-- // MIR for `hello` before ConstProp
-+ // MIR for `hello` after ConstProp
-
- fn hello() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/control_flow_simplification.rs:+0:14: +0:14
- let mut _1: bool; // in scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
- let mut _2: !; // in scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
- _1 = const _; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
-- switchInt(move _1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
-+ switchInt(const false) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
- }
-
- bb1: {
- _2 = begin_panic::<&str>(const "explicit panic"); // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/std/src/panic.rs:LL:COL
- // + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value(<ZST>) }
- // mir::Constant
- // + span: $SRC_DIR/std/src/panic.rs:LL:COL
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- }
-
- bb2: {
- StorageDead(_1); // scope 0 at $DIR/control_flow_simplification.rs:+3:5: +3:6
- return; // scope 0 at $DIR/control_flow_simplification.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..ba2e89f0a
--- /dev/null
+++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-abort.diff
@@ -0,0 +1,26 @@
+- // MIR for `hello` before ConstProp
++ // MIR for `hello` after ConstProp
+
+ fn hello() -> () {
+ let mut _0: ();
+ let mut _1: bool;
+ let mut _2: !;
+
+ bb0: {
+ StorageLive(_1);
+- _1 = const _;
+- switchInt(move _1) -> [0: bb2, otherwise: bb1];
++ _1 = const false;
++ switchInt(const false) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ _2 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable;
+ }
+
+ bb2: {
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff
new file mode 100644
index 000000000..e0a610f60
--- /dev/null
+++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff
@@ -0,0 +1,26 @@
+- // MIR for `hello` before ConstProp
++ // MIR for `hello` after ConstProp
+
+ fn hello() -> () {
+ let mut _0: ();
+ let mut _1: bool;
+ let mut _2: !;
+
+ bb0: {
+ StorageLive(_1);
+- _1 = const _;
+- switchInt(move _1) -> [0: bb2, otherwise: bb1];
++ _1 = const false;
++ switchInt(const false) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ _2 = begin_panic::<&str>(const "explicit panic") -> unwind continue;
+ }
+
+ bb2: {
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir b/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir
deleted file mode 100644
index 9f7528f0c..000000000
--- a/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir
+++ /dev/null
@@ -1,9 +0,0 @@
-// MIR for `hello` before PreCodegen
-
-fn hello() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/control_flow_simplification.rs:+0:14: +0:14
-
- bb0: {
- return; // scope 0 at $DIR/control_flow_simplification.rs:+4:2: +4:2
- }
-}
diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.panic-abort.mir b/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.panic-abort.mir
new file mode 100644
index 000000000..2b90410f9
--- /dev/null
+++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.panic-abort.mir
@@ -0,0 +1,9 @@
+// MIR for `hello` before PreCodegen
+
+fn hello() -> () {
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.panic-unwind.mir b/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.panic-unwind.mir
new file mode 100644
index 000000000..2b90410f9
--- /dev/null
+++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.panic-unwind.mir
@@ -0,0 +1,9 @@
+// MIR for `hello` before PreCodegen
+
+fn hello() -> () {
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/const_prop/control_flow_simplification.rs b/tests/mir-opt/const_prop/control_flow_simplification.rs
index b2ca045e8..5fc13e202 100644
--- a/tests/mir-opt/const_prop/control_flow_simplification.rs
+++ b/tests/mir-opt/const_prop/control_flow_simplification.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -Zmir-opt-level=1
diff --git a/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff
index 6d8738aa6..e02e7f320 100644
--- a/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff
@@ -2,54 +2,51 @@
+ // MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/discriminant.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/discriminant.rs:+1:9: +1:10
- let mut _2: i32; // in scope 0 at $DIR/discriminant.rs:+1:13: +1:64
- let mut _3: std::option::Option<bool>; // in scope 0 at $DIR/discriminant.rs:+1:34: +1:44
- let mut _4: isize; // in scope 0 at $DIR/discriminant.rs:+1:21: +1:31
+ let mut _0: ();
+ let _1: i32;
+ let mut _2: i32;
+ let mut _3: std::option::Option<bool>;
+ let mut _4: isize;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/discriminant.rs:+1:9: +1:10
+ debug x => _1;
}
scope 2 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/discriminant.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/discriminant.rs:+1:13: +1:64
- StorageLive(_3); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
-- _3 = Option::<bool>::Some(const true); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
-- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
-- switchInt(move _4) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
-+ _3 = const Option::<bool>::Some(true); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: Option<bool>, val: Value(Scalar(0x01)) }
-+ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
-+ switchInt(const 1_isize) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = Option::<bool>::Some(const true);
+- _4 = discriminant(_3);
+- switchInt(move _4) -> [1: bb1, otherwise: bb3];
++ _3 = const Option::<bool>::Some(true);
++ _4 = const 1_isize;
++ switchInt(const 1_isize) -> [1: bb1, otherwise: bb3];
}
bb1: {
-- switchInt(((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
-+ switchInt(const true) -> [0: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
+- switchInt(((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2];
++ switchInt(const true) -> [0: bb3, otherwise: bb2];
}
bb2: {
- _2 = const 42_i32; // scope 2 at $DIR/discriminant.rs:+1:47: +1:49
- goto -> bb4; // scope 0 at $DIR/discriminant.rs:+1:13: +1:64
+ _2 = const 42_i32;
+ goto -> bb4;
}
bb3: {
- _2 = const 10_i32; // scope 0 at $DIR/discriminant.rs:+1:59: +1:61
- goto -> bb4; // scope 0 at $DIR/discriminant.rs:+1:13: +1:64
+ _2 = const 10_i32;
+ goto -> bb4;
}
bb4: {
- _1 = Add(move _2, const 0_i32); // scope 0 at $DIR/discriminant.rs:+1:13: +1:68
- StorageDead(_2); // scope 0 at $DIR/discriminant.rs:+1:67: +1:68
- StorageDead(_3); // scope 0 at $DIR/discriminant.rs:+1:68: +1:69
- _0 = const (); // scope 0 at $DIR/discriminant.rs:+0:11: +2:2
- StorageDead(_1); // scope 0 at $DIR/discriminant.rs:+2:1: +2:2
- return; // scope 0 at $DIR/discriminant.rs:+2:2: +2:2
+ _1 = Add(move _2, const 0_i32);
+ StorageDead(_2);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff
index 6d8738aa6..e02e7f320 100644
--- a/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff
@@ -2,54 +2,51 @@
+ // MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/discriminant.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/discriminant.rs:+1:9: +1:10
- let mut _2: i32; // in scope 0 at $DIR/discriminant.rs:+1:13: +1:64
- let mut _3: std::option::Option<bool>; // in scope 0 at $DIR/discriminant.rs:+1:34: +1:44
- let mut _4: isize; // in scope 0 at $DIR/discriminant.rs:+1:21: +1:31
+ let mut _0: ();
+ let _1: i32;
+ let mut _2: i32;
+ let mut _3: std::option::Option<bool>;
+ let mut _4: isize;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/discriminant.rs:+1:9: +1:10
+ debug x => _1;
}
scope 2 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/discriminant.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/discriminant.rs:+1:13: +1:64
- StorageLive(_3); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
-- _3 = Option::<bool>::Some(const true); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
-- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
-- switchInt(move _4) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
-+ _3 = const Option::<bool>::Some(true); // scope 2 at $DIR/discriminant.rs:+1:34: +1:44
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: Option<bool>, val: Value(Scalar(0x01)) }
-+ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
-+ switchInt(const 1_isize) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = Option::<bool>::Some(const true);
+- _4 = discriminant(_3);
+- switchInt(move _4) -> [1: bb1, otherwise: bb3];
++ _3 = const Option::<bool>::Some(true);
++ _4 = const 1_isize;
++ switchInt(const 1_isize) -> [1: bb1, otherwise: bb3];
}
bb1: {
-- switchInt(((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
-+ switchInt(const true) -> [0: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31
+- switchInt(((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2];
++ switchInt(const true) -> [0: bb3, otherwise: bb2];
}
bb2: {
- _2 = const 42_i32; // scope 2 at $DIR/discriminant.rs:+1:47: +1:49
- goto -> bb4; // scope 0 at $DIR/discriminant.rs:+1:13: +1:64
+ _2 = const 42_i32;
+ goto -> bb4;
}
bb3: {
- _2 = const 10_i32; // scope 0 at $DIR/discriminant.rs:+1:59: +1:61
- goto -> bb4; // scope 0 at $DIR/discriminant.rs:+1:13: +1:64
+ _2 = const 10_i32;
+ goto -> bb4;
}
bb4: {
- _1 = Add(move _2, const 0_i32); // scope 0 at $DIR/discriminant.rs:+1:13: +1:68
- StorageDead(_2); // scope 0 at $DIR/discriminant.rs:+1:67: +1:68
- StorageDead(_3); // scope 0 at $DIR/discriminant.rs:+1:68: +1:69
- _0 = const (); // scope 0 at $DIR/discriminant.rs:+0:11: +2:2
- StorageDead(_1); // scope 0 at $DIR/discriminant.rs:+2:1: +2:2
- return; // scope 0 at $DIR/discriminant.rs:+2:2: +2:2
+ _1 = Add(move _2, const 0_i32);
+ StorageDead(_2);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/discriminant.rs b/tests/mir-opt/const_prop/discriminant.rs
index fdd67ca8a..0ed683d62 100644
--- a/tests/mir-opt/const_prop/discriminant.rs
+++ b/tests/mir-opt/const_prop/discriminant.rs
@@ -1,5 +1,4 @@
// unit-test: ConstProp
-// compile-flags: -O
// FIXME(wesleywiser): Ideally, we could const-prop away all of this and just be left with
// `let x = 42` but that doesn't work because const-prop doesn't support `Operand::Indirect`
@@ -9,5 +8,18 @@
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR discriminant.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: bb0: {
+ // CHECK: switchInt(const 1_isize) -> [1: bb1, otherwise: bb3];
+ // CHECK: bb1: {
+ // CHECK: switchInt(const true) -> [0: bb3, otherwise: bb2];
+ // CHECK: bb2: {
+ // CHECK: [[tmp:_.*]] = const 42_i32;
+ // CHECK: goto -> bb4;
+ // CHECK: bb3: {
+ // CHECK: [[tmp]] = const 10_i32;
+ // CHECK: goto -> bb4;
+ // CHECK: bb4: {
+ // CHECK: {{_.*}} = Add(move [[tmp]], const 0_i32);
let x = (if let Some(true) = Some(true) { 42 } else { 10 }) + 0;
}
diff --git a/tests/mir-opt/const_prop/indirect.main.ConstProp.diff b/tests/mir-opt/const_prop/indirect.main.ConstProp.diff
deleted file mode 100644
index f4c0c5c5e..000000000
--- a/tests/mir-opt/const_prop/indirect.main.ConstProp.diff
+++ /dev/null
@@ -1,33 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/indirect.rs:+0:11: +0:11
- let _1: u8; // in scope 0 at $DIR/indirect.rs:+1:9: +1:10
- let mut _2: u8; // in scope 0 at $DIR/indirect.rs:+1:13: +1:25
- let mut _3: (u8, bool); // in scope 0 at $DIR/indirect.rs:+1:13: +1:29
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/indirect.rs:+1:9: +1:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/indirect.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/indirect.rs:+1:13: +1:25
-- _2 = const 2_u32 as u8 (IntToInt); // scope 0 at $DIR/indirect.rs:+1:13: +1:25
-- _3 = CheckedAdd(_2, const 1_u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29
-- assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
-+ _2 = const 2_u8; // scope 0 at $DIR/indirect.rs:+1:13: +1:25
-+ _3 = const (3_u8, false); // scope 0 at $DIR/indirect.rs:+1:13: +1:29
-+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> bb1; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
- }
-
- bb1: {
-- _1 = move (_3.0: u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29
-+ _1 = const 3_u8; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
- StorageDead(_2); // scope 0 at $DIR/indirect.rs:+1:28: +1:29
- _0 = const (); // scope 0 at $DIR/indirect.rs:+0:11: +2:2
- StorageDead(_1); // scope 0 at $DIR/indirect.rs:+2:1: +2:2
- return; // scope 0 at $DIR/indirect.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..530cfc653
--- /dev/null
+++ b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff
@@ -0,0 +1,37 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u8;
+ let mut _2: u8;
+ let mut _3: (u8, bool);
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = const 2_u32 as u8 (IntToInt);
+- _3 = CheckedAdd(_2, const 1_u8);
+- assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind unreachable];
++ _2 = const 2_u8;
++ _3 = const (3_u8, false);
++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u8, const 1_u8) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = move (_3.0: u8);
++ _1 = const 3_u8;
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (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
new file mode 100644
index 000000000..08cf72e47
--- /dev/null
+++ b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,37 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u8;
+ let mut _2: u8;
+ let mut _3: (u8, bool);
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = const 2_u32 as u8 (IntToInt);
+- _3 = CheckedAdd(_2, const 1_u8);
+- assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind continue];
++ _2 = const 2_u8;
++ _3 = const (3_u8, false);
++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u8, const 1_u8) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = move (_3.0: u8);
++ _1 = const 3_u8;
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (size: 2, align: 1) {
++ 03 00 │ ..
+ }
+
diff --git a/tests/mir-opt/const_prop/indirect.rs b/tests/mir-opt/const_prop/indirect.rs
index 46fd8082d..d3c42e3eb 100644
--- a/tests/mir-opt/const_prop/indirect.rs
+++ b/tests/mir-opt/const_prop/indirect.rs
@@ -1,8 +1,11 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -C overflow-checks=on
// EMIT_MIR indirect.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: [[x]] = const 3_u8;
let x = (2u32 as u8) + 1;
}
diff --git a/tests/mir-opt/const_prop/indirect_mutation.bar.ConstProp.diff b/tests/mir-opt/const_prop/indirect_mutation.bar.ConstProp.diff
new file mode 100644
index 000000000..4eafb8d09
--- /dev/null
+++ b/tests/mir-opt/const_prop/indirect_mutation.bar.ConstProp.diff
@@ -0,0 +1,41 @@
+- // MIR for `bar` before ConstProp
++ // MIR for `bar` after ConstProp
+
+ fn bar() -> () {
+ let mut _0: ();
+ let mut _1: (i32,);
+ let _2: ();
+ let mut _3: *mut i32;
+ let mut _5: i32;
+ scope 1 {
+ debug v => _1;
+ let _4: bool;
+ scope 2 {
+ }
+ scope 3 {
+ debug y => _4;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = (const 1_i32,);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &raw mut (_1.0: i32);
+ (*_3) = const 5_i32;
+ StorageDead(_3);
+ _2 = const ();
+ StorageDead(_2);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = (_1.0: i32);
+ _4 = Eq(move _5, const 5_i32);
+ StorageDead(_5);
+ _0 = const ();
+ StorageDead(_4);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/indirect_mutation.foo.ConstProp.diff b/tests/mir-opt/const_prop/indirect_mutation.foo.ConstProp.diff
new file mode 100644
index 000000000..445d9895d
--- /dev/null
+++ b/tests/mir-opt/const_prop/indirect_mutation.foo.ConstProp.diff
@@ -0,0 +1,35 @@
+- // MIR for `foo` before ConstProp
++ // MIR for `foo` after ConstProp
+
+ fn foo() -> () {
+ let mut _0: ();
+ let mut _1: (i32,);
+ let mut _2: &mut i32;
+ let mut _4: i32;
+ scope 1 {
+ debug u => _1;
+ let _3: bool;
+ scope 2 {
+ debug y => _3;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = (const 1_i32,);
+ StorageLive(_2);
+ _2 = &mut (_1.0: i32);
+ (*_2) = const 5_i32;
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = (_1.0: i32);
+ _3 = Eq(move _4, const 5_i32);
+ StorageDead(_4);
+ _0 = const ();
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/indirect_mutation.rs b/tests/mir-opt/const_prop/indirect_mutation.rs
new file mode 100644
index 000000000..ec9da6e8e
--- /dev/null
+++ b/tests/mir-opt/const_prop/indirect_mutation.rs
@@ -0,0 +1,41 @@
+// unit-test: ConstProp
+// Check that we do not propagate past an indirect mutation.
+#![feature(raw_ref_op)]
+
+// EMIT_MIR indirect_mutation.foo.ConstProp.diff
+fn foo() {
+ // CHECK-LABEL: fn foo(
+ // CHECK: debug u => _1;
+ // CHECK: debug y => _3;
+ // CHECK: _1 = (const 1_i32,);
+ // CHECK: _2 = &mut (_1.0: i32);
+ // CHECK: (*_2) = const 5_i32;
+ // CHECK: _4 = (_1.0: i32);
+ // CHECK: _3 = Eq(move _4, const 5_i32);
+
+ let mut u = (1,);
+ *&mut u.0 = 5;
+ let y = { u.0 } == 5;
+}
+
+// EMIT_MIR indirect_mutation.bar.ConstProp.diff
+fn bar() {
+ // CHECK-LABEL: fn bar(
+ // CHECK: debug v => _1;
+ // CHECK: debug y => _4;
+ // CHECK: _3 = &raw mut (_1.0: i32);
+ // CHECK: (*_3) = const 5_i32;
+ // CHECK: _5 = (_1.0: i32);
+ // CHECK: _4 = Eq(move _5, const 5_i32);
+
+ let mut v = (1,);
+ unsafe {
+ *&raw mut v.0 = 5;
+ }
+ let y = { v.0 } == 5;
+}
+
+fn main() {
+ foo();
+ bar();
+}
diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.diff
deleted file mode 100644
index 0ac7fa43d..000000000
--- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.diff
+++ /dev/null
@@ -1,39 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inherit_overflow.rs:+0:11: +0:11
- let mut _1: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- let mut _2: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- let mut _3: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- scope 1 {
- }
- scope 2 (inlined <u8 as Add>::add) { // at $DIR/inherit_overflow.rs:9:13: 9:47
- debug self => _2; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
- debug other => _3; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
- let mut _4: (u8, bool); // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- StorageLive(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- _2 = const u8::MAX; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- StorageLive(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- _3 = const 1_u8; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
-- _4 = CheckedAdd(_2, _3); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
-- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> bb1; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
-+ _4 = const (0_u8, true); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
-+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", _2, _3) -> bb1; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
- }
-
- bb1: {
-- _1 = move (_4.0: u8); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
-+ _1 = const 0_u8; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
- StorageDead(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- StorageDead(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- StorageDead(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:47: +3:48
- _0 = const (); // scope 0 at $DIR/inherit_overflow.rs:+0:11: +4:2
- return; // scope 0 at $DIR/inherit_overflow.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..11cdf9e09
--- /dev/null
+++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
@@ -0,0 +1,45 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: u8;
+ let mut _2: u8;
+ let mut _3: u8;
+ scope 1 {
+ }
+ scope 2 (inlined #[track_caller] <u8 as Add>::add) {
+ debug self => _2;
+ debug other => _3;
+ let mut _4: (u8, bool);
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const u8::MAX;
+ StorageLive(_3);
+ _3 = const 1_u8;
+ StorageLive(_4);
+- _4 = CheckedAdd(_2, _3);
+- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable];
++ _4 = const (0_u8, true);
++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = move (_4.0: u8);
++ _1 = const 0_u8;
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
++ }
++
++ ALLOC0 (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
new file mode 100644
index 000000000..181a2f287
--- /dev/null
+++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,45 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: u8;
+ let mut _2: u8;
+ let mut _3: u8;
+ scope 1 {
+ }
+ scope 2 (inlined #[track_caller] <u8 as Add>::add) {
+ debug self => _2;
+ debug other => _3;
+ let mut _4: (u8, bool);
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const u8::MAX;
+ StorageLive(_3);
+ _3 = const 1_u8;
+ StorageLive(_4);
+- _4 = CheckedAdd(_2, _3);
+- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue];
++ _4 = const (0_u8, true);
++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = move (_4.0: u8);
++ _1 = const 0_u8;
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
++ }
++
++ ALLOC0 (size: 2, align: 1) {
++ 00 01 │ ..
+ }
+
diff --git a/tests/mir-opt/const_prop/inherit_overflow.rs b/tests/mir-opt/const_prop/inherit_overflow.rs
index 4e905d00d..5b561ae14 100644
--- a/tests/mir-opt/const_prop/inherit_overflow.rs
+++ b/tests/mir-opt/const_prop/inherit_overflow.rs
@@ -1,10 +1,14 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -Zmir-enable-passes=+Inline
+// After inlining, this will contain a `CheckedBinaryOp`.
+// Propagating the overflow is ok as codegen will just skip emitting the panic.
// EMIT_MIR inherit_overflow.main.ConstProp.diff
fn main() {
- // After inlining, this will contain a `CheckedBinaryOp`.
- // Propagating the overflow is ok as codegen will just skip emitting the panic.
+ // CHECK-LABEL: fn main(
+ // CHECK: {{_.*}} = const (0_u8, true);
+ // CHECK: assert(!const true,
+ // CHECK: {{_.*}} = const 0_u8;
let _ = <u8 as std::ops::Add>::add(255, 1);
}
diff --git a/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff b/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff
index 1752d222f..10e978a68 100644
--- a/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff
@@ -2,24 +2,24 @@
+ // MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/invalid_constant.rs:+0:11: +0:11
- let _1: char; // in scope 0 at $DIR/invalid_constant.rs:+6:9: +6:22
- let mut _2: main::InvalidChar; // in scope 0 at $DIR/invalid_constant.rs:+6:34: +6:63
- let mut _4: E; // in scope 0 at $DIR/invalid_constant.rs:+13:25: +13:59
- let mut _5: main::InvalidTag; // in scope 0 at $DIR/invalid_constant.rs:+13:34: +13:55
- let mut _7: Empty; // in scope 0 at $DIR/invalid_constant.rs:+20:35: +20:73
- let mut _8: main::NoVariants; // in scope 0 at $DIR/invalid_constant.rs:+20:44: +20:65
+ let mut _0: ();
+ let _1: char;
+ let mut _2: main::InvalidChar;
+ let mut _4: E;
+ let mut _5: main::InvalidTag;
+ let mut _7: Empty;
+ let mut _8: main::NoVariants;
scope 1 {
- debug _invalid_char => _1; // in scope 1 at $DIR/invalid_constant.rs:+6:9: +6:22
- let _3: [E; 1]; // in scope 1 at $DIR/invalid_constant.rs:+13:9: +13:21
+ debug _invalid_char => _1;
+ let _3: [E; 1];
scope 3 {
- debug _invalid_tag => _3; // in scope 3 at $DIR/invalid_constant.rs:+13:9: +13:21
- let _6: [Empty; 1]; // in scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31
+ debug _invalid_tag => _3;
+ let _6: [Empty; 1];
scope 5 {
- debug _enum_without_variants => const [ZeroSized: Empty]; // in scope 5 at $DIR/invalid_constant.rs:+20:9: +20:31
- let _9: main::Str<"���">; // in scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22
+ debug _enum_without_variants => const [ZeroSized: Empty];
+ let _9: main::Str<"���">;
scope 7 {
- debug _non_utf8_str => const Str::<"���">; // in scope 7 at $DIR/invalid_constant.rs:+24:9: +24:22
+ debug _non_utf8_str => const Str::<"���">;
}
}
scope 6 {
@@ -32,39 +32,37 @@
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/invalid_constant.rs:+6:9: +6:22
- StorageLive(_2); // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:63
- _2 = InvalidChar { int: const 1114113_u32 }; // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:63
-- _1 = (_2.1: char); // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:67
-+ _1 = const {transmute(0x00110001): char}; // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:67
- StorageDead(_2); // scope 0 at $DIR/invalid_constant.rs:+6:69: +6:70
- StorageLive(_3); // scope 1 at $DIR/invalid_constant.rs:+13:9: +13:21
- StorageLive(_4); // scope 1 at $DIR/invalid_constant.rs:+13:25: +13:59
- StorageLive(_5); // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55
- _5 = InvalidTag { int: const 4_u32 }; // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55
-- _4 = (_5.1: E); // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:57
-+ _4 = const Scalar(0x00000004): E; // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:57
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: E, val: Value(Scalar(0x00000004)) }
- _3 = [move _4]; // scope 1 at $DIR/invalid_constant.rs:+13:24: +13:60
- StorageDead(_4); // scope 1 at $DIR/invalid_constant.rs:+13:59: +13:60
- StorageDead(_5); // scope 1 at $DIR/invalid_constant.rs:+13:60: +13:61
- nop; // scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31
- nop; // scope 3 at $DIR/invalid_constant.rs:+20:35: +20:73
- StorageLive(_8); // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65
- _8 = NoVariants { int: const 0_u32 }; // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65
- nop; // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:71
- nop; // scope 3 at $DIR/invalid_constant.rs:+20:34: +20:74
- nop; // scope 3 at $DIR/invalid_constant.rs:+20:73: +20:74
- StorageDead(_8); // scope 3 at $DIR/invalid_constant.rs:+20:74: +20:75
- nop; // scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22
- nop; // scope 0 at $DIR/invalid_constant.rs:+0:11: +27:2
- nop; // scope 5 at $DIR/invalid_constant.rs:+27:1: +27:2
- nop; // scope 3 at $DIR/invalid_constant.rs:+27:1: +27:2
- StorageDead(_3); // scope 1 at $DIR/invalid_constant.rs:+27:1: +27:2
- StorageDead(_1); // scope 0 at $DIR/invalid_constant.rs:+27:1: +27:2
- return; // scope 0 at $DIR/invalid_constant.rs:+27:2: +27:2
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = InvalidChar { int: const 1114113_u32 };
+- _1 = (_2.1: char);
++ _1 = const {transmute(0x00110001): char};
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = InvalidTag { int: const 4_u32 };
+- _4 = (_5.1: E);
+- _3 = [move _4];
++ _4 = const Scalar(0x00000004): E;
++ _3 = [const Scalar(0x00000004): E];
+ StorageDead(_4);
+ StorageDead(_5);
+ nop;
+ nop;
+ StorageLive(_8);
+ _8 = NoVariants { int: const 0_u32 };
+ nop;
+ nop;
+ nop;
+ StorageDead(_8);
+ nop;
+ nop;
+ nop;
+ nop;
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff b/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff
index e31c2bc39..455c2375e 100644
--- a/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff
+++ b/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff
@@ -2,26 +2,26 @@
+ // MIR for `main` after RemoveZsts
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/invalid_constant.rs:+0:11: +0:11
- let _1: char; // in scope 0 at $DIR/invalid_constant.rs:+6:9: +6:22
- let mut _2: main::InvalidChar; // in scope 0 at $DIR/invalid_constant.rs:+6:34: +6:63
- let mut _4: E; // in scope 0 at $DIR/invalid_constant.rs:+13:25: +13:59
- let mut _5: main::InvalidTag; // in scope 0 at $DIR/invalid_constant.rs:+13:34: +13:55
- let mut _7: Empty; // in scope 0 at $DIR/invalid_constant.rs:+20:35: +20:73
- let mut _8: main::NoVariants; // in scope 0 at $DIR/invalid_constant.rs:+20:44: +20:65
+ let mut _0: ();
+ let _1: char;
+ let mut _2: main::InvalidChar;
+ let mut _4: E;
+ let mut _5: main::InvalidTag;
+ let mut _7: Empty;
+ let mut _8: main::NoVariants;
scope 1 {
- debug _invalid_char => _1; // in scope 1 at $DIR/invalid_constant.rs:+6:9: +6:22
- let _3: [E; 1]; // in scope 1 at $DIR/invalid_constant.rs:+13:9: +13:21
+ debug _invalid_char => _1;
+ let _3: [E; 1];
scope 3 {
- debug _invalid_tag => _3; // in scope 3 at $DIR/invalid_constant.rs:+13:9: +13:21
- let _6: [Empty; 1]; // in scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31
+ debug _invalid_tag => _3;
+ let _6: [Empty; 1];
scope 5 {
-- debug _enum_without_variants => _6; // in scope 5 at $DIR/invalid_constant.rs:+20:9: +20:31
-+ debug _enum_without_variants => const [ZeroSized: Empty]; // in scope 5 at $DIR/invalid_constant.rs:+20:9: +20:31
- let _9: main::Str<"���">; // in scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22
+- debug _enum_without_variants => _6;
++ debug _enum_without_variants => const [ZeroSized: Empty];
+ let _9: main::Str<"���">;
scope 7 {
-- debug _non_utf8_str => _9; // in scope 7 at $DIR/invalid_constant.rs:+24:9: +24:22
-+ debug _non_utf8_str => const Str::<"���">; // in scope 7 at $DIR/invalid_constant.rs:+24:9: +24:22
+- debug _non_utf8_str => _9;
++ debug _non_utf8_str => const Str::<"���">;
}
}
scope 6 {
@@ -34,43 +34,43 @@
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/invalid_constant.rs:+6:9: +6:22
- StorageLive(_2); // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:63
- _2 = InvalidChar { int: const 1114113_u32 }; // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:63
- _1 = (_2.1: char); // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:67
- StorageDead(_2); // scope 0 at $DIR/invalid_constant.rs:+6:69: +6:70
- StorageLive(_3); // scope 1 at $DIR/invalid_constant.rs:+13:9: +13:21
- StorageLive(_4); // scope 1 at $DIR/invalid_constant.rs:+13:25: +13:59
- StorageLive(_5); // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55
- _5 = InvalidTag { int: const 4_u32 }; // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55
- _4 = (_5.1: E); // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:57
- _3 = [move _4]; // scope 1 at $DIR/invalid_constant.rs:+13:24: +13:60
- StorageDead(_4); // scope 1 at $DIR/invalid_constant.rs:+13:59: +13:60
- StorageDead(_5); // scope 1 at $DIR/invalid_constant.rs:+13:60: +13:61
-- StorageLive(_6); // scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31
-- StorageLive(_7); // scope 3 at $DIR/invalid_constant.rs:+20:35: +20:73
-+ nop; // scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31
-+ nop; // scope 3 at $DIR/invalid_constant.rs:+20:35: +20:73
- StorageLive(_8); // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65
- _8 = NoVariants { int: const 0_u32 }; // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65
-- _7 = (_8.1: Empty); // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:71
-- _6 = [move _7]; // scope 3 at $DIR/invalid_constant.rs:+20:34: +20:74
-- StorageDead(_7); // scope 3 at $DIR/invalid_constant.rs:+20:73: +20:74
-+ nop; // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:71
-+ nop; // scope 3 at $DIR/invalid_constant.rs:+20:34: +20:74
-+ nop; // scope 3 at $DIR/invalid_constant.rs:+20:73: +20:74
- StorageDead(_8); // scope 3 at $DIR/invalid_constant.rs:+20:74: +20:75
-- StorageLive(_9); // scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22
-- _0 = const (); // scope 0 at $DIR/invalid_constant.rs:+0:11: +27:2
-- StorageDead(_9); // scope 5 at $DIR/invalid_constant.rs:+27:1: +27:2
-- StorageDead(_6); // scope 3 at $DIR/invalid_constant.rs:+27:1: +27:2
-+ nop; // scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22
-+ nop; // scope 0 at $DIR/invalid_constant.rs:+0:11: +27:2
-+ nop; // scope 5 at $DIR/invalid_constant.rs:+27:1: +27:2
-+ nop; // scope 3 at $DIR/invalid_constant.rs:+27:1: +27:2
- StorageDead(_3); // scope 1 at $DIR/invalid_constant.rs:+27:1: +27:2
- StorageDead(_1); // scope 0 at $DIR/invalid_constant.rs:+27:1: +27:2
- return; // scope 0 at $DIR/invalid_constant.rs:+27:2: +27:2
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = InvalidChar { int: const 1114113_u32 };
+ _1 = (_2.1: char);
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = InvalidTag { int: const 4_u32 };
+ _4 = (_5.1: E);
+ _3 = [move _4];
+ StorageDead(_4);
+ StorageDead(_5);
+- StorageLive(_6);
+- StorageLive(_7);
++ nop;
++ nop;
+ StorageLive(_8);
+ _8 = NoVariants { int: const 0_u32 };
+- _7 = (_8.1: Empty);
+- _6 = [move _7];
+- StorageDead(_7);
++ nop;
++ nop;
++ nop;
+ StorageDead(_8);
+- StorageLive(_9);
+- _0 = const ();
+- StorageDead(_9);
+- StorageDead(_6);
++ nop;
++ nop;
++ nop;
++ nop;
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/invalid_constant.rs b/tests/mir-opt/const_prop/invalid_constant.rs
index bdbc5a199..ff6b31a1e 100644
--- a/tests/mir-opt/const_prop/invalid_constant.rs
+++ b/tests/mir-opt/const_prop/invalid_constant.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// compile-flags: -Zmir-enable-passes=+RemoveZsts
// Verify that we can pretty print invalid constants.
diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.diff
deleted file mode 100644
index 265269409..000000000
--- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.diff
+++ /dev/null
@@ -1,23 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/issue_66971.rs:+0:11: +0:11
- let _1: (); // in scope 0 at $DIR/issue_66971.rs:+1:5: +1:23
- let mut _2: ((), u8, u8); // in scope 0 at $DIR/issue_66971.rs:+1:12: +1:22
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_66971.rs:+1:12: +1:22
- _2 = (const (), const 0_u8, const 0_u8); // scope 0 at $DIR/issue_66971.rs:+1:12: +1:22
- _1 = encode(move _2) -> bb1; // scope 0 at $DIR/issue_66971.rs:+1:5: +1:23
- // mir::Constant
- // + span: $DIR/issue_66971.rs:18:5: 18:11
- // + literal: Const { ty: fn(((), u8, u8)) {encode}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/issue_66971.rs:+1:22: +1:23
- return; // scope 0 at $DIR/issue_66971.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..ff93c85e5
--- /dev/null
+++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff
@@ -0,0 +1,37 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
+ let mut _2: ((), u8, u8);
+ let mut _3: ();
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = ();
+- _2 = (move _3, const 0_u8, const 0_u8);
++ _2 = const ((), 0_u8, 0_u8);
+ StorageDead(_3);
+- _1 = encode(move _2) -> [return: bb1, unwind unreachable];
++ _1 = encode(const ((), 0_u8, 0_u8)) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
++ }
++
++ ALLOC0 (size: 2, align: 1) {
++ 00 00 │ ..
++ }
++
++ ALLOC1 (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
new file mode 100644
index 000000000..8790aad45
--- /dev/null
+++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,37 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
+ let mut _2: ((), u8, u8);
+ let mut _3: ();
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = ();
+- _2 = (move _3, const 0_u8, const 0_u8);
++ _2 = const ((), 0_u8, 0_u8);
+ StorageDead(_3);
+- _1 = encode(move _2) -> [return: bb1, unwind continue];
++ _1 = encode(const ((), 0_u8, 0_u8)) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
++ }
++
++ ALLOC0 (size: 2, align: 1) {
++ 00 00 │ ..
++ }
++
++ ALLOC1 (size: 2, align: 1) {
++ 00 00 │ ..
+ }
+
diff --git a/tests/mir-opt/const_prop/issue_66971.rs b/tests/mir-opt/const_prop/issue_66971.rs
index af95c9ca2..49d598ff2 100644
--- a/tests/mir-opt/const_prop/issue_66971.rs
+++ b/tests/mir-opt/const_prop/issue_66971.rs
@@ -1,6 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
-// compile-flags: -Z mir-opt-level=3
// Due to a bug in propagating scalar pairs the assertion below used to fail. In the expected
// outputs below, after ConstProp this is how _2 would look like with the bug:
@@ -15,5 +14,7 @@ fn encode(this: ((), u8, u8)) {
// EMIT_MIR issue_66971.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: = encode(const ((), 0_u8, 0_u8))
encode(((), 0, 0));
}
diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.diff b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.diff
deleted file mode 100644
index 54c9200d6..000000000
--- a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.diff
+++ /dev/null
@@ -1,28 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/issue_67019.rs:+0:11: +0:11
- let _1: (); // in scope 0 at $DIR/issue_67019.rs:+1:5: +1:20
- let mut _2: ((u8, u8),); // in scope 0 at $DIR/issue_67019.rs:+1:10: +1:19
- let mut _3: (u8, u8); // in scope 0 at $DIR/issue_67019.rs:+1:11: +1:17
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_67019.rs:+1:10: +1:19
- StorageLive(_3); // scope 0 at $DIR/issue_67019.rs:+1:11: +1:17
-- _3 = (const 1_u8, const 2_u8); // scope 0 at $DIR/issue_67019.rs:+1:11: +1:17
-+ _3 = const (1_u8, 2_u8); // scope 0 at $DIR/issue_67019.rs:+1:11: +1:17
- _2 = (move _3,); // scope 0 at $DIR/issue_67019.rs:+1:10: +1:19
- StorageDead(_3); // scope 0 at $DIR/issue_67019.rs:+1:18: +1:19
- _1 = test(move _2) -> bb1; // scope 0 at $DIR/issue_67019.rs:+1:5: +1:20
- // mir::Constant
- // + span: $DIR/issue_67019.rs:13:5: 13:9
- // + literal: Const { ty: fn(((u8, u8),)) {test}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/issue_67019.rs:+1:19: +1:20
- return; // scope 0 at $DIR/issue_67019.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..3de9cdd79
--- /dev/null
+++ b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff
@@ -0,0 +1,42 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
+ let mut _2: ((u8, u8),);
+ let mut _3: (u8, u8);
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = (const 1_u8, const 2_u8);
+- _2 = (move _3,);
++ _3 = const (1_u8, 2_u8);
++ _2 = const ((1_u8, 2_u8),);
+ StorageDead(_3);
+- _1 = test(move _2) -> [return: bb1, unwind unreachable];
++ _1 = test(const ((1_u8, 2_u8),)) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
++ }
++
++ ALLOC0 (size: 2, align: 1) {
++ 01 02 │ ..
++ }
++
++ ALLOC1 (size: 2, align: 1) {
++ 01 02 │ ..
++ }
++
++ ALLOC2 (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
new file mode 100644
index 000000000..72cf48b5c
--- /dev/null
+++ b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,42 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
+ let mut _2: ((u8, u8),);
+ let mut _3: (u8, u8);
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = (const 1_u8, const 2_u8);
+- _2 = (move _3,);
++ _3 = const (1_u8, 2_u8);
++ _2 = const ((1_u8, 2_u8),);
+ StorageDead(_3);
+- _1 = test(move _2) -> [return: bb1, unwind continue];
++ _1 = test(const ((1_u8, 2_u8),)) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
++ }
++
++ ALLOC0 (size: 2, align: 1) {
++ 01 02 │ ..
++ }
++
++ ALLOC1 (size: 2, align: 1) {
++ 01 02 │ ..
++ }
++
++ ALLOC2 (size: 2, align: 1) {
++ 01 02 │ ..
+ }
+
diff --git a/tests/mir-opt/const_prop/issue_67019.rs b/tests/mir-opt/const_prop/issue_67019.rs
index 08c7d4805..f0a09e6e8 100644
--- a/tests/mir-opt/const_prop/issue_67019.rs
+++ b/tests/mir-opt/const_prop/issue_67019.rs
@@ -1,6 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
-// compile-flags: -Z mir-opt-level=3
// This used to ICE in const-prop
@@ -10,5 +9,7 @@ fn test(this: ((u8, u8),)) {
// EMIT_MIR issue_67019.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: = test(const ((1_u8, 2_u8),))
test(((1, 2),));
}
diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff
deleted file mode 100644
index 33bbad2f4..000000000
--- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff
+++ /dev/null
@@ -1,39 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/large_array_index.rs:+0:11: +0:11
- let _1: u8; // in scope 0 at $DIR/large_array_index.rs:+2:9: +2:10
- let mut _2: [u8; 5000]; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
- let _3: usize; // in scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
- let mut _4: usize; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
- let mut _5: bool; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/large_array_index.rs:+2:9: +2:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/large_array_index.rs:+2:9: +2:10
- StorageLive(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
- _2 = [const 0_u8; 5000]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
- StorageLive(_3); // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
- _3 = const 2_usize; // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
-- _4 = Len(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
-- _5 = Lt(_3, _4); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
-- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
-+ _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
-+ _5 = const true; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
-+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
- }
-
- bb1: {
-- _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
-+ _1 = _2[2 of 3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
- StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
- StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
- _0 = const (); // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2
- StorageDead(_1); // scope 0 at $DIR/large_array_index.rs:+3:1: +3:2
- return; // scope 0 at $DIR/large_array_index.rs:+3:2: +3:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..20e2ee326
--- /dev/null
+++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ 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/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..1bdbbbf78
--- /dev/null
+++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ 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/const_prop/large_array_index.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff
deleted file mode 100644
index 33bbad2f4..000000000
--- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff
+++ /dev/null
@@ -1,39 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/large_array_index.rs:+0:11: +0:11
- let _1: u8; // in scope 0 at $DIR/large_array_index.rs:+2:9: +2:10
- let mut _2: [u8; 5000]; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
- let _3: usize; // in scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
- let mut _4: usize; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
- let mut _5: bool; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/large_array_index.rs:+2:9: +2:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/large_array_index.rs:+2:9: +2:10
- StorageLive(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
- _2 = [const 0_u8; 5000]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
- StorageLive(_3); // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
- _3 = const 2_usize; // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
-- _4 = Len(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
-- _5 = Lt(_3, _4); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
-- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
-+ _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
-+ _5 = const true; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
-+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
- }
-
- bb1: {
-- _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
-+ _1 = _2[2 of 3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
- StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
- StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
- _0 = const (); // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2
- StorageDead(_1); // scope 0 at $DIR/large_array_index.rs:+3:1: +3:2
- return; // scope 0 at $DIR/large_array_index.rs:+3:2: +3:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..20e2ee326
--- /dev/null
+++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ 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/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..1bdbbbf78
--- /dev/null
+++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,39 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ 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/const_prop/large_array_index.rs b/tests/mir-opt/const_prop/large_array_index.rs
index 0876445bf..d98d166ff 100644
--- a/tests/mir-opt/const_prop/large_array_index.rs
+++ b/tests/mir-opt/const_prop/large_array_index.rs
@@ -1,6 +1,6 @@
+// skip-filecheck
// unit-test: ConstProp
-// ignore-wasm32 compiled with panic=abort by default
-// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR large_array_index.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/mult_by_zero.rs b/tests/mir-opt/const_prop/mult_by_zero.rs
index 7bd30975a..2e9c63a1c 100644
--- a/tests/mir-opt/const_prop/mult_by_zero.rs
+++ b/tests/mir-opt/const_prop/mult_by_zero.rs
@@ -1,8 +1,10 @@
// unit-test: ConstProp
// EMIT_MIR mult_by_zero.test.ConstProp.diff
-fn test(x : i32) -> i32 {
- x * 0
+fn test(x: i32) -> i32 {
+ // CHECK: fn test(
+ // CHECK: _0 = const 0_i32;
+ x * 0
}
fn main() {
diff --git a/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff b/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff
index 629c8e601..73b1da064 100644
--- a/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff
@@ -2,17 +2,17 @@
+ // MIR for `test` after ConstProp
fn test(_1: i32) -> i32 {
- debug x => _1; // in scope 0 at $DIR/mult_by_zero.rs:+0:9: +0:10
- let mut _0: i32; // return place in scope 0 at $DIR/mult_by_zero.rs:+0:21: +0:24
- let mut _2: i32; // in scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:4
+ debug x => _1;
+ let mut _0: i32;
+ let mut _2: i32;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:4
- _2 = _1; // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:4
-- _0 = Mul(move _2, const 0_i32); // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:8
-+ _0 = const 0_i32; // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:8
- StorageDead(_2); // scope 0 at $DIR/mult_by_zero.rs:+1:7: +1:8
- return; // scope 0 at $DIR/mult_by_zero.rs:+2:2: +2:2
+ StorageLive(_2);
+ _2 = _1;
+- _0 = Mul(move _2, const 0_i32);
++ _0 = const 0_i32;
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff
index bd010e7b1..ad8d9ddb0 100644
--- a/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff
@@ -2,27 +2,27 @@
+ // MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/mutable_variable.rs:+0:11: +0:11
- let mut _1: i32; // in scope 0 at $DIR/mutable_variable.rs:+1:9: +1:14
+ let mut _0: ();
+ let mut _1: i32;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/mutable_variable.rs:+1:9: +1:14
- let _2: i32; // in scope 1 at $DIR/mutable_variable.rs:+3:9: +3:10
+ debug x => _1;
+ let _2: i32;
scope 2 {
- debug y => _2; // in scope 2 at $DIR/mutable_variable.rs:+3:9: +3:10
+ debug y => _2;
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/mutable_variable.rs:+1:9: +1:14
- _1 = const 42_i32; // scope 0 at $DIR/mutable_variable.rs:+1:17: +1:19
- _1 = const 99_i32; // scope 1 at $DIR/mutable_variable.rs:+2:5: +2:11
- StorageLive(_2); // scope 1 at $DIR/mutable_variable.rs:+3:9: +3:10
-- _2 = _1; // scope 1 at $DIR/mutable_variable.rs:+3:13: +3:14
-+ _2 = const 99_i32; // scope 1 at $DIR/mutable_variable.rs:+3:13: +3:14
- _0 = const (); // scope 0 at $DIR/mutable_variable.rs:+0:11: +4:2
- StorageDead(_2); // scope 1 at $DIR/mutable_variable.rs:+4:1: +4:2
- StorageDead(_1); // scope 0 at $DIR/mutable_variable.rs:+4:1: +4:2
- return; // scope 0 at $DIR/mutable_variable.rs:+4:2: +4:2
+ StorageLive(_1);
+ _1 = const 42_i32;
+ _1 = const 99_i32;
+ StorageLive(_2);
+- _2 = _1;
++ _2 = const 99_i32;
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/mutable_variable.rs b/tests/mir-opt/const_prop/mutable_variable.rs
index 95987ef7f..6c74ea5b9 100644
--- a/tests/mir-opt/const_prop/mutable_variable.rs
+++ b/tests/mir-opt/const_prop/mutable_variable.rs
@@ -2,6 +2,12 @@
// EMIT_MIR mutable_variable.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: debug y => [[y:_.*]];
+ // CHECK: [[x]] = const 42_i32;
+ // CHECK: [[x]] = const 99_i32;
+ // CHECK: [[y]] = const 99_i32;
let mut x = 42;
x = 99;
let y = x;
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 539f6dd94..c3ace9687 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
@@ -2,28 +2,36 @@
+ // MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate.rs:+0:11: +0:11
- let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
+ let mut _0: ();
+ let mut _1: (i32, i32);
scope 1 {
- debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
- let _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
+ debug x => _1;
+ let _2: (i32, i32);
scope 2 {
- debug y => _2; // in scope 2 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
+ debug y => _2;
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
-- _1 = (const 42_i32, const 43_i32); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25
-+ _1 = const (42_i32, 43_i32); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25
- (_1.1: i32) = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate.rs:+2:5: +2:13
- StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
-- _2 = _1; // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14
-+ _2 = const (42_i32, 99_i32); // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14
- _0 = const (); // scope 0 at $DIR/mutable_variable_aggregate.rs:+0:11: +4:2
- StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:+4:1: +4:2
- StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:+4:1: +4:2
- return; // scope 0 at $DIR/mutable_variable_aggregate.rs:+4:2: +4:2
+ StorageLive(_1);
+- _1 = (const 42_i32, const 43_i32);
++ _1 = const (42_i32, 43_i32);
+ (_1.1: i32) = const 99_i32;
+ StorageLive(_2);
+- _2 = _1;
++ _2 = const (42_i32, 99_i32);
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 2a 00 00 00 63 00 00 00 │ *...c...
++ }
++
++ ALLOC1 (size: 8, align: 4) {
++ 2a 00 00 00 2b 00 00 00 │ *...+...
}
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs
index a145c0354..a38296502 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs
@@ -2,6 +2,12 @@
// EMIT_MIR mutable_variable_aggregate.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: debug y => [[y:_.*]];
+ // CHECK: [[x]] = const (42_i32, 43_i32);
+ // CHECK: ([[x]].1: i32) = const 99_i32;
+ // CHECK: [[y]] = const (42_i32, 99_i32);
let mut x = (42, 43);
x.1 = 99;
let y = x;
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff
index bec641ecf..106e27f8f 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff
@@ -2,33 +2,33 @@
+ // MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+0:11: +0:11
- let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:9: +1:14
+ let mut _0: ();
+ let mut _1: (i32, i32);
scope 1 {
- debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:9: +1:14
- let _2: &mut (i32, i32); // in scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:9: +2:10
+ debug x => _1;
+ let _2: &mut (i32, i32);
scope 2 {
- debug z => _2; // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:9: +2:10
- let _3: (i32, i32); // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
+ debug z => _2;
+ let _3: (i32, i32);
scope 3 {
- debug y => _3; // in scope 3 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
+ debug y => _3;
}
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:9: +1:14
- _1 = (const 42_i32, const 43_i32); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+1:17: +1:25
- StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:9: +2:10
- _2 = &mut _1; // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:13: +2:19
- ((*_2).1: i32) = const 99_i32; // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+3:5: +3:13
- StorageLive(_3); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
- _3 = _1; // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:13: +4:14
- _0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+0:11: +5:2
- StorageDead(_3); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2
- StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2
- StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2
- return; // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:2: +5:2
+ StorageLive(_1);
+ _1 = (const 42_i32, const 43_i32);
+ StorageLive(_2);
+ _2 = &mut _1;
+ ((*_2).1: i32) = const 99_i32;
+ StorageLive(_3);
+ _3 = _1;
+ _0 = const ();
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs
index 3099e659f..60f414ae2 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs
@@ -2,6 +2,14 @@
// EMIT_MIR mutable_variable_aggregate_mut_ref.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: debug z => [[z:_.*]];
+ // CHECK: debug y => [[y:_.*]];
+ // CHECK: [[x]] = (const 42_i32, const 43_i32);
+ // CHECK: [[z]] = &mut [[x]];
+ // CHECK: ((*[[z]]).1: i32) = const 99_i32;
+ // CHECK: [[y]] = [[x]];
let mut x = (42, 43);
let z = &mut x;
z.1 = 99;
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff
deleted file mode 100644
index 374151057..000000000
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff
+++ /dev/null
@@ -1,35 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+0:11: +0:11
- let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14
- let _2: i32; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10
- scope 2 {
- debug y => _2; // in scope 2 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14
- _1 = foo() -> bb1; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:29: +1:34
- // mir::Constant
- // + span: $DIR/mutable_variable_aggregate_partial_read.rs:6:29: 6:32
- // + literal: Const { ty: fn() -> (i32, i32) {foo}, val: Value(<ZST>) }
- }
-
- bb1: {
- (_1.1: i32) = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+2:5: +2:13
- (_1.0: i32) = const 42_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+3:5: +3:13
- StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10
-- _2 = (_1.1: i32); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16
-+ _2 = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16
- _0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+0:11: +5:2
- StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2
- StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2
- return; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..34288c62f
--- /dev/null
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-abort.diff
@@ -0,0 +1,32 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: (i32, i32);
+ scope 1 {
+ debug x => _1;
+ let _2: i32;
+ scope 2 {
+ debug y => _2;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = foo() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ (_1.1: i32) = const 99_i32;
+ (_1.0: i32) = const 42_i32;
+ StorageLive(_2);
+- _2 = (_1.1: i32);
++ _2 = const 99_i32;
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-unwind.diff
new file mode 100644
index 000000000..7ba2b483d
--- /dev/null
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,32 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: (i32, i32);
+ scope 1 {
+ debug x => _1;
+ let _2: i32;
+ scope 2 {
+ debug y => _2;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = foo() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ (_1.1: i32) = const 99_i32;
+ (_1.0: i32) = const 42_i32;
+ StorageLive(_2);
+- _2 = (_1.1: i32);
++ _2 = const 99_i32;
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs
index 0e823e9dc..888fcde2d 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs
@@ -1,8 +1,15 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// EMIT_MIR mutable_variable_aggregate_partial_read.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: debug y => [[y:_.*]];
+ // CHECK: [[x]] = foo()
+ // CHECK: ([[x]].1: i32) = const 99_i32;
+ // CHECK: ([[x]].0: i32) = const 42_i32;
+ // CHECK: [[y]] = const 99_i32;
let mut x: (i32, i32) = foo();
x.1 = 99;
x.0 = 42;
diff --git a/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff
index fab810630..1f74bdcfd 100644
--- a/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff
@@ -2,47 +2,44 @@
+ // MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_no_prop.rs:+0:11: +0:11
- let mut _1: u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+1:9: +1:14
- let _2: (); // in scope 0 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6
- let mut _3: u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
- let mut _4: *mut u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
+ let mut _0: ();
+ let mut _1: u32;
+ let _2: ();
+ let mut _3: u32;
+ let mut _4: *mut u32;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/mutable_variable_no_prop.rs:+1:9: +1:14
- let _5: u32; // in scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10
+ debug x => _1;
+ let _5: u32;
scope 2 {
}
scope 3 {
- debug y => _5; // in scope 3 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10
+ debug y => _5;
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/mutable_variable_no_prop.rs:+1:9: +1:14
- _1 = const 42_u32; // scope 0 at $DIR/mutable_variable_no_prop.rs:+1:17: +1:19
- StorageLive(_2); // scope 1 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6
- StorageLive(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
- StorageLive(_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
- _4 = const {alloc1: *mut u32}; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
- // mir::Constant
- // + span: $DIR/mutable_variable_no_prop.rs:9:13: 9:19
- // + literal: Const { ty: *mut u32, val: Value(Scalar(alloc1)) }
- _3 = (*_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
- _1 = move _3; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:9: +3:19
- StorageDead(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:18: +3:19
- StorageDead(_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:19: +3:20
- _2 = const (); // scope 2 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6
- StorageDead(_2); // scope 1 at $DIR/mutable_variable_no_prop.rs:+4:5: +4:6
- StorageLive(_5); // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10
- _5 = _1; // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:13: +5:14
- _0 = const (); // scope 0 at $DIR/mutable_variable_no_prop.rs:+0:11: +6:2
- StorageDead(_5); // scope 1 at $DIR/mutable_variable_no_prop.rs:+6:1: +6:2
- StorageDead(_1); // scope 0 at $DIR/mutable_variable_no_prop.rs:+6:1: +6:2
- return; // scope 0 at $DIR/mutable_variable_no_prop.rs:+6:2: +6:2
+ StorageLive(_1);
+ _1 = const 42_u32;
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = const {ALLOC0: *mut u32};
+ _3 = (*_4);
+ _1 = move _3;
+ StorageDead(_3);
+ StorageDead(_4);
+ _2 = const ();
+ StorageDead(_2);
+ StorageLive(_5);
+ _5 = _1;
+ _0 = const ();
+ StorageDead(_5);
+ StorageDead(_1);
+ return;
}
}
- alloc1 (static: STATIC, size: 4, align: 4) {
+ ALLOC0 (static: STATIC, size: 4, align: 4) {
42 42 42 42 │ BBBB
}
diff --git a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs
index e51c62235..49e9a7015 100644
--- a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs
@@ -1,9 +1,17 @@
// unit-test: ConstProp
+// Verify that we do not propagate the contents of this mutable static.
static mut STATIC: u32 = 0x42424242;
// EMIT_MIR mutable_variable_no_prop.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: debug y => [[y:_.*]];
+ // CHECK: [[x]] = const 42_u32;
+ // CHECK: [[tmp:_.*]] = (*{{_.*}});
+ // CHECK: [[x]] = move [[tmp]];
+ // CHECK: [[y]] = [[x]];
let mut x = 42;
unsafe {
x = STATIC;
diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff
deleted file mode 100644
index 3048122d8..000000000
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff
+++ /dev/null
@@ -1,53 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10
- let mut _3: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
- scope 1 {
- debug a => _1; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10
- let mut _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
- scope 2 {
- debug x => _2; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
- let _4: i32; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10
- scope 3 {
- debug y => _4; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10
- let _5: i32; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10
- scope 4 {
- debug z => _5; // in scope 4 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10
- }
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10
- _1 = foo() -> bb1; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:13: +1:18
- // mir::Constant
- // + span: $DIR/mutable_variable_unprop_assign.rs:6:13: 6:16
- // + literal: Const { ty: fn() -> i32 {foo}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageLive(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
-- _2 = (const 1_i32, const 2_i32); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35
-+ _2 = const (1_i32, 2_i32); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35
- StorageLive(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
- _3 = _1; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
- (_2.1: i32) = move _3; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:5: +3:12
- StorageDead(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
- StorageLive(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10
- _4 = (_2.1: i32); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:13: +4:16
- StorageLive(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10
-- _5 = (_2.0: i32); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16
-+ _5 = const 1_i32; // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16
- _0 = const (); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+0:11: +6:2
- StorageDead(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
- StorageDead(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
- StorageDead(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
- StorageDead(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
- return; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+6:2: +6:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..85bd2b6e7
--- /dev/null
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff
@@ -0,0 +1,54 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _3: i32;
+ scope 1 {
+ debug a => _1;
+ let mut _2: (i32, i32);
+ scope 2 {
+ debug x => _2;
+ let _4: i32;
+ scope 3 {
+ debug y => _4;
+ let _5: i32;
+ scope 4 {
+ debug z => _5;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = foo() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageLive(_2);
+- _2 = (const 1_i32, const 2_i32);
++ _2 = const (1_i32, 2_i32);
+ StorageLive(_3);
+ _3 = _1;
+ (_2.1: i32) = move _3;
+ StorageDead(_3);
+ StorageLive(_4);
+ _4 = (_2.1: i32);
+ StorageLive(_5);
+- _5 = (_2.0: i32);
++ _5 = const 1_i32;
+ _0 = const ();
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (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
new file mode 100644
index 000000000..06e96e57a
--- /dev/null
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,54 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _3: i32;
+ scope 1 {
+ debug a => _1;
+ let mut _2: (i32, i32);
+ scope 2 {
+ debug x => _2;
+ let _4: i32;
+ scope 3 {
+ debug y => _4;
+ let _5: i32;
+ scope 4 {
+ debug z => _5;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = foo() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageLive(_2);
+- _2 = (const 1_i32, const 2_i32);
++ _2 = const (1_i32, 2_i32);
+ StorageLive(_3);
+ _3 = _1;
+ (_2.1: i32) = move _3;
+ StorageDead(_3);
+ StorageLive(_4);
+ _4 = (_2.1: i32);
+ StorageLive(_5);
+- _5 = (_2.0: i32);
++ _5 = const 1_i32;
+ _0 = const ();
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs
index 5577f78a9..04e347fc0 100644
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs
@@ -1,13 +1,24 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// EMIT_MIR mutable_variable_unprop_assign.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug a => [[a:_.*]];
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: debug y => [[y:_.*]];
+ // CHECK: debug z => [[z:_.*]];
+ // CHECK: [[a]] = foo()
+ // CHECK: [[x]] = const (1_i32, 2_i32);
+ // CHECK: [[tmp:_.*]] = [[a]];
+ // CHECK: ([[x]].1: i32) = move [[tmp]];
+ // CHECK: [[y]] = ([[x]].1: i32);
+ // CHECK: [[z]] = const 1_i32;
let a = foo();
let mut x: (i32, i32) = (1, 2);
x.1 = a;
let y = x.1;
- let z = x.0; // this could theoretically be allowed, but we can't handle it right now
+ let z = x.0;
}
#[inline(never)]
diff --git a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff
deleted file mode 100644
index e3757941c..000000000
--- a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff
+++ /dev/null
@@ -1,44 +0,0 @@
-- // MIR for `concrete` before ConstProp
-+ // MIR for `concrete` after ConstProp
-
- fn concrete() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/offset_of.rs:+0:15: +0:15
- let _1: usize; // in scope 0 at $DIR/offset_of.rs:+1:9: +1:10
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/offset_of.rs:+1:9: +1:10
- let _2: usize; // in scope 1 at $DIR/offset_of.rs:+2:9: +2:10
- scope 2 {
- debug y => _2; // in scope 2 at $DIR/offset_of.rs:+2:9: +2:10
- let _3: usize; // in scope 2 at $DIR/offset_of.rs:+3:9: +3:11
- scope 3 {
- debug z0 => _3; // in scope 3 at $DIR/offset_of.rs:+3:9: +3:11
- let _4: usize; // in scope 3 at $DIR/offset_of.rs:+4:9: +4:11
- scope 4 {
- debug z1 => _4; // in scope 4 at $DIR/offset_of.rs:+4:9: +4:11
- }
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/offset_of.rs:+1:9: +1:10
-- _1 = OffsetOf(Alpha, [0]); // scope 0 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
-+ _1 = const 4_usize; // scope 0 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- StorageLive(_2); // scope 1 at $DIR/offset_of.rs:+2:9: +2:10
-- _2 = OffsetOf(Alpha, [1]); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
-+ _2 = const 0_usize; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- StorageLive(_3); // scope 2 at $DIR/offset_of.rs:+3:9: +3:11
-- _3 = OffsetOf(Alpha, [2, 0]); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
-+ _3 = const 2_usize; // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- StorageLive(_4); // scope 3 at $DIR/offset_of.rs:+4:9: +4:11
-- _4 = OffsetOf(Alpha, [2, 1]); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
-+ _4 = const 3_usize; // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- _0 = const (); // scope 0 at $DIR/offset_of.rs:+0:15: +5:2
- StorageDead(_4); // scope 3 at $DIR/offset_of.rs:+5:1: +5:2
- StorageDead(_3); // scope 2 at $DIR/offset_of.rs:+5:1: +5:2
- StorageDead(_2); // scope 1 at $DIR/offset_of.rs:+5:1: +5:2
- StorageDead(_1); // scope 0 at $DIR/offset_of.rs:+5:1: +5:2
- return; // scope 0 at $DIR/offset_of.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..711db3d21
--- /dev/null
+++ b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff
@@ -0,0 +1,124 @@
+- // MIR for `concrete` before ConstProp
++ // MIR for `concrete` after ConstProp
+
+ fn concrete() -> () {
+ let mut _0: ();
+ let _1: usize;
+ let mut _2: usize;
+ let mut _4: usize;
+ let mut _6: usize;
+ let mut _8: usize;
+ let mut _10: usize;
+ let mut _12: usize;
+ let mut _14: 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;
+ let _9: usize;
+ scope 5 {
+ debug eA0 => _9;
+ let _11: usize;
+ scope 6 {
+ debug eA1 => _11;
+ let _13: usize;
+ scope 7 {
+ debug eC => _13;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = OffsetOf(Alpha, [(0, 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, [(0, 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, [(0, 2), (0, 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, [(0, 2), (0, 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);
+ StorageLive(_9);
+ StorageLive(_10);
+- _10 = OffsetOf(Epsilon, [(0, 0)]);
+- _9 = must_use::<usize>(move _10) -> [return: bb5, unwind unreachable];
++ _10 = const 1_usize;
++ _9 = must_use::<usize>(const 1_usize) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+- _12 = OffsetOf(Epsilon, [(0, 1)]);
+- _11 = must_use::<usize>(move _12) -> [return: bb6, unwind unreachable];
++ _12 = const 2_usize;
++ _11 = must_use::<usize>(const 2_usize) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+- _14 = OffsetOf(Epsilon, [(2, 0)]);
+- _13 = must_use::<usize>(move _14) -> [return: bb7, unwind unreachable];
++ _14 = const 4_usize;
++ _13 = must_use::<usize>(const 4_usize) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ StorageDead(_14);
+ _0 = const ();
+ StorageDead(_13);
+ StorageDead(_11);
+ StorageDead(_9);
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff
new file mode 100644
index 000000000..494581454
--- /dev/null
+++ b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff
@@ -0,0 +1,124 @@
+- // MIR for `concrete` before ConstProp
++ // MIR for `concrete` after ConstProp
+
+ fn concrete() -> () {
+ let mut _0: ();
+ let _1: usize;
+ let mut _2: usize;
+ let mut _4: usize;
+ let mut _6: usize;
+ let mut _8: usize;
+ let mut _10: usize;
+ let mut _12: usize;
+ let mut _14: 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;
+ let _9: usize;
+ scope 5 {
+ debug eA0 => _9;
+ let _11: usize;
+ scope 6 {
+ debug eA1 => _11;
+ let _13: usize;
+ scope 7 {
+ debug eC => _13;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = OffsetOf(Alpha, [(0, 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, [(0, 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, [(0, 2), (0, 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, [(0, 2), (0, 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);
+ StorageLive(_9);
+ StorageLive(_10);
+- _10 = OffsetOf(Epsilon, [(0, 0)]);
+- _9 = must_use::<usize>(move _10) -> [return: bb5, unwind continue];
++ _10 = const 1_usize;
++ _9 = must_use::<usize>(const 1_usize) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+- _12 = OffsetOf(Epsilon, [(0, 1)]);
+- _11 = must_use::<usize>(move _12) -> [return: bb6, unwind continue];
++ _12 = const 2_usize;
++ _11 = must_use::<usize>(const 2_usize) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+- _14 = OffsetOf(Epsilon, [(2, 0)]);
+- _13 = must_use::<usize>(move _14) -> [return: bb7, unwind continue];
++ _14 = const 4_usize;
++ _13 = must_use::<usize>(const 4_usize) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ StorageDead(_14);
+ _0 = const ();
+ StorageDead(_13);
+ StorageDead(_11);
+ StorageDead(_9);
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff
deleted file mode 100644
index 4a655604c..000000000
--- a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff
+++ /dev/null
@@ -1,40 +0,0 @@
-- // MIR for `generic` before ConstProp
-+ // MIR for `generic` after ConstProp
-
- fn generic() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/offset_of.rs:+0:17: +0:17
- let _1: usize; // in scope 0 at $DIR/offset_of.rs:+1:9: +1:11
- scope 1 {
- debug gx => _1; // in scope 1 at $DIR/offset_of.rs:+1:9: +1:11
- let _2: usize; // in scope 1 at $DIR/offset_of.rs:+2:9: +2:11
- scope 2 {
- debug gy => _2; // in scope 2 at $DIR/offset_of.rs:+2:9: +2:11
- let _3: usize; // in scope 2 at $DIR/offset_of.rs:+3:9: +3:11
- scope 3 {
- debug dx => _3; // in scope 3 at $DIR/offset_of.rs:+3:9: +3:11
- let _4: usize; // in scope 3 at $DIR/offset_of.rs:+4:9: +4:11
- scope 4 {
- debug dy => _4; // in scope 4 at $DIR/offset_of.rs:+4:9: +4:11
- }
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/offset_of.rs:+1:9: +1:11
- _1 = OffsetOf(Gamma<T>, [0]); // scope 0 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- StorageLive(_2); // scope 1 at $DIR/offset_of.rs:+2:9: +2:11
- _2 = OffsetOf(Gamma<T>, [1]); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- StorageLive(_3); // scope 2 at $DIR/offset_of.rs:+3:9: +3:11
- _3 = OffsetOf(Delta<T>, [1]); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- StorageLive(_4); // scope 3 at $DIR/offset_of.rs:+4:9: +4:11
- _4 = OffsetOf(Delta<T>, [2]); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- _0 = const (); // scope 0 at $DIR/offset_of.rs:+0:17: +5:2
- StorageDead(_4); // scope 3 at $DIR/offset_of.rs:+5:1: +5:2
- StorageDead(_3); // scope 2 at $DIR/offset_of.rs:+5:1: +5:2
- StorageDead(_2); // scope 1 at $DIR/offset_of.rs:+5:1: +5:2
- StorageDead(_1); // scope 0 at $DIR/offset_of.rs:+5:1: +5:2
- return; // scope 0 at $DIR/offset_of.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..768970a72
--- /dev/null
+++ b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff
@@ -0,0 +1,110 @@
+- // MIR for `generic` before ConstProp
++ // MIR for `generic` after ConstProp
+
+ fn generic() -> () {
+ let mut _0: ();
+ let _1: usize;
+ let mut _2: usize;
+ let mut _4: usize;
+ let mut _6: usize;
+ let mut _8: usize;
+ let mut _10: usize;
+ let mut _12: usize;
+ let mut _14: 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;
+ let _9: usize;
+ scope 5 {
+ debug zA0 => _9;
+ let _11: usize;
+ scope 6 {
+ debug zA1 => _11;
+ let _13: usize;
+ scope 7 {
+ debug zB => _13;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = OffsetOf(Gamma<T>, [(0, 0)]);
+ _1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = OffsetOf(Gamma<T>, [(0, 1)]);
+ _3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = OffsetOf(Delta<T>, [(0, 1)]);
+ _5 = must_use::<usize>(move _6) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = OffsetOf(Delta<T>, [(0, 2)]);
+ _7 = must_use::<usize>(move _8) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = OffsetOf(Zeta<T>, [(0, 0)]);
+ _9 = must_use::<usize>(move _10) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = OffsetOf(Zeta<T>, [(0, 1)]);
+ _11 = must_use::<usize>(move _12) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+ _14 = OffsetOf(Zeta<T>, [(1, 0)]);
+ _13 = must_use::<usize>(move _14) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ StorageDead(_14);
+ _0 = const ();
+ StorageDead(_13);
+ StorageDead(_11);
+ StorageDead(_9);
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff
new file mode 100644
index 000000000..04ccd2b36
--- /dev/null
+++ b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff
@@ -0,0 +1,110 @@
+- // MIR for `generic` before ConstProp
++ // MIR for `generic` after ConstProp
+
+ fn generic() -> () {
+ let mut _0: ();
+ let _1: usize;
+ let mut _2: usize;
+ let mut _4: usize;
+ let mut _6: usize;
+ let mut _8: usize;
+ let mut _10: usize;
+ let mut _12: usize;
+ let mut _14: 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;
+ let _9: usize;
+ scope 5 {
+ debug zA0 => _9;
+ let _11: usize;
+ scope 6 {
+ debug zA1 => _11;
+ let _13: usize;
+ scope 7 {
+ debug zB => _13;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = OffsetOf(Gamma<T>, [(0, 0)]);
+ _1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = OffsetOf(Gamma<T>, [(0, 1)]);
+ _3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = OffsetOf(Delta<T>, [(0, 1)]);
+ _5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = OffsetOf(Delta<T>, [(0, 2)]);
+ _7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = OffsetOf(Zeta<T>, [(0, 0)]);
+ _9 = must_use::<usize>(move _10) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = OffsetOf(Zeta<T>, [(0, 1)]);
+ _11 = must_use::<usize>(move _12) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+ _14 = OffsetOf(Zeta<T>, [(1, 0)]);
+ _13 = must_use::<usize>(move _14) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ StorageDead(_14);
+ _0 = const ();
+ StorageDead(_13);
+ StorageDead(_11);
+ StorageDead(_9);
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/offset_of.rs b/tests/mir-opt/const_prop/offset_of.rs
index 4cdcd28ee..2571c3856 100644
--- a/tests/mir-opt/const_prop/offset_of.rs
+++ b/tests/mir-opt/const_prop/offset_of.rs
@@ -1,6 +1,8 @@
+// skip-filecheck
// unit-test: ConstProp
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-#![feature(offset_of)]
+#![feature(offset_of, offset_of_enum)]
use std::marker::PhantomData;
use std::mem::offset_of;
@@ -26,12 +28,26 @@ struct Delta<T> {
y: u16,
}
+enum Epsilon {
+ A(u8, u16),
+ B,
+ C { c: u32 }
+}
+
+enum Zeta<T> {
+ A(T, bool),
+ B(char),
+}
+
// EMIT_MIR offset_of.concrete.ConstProp.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);
+ let eA0 = offset_of!(Epsilon, A.0);
+ let eA1 = offset_of!(Epsilon, A.1);
+ let eC = offset_of!(Epsilon, C.c);
}
// EMIT_MIR offset_of.generic.ConstProp.diff
@@ -40,6 +56,9 @@ fn generic<T>() {
let gy = offset_of!(Gamma<T>, y);
let dx = offset_of!(Delta<T>, x);
let dy = offset_of!(Delta<T>, y);
+ let zA0 = offset_of!(Zeta<T>, A.0);
+ let zA1 = offset_of!(Zeta<T>, A.1);
+ let zB = offset_of!(Zeta<T>, B.0);
}
fn main() {
diff --git a/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs
new file mode 100644
index 000000000..4cf6d7c13
--- /dev/null
+++ b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs
@@ -0,0 +1,26 @@
+// unit-test: ConstProp
+// compile-flags: -O
+
+// Regression test for https://github.com/rust-lang/rust/issues/118328
+
+#![allow(unused_assignments)]
+
+struct SizeOfConst<T>(std::marker::PhantomData<T>);
+impl<T> SizeOfConst<T> {
+ const SIZE: usize = std::mem::size_of::<T>();
+}
+
+// EMIT_MIR overwrite_with_const_with_params.size_of.ConstProp.diff
+fn size_of<T>() -> usize {
+ // CHECK-LABEL: fn size_of(
+ // CHECK: _1 = const 0_usize;
+ // CHECK-NEXT: _1 = const _;
+ // CHECK-NEXT: _0 = _1;
+ let mut a = 0;
+ a = SizeOfConst::<T>::SIZE;
+ a
+}
+
+fn main() {
+ assert_eq!(size_of::<u32>(), std::mem::size_of::<u32>());
+}
diff --git a/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff b/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff
new file mode 100644
index 000000000..ad8318832
--- /dev/null
+++ b/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff
@@ -0,0 +1,20 @@
+- // MIR for `size_of` before ConstProp
++ // MIR for `size_of` after ConstProp
+
+ fn size_of() -> usize {
+ let mut _0: usize;
+ let mut _1: usize;
+ scope 1 {
+ debug a => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 0_usize;
+ _1 = const _;
+ _0 = _1;
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..bd1de7476
--- /dev/null
+++ b/tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-abort.diff
@@ -0,0 +1,38 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: usize;
+ let mut _2: *const i32;
+ let _3: &i32;
+ let _4: ();
+ let mut _5: usize;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = const _;
+ _2 = &raw const (*_3);
+ _1 = move _2 as usize (PointerExposeAddress);
+ StorageDead(_2);
+ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ _4 = read(move _5) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-unwind.diff
new file mode 100644
index 000000000..850b743fe
--- /dev/null
+++ b/tests/mir-opt/const_prop/pointer_expose_address.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,38 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: usize;
+ let mut _2: *const i32;
+ let _3: &i32;
+ let _4: ();
+ let mut _5: usize;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = const _;
+ _2 = &raw const (*_3);
+ _1 = move _2 as usize (PointerExposeAddress);
+ StorageDead(_2);
+ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ _4 = read(move _5) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/pointer_expose_address.rs b/tests/mir-opt/const_prop/pointer_expose_address.rs
new file mode 100644
index 000000000..631aac901
--- /dev/null
+++ b/tests/mir-opt/const_prop/pointer_expose_address.rs
@@ -0,0 +1,18 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// unit-test: ConstProp
+
+#[inline(never)]
+fn read(_: usize) { }
+
+// EMIT_MIR pointer_expose_address.main.ConstProp.diff
+fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: [[ptr:_.*]] = const _;
+ // CHECK: [[ref:_.*]] = &raw const (*[[ptr]]);
+ // CHECK: [[x:_.*]] = move [[ref]] as usize (PointerExposeAddress);
+ // CHECK: [[arg:_.*]] = [[x]];
+ // CHECK: = read(move [[arg]])
+ const FOO: &i32 = &1;
+ let x = FOO as *const i32 as usize;
+ read(x);
+}
diff --git a/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff b/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff
index c290fba56..e193c82d2 100644
--- a/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff
@@ -2,47 +2,41 @@
+ // MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/read_immutable_static.rs:+0:11: +0:11
- let _1: u8; // in scope 0 at $DIR/read_immutable_static.rs:+1:9: +1:10
- let mut _2: u8; // in scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
- let mut _3: &u8; // in scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
- let mut _4: u8; // in scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
- let mut _5: &u8; // in scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
+ let mut _0: ();
+ let _1: u8;
+ let mut _2: u8;
+ let mut _3: &u8;
+ let mut _4: u8;
+ let mut _5: &u8;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/read_immutable_static.rs:+1:9: +1:10
+ debug x => _1;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/read_immutable_static.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
- StorageLive(_3); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
- _3 = const {alloc1: &u8}; // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
- // mir::Constant
- // + span: $DIR/read_immutable_static.rs:7:13: 7:16
- // + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) }
-- _2 = (*_3); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
-+ _2 = const 2_u8; // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
- StorageLive(_4); // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
- StorageLive(_5); // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
- _5 = const {alloc1: &u8}; // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
- // mir::Constant
- // + span: $DIR/read_immutable_static.rs:7:19: 7:22
- // + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) }
-- _4 = (*_5); // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
-- _1 = Add(move _2, move _4); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:22
-+ _4 = const 2_u8; // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
-+ _1 = const 4_u8; // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:22
- StorageDead(_4); // scope 0 at $DIR/read_immutable_static.rs:+1:21: +1:22
- StorageDead(_2); // scope 0 at $DIR/read_immutable_static.rs:+1:21: +1:22
- StorageDead(_5); // scope 0 at $DIR/read_immutable_static.rs:+1:22: +1:23
- StorageDead(_3); // scope 0 at $DIR/read_immutable_static.rs:+1:22: +1:23
- _0 = const (); // scope 0 at $DIR/read_immutable_static.rs:+0:11: +2:2
- StorageDead(_1); // scope 0 at $DIR/read_immutable_static.rs:+2:1: +2:2
- return; // scope 0 at $DIR/read_immutable_static.rs:+2:2: +2:2
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = const {ALLOC0: &u8};
+- _2 = (*_3);
++ _2 = const 2_u8;
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = const {ALLOC0: &u8};
+- _4 = (*_5);
+- _1 = Add(move _2, move _4);
++ _4 = const 2_u8;
++ _1 = const 4_u8;
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_5);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
}
}
- alloc1 (static: FOO, size: 1, align: 1) {
+ ALLOC0 (static: FOO, size: 1, align: 1) {
02 │ .
}
diff --git a/tests/mir-opt/const_prop/read_immutable_static.rs b/tests/mir-opt/const_prop/read_immutable_static.rs
index fb8f9fe99..0fa18dd10 100644
--- a/tests/mir-opt/const_prop/read_immutable_static.rs
+++ b/tests/mir-opt/const_prop/read_immutable_static.rs
@@ -4,5 +4,8 @@ static FOO: u8 = 2;
// EMIT_MIR read_immutable_static.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: [[x]] = const 4_u8;
let x = FOO + FOO;
}
diff --git a/tests/mir-opt/const_prop/ref_deref.main.ConstProp.diff b/tests/mir-opt/const_prop/ref_deref.main.ConstProp.diff
index 924a267f3..a54ae8d2f 100644
--- a/tests/mir-opt/const_prop/ref_deref.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/ref_deref.main.ConstProp.diff
@@ -2,25 +2,25 @@
+ // MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/ref_deref.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/ref_deref.rs:+1:5: +1:10
- let mut _2: &i32; // in scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
- let _3: i32; // in scope 0 at $DIR/ref_deref.rs:+1:8: +1:9
- let mut _4: &i32; // in scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
+ let mut _0: ();
+ let _1: i32;
+ let mut _2: &i32;
+ let _3: i32;
+ let mut _4: &i32;
+ scope 1 {
+ debug a => _1;
+ }
bb0: {
- StorageLive(_1); // scope 0 at $DIR/ref_deref.rs:+1:5: +1:10
- StorageLive(_2); // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
- _4 = const _; // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
- // mir::Constant
- // + span: $DIR/ref_deref.rs:5:6: 5:10
- // + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) }
- _2 = &(*_4); // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
- _1 = (*_2); // scope 0 at $DIR/ref_deref.rs:+1:5: +1:10
- StorageDead(_2); // scope 0 at $DIR/ref_deref.rs:+1:10: +1:11
- StorageDead(_1); // scope 0 at $DIR/ref_deref.rs:+1:10: +1:11
- _0 = const (); // scope 0 at $DIR/ref_deref.rs:+0:11: +2:2
- return; // scope 0 at $DIR/ref_deref.rs:+2:2: +2:2
+ StorageLive(_1);
+ StorageLive(_2);
+ _4 = const _;
+ _2 = &(*_4);
+ _1 = (*_2);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/ref_deref.rs b/tests/mir-opt/const_prop/ref_deref.rs
index 76e56916a..5bceae749 100644
--- a/tests/mir-opt/const_prop/ref_deref.rs
+++ b/tests/mir-opt/const_prop/ref_deref.rs
@@ -1,6 +1,9 @@
// unit-test: ConstProp
-// EMIT_MIR ref_deref.main.ConstProp.diff
+// EMIT_MIR ref_deref.main.ConstProp.diff
fn main() {
- *(&4);
+ // CHECK-LABEL: fn main(
+ // CHECK: debug a => [[a:_.*]];
+ // CHECK: [[a]] = (*{{_.*}});
+ let a = *(&4);
}
diff --git a/tests/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff b/tests/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff
index 59095b448..05a4e1774 100644
--- a/tests/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/ref_deref_project.main.ConstProp.diff
@@ -2,25 +2,25 @@
+ // MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/ref_deref_project.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17
- let mut _2: &i32; // in scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
- let _3: (i32, i32); // in scope 0 at $DIR/ref_deref_project.rs:+1:8: +1:14
- let mut _4: &(i32, i32); // in scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
+ let mut _0: ();
+ let _1: i32;
+ let mut _2: &i32;
+ let _3: (i32, i32);
+ let mut _4: &(i32, i32);
+ scope 1 {
+ debug a => _1;
+ }
bb0: {
- StorageLive(_1); // scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17
- StorageLive(_2); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
- _4 = const _; // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
- // mir::Constant
- // + span: $DIR/ref_deref_project.rs:5:6: 5:17
- // + literal: Const { ty: &(i32, i32), val: Unevaluated(main, [], Some(promoted[0])) }
- _2 = &((*_4).1: i32); // scope 0 at $DIR/ref_deref_project.rs:+1:6: +1:17
- _1 = (*_2); // scope 0 at $DIR/ref_deref_project.rs:+1:5: +1:17
- StorageDead(_2); // scope 0 at $DIR/ref_deref_project.rs:+1:17: +1:18
- StorageDead(_1); // scope 0 at $DIR/ref_deref_project.rs:+1:17: +1:18
- _0 = const (); // scope 0 at $DIR/ref_deref_project.rs:+0:11: +2:2
- return; // scope 0 at $DIR/ref_deref_project.rs:+2:2: +2:2
+ StorageLive(_1);
+ StorageLive(_2);
+ _4 = const _;
+ _2 = &((*_4).1: i32);
+ _1 = (*_2);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/ref_deref_project.rs b/tests/mir-opt/const_prop/ref_deref_project.rs
index 04fc7f8da..4b5c67303 100644
--- a/tests/mir-opt/const_prop/ref_deref_project.rs
+++ b/tests/mir-opt/const_prop/ref_deref_project.rs
@@ -1,6 +1,10 @@
+// This does not currently propagate (#67862)
// unit-test: ConstProp
-// EMIT_MIR ref_deref_project.main.ConstProp.diff
+// EMIT_MIR ref_deref_project.main.ConstProp.diff
fn main() {
- *(&(4, 5).1); // This does not currently propagate (#67862)
+ // CHECK-LABEL: fn main(
+ // CHECK: debug a => [[a:_.*]];
+ // CHECK: [[a]] = (*{{_.*}});
+ let a = *(&(4, 5).1);
}
diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff b/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff
index 077b9bf83..e7aa015d0 100644
--- a/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff
@@ -2,28 +2,25 @@
+ // MIR for `main` after ConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/reify_fn_ptr.rs:+0:11: +0:11
- let mut _1: *const fn(); // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:41
- let mut _2: usize; // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26
- let mut _3: fn(); // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17
+ let mut _0: ();
+ let mut _1: *const fn();
+ let mut _2: usize;
+ let mut _3: fn();
scope 1 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:41
- StorageLive(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26
- StorageLive(_3); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17
- _3 = main as fn() (Pointer(ReifyFnPointer)); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17
- // mir::Constant
- // + span: $DIR/reify_fn_ptr.rs:5:13: 5:17
- // + literal: Const { ty: fn() {main}, val: Value(<ZST>) }
- _2 = move _3 as usize (PointerExposeAddress); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26
- StorageDead(_3); // scope 0 at $DIR/reify_fn_ptr.rs:+1:25: +1:26
- _1 = move _2 as *const fn() (PointerFromExposedAddress); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:41
- StorageDead(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:40: +1:41
- StorageDead(_1); // scope 0 at $DIR/reify_fn_ptr.rs:+1:41: +1:42
- _0 = const (); // scope 0 at $DIR/reify_fn_ptr.rs:+0:11: +2:2
- return; // scope 0 at $DIR/reify_fn_ptr.rs:+2:2: +2:2
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = main as fn() (PointerCoercion(ReifyFnPointer));
+ _2 = move _3 as usize (PointerExposeAddress);
+ StorageDead(_3);
+ _1 = move _2 as *const fn() (PointerFromExposedAddress);
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.rs b/tests/mir-opt/const_prop/reify_fn_ptr.rs
index 5f6382066..33fdd4142 100644
--- a/tests/mir-opt/const_prop/reify_fn_ptr.rs
+++ b/tests/mir-opt/const_prop/reify_fn_ptr.rs
@@ -2,5 +2,9 @@
// EMIT_MIR reify_fn_ptr.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: [[ptr:_.*]] = main as fn() (PointerCoercion(ReifyFnPointer));
+ // CHECK: [[addr:_.*]] = move [[ptr]] as usize (PointerExposeAddress);
+ // CHECK: [[back:_.*]] = move [[addr]] as *const fn() (PointerFromExposedAddress);
let _ = main as usize as *const fn();
}
diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff
deleted file mode 100644
index 6641220db..000000000
--- a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff
+++ /dev/null
@@ -1,44 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:+0:11: +0:11
- let _1: u32; // in scope 0 at $DIR/repeat.rs:+1:9: +1:10
- let mut _2: u32; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
- let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:+1:18: +1:25
- let _4: usize; // in scope 0 at $DIR/repeat.rs:+1:26: +1:27
- let mut _5: usize; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
- let mut _6: bool; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/repeat.rs:+1:9: +1:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/repeat.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
- StorageLive(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:25
- _3 = [const 42_u32; 8]; // scope 0 at $DIR/repeat.rs:+1:18: +1:25
- StorageLive(_4); // scope 0 at $DIR/repeat.rs:+1:26: +1:27
- _4 = const 2_usize; // scope 0 at $DIR/repeat.rs:+1:26: +1:27
-- _5 = Len(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-- _6 = Lt(_4, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-+ _5 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-+ _6 = const true; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
- }
-
- bb1: {
-- _2 = _3[_4]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-- _1 = Add(move _2, const 0_u32); // scope 0 at $DIR/repeat.rs:+1:18: +1:32
-+ _2 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-+ _1 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:32
- StorageDead(_2); // scope 0 at $DIR/repeat.rs:+1:31: +1:32
- StorageDead(_4); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
- StorageDead(_3); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
- _0 = const (); // scope 0 at $DIR/repeat.rs:+0:11: +2:2
- StorageDead(_1); // scope 0 at $DIR/repeat.rs:+2:1: +2:2
- return; // scope 0 at $DIR/repeat.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..a55bd029e
--- /dev/null
+++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff
@@ -0,0 +1,44 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ 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];
+- _1 = Add(move _2, const 0_u32);
++ _2 = const 42_u32;
++ _1 = const 42_u32;
+ StorageDead(_2);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..d49ef2e01
--- /dev/null
+++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,44 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ 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];
+- _1 = Add(move _2, const 0_u32);
++ _2 = const 42_u32;
++ _1 = const 42_u32;
+ StorageDead(_2);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff
deleted file mode 100644
index 6641220db..000000000
--- a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff
+++ /dev/null
@@ -1,44 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:+0:11: +0:11
- let _1: u32; // in scope 0 at $DIR/repeat.rs:+1:9: +1:10
- let mut _2: u32; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
- let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:+1:18: +1:25
- let _4: usize; // in scope 0 at $DIR/repeat.rs:+1:26: +1:27
- let mut _5: usize; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
- let mut _6: bool; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/repeat.rs:+1:9: +1:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/repeat.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
- StorageLive(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:25
- _3 = [const 42_u32; 8]; // scope 0 at $DIR/repeat.rs:+1:18: +1:25
- StorageLive(_4); // scope 0 at $DIR/repeat.rs:+1:26: +1:27
- _4 = const 2_usize; // scope 0 at $DIR/repeat.rs:+1:26: +1:27
-- _5 = Len(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-- _6 = Lt(_4, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-+ _5 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-+ _6 = const true; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
- }
-
- bb1: {
-- _2 = _3[_4]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-- _1 = Add(move _2, const 0_u32); // scope 0 at $DIR/repeat.rs:+1:18: +1:32
-+ _2 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-+ _1 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:32
- StorageDead(_2); // scope 0 at $DIR/repeat.rs:+1:31: +1:32
- StorageDead(_4); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
- StorageDead(_3); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
- _0 = const (); // scope 0 at $DIR/repeat.rs:+0:11: +2:2
- StorageDead(_1); // scope 0 at $DIR/repeat.rs:+2:1: +2:2
- return; // scope 0 at $DIR/repeat.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..a55bd029e
--- /dev/null
+++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-abort.diff
@@ -0,0 +1,44 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ 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];
+- _1 = Add(move _2, const 0_u32);
++ _2 = const 42_u32;
++ _1 = const 42_u32;
+ StorageDead(_2);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..d49ef2e01
--- /dev/null
+++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,44 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ 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];
+- _1 = Add(move _2, const 0_u32);
++ _2 = const 42_u32;
++ _1 = const 42_u32;
+ StorageDead(_2);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/repeat.rs b/tests/mir-opt/const_prop/repeat.rs
index 9c11dbc5b..9f688bbb5 100644
--- a/tests/mir-opt/const_prop/repeat.rs
+++ b/tests/mir-opt/const_prop/repeat.rs
@@ -1,9 +1,11 @@
// unit-test: ConstProp
-// ignore-wasm32 compiled with panic=abort by default
-// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR repeat.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: [[x]] = const 42_u32;
let x: u32 = [42; 8][2] + 0;
}
diff --git a/tests/mir-opt/const_prop/return_place.add.ConstProp.diff b/tests/mir-opt/const_prop/return_place.add.ConstProp.diff
deleted file mode 100644
index 5ebd8a520..000000000
--- a/tests/mir-opt/const_prop/return_place.add.ConstProp.diff
+++ /dev/null
@@ -1,21 +0,0 @@
-- // MIR for `add` before ConstProp
-+ // MIR for `add` after ConstProp
-
- fn add() -> u32 {
- let mut _0: u32; // return place in scope 0 at $DIR/return_place.rs:+0:13: +0:16
- let mut _1: (u32, bool); // in scope 0 at $DIR/return_place.rs:+1:5: +1:10
-
- bb0: {
-- _1 = CheckedAdd(const 2_u32, const 2_u32); // scope 0 at $DIR/return_place.rs:+1:5: +1:10
-- assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
-+ _1 = const (4_u32, false); // scope 0 at $DIR/return_place.rs:+1:5: +1:10
-+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
- }
-
- bb1: {
-- _0 = move (_1.0: u32); // scope 0 at $DIR/return_place.rs:+1:5: +1:10
-+ _0 = const 4_u32; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
- return; // scope 0 at $DIR/return_place.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..974a42e50
--- /dev/null
+++ b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff
@@ -0,0 +1,25 @@
+- // MIR for `add` before ConstProp
++ // MIR for `add` after ConstProp
+
+ fn add() -> u32 {
+ let mut _0: u32;
+ let mut _1: (u32, bool);
+
+ bb0: {
+- _1 = CheckedAdd(const 2_u32, const 2_u32);
+- assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> [success: bb1, unwind unreachable];
++ _1 = const (4_u32, false);
++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _0 = move (_1.0: u32);
++ _0 = const 4_u32;
+ return;
+ }
++ }
++
++ ALLOC0 (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
new file mode 100644
index 000000000..55dbc7002
--- /dev/null
+++ b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff
@@ -0,0 +1,25 @@
+- // MIR for `add` before ConstProp
++ // MIR for `add` after ConstProp
+
+ fn add() -> u32 {
+ let mut _0: u32;
+ let mut _1: (u32, bool);
+
+ bb0: {
+- _1 = CheckedAdd(const 2_u32, const 2_u32);
+- assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> [success: bb1, unwind continue];
++ _1 = const (4_u32, false);
++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _0 = move (_1.0: u32);
++ _0 = const 4_u32;
+ return;
+ }
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 04 00 00 00 00 __ __ __ │ .....░░░
+ }
+
diff --git a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir
deleted file mode 100644
index b12d84fa4..000000000
--- a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir
+++ /dev/null
@@ -1,16 +0,0 @@
-// MIR for `add` before PreCodegen
-
-fn add() -> u32 {
- let mut _0: u32; // return place in scope 0 at $DIR/return_place.rs:+0:13: +0:16
- let mut _1: (u32, bool); // in scope 0 at $DIR/return_place.rs:+1:5: +1:10
-
- bb0: {
- _1 = const (4_u32, false); // scope 0 at $DIR/return_place.rs:+1:5: +1:10
- assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
- }
-
- bb1: {
- _0 = const 4_u32; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
- return; // scope 0 at $DIR/return_place.rs:+2:2: +2:2
- }
-}
diff --git a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir
new file mode 100644
index 000000000..f87c26bb0
--- /dev/null
+++ b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir
@@ -0,0 +1,20 @@
+// MIR for `add` before PreCodegen
+
+fn add() -> u32 {
+ let mut _0: u32;
+ let mut _1: (u32, bool);
+
+ bb0: {
+ _1 = const (4_u32, false);
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _0 = const 4_u32;
+ return;
+ }
+}
+
+ALLOC0 (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
new file mode 100644
index 000000000..33f975913
--- /dev/null
+++ b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir
@@ -0,0 +1,20 @@
+// MIR for `add` before PreCodegen
+
+fn add() -> u32 {
+ let mut _0: u32;
+ let mut _1: (u32, bool);
+
+ bb0: {
+ _1 = const (4_u32, false);
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+ _0 = const 4_u32;
+ return;
+ }
+}
+
+ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
+}
diff --git a/tests/mir-opt/const_prop/return_place.rs b/tests/mir-opt/const_prop/return_place.rs
index 0e68309f0..286543abb 100644
--- a/tests/mir-opt/const_prop/return_place.rs
+++ b/tests/mir-opt/const_prop/return_place.rs
@@ -1,10 +1,12 @@
// unit-test: ConstProp
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -C overflow-checks=on
// EMIT_MIR return_place.add.ConstProp.diff
// EMIT_MIR return_place.add.PreCodegen.before.mir
fn add() -> u32 {
+ // CHECK-LABEL: fn add(
+ // CHECK: _0 = const 4_u32;
2 + 2
}
diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff
deleted file mode 100644
index c2f97a0f6..000000000
--- a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff
+++ /dev/null
@@ -1,34 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/scalar_literal_propagation.rs:+0:11: +0:11
- let _1: u32; // in scope 0 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10
- let _2: (); // in scope 0 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15
- let mut _3: u32; // in scope 0 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10
- _1 = const 1_u32; // scope 0 at $DIR/scalar_literal_propagation.rs:+1:13: +1:14
- StorageLive(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15
- StorageLive(_3); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14
-- _3 = _1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14
-+ _3 = const 1_u32; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14
- _2 = consume(move _3) -> bb1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15
- // mir::Constant
- // + span: $DIR/scalar_literal_propagation.rs:6:5: 6:12
- // + literal: Const { ty: fn(u32) {consume}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_3); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:14: +2:15
- StorageDead(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:15: +2:16
- _0 = const (); // scope 0 at $DIR/scalar_literal_propagation.rs:+0:11: +3:2
- StorageDead(_1); // scope 0 at $DIR/scalar_literal_propagation.rs:+3:1: +3:2
- return; // scope 0 at $DIR/scalar_literal_propagation.rs:+3:2: +3:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..c5c09c8ed
--- /dev/null
+++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-abort.diff
@@ -0,0 +1,32 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let _2: ();
+ let mut _3: u32;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 1_u32;
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = _1;
+- _2 = consume(move _3) -> [return: bb1, unwind unreachable];
++ _3 = const 1_u32;
++ _2 = consume(const 1_u32) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff
new file mode 100644
index 000000000..b256c5676
--- /dev/null
+++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,32 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let _2: ();
+ let mut _3: u32;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 1_u32;
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = _1;
+- _2 = consume(move _3) -> [return: bb1, unwind continue];
++ _3 = const 1_u32;
++ _2 = consume(const 1_u32) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.rs b/tests/mir-opt/const_prop/scalar_literal_propagation.rs
index fc33cc2d0..782cd35d4 100644
--- a/tests/mir-opt/const_prop/scalar_literal_propagation.rs
+++ b/tests/mir-opt/const_prop/scalar_literal_propagation.rs
@@ -1,7 +1,10 @@
// unit-test: ConstProp
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
// EMIT_MIR scalar_literal_propagation.main.ConstProp.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: = consume(const 1_u32)
let x = 1;
consume(x);
}
diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff
deleted file mode 100644
index 8bd2b48d6..000000000
--- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.diff
+++ /dev/null
@@ -1,50 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/slice_len.rs:+0:11: +0:11
- let _1: u32; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33
- let mut _2: &[u32]; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:30
- let mut _3: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- let _4: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- let _5: [u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:7: +1:19
- let _6: usize; // in scope 0 at $DIR/slice_len.rs:+1:31: +1:32
- let mut _7: usize; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33
- let mut _8: bool; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33
- let mut _9: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
- StorageLive(_2); // scope 0 at $DIR/slice_len.rs:+1:5: +1:30
- StorageLive(_3); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- StorageLive(_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- _9 = const _; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- // mir::Constant
- // + span: $DIR/slice_len.rs:8:6: 8:19
- // + literal: Const { ty: &[u32; 3], val: Unevaluated(main, [], Some(promoted[0])) }
- _4 = _9; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- _3 = _4; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- _2 = move _3 as &[u32] (Pointer(Unsize)); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- StorageDead(_3); // scope 0 at $DIR/slice_len.rs:+1:18: +1:19
- StorageLive(_6); // scope 0 at $DIR/slice_len.rs:+1:31: +1:32
- _6 = const 1_usize; // scope 0 at $DIR/slice_len.rs:+1:31: +1:32
-- _7 = Len((*_2)); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
-- _8 = Lt(_6, _7); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
-- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
-+ _7 = const 3_usize; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
-+ _8 = const true; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
-+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
- }
-
- bb1: {
-- _1 = (*_2)[_6]; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
-+ _1 = const 2_u32; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
- StorageDead(_6); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
- StorageDead(_4); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
- StorageDead(_2); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
- StorageDead(_1); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
- _0 = const (); // scope 0 at $DIR/slice_len.rs:+0:11: +2:2
- return; // scope 0 at $DIR/slice_len.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..7d5d036f4
--- /dev/null
+++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-abort.diff
@@ -0,0 +1,50 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: &[u32];
+ let mut _3: &[u32; 3];
+ let _4: &[u32; 3];
+ let _5: [u32; 3];
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: bool;
+ let mut _9: &[u32; 3];
+ scope 1 {
+ debug a => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _9 = const _;
+ _4 = _9;
+ _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 = const 2_u32;
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff
new file mode 100644
index 000000000..fa4c5a71b
--- /dev/null
+++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,50 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ 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 _9: &[u32; 3];
+ scope 1 {
+ debug a => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _9 = const _;
+ _4 = _9;
+ _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 = const 2_u32;
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff
deleted file mode 100644
index 8bd2b48d6..000000000
--- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.diff
+++ /dev/null
@@ -1,50 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/slice_len.rs:+0:11: +0:11
- let _1: u32; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33
- let mut _2: &[u32]; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:30
- let mut _3: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- let _4: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- let _5: [u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:7: +1:19
- let _6: usize; // in scope 0 at $DIR/slice_len.rs:+1:31: +1:32
- let mut _7: usize; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33
- let mut _8: bool; // in scope 0 at $DIR/slice_len.rs:+1:5: +1:33
- let mut _9: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:+1:6: +1:19
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
- StorageLive(_2); // scope 0 at $DIR/slice_len.rs:+1:5: +1:30
- StorageLive(_3); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- StorageLive(_4); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- _9 = const _; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- // mir::Constant
- // + span: $DIR/slice_len.rs:8:6: 8:19
- // + literal: Const { ty: &[u32; 3], val: Unevaluated(main, [], Some(promoted[0])) }
- _4 = _9; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- _3 = _4; // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- _2 = move _3 as &[u32] (Pointer(Unsize)); // scope 0 at $DIR/slice_len.rs:+1:6: +1:19
- StorageDead(_3); // scope 0 at $DIR/slice_len.rs:+1:18: +1:19
- StorageLive(_6); // scope 0 at $DIR/slice_len.rs:+1:31: +1:32
- _6 = const 1_usize; // scope 0 at $DIR/slice_len.rs:+1:31: +1:32
-- _7 = Len((*_2)); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
-- _8 = Lt(_6, _7); // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
-- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
-+ _7 = const 3_usize; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
-+ _8 = const true; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
-+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
- }
-
- bb1: {
-- _1 = (*_2)[_6]; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
-+ _1 = const 2_u32; // scope 0 at $DIR/slice_len.rs:+1:5: +1:33
- StorageDead(_6); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
- StorageDead(_4); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
- StorageDead(_2); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
- StorageDead(_1); // scope 0 at $DIR/slice_len.rs:+1:33: +1:34
- _0 = const (); // scope 0 at $DIR/slice_len.rs:+0:11: +2:2
- return; // scope 0 at $DIR/slice_len.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..7d5d036f4
--- /dev/null
+++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-abort.diff
@@ -0,0 +1,50 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ let mut _2: &[u32];
+ let mut _3: &[u32; 3];
+ let _4: &[u32; 3];
+ let _5: [u32; 3];
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: bool;
+ let mut _9: &[u32; 3];
+ scope 1 {
+ debug a => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _9 = const _;
+ _4 = _9;
+ _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 = const 2_u32;
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff
new file mode 100644
index 000000000..fa4c5a71b
--- /dev/null
+++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,50 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ 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 _9: &[u32; 3];
+ scope 1 {
+ debug a => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _9 = const _;
+ _4 = _9;
+ _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 = const 2_u32;
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs
index 9821d1b1e..0bf442726 100644
--- a/tests/mir-opt/const_prop/slice_len.rs
+++ b/tests/mir-opt/const_prop/slice_len.rs
@@ -1,9 +1,13 @@
-// ignore-wasm32 compiled with panic=abort by default
// unit-test: ConstProp
// compile-flags: -Zmir-enable-passes=+InstSimplify
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR slice_len.main.ConstProp.diff
fn main() {
- (&[1u32, 2, 3] as &[u32])[1];
+ // CHECK-LABEL: fn main(
+ // CHECK: debug a => [[a:_.*]];
+ // CHECK: assert(const true,
+ // CHECK: [[a]] = const 2_u32;
+ let a = (&[1u32, 2, 3] as &[u32])[1];
}
diff --git a/tests/mir-opt/const_prop/switch_int.main.ConstProp.diff b/tests/mir-opt/const_prop/switch_int.main.ConstProp.diff
deleted file mode 100644
index 664b7839f..000000000
--- a/tests/mir-opt/const_prop/switch_int.main.ConstProp.diff
+++ /dev/null
@@ -1,34 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/switch_int.rs:+0:11: +0:11
- let mut _1: i32; // in scope 0 at $DIR/switch_int.rs:+1:11: +1:12
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/switch_int.rs:+1:11: +1:12
- _1 = const 1_i32; // scope 0 at $DIR/switch_int.rs:+1:11: +1:12
-- switchInt(_1) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12
-+ switchInt(const 1_i32) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12
- }
-
- bb1: {
- _0 = foo(const -1_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+3:14: +3:21
- // mir::Constant
- // + span: $DIR/switch_int.rs:12:14: 12:17
- // + literal: Const { ty: fn(i32) {foo}, val: Value(<ZST>) }
- }
-
- bb2: {
- _0 = foo(const 0_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+2:14: +2:20
- // mir::Constant
- // + span: $DIR/switch_int.rs:11:14: 11:17
- // + literal: Const { ty: fn(i32) {foo}, val: Value(<ZST>) }
- }
-
- bb3: {
- StorageDead(_1); // scope 0 at $DIR/switch_int.rs:+5:1: +5:2
- return; // scope 0 at $DIR/switch_int.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..508cc1573
--- /dev/null
+++ b/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-abort.diff
@@ -0,0 +1,28 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 1_i32;
+- switchInt(_1) -> [1: bb2, otherwise: bb1];
++ switchInt(const 1_i32) -> [1: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ _0 = foo(const -1_i32) -> [return: bb3, unwind unreachable];
+ }
+
+ bb2: {
+ _0 = foo(const 0_i32) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-unwind.diff
new file mode 100644
index 000000000..1ce28e979
--- /dev/null
+++ b/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,28 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 1_i32;
+- switchInt(_1) -> [1: bb2, otherwise: bb1];
++ switchInt(const 1_i32) -> [1: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ _0 = foo(const -1_i32) -> [return: bb3, unwind continue];
+ }
+
+ bb2: {
+ _0 = foo(const 0_i32) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff
deleted file mode 100644
index ef2c4d5fa..000000000
--- a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff
+++ /dev/null
@@ -1,34 +0,0 @@
-- // MIR for `main` before SimplifyConstCondition-after-const-prop
-+ // MIR for `main` after SimplifyConstCondition-after-const-prop
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/switch_int.rs:+0:11: +0:11
- let mut _1: i32; // in scope 0 at $DIR/switch_int.rs:+1:11: +1:12
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/switch_int.rs:+1:11: +1:12
- _1 = const 1_i32; // scope 0 at $DIR/switch_int.rs:+1:11: +1:12
-- switchInt(const 1_i32) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12
-+ goto -> bb2; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12
- }
-
- bb1: {
- _0 = foo(const -1_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+3:14: +3:21
- // mir::Constant
- // + span: $DIR/switch_int.rs:12:14: 12:17
- // + literal: Const { ty: fn(i32) {foo}, val: Value(<ZST>) }
- }
-
- bb2: {
- _0 = foo(const 0_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+2:14: +2:20
- // mir::Constant
- // + span: $DIR/switch_int.rs:11:14: 11:17
- // + literal: Const { ty: fn(i32) {foo}, val: Value(<ZST>) }
- }
-
- bb3: {
- StorageDead(_1); // scope 0 at $DIR/switch_int.rs:+5:1: +5:2
- return; // scope 0 at $DIR/switch_int.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-abort.diff b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-abort.diff
new file mode 100644
index 000000000..ced5e500d
--- /dev/null
+++ b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-abort.diff
@@ -0,0 +1,28 @@
+- // MIR for `main` before SimplifyConstCondition-after-const-prop
++ // MIR for `main` after SimplifyConstCondition-after-const-prop
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 1_i32;
+- switchInt(const 1_i32) -> [1: bb2, otherwise: bb1];
++ goto -> bb2;
+ }
+
+ bb1: {
+ _0 = foo(const -1_i32) -> [return: bb3, unwind unreachable];
+ }
+
+ bb2: {
+ _0 = foo(const 0_i32) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff
new file mode 100644
index 000000000..e598a0d3d
--- /dev/null
+++ b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff
@@ -0,0 +1,28 @@
+- // MIR for `main` before SimplifyConstCondition-after-const-prop
++ // MIR for `main` after SimplifyConstCondition-after-const-prop
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 1_i32;
+- switchInt(const 1_i32) -> [1: bb2, otherwise: bb1];
++ goto -> bb2;
+ }
+
+ bb1: {
+ _0 = foo(const -1_i32) -> [return: bb3, unwind continue];
+ }
+
+ bb2: {
+ _0 = foo(const 0_i32) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/switch_int.rs b/tests/mir-opt/const_prop/switch_int.rs
index 7158ea4d2..d1cbaae49 100644
--- a/tests/mir-opt/const_prop/switch_int.rs
+++ b/tests/mir-opt/const_prop/switch_int.rs
@@ -1,12 +1,20 @@
// unit-test: ConstProp
// compile-flags: -Zmir-enable-passes=+SimplifyConstCondition-after-const-prop
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
#[inline(never)]
fn foo(_: i32) { }
// EMIT_MIR switch_int.main.ConstProp.diff
// EMIT_MIR switch_int.main.SimplifyConstCondition-after-const-prop.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: bb0: {
+ // CHECK-NOT: switchInt(
+ // CHECK: goto -> [[bb:bb.*]];
+ // CHECK: [[bb]]: {
+ // CHECK-NOT: _0 = foo(const -1_i32)
+ // CHECK: _0 = foo(const 0_i32)
match 1 {
1 => foo(0),
_ => foo(-1),
diff --git a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff
index 933dfbb51..febfebc85 100644
--- a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff
@@ -2,14 +2,14 @@
+ // MIR for `from_char` after ConstProp
fn from_char() -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/transmute.rs:+0:23: +0:26
+ let mut _0: i32;
scope 1 {
}
bb0: {
-- _0 = const 'R' as i32 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:28
-+ _0 = const 82_i32; // scope 1 at $DIR/transmute.rs:+1:14: +1:28
- return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
+- _0 = const 'R' as i32 (Transmute);
++ _0 = const 82_i32;
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff
index 933dfbb51..febfebc85 100644
--- a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff
@@ -2,14 +2,14 @@
+ // MIR for `from_char` after ConstProp
fn from_char() -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/transmute.rs:+0:23: +0:26
+ let mut _0: i32;
scope 1 {
}
bb0: {
-- _0 = const 'R' as i32 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:28
-+ _0 = const 82_i32; // scope 1 at $DIR/transmute.rs:+1:14: +1:28
- return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
+- _0 = const 'R' as i32 (Transmute);
++ _0 = const 82_i32;
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff
index 4a31194de..38a1eb5a1 100644
--- a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff
@@ -2,14 +2,14 @@
+ // MIR for `invalid_bool` after ConstProp
fn invalid_bool() -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37
+ let mut _0: bool;
scope 1 {
}
bb0: {
-- _0 = const -1_i8 as bool (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:30
-+ _0 = const {transmute(0xff): bool}; // scope 1 at $DIR/transmute.rs:+1:14: +1:30
- return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
+- _0 = const -1_i8 as bool (Transmute);
++ _0 = const {transmute(0xff): bool};
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff
index 4a31194de..38a1eb5a1 100644
--- a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff
@@ -2,14 +2,14 @@
+ // MIR for `invalid_bool` after ConstProp
fn invalid_bool() -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37
+ let mut _0: bool;
scope 1 {
}
bb0: {
-- _0 = const -1_i8 as bool (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:30
-+ _0 = const {transmute(0xff): bool}; // scope 1 at $DIR/transmute.rs:+1:14: +1:30
- return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
+- _0 = const -1_i8 as bool (Transmute);
++ _0 = const {transmute(0xff): bool};
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff
index 2c541f2f6..2c0998f77 100644
--- a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff
@@ -2,14 +2,14 @@
+ // MIR for `invalid_char` after ConstProp
fn invalid_char() -> char {
- let mut _0: char; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37
+ let mut _0: char;
scope 1 {
}
bb0: {
-- _0 = const _ as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33
-+ _0 = const {transmute(0x7fffffff): char}; // scope 1 at $DIR/transmute.rs:+1:14: +1:33
- return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
+- _0 = const _ as char (Transmute);
++ _0 = const {transmute(0x7fffffff): char};
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff
index 2c541f2f6..2c0998f77 100644
--- a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff
@@ -2,14 +2,14 @@
+ // MIR for `invalid_char` after ConstProp
fn invalid_char() -> char {
- let mut _0: char; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37
+ let mut _0: char;
scope 1 {
}
bb0: {
-- _0 = const _ as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33
-+ _0 = const {transmute(0x7fffffff): char}; // scope 1 at $DIR/transmute.rs:+1:14: +1:33
- return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
+- _0 = const _ as char (Transmute);
++ _0 = const {transmute(0x7fffffff): char};
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff
index 76d464789..7ac7bed8a 100644
--- a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff
@@ -2,22 +2,19 @@
+ // MIR for `less_as_i8` after ConstProp
fn less_as_i8() -> i8 {
- let mut _0: i8; // return place in scope 0 at $DIR/transmute.rs:+0:24: +0:26
- let mut _1: std::cmp::Ordering; // in scope 0 at $DIR/transmute.rs:+1:24: +1:48
+ let mut _0: i8;
+ let mut _1: std::cmp::Ordering;
scope 1 {
}
bb0: {
- StorageLive(_1); // scope 1 at $DIR/transmute.rs:+1:24: +1:48
-- _1 = Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48
-- _0 = move _1 as i8 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:49
-+ _1 = const Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: std::cmp::Ordering, val: Value(Scalar(0xff)) }
-+ _0 = const -1_i8; // scope 1 at $DIR/transmute.rs:+1:14: +1:49
- StorageDead(_1); // scope 1 at $DIR/transmute.rs:+1:48: +1:49
- return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
+ StorageLive(_1);
+- _1 = Less;
+- _0 = move _1 as i8 (Transmute);
++ _1 = const Less;
++ _0 = const -1_i8;
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff
index 76d464789..7ac7bed8a 100644
--- a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff
@@ -2,22 +2,19 @@
+ // MIR for `less_as_i8` after ConstProp
fn less_as_i8() -> i8 {
- let mut _0: i8; // return place in scope 0 at $DIR/transmute.rs:+0:24: +0:26
- let mut _1: std::cmp::Ordering; // in scope 0 at $DIR/transmute.rs:+1:24: +1:48
+ let mut _0: i8;
+ let mut _1: std::cmp::Ordering;
scope 1 {
}
bb0: {
- StorageLive(_1); // scope 1 at $DIR/transmute.rs:+1:24: +1:48
-- _1 = Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48
-- _0 = move _1 as i8 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:49
-+ _1 = const Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: std::cmp::Ordering, val: Value(Scalar(0xff)) }
-+ _0 = const -1_i8; // scope 1 at $DIR/transmute.rs:+1:14: +1:49
- StorageDead(_1); // scope 1 at $DIR/transmute.rs:+1:48: +1:49
- return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
+ StorageLive(_1);
+- _1 = Less;
+- _0 = move _1 as i8 (Transmute);
++ _1 = const Less;
++ _0 = const -1_i8;
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.rs b/tests/mir-opt/const_prop/transmute.rs
index 762c42171..99988d059 100644
--- a/tests/mir-opt/const_prop/transmute.rs
+++ b/tests/mir-opt/const_prop/transmute.rs
@@ -7,55 +7,77 @@ use std::mem::transmute;
// EMIT_MIR transmute.less_as_i8.ConstProp.diff
pub fn less_as_i8() -> i8 {
+ // CHECK-LABEL: fn less_as_i8(
+ // CHECK: _0 = const -1_i8;
unsafe { transmute(std::cmp::Ordering::Less) }
}
// EMIT_MIR transmute.from_char.ConstProp.diff
pub fn from_char() -> i32 {
+ // CHECK-LABEL: fn from_char(
+ // CHECK: _0 = const 82_i32;
unsafe { transmute('R') }
}
// EMIT_MIR transmute.valid_char.ConstProp.diff
pub fn valid_char() -> char {
+ // CHECK-LABEL: fn valid_char(
+ // CHECK: _0 = const 'R';
unsafe { transmute(0x52_u32) }
}
// EMIT_MIR transmute.invalid_char.ConstProp.diff
pub unsafe fn invalid_char() -> char {
+ // CHECK-LABEL: fn invalid_char(
+ // CHECK: _0 = const {transmute(0x7fffffff): char};
unsafe { transmute(i32::MAX) }
}
// EMIT_MIR transmute.invalid_bool.ConstProp.diff
pub unsafe fn invalid_bool() -> bool {
+ // CHECK-LABEL: fn invalid_bool(
+ // CHECK: _0 = const {transmute(0xff): bool};
unsafe { transmute(-1_i8) }
}
// EMIT_MIR transmute.undef_union_as_integer.ConstProp.diff
pub unsafe fn undef_union_as_integer() -> u32 {
+ // CHECK-LABEL: fn undef_union_as_integer(
+ // CHECK: _1 = Union32 {
+ // CHECK: _0 = move _1 as u32 (Transmute);
union Union32 { value: u32, unit: () }
unsafe { transmute(Union32 { unit: () }) }
}
// EMIT_MIR transmute.unreachable_direct.ConstProp.diff
pub unsafe fn unreachable_direct() -> ! {
+ // CHECK-LABEL: fn unreachable_direct(
+ // CHECK: [[unit:_.*]] = ();
+ // CHECK: move [[unit]] as Never (Transmute);
let x: Never = unsafe { transmute(()) };
match x {}
}
// EMIT_MIR transmute.unreachable_ref.ConstProp.diff
pub unsafe fn unreachable_ref() -> ! {
+ // CHECK-LABEL: fn unreachable_ref(
+ // CHECK: = const {0x1 as &Never};
let x: &Never = unsafe { transmute(1_usize) };
match *x {}
}
// EMIT_MIR transmute.unreachable_mut.ConstProp.diff
pub unsafe fn unreachable_mut() -> ! {
+ // CHECK-LABEL: fn unreachable_mut(
+ // CHECK: = const {0x1 as &mut Never};
let x: &mut Never = unsafe { transmute(1_usize) };
match *x {}
}
// EMIT_MIR transmute.unreachable_box.ConstProp.diff
pub unsafe fn unreachable_box() -> ! {
+ // CHECK-LABEL: fn unreachable_box(
+ // CHECK: = const Box::<Never>(
let x: Box<Never> = unsafe { transmute(1_usize) };
match *x {}
}
diff --git a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff
index 538b1f26e..afedf2a30 100644
--- a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff
@@ -2,21 +2,21 @@
+ // MIR for `undef_union_as_integer` after ConstProp
fn undef_union_as_integer() -> u32 {
- let mut _0: u32; // return place in scope 0 at $DIR/transmute.rs:+0:43: +0:46
- let mut _1: undef_union_as_integer::Union32; // in scope 0 at $DIR/transmute.rs:+2:24: +2:44
- let mut _2: (); // in scope 0 at $DIR/transmute.rs:+2:40: +2:42
+ let mut _0: u32;
+ let mut _1: undef_union_as_integer::Union32;
+ let mut _2: ();
scope 1 {
}
bb0: {
- StorageLive(_1); // scope 1 at $DIR/transmute.rs:+2:24: +2:44
- StorageLive(_2); // scope 1 at $DIR/transmute.rs:+2:40: +2:42
- _2 = (); // scope 1 at $DIR/transmute.rs:+2:40: +2:42
- _1 = Union32 { value: move _2 }; // scope 1 at $DIR/transmute.rs:+2:24: +2:44
- StorageDead(_2); // scope 1 at $DIR/transmute.rs:+2:43: +2:44
- _0 = move _1 as u32 (Transmute); // scope 1 at $DIR/transmute.rs:+2:14: +2:45
- StorageDead(_1); // scope 1 at $DIR/transmute.rs:+2:44: +2:45
- return; // scope 0 at $DIR/transmute.rs:+3:2: +3:2
+ 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/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff
index 538b1f26e..afedf2a30 100644
--- a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff
@@ -2,21 +2,21 @@
+ // MIR for `undef_union_as_integer` after ConstProp
fn undef_union_as_integer() -> u32 {
- let mut _0: u32; // return place in scope 0 at $DIR/transmute.rs:+0:43: +0:46
- let mut _1: undef_union_as_integer::Union32; // in scope 0 at $DIR/transmute.rs:+2:24: +2:44
- let mut _2: (); // in scope 0 at $DIR/transmute.rs:+2:40: +2:42
+ let mut _0: u32;
+ let mut _1: undef_union_as_integer::Union32;
+ let mut _2: ();
scope 1 {
}
bb0: {
- StorageLive(_1); // scope 1 at $DIR/transmute.rs:+2:24: +2:44
- StorageLive(_2); // scope 1 at $DIR/transmute.rs:+2:40: +2:42
- _2 = (); // scope 1 at $DIR/transmute.rs:+2:40: +2:42
- _1 = Union32 { value: move _2 }; // scope 1 at $DIR/transmute.rs:+2:24: +2:44
- StorageDead(_2); // scope 1 at $DIR/transmute.rs:+2:43: +2:44
- _0 = move _1 as u32 (Transmute); // scope 1 at $DIR/transmute.rs:+2:14: +2:45
- StorageDead(_1); // scope 1 at $DIR/transmute.rs:+2:44: +2:45
- return; // scope 0 at $DIR/transmute.rs:+3:2: +3:2
+ 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/const_prop/transmute.unreachable_box.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff
index 5258d75bd..16519749b 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff
@@ -2,22 +2,22 @@
+ // MIR for `unreachable_box` after ConstProp
fn unreachable_box() -> ! {
- let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
- let _1: std::boxed::Box<Never>; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
+ let mut _0: !;
+ let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ debug x => _1;
}
scope 2 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
-- _1 = const 1_usize as std::boxed::Box<Never> (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
-+ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: Box<Never>, val: Value(Scalar(0x00000001)) }
- unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
+ StorageLive(_1);
+- _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
+- _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
++ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global);
++ _2 = const {0x1 as *const Never};
+ unreachable;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff
index 7e57e06a5..16519749b 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff
@@ -2,22 +2,22 @@
+ // MIR for `unreachable_box` after ConstProp
fn unreachable_box() -> ! {
- let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
- let _1: std::boxed::Box<Never>; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
+ let mut _0: !;
+ let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ debug x => _1;
}
scope 2 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
-- _1 = const 1_usize as std::boxed::Box<Never> (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
-+ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: Box<Never>, val: Value(Scalar(0x0000000000000001)) }
- unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
+ StorageLive(_1);
+- _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
+- _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
++ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global);
++ _2 = const {0x1 as *const Never};
+ unreachable;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff
index 032681f23..896608e7e 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff
@@ -2,21 +2,21 @@
+ // MIR for `unreachable_direct` after ConstProp
fn unreachable_direct() -> ! {
- let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:39: +0:40
- let _1: Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
- let mut _2: (); // in scope 0 at $DIR/transmute.rs:+1:39: +1:41
+ let mut _0: !;
+ let _1: Never;
+ let mut _2: ();
scope 1 {
- debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ debug x => _1;
}
scope 2 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
- StorageLive(_2); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
- _2 = (); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
- _1 = move _2 as Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:29: +1:42
- unreachable; // scope 2 at $DIR/transmute.rs:+1:29: +1:42
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = ();
+ _1 = move _2 as Never (Transmute);
+ unreachable;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff
index 032681f23..896608e7e 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff
@@ -2,21 +2,21 @@
+ // MIR for `unreachable_direct` after ConstProp
fn unreachable_direct() -> ! {
- let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:39: +0:40
- let _1: Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
- let mut _2: (); // in scope 0 at $DIR/transmute.rs:+1:39: +1:41
+ let mut _0: !;
+ let _1: Never;
+ let mut _2: ();
scope 1 {
- debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ debug x => _1;
}
scope 2 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
- StorageLive(_2); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
- _2 = (); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
- _1 = move _2 as Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:29: +1:42
- unreachable; // scope 2 at $DIR/transmute.rs:+1:29: +1:42
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = ();
+ _1 = move _2 as Never (Transmute);
+ unreachable;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff
index ec8a62bd6..c9d5ccf0b 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff
@@ -2,26 +2,23 @@
+ // MIR for `unreachable_mut` after ConstProp
fn unreachable_mut() -> ! {
- let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
- let _1: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
- let mut _2: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:34: +1:52
+ let mut _0: !;
+ let _1: &mut Never;
+ let mut _2: &mut Never;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ debug x => _1;
}
scope 2 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:34: +1:52
-- _2 = const 1_usize as &mut Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
-+ _2 = const {0x1 as &mut Never}; // scope 2 at $DIR/transmute.rs:+1:34: +1:52
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: &mut Never, val: Value(Scalar(0x00000001)) }
- _1 = &mut (*_2); // scope 0 at $DIR/transmute.rs:+1:34: +1:52
- StorageDead(_2); // scope 0 at $DIR/transmute.rs:+1:54: +1:55
- unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
+ 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/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff
index 288da6e56..c9d5ccf0b 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff
@@ -2,26 +2,23 @@
+ // MIR for `unreachable_mut` after ConstProp
fn unreachable_mut() -> ! {
- let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
- let _1: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
- let mut _2: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:34: +1:52
+ let mut _0: !;
+ let _1: &mut Never;
+ let mut _2: &mut Never;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ debug x => _1;
}
scope 2 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:34: +1:52
-- _2 = const 1_usize as &mut Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
-+ _2 = const {0x1 as &mut Never}; // scope 2 at $DIR/transmute.rs:+1:34: +1:52
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: &mut Never, val: Value(Scalar(0x0000000000000001)) }
- _1 = &mut (*_2); // scope 0 at $DIR/transmute.rs:+1:34: +1:52
- StorageDead(_2); // scope 0 at $DIR/transmute.rs:+1:54: +1:55
- unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
+ 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/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff
index dcca0fca6..b684ba34c 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff
@@ -2,22 +2,19 @@
+ // MIR for `unreachable_ref` after ConstProp
fn unreachable_ref() -> ! {
- let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
- let _1: &Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
+ let mut _0: !;
+ let _1: &Never;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ debug x => _1;
}
scope 2 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
-- _1 = const 1_usize as &Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:30: +1:48
-+ _1 = const {0x1 as &Never}; // scope 2 at $DIR/transmute.rs:+1:30: +1:48
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: &Never, val: Value(Scalar(0x00000001)) }
- unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
+ StorageLive(_1);
+- _1 = const 1_usize as &Never (Transmute);
++ _1 = const {0x1 as &Never};
+ unreachable;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff
index 3a0b967e6..b684ba34c 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff
@@ -2,22 +2,19 @@
+ // MIR for `unreachable_ref` after ConstProp
fn unreachable_ref() -> ! {
- let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
- let _1: &Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
+ let mut _0: !;
+ let _1: &Never;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ debug x => _1;
}
scope 2 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
-- _1 = const 1_usize as &Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:30: +1:48
-+ _1 = const {0x1 as &Never}; // scope 2 at $DIR/transmute.rs:+1:30: +1:48
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: &Never, val: Value(Scalar(0x0000000000000001)) }
- unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
+ StorageLive(_1);
+- _1 = const 1_usize as &Never (Transmute);
++ _1 = const {0x1 as &Never};
+ unreachable;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff
index eac33b730..f215b3ca3 100644
--- a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff
@@ -2,14 +2,14 @@
+ // MIR for `valid_char` after ConstProp
fn valid_char() -> char {
- let mut _0: char; // return place in scope 0 at $DIR/transmute.rs:+0:24: +0:28
+ let mut _0: char;
scope 1 {
}
bb0: {
-- _0 = const 82_u32 as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33
-+ _0 = const 'R'; // scope 1 at $DIR/transmute.rs:+1:14: +1:33
- return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
+- _0 = const 82_u32 as char (Transmute);
++ _0 = const 'R';
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff
index eac33b730..f215b3ca3 100644
--- a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff
@@ -2,14 +2,14 @@
+ // MIR for `valid_char` after ConstProp
fn valid_char() -> char {
- let mut _0: char; // return place in scope 0 at $DIR/transmute.rs:+0:24: +0:28
+ let mut _0: char;
scope 1 {
}
bb0: {
-- _0 = const 82_u32 as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33
-+ _0 = const 'R'; // scope 1 at $DIR/transmute.rs:+1:14: +1:33
- return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
+- _0 = const 82_u32 as char (Transmute);
++ _0 = const 'R';
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff
deleted file mode 100644
index e4a7c0d1e..000000000
--- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff
+++ /dev/null
@@ -1,35 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/tuple_literal_propagation.rs:+0:11: +0:11
- let _1: (u32, u32); // in scope 0 at $DIR/tuple_literal_propagation.rs:+1:9: +1:10
- let _2: (); // in scope 0 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15
- let mut _3: (u32, u32); // in scope 0 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/tuple_literal_propagation.rs:+1:9: +1:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:9: +1:10
-- _1 = (const 1_u32, const 2_u32); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:13: +1:19
-+ _1 = const (1_u32, 2_u32); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:13: +1:19
- StorageLive(_2); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15
- StorageLive(_3); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14
-- _3 = _1; // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14
-+ _3 = const (1_u32, 2_u32); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14
- _2 = consume(move _3) -> bb1; // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15
- // mir::Constant
- // + span: $DIR/tuple_literal_propagation.rs:7:5: 7:12
- // + literal: Const { ty: fn((u32, u32)) {consume}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_3); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:14: +3:15
- StorageDead(_2); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:15: +3:16
- _0 = const (); // scope 0 at $DIR/tuple_literal_propagation.rs:+0:11: +4:2
- StorageDead(_1); // scope 0 at $DIR/tuple_literal_propagation.rs:+4:1: +4:2
- return; // scope 0 at $DIR/tuple_literal_propagation.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..f19650d5a
--- /dev/null
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff
@@ -0,0 +1,45 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: (u32, u32);
+ let _2: ();
+ let mut _3: (u32, u32);
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = (const 1_u32, const 2_u32);
++ _1 = const (1_u32, 2_u32);
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = _1;
+- _2 = consume(move _3) -> [return: bb1, unwind unreachable];
++ _3 = const (1_u32, 2_u32);
++ _2 = consume(const (1_u32, 2_u32)) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
++ }
++
++ ALLOC1 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
++ }
++
++ ALLOC2 (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
new file mode 100644
index 000000000..67307c423
--- /dev/null
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,45 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: (u32, u32);
+ let _2: ();
+ let mut _3: (u32, u32);
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = (const 1_u32, const 2_u32);
++ _1 = const (1_u32, 2_u32);
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = _1;
+- _2 = consume(move _3) -> [return: bb1, unwind continue];
++ _3 = const (1_u32, 2_u32);
++ _2 = consume(const (1_u32, 2_u32)) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
++ }
++
++ ALLOC1 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
++ }
++
++ ALLOC2 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.rs b/tests/mir-opt/const_prop/tuple_literal_propagation.rs
index f342ae270..dfc4a6f3f 100644
--- a/tests/mir-opt/const_prop/tuple_literal_propagation.rs
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.rs
@@ -1,9 +1,11 @@
// unit-test: ConstProp
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR tuple_literal_propagation.main.ConstProp.diff
+
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: = consume(const (1_u32, 2_u32))
let x = (1, 2);
-
consume(x);
}
diff --git a/tests/mir-opt/const_prop/while_let_loops.change_loop_body.ConstProp.diff b/tests/mir-opt/const_prop/while_let_loops.change_loop_body.ConstProp.diff
index 377324218..f54908b4a 100644
--- a/tests/mir-opt/const_prop/while_let_loops.change_loop_body.ConstProp.diff
+++ b/tests/mir-opt/const_prop/while_let_loops.change_loop_body.ConstProp.diff
@@ -2,53 +2,53 @@
+ // MIR for `change_loop_body` after ConstProp
fn change_loop_body() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:+0:27: +0:27
- let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15
- let mut _2: (); // in scope 0 at $DIR/while_let_loops.rs:+0:1: +6:2
- let mut _3: std::option::Option<u32>; // in scope 0 at $DIR/while_let_loops.rs:+2:28: +2:32
- let mut _4: isize; // in scope 0 at $DIR/while_let_loops.rs:+2:15: +2:25
- let mut _5: !; // in scope 0 at $DIR/while_let_loops.rs:+2:33: +5:6
- let mut _6: !; // in scope 0 at $DIR/while_let_loops.rs:+2:5: +5:6
- let _7: (); // in scope 0 at $DIR/while_let_loops.rs:+2:5: +5:6
- let mut _8: !; // in scope 0 at $DIR/while_let_loops.rs:+2:5: +5:6
+ let mut _0: ();
+ let mut _1: i32;
+ let mut _2: ();
+ let mut _3: std::option::Option<u32>;
+ let mut _4: isize;
+ let mut _5: !;
+ let mut _6: !;
+ let _7: ();
+ let mut _8: !;
scope 1 {
- debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:+1:9: +1:15
+ debug _x => _1;
scope 2 {
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15
- _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:+1:18: +1:19
- StorageLive(_3); // scope 2 at $DIR/while_let_loops.rs:+2:28: +2:32
- _3 = Option::<u32>::None; // scope 2 at $DIR/while_let_loops.rs:+2:28: +2:32
-- _4 = discriminant(_3); // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25
-- switchInt(move _4) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25
-+ _4 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25
-+ switchInt(const 0_isize) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25
+ StorageLive(_1);
+ _1 = const 0_i32;
+ StorageLive(_3);
+ _3 = Option::<u32>::None;
+- _4 = discriminant(_3);
+- switchInt(move _4) -> [1: bb1, otherwise: bb3];
++ _4 = const 0_isize;
++ switchInt(const 0_isize) -> [1: bb1, otherwise: bb3];
}
bb1: {
- switchInt(((_3 as Some).0: u32)) -> [0: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25
+ switchInt(((_3 as Some).0: u32)) -> [0: bb2, otherwise: bb3];
}
bb2: {
- _1 = const 1_i32; // scope 2 at $DIR/while_let_loops.rs:+3:9: +3:15
- _0 = const (); // scope 2 at $DIR/while_let_loops.rs:+4:9: +4:14
- goto -> bb4; // scope 2 at $DIR/while_let_loops.rs:+4:9: +4:14
+ _1 = const 1_i32;
+ _0 = const ();
+ goto -> bb4;
}
bb3: {
- StorageLive(_7); // scope 1 at $DIR/while_let_loops.rs:+2:5: +5:6
- _0 = const (); // scope 1 at $DIR/while_let_loops.rs:+2:5: +5:6
- StorageDead(_7); // scope 1 at $DIR/while_let_loops.rs:+5:5: +5:6
- goto -> bb4; // scope 1 at no-location
+ StorageLive(_7);
+ _0 = const ();
+ StorageDead(_7);
+ goto -> bb4;
}
bb4: {
- StorageDead(_3); // scope 1 at $DIR/while_let_loops.rs:+5:5: +5:6
- StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:+6:1: +6:2
- return; // scope 0 at $DIR/while_let_loops.rs:+6:2: +6:2
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/const_prop/while_let_loops.rs b/tests/mir-opt/const_prop/while_let_loops.rs
index 595a94b88..8b2a73438 100644
--- a/tests/mir-opt/const_prop/while_let_loops.rs
+++ b/tests/mir-opt/const_prop/while_let_loops.rs
@@ -2,6 +2,8 @@
// EMIT_MIR while_let_loops.change_loop_body.ConstProp.diff
pub fn change_loop_body() {
+ // CHECK-LABEL: fn change_loop_body(
+ // CHECK: switchInt(const 0_isize)
let mut _x = 0;
while let Some(0u32) = None {
_x = 1;
diff --git a/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff b/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff
deleted file mode 100644
index a5f52d089..000000000
--- a/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff
+++ /dev/null
@@ -1,41 +0,0 @@
-- // MIR for `bar` before ConstProp
-+ // MIR for `bar` after ConstProp
-
- fn bar() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/const_prop_miscompile.rs:+0:10: +0:10
- let mut _1: (i32,); // in scope 0 at $DIR/const_prop_miscompile.rs:+1:9: +1:14
- let _2: (); // in scope 0 at $DIR/const_prop_miscompile.rs:+2:5: +4:6
- let mut _3: *mut i32; // in scope 0 at $DIR/const_prop_miscompile.rs:+3:10: +3:22
- let mut _5: i32; // in scope 0 at $DIR/const_prop_miscompile.rs:+5:13: +5:20
- scope 1 {
- debug v => _1; // in scope 1 at $DIR/const_prop_miscompile.rs:+1:9: +1:14
- let _4: bool; // in scope 1 at $DIR/const_prop_miscompile.rs:+5:9: +5:10
- scope 2 {
- }
- scope 3 {
- debug y => _4; // in scope 3 at $DIR/const_prop_miscompile.rs:+5:9: +5:10
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+1:9: +1:14
- _1 = (const 1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21
- StorageLive(_2); // scope 1 at $DIR/const_prop_miscompile.rs:+2:5: +4:6
- StorageLive(_3); // scope 2 at $DIR/const_prop_miscompile.rs:+3:10: +3:22
- _3 = &raw mut (_1.0: i32); // scope 2 at $DIR/const_prop_miscompile.rs:+3:10: +3:22
- (*_3) = const 5_i32; // scope 2 at $DIR/const_prop_miscompile.rs:+3:9: +3:26
- StorageDead(_3); // scope 2 at $DIR/const_prop_miscompile.rs:+3:26: +3:27
- _2 = const (); // scope 2 at $DIR/const_prop_miscompile.rs:+2:5: +4:6
- StorageDead(_2); // scope 1 at $DIR/const_prop_miscompile.rs:+4:5: +4:6
- StorageLive(_4); // scope 1 at $DIR/const_prop_miscompile.rs:+5:9: +5:10
- StorageLive(_5); // scope 1 at $DIR/const_prop_miscompile.rs:+5:13: +5:20
- _5 = (_1.0: i32); // scope 1 at $DIR/const_prop_miscompile.rs:+5:15: +5:18
- _4 = Eq(move _5, const 5_i32); // scope 1 at $DIR/const_prop_miscompile.rs:+5:13: +5:25
- StorageDead(_5); // scope 1 at $DIR/const_prop_miscompile.rs:+5:24: +5:25
- _0 = const (); // scope 0 at $DIR/const_prop_miscompile.rs:+0:10: +6:2
- StorageDead(_4); // scope 1 at $DIR/const_prop_miscompile.rs:+6:1: +6:2
- StorageDead(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+6:1: +6:2
- return; // scope 0 at $DIR/const_prop_miscompile.rs:+6:2: +6:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff b/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff
deleted file mode 100644
index 42ddc2a56..000000000
--- a/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff
+++ /dev/null
@@ -1,35 +0,0 @@
-- // MIR for `foo` before ConstProp
-+ // MIR for `foo` after ConstProp
-
- fn foo() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/const_prop_miscompile.rs:+0:10: +0:10
- let mut _1: (i32,); // in scope 0 at $DIR/const_prop_miscompile.rs:+1:9: +1:14
- let mut _2: &mut i32; // in scope 0 at $DIR/const_prop_miscompile.rs:+2:6: +2:14
- let mut _4: i32; // in scope 0 at $DIR/const_prop_miscompile.rs:+3:13: +3:20
- scope 1 {
- debug u => _1; // in scope 1 at $DIR/const_prop_miscompile.rs:+1:9: +1:14
- let _3: bool; // in scope 1 at $DIR/const_prop_miscompile.rs:+3:9: +3:10
- scope 2 {
- debug y => _3; // in scope 2 at $DIR/const_prop_miscompile.rs:+3:9: +3:10
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+1:9: +1:14
- _1 = (const 1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21
- StorageLive(_2); // scope 1 at $DIR/const_prop_miscompile.rs:+2:6: +2:14
- _2 = &mut (_1.0: i32); // scope 1 at $DIR/const_prop_miscompile.rs:+2:6: +2:14
- (*_2) = const 5_i32; // scope 1 at $DIR/const_prop_miscompile.rs:+2:5: +2:18
- StorageDead(_2); // scope 1 at $DIR/const_prop_miscompile.rs:+2:18: +2:19
- StorageLive(_3); // scope 1 at $DIR/const_prop_miscompile.rs:+3:9: +3:10
- StorageLive(_4); // scope 1 at $DIR/const_prop_miscompile.rs:+3:13: +3:20
- _4 = (_1.0: i32); // scope 1 at $DIR/const_prop_miscompile.rs:+3:15: +3:18
- _3 = Eq(move _4, const 5_i32); // scope 1 at $DIR/const_prop_miscompile.rs:+3:13: +3:25
- StorageDead(_4); // scope 1 at $DIR/const_prop_miscompile.rs:+3:24: +3:25
- _0 = const (); // scope 0 at $DIR/const_prop_miscompile.rs:+0:10: +4:2
- StorageDead(_3); // scope 1 at $DIR/const_prop_miscompile.rs:+4:1: +4:2
- StorageDead(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+4:1: +4:2
- return; // scope 0 at $DIR/const_prop_miscompile.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/const_prop_miscompile.rs b/tests/mir-opt/const_prop_miscompile.rs
deleted file mode 100644
index dbbe5ee08..000000000
--- a/tests/mir-opt/const_prop_miscompile.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// unit-test: ConstProp
-#![feature(raw_ref_op)]
-
-// EMIT_MIR const_prop_miscompile.foo.ConstProp.diff
-fn foo() {
- let mut u = (1,);
- *&mut u.0 = 5;
- let y = { u.0 } == 5;
-}
-
-// EMIT_MIR const_prop_miscompile.bar.ConstProp.diff
-fn bar() {
- let mut v = (1,);
- unsafe {
- *&raw mut v.0 = 5;
- }
- let y = { v.0 } == 5;
-}
-
-fn main() {
- foo();
- bar();
-}
diff --git a/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff
deleted file mode 100644
index 51707e716..000000000
--- a/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff
+++ /dev/null
@@ -1,33 +0,0 @@
-- // MIR for `f` before CopyProp
-+ // MIR for `f` after CopyProp
-
- fn f() -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/borrowed_local.rs:+0:11: +0:15
- let mut _1: u8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _2: &u8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _3: u8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _4: &u8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-
- bb0: {
- _1 = const 5_u8; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _2 = &_1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _3 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _4 = &_3; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _0 = cmp_ref(_2, _4) -> bb1; // scope 0 at $DIR/borrowed_local.rs:+8:13: +8:45
- // mir::Constant
- // + span: $DIR/borrowed_local.rs:24:29: 24:36
- // + literal: Const { ty: for<'a, 'b> fn(&'a u8, &'b u8) -> bool {cmp_ref}, val: Value(<ZST>) }
- }
-
- bb1: {
- _0 = opaque::<u8>(_3) -> bb2; // scope 0 at $DIR/borrowed_local.rs:+12:13: +12:38
- // mir::Constant
- // + span: $DIR/borrowed_local.rs:28:28: 28:34
- // + literal: Const { ty: fn(u8) -> bool {opaque::<u8>}, val: Value(<ZST>) }
- }
-
- bb2: {
- return; // scope 0 at $DIR/borrowed_local.rs:+15:13: +15:21
- }
- }
-
diff --git a/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-abort.diff
new file mode 100644
index 000000000..46534076c
--- /dev/null
+++ b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-abort.diff
@@ -0,0 +1,27 @@
+- // MIR for `f` before CopyProp
++ // MIR for `f` after CopyProp
+
+ fn f() -> bool {
+ let mut _0: bool;
+ let mut _1: u8;
+ let mut _2: &u8;
+ let mut _3: u8;
+ let mut _4: &u8;
+
+ bb0: {
+ _1 = const 5_u8;
+ _2 = &_1;
+ _3 = _1;
+ _4 = &_3;
+ _0 = cmp_ref(_2, _4) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _0 = opaque::<u8>(_3) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-unwind.diff
new file mode 100644
index 000000000..b702e3b7d
--- /dev/null
+++ b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-unwind.diff
@@ -0,0 +1,27 @@
+- // MIR for `f` before CopyProp
++ // MIR for `f` after CopyProp
+
+ fn f() -> bool {
+ let mut _0: bool;
+ let mut _1: u8;
+ let mut _2: &u8;
+ let mut _3: u8;
+ let mut _4: &u8;
+
+ bb0: {
+ _1 = const 5_u8;
+ _2 = &_1;
+ _3 = _1;
+ _4 = &_3;
+ _0 = cmp_ref(_2, _4) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ _0 = opaque::<u8>(_3) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/borrowed_local.rs b/tests/mir-opt/copy-prop/borrowed_local.rs
index 9186da5af..a44e65164 100644
--- a/tests/mir-opt/copy-prop/borrowed_local.rs
+++ b/tests/mir-opt/copy-prop/borrowed_local.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: CopyProp
#![feature(custom_mir, core_intrinsics)]
@@ -21,11 +22,11 @@ fn f() -> bool {
let b = a;
// We cannot propagate the place `a`.
let r2 = &b;
- Call(RET, next, cmp_ref(r1, r2))
+ Call(RET = cmp_ref(r1, r2), next, UnwindContinue())
}
next = {
// But we can propagate the value `a`.
- Call(RET, ret, opaque(b))
+ Call(RET = opaque(b), ret, UnwindContinue())
}
ret = {
Return()
diff --git a/tests/mir-opt/copy-prop/branch.foo.CopyProp.diff b/tests/mir-opt/copy-prop/branch.foo.CopyProp.diff
deleted file mode 100644
index b78c19d78..000000000
--- a/tests/mir-opt/copy-prop/branch.foo.CopyProp.diff
+++ /dev/null
@@ -1,65 +0,0 @@
-- // MIR for `foo` before CopyProp
-+ // MIR for `foo` after CopyProp
-
- fn foo() -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/branch.rs:+0:13: +0:16
- let _1: i32; // in scope 0 at $DIR/branch.rs:+1:9: +1:10
- let mut _3: bool; // in scope 0 at $DIR/branch.rs:+3:16: +3:22
- let _4: i32; // in scope 0 at $DIR/branch.rs:+6:9: +6:14
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/branch.rs:+1:9: +1:10
- let _2: i32; // in scope 1 at $DIR/branch.rs:+3:9: +3:10
- scope 2 {
- debug y => _2; // in scope 2 at $DIR/branch.rs:+3:9: +3:10
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/branch.rs:+1:9: +1:10
- _1 = val() -> bb1; // scope 0 at $DIR/branch.rs:+1:13: +1:18
- // mir::Constant
- // + span: $DIR/branch.rs:14:13: 14:16
- // + literal: Const { ty: fn() -> i32 {val}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageLive(_2); // scope 1 at $DIR/branch.rs:+3:9: +3:10
- StorageLive(_3); // scope 1 at $DIR/branch.rs:+3:16: +3:22
- _3 = cond() -> bb2; // scope 1 at $DIR/branch.rs:+3:16: +3:22
- // mir::Constant
- // + span: $DIR/branch.rs:16:16: 16:20
- // + literal: Const { ty: fn() -> bool {cond}, val: Value(<ZST>) }
- }
-
- bb2: {
- switchInt(move _3) -> [0: bb4, otherwise: bb3]; // scope 1 at $DIR/branch.rs:+3:16: +3:22
- }
-
- bb3: {
- _2 = _1; // scope 1 at $DIR/branch.rs:+4:9: +4:10
- goto -> bb6; // scope 1 at $DIR/branch.rs:+3:13: +8:6
- }
-
- bb4: {
- StorageLive(_4); // scope 1 at $DIR/branch.rs:+6:9: +6:14
- _4 = val() -> bb5; // scope 1 at $DIR/branch.rs:+6:9: +6:14
- // mir::Constant
- // + span: $DIR/branch.rs:19:9: 19:12
- // + literal: Const { ty: fn() -> i32 {val}, val: Value(<ZST>) }
- }
-
- bb5: {
- StorageDead(_4); // scope 1 at $DIR/branch.rs:+6:14: +6:15
- _2 = _1; // scope 1 at $DIR/branch.rs:+7:9: +7:10
- goto -> bb6; // scope 1 at $DIR/branch.rs:+3:13: +8:6
- }
-
- bb6: {
- StorageDead(_3); // scope 1 at $DIR/branch.rs:+8:5: +8:6
- _0 = _2; // scope 2 at $DIR/branch.rs:+10:5: +10:6
- StorageDead(_2); // scope 1 at $DIR/branch.rs:+11:1: +11:2
- StorageDead(_1); // scope 0 at $DIR/branch.rs:+11:1: +11:2
- return; // scope 0 at $DIR/branch.rs:+11:2: +11:2
- }
- }
-
diff --git a/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-abort.diff
new file mode 100644
index 000000000..3334cdf92
--- /dev/null
+++ b/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-abort.diff
@@ -0,0 +1,56 @@
+- // MIR for `foo` before CopyProp
++ // MIR for `foo` after CopyProp
+
+ fn foo() -> i32 {
+ let mut _0: i32;
+ let _1: i32;
+ let mut _3: bool;
+ let _4: i32;
+ scope 1 {
+ debug x => _1;
+ let _2: i32;
+ scope 2 {
+ debug y => _2;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = val() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = cond() -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ switchInt(move _3) -> [0: bb4, otherwise: bb3];
+ }
+
+ bb3: {
+ _2 = _1;
+ goto -> bb6;
+ }
+
+ bb4: {
+ StorageLive(_4);
+ _4 = val() -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_4);
+ _2 = _1;
+ goto -> bb6;
+ }
+
+ bb6: {
+ StorageDead(_3);
+ _0 = _2;
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-unwind.diff
new file mode 100644
index 000000000..2f92d8818
--- /dev/null
+++ b/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-unwind.diff
@@ -0,0 +1,56 @@
+- // MIR for `foo` before CopyProp
++ // MIR for `foo` after CopyProp
+
+ fn foo() -> i32 {
+ let mut _0: i32;
+ let _1: i32;
+ let mut _3: bool;
+ let _4: i32;
+ scope 1 {
+ debug x => _1;
+ let _2: i32;
+ scope 2 {
+ debug y => _2;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = val() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = cond() -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ switchInt(move _3) -> [0: bb4, otherwise: bb3];
+ }
+
+ bb3: {
+ _2 = _1;
+ goto -> bb6;
+ }
+
+ bb4: {
+ StorageLive(_4);
+ _4 = val() -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_4);
+ _2 = _1;
+ goto -> bb6;
+ }
+
+ bb6: {
+ StorageDead(_3);
+ _0 = _2;
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/branch.rs b/tests/mir-opt/copy-prop/branch.rs
index 0a2e16946..278508957 100644
--- a/tests/mir-opt/copy-prop/branch.rs
+++ b/tests/mir-opt/copy-prop/branch.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that we bail out when there are multiple assignments to the same local.
// unit-test: CopyProp
fn val() -> i32 {
diff --git a/tests/mir-opt/copy-prop/calls.multiple_edges.CopyProp.diff b/tests/mir-opt/copy-prop/calls.multiple_edges.CopyProp.diff
new file mode 100644
index 000000000..4d56a8b25
--- /dev/null
+++ b/tests/mir-opt/copy-prop/calls.multiple_edges.CopyProp.diff
@@ -0,0 +1,21 @@
+- // MIR for `multiple_edges` before CopyProp
++ // MIR for `multiple_edges` after CopyProp
+
+ fn multiple_edges(_1: bool) -> u8 {
+ let mut _0: u8;
+ let mut _2: u8;
+
+ bb0: {
+ switchInt(_1) -> [1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _2 = dummy(const 13_u8) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ _0 = _2;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/calls.nrvo.CopyProp.diff b/tests/mir-opt/copy-prop/calls.nrvo.CopyProp.diff
new file mode 100644
index 000000000..b5d56909b
--- /dev/null
+++ b/tests/mir-opt/copy-prop/calls.nrvo.CopyProp.diff
@@ -0,0 +1,24 @@
+- // MIR for `nrvo` before CopyProp
++ // MIR for `nrvo` after CopyProp
+
+ fn nrvo() -> u8 {
+ let mut _0: u8;
+ let _1: u8;
+ scope 1 {
+- debug y => _1;
++ debug y => _0;
+ }
+
+ bb0: {
+- StorageLive(_1);
+- _1 = dummy(const 5_u8) -> [return: bb1, unwind continue];
++ _0 = dummy(const 5_u8) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- _0 = _1;
+- StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/calls.rs b/tests/mir-opt/copy-prop/calls.rs
new file mode 100644
index 000000000..bc6760707
--- /dev/null
+++ b/tests/mir-opt/copy-prop/calls.rs
@@ -0,0 +1,44 @@
+// skip-filecheck
+// Check that CopyProp does propagate return values of call terminators.
+// unit-test: CopyProp
+// needs-unwind
+
+#![feature(custom_mir, core_intrinsics)]
+use std::intrinsics::mir::*;
+
+#[inline(never)]
+fn dummy(x: u8) -> u8 {
+ x
+}
+
+// EMIT_MIR calls.nrvo.CopyProp.diff
+fn nrvo() -> u8 {
+ let y = dummy(5); // this should get NRVO
+ y
+}
+
+// EMIT_MIR calls.multiple_edges.CopyProp.diff
+#[custom_mir(dialect = "runtime", phase = "initial")]
+fn multiple_edges(t: bool) -> u8 {
+ mir! {
+ let x: u8;
+ {
+ match t { true => bbt, _ => ret }
+ }
+ bbt = {
+ Call(x = dummy(13), ret, UnwindContinue())
+ }
+ ret = {
+ // `x` is not assigned on the `bb0 -> ret` edge,
+ // so should not be marked as SSA for merging with `_0`.
+ RET = x;
+ Return()
+ }
+ }
+}
+
+fn main() {
+ // Make sure the function actually gets instantiated.
+ nrvo();
+ multiple_edges(false);
+}
diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.diff
deleted file mode 100644
index 1c7b6494d..000000000
--- a/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.diff
+++ /dev/null
@@ -1,23 +0,0 @@
-- // MIR for `arg_src` before CopyProp
-+ // MIR for `arg_src` after CopyProp
-
- fn arg_src(_1: i32) -> i32 {
- debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:12: +0:17
- let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:27: +0:30
- let _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
- scope 1 {
-- debug y => _2; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
-+ debug y => _0; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
- }
-
- bb0: {
-- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
-- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14
-+ _0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14
- _1 = const 123_i32; // scope 1 at $DIR/copy_propagation_arg.rs:+2:5: +2:12
-- _0 = _2; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6
-- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+4:1: +4:2
- return; // scope 0 at $DIR/copy_propagation_arg.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-abort.diff
new file mode 100644
index 000000000..70674a912
--- /dev/null
+++ b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-abort.diff
@@ -0,0 +1,23 @@
+- // MIR for `arg_src` before CopyProp
++ // MIR for `arg_src` after CopyProp
+
+ fn arg_src(_1: i32) -> i32 {
+ debug x => _1;
+ let mut _0: i32;
+ let _2: i32;
+ scope 1 {
+- debug y => _2;
++ debug y => _0;
+ }
+
+ bb0: {
+- StorageLive(_2);
+- _2 = _1;
++ _0 = _1;
+ _1 = const 123_i32;
+- _0 = _2;
+- StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-unwind.diff
new file mode 100644
index 000000000..70674a912
--- /dev/null
+++ b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-unwind.diff
@@ -0,0 +1,23 @@
+- // MIR for `arg_src` before CopyProp
++ // MIR for `arg_src` after CopyProp
+
+ fn arg_src(_1: i32) -> i32 {
+ debug x => _1;
+ let mut _0: i32;
+ let _2: i32;
+ scope 1 {
+- debug y => _2;
++ debug y => _0;
+ }
+
+ bb0: {
+- StorageLive(_2);
+- _2 = _1;
++ _0 = _1;
+ _1 = const 123_i32;
+- _0 = _2;
+- StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.diff
deleted file mode 100644
index 24bca3220..000000000
--- a/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.diff
+++ /dev/null
@@ -1,28 +0,0 @@
-- // MIR for `bar` before CopyProp
-+ // MIR for `bar` after CopyProp
-
- fn bar(_1: u8) -> () {
- debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13
- let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +0:19
- let _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13
- let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13
- StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12
- _3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12
- _2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13
- // mir::Constant
- // + span: $DIR/copy_propagation_arg.rs:17:5: 17:10
- // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+1:12: +1:13
- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14
- _1 = const 5_u8; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10
- _0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +3:2
- return; // scope 0 at $DIR/copy_propagation_arg.rs:+3:2: +3:2
- }
- }
-
diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-abort.diff
new file mode 100644
index 000000000..9ec014e2b
--- /dev/null
+++ b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-abort.diff
@@ -0,0 +1,25 @@
+- // MIR for `bar` before CopyProp
++ // MIR for `bar` after CopyProp
+
+ fn bar(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: u8;
+ let mut _3: u8;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _2 = dummy(move _3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ _1 = const 5_u8;
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-unwind.diff
new file mode 100644
index 000000000..ef9c343a2
--- /dev/null
+++ b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-unwind.diff
@@ -0,0 +1,25 @@
+- // MIR for `bar` before CopyProp
++ // MIR for `bar` after CopyProp
+
+ fn bar(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: u8;
+ let mut _3: u8;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _2 = dummy(move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ _1 = const 5_u8;
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.diff
deleted file mode 100644
index 7ab6ebb7d..000000000
--- a/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.diff
+++ /dev/null
@@ -1,18 +0,0 @@
-- // MIR for `baz` before CopyProp
-+ // MIR for `baz` after CopyProp
-
- fn baz(_1: i32) -> i32 {
- debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13
- let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:23: +0:26
- let mut _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
- _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10
- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
- _0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+3:5: +3:6
- return; // scope 0 at $DIR/copy_propagation_arg.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-abort.diff
new file mode 100644
index 000000000..71facf91d
--- /dev/null
+++ b/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-abort.diff
@@ -0,0 +1,18 @@
+- // MIR for `baz` before CopyProp
++ // MIR for `baz` after CopyProp
+
+ fn baz(_1: i32) -> i32 {
+ debug x => _1;
+ let mut _0: i32;
+ let mut _2: i32;
+
+ bb0: {
+ StorageLive(_2);
+ _2 = _1;
+ _1 = move _2;
+ StorageDead(_2);
+ _0 = _1;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-unwind.diff
new file mode 100644
index 000000000..71facf91d
--- /dev/null
+++ b/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-unwind.diff
@@ -0,0 +1,18 @@
+- // MIR for `baz` before CopyProp
++ // MIR for `baz` after CopyProp
+
+ fn baz(_1: i32) -> i32 {
+ debug x => _1;
+ let mut _0: i32;
+ let mut _2: i32;
+
+ bb0: {
+ StorageLive(_2);
+ _2 = _1;
+ _1 = move _2;
+ StorageDead(_2);
+ _0 = _1;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.diff
deleted file mode 100644
index 87708f340..000000000
--- a/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.diff
+++ /dev/null
@@ -1,28 +0,0 @@
-- // MIR for `foo` before CopyProp
-+ // MIR for `foo` after CopyProp
-
- fn foo(_1: u8) -> () {
- debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13
- let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +0:19
- let mut _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17
- let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17
- StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16
- _3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16
- _2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17
- // mir::Constant
- // + span: $DIR/copy_propagation_arg.rs:12:9: 12:14
- // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17
- _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:17
- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17
- _0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +3:2
- return; // scope 0 at $DIR/copy_propagation_arg.rs:+3:2: +3:2
- }
- }
-
diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-abort.diff
new file mode 100644
index 000000000..81b73e187
--- /dev/null
+++ b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-abort.diff
@@ -0,0 +1,25 @@
+- // MIR for `foo` before CopyProp
++ // MIR for `foo` after CopyProp
+
+ fn foo(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let mut _2: u8;
+ let mut _3: u8;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _2 = dummy(move _3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ _1 = move _2;
+ StorageDead(_2);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-unwind.diff
new file mode 100644
index 000000000..769089e16
--- /dev/null
+++ b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-unwind.diff
@@ -0,0 +1,25 @@
+- // MIR for `foo` before CopyProp
++ // MIR for `foo` after CopyProp
+
+ fn foo(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let mut _2: u8;
+ let mut _3: u8;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _2 = dummy(move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ _1 = move _2;
+ StorageDead(_2);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.rs b/tests/mir-opt/copy-prop/copy_propagation_arg.rs
index 1b65dcb01..83bbefe09 100644
--- a/tests/mir-opt/copy-prop/copy_propagation_arg.rs
+++ b/tests/mir-opt/copy-prop/copy_propagation_arg.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that CopyProp does not propagate an assignment to a function argument
// (doing so can break usages of the original argument value)
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.diff b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.diff
deleted file mode 100644
index 160f47bdd..000000000
--- a/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.diff
+++ /dev/null
@@ -1,31 +0,0 @@
-- // MIR for `f` before CopyProp
-+ // MIR for `f` after CopyProp
-
- fn f(_1: NotCopy) -> () {
- let mut _0: (); // return place in scope 0 at $DIR/custom_move_arg.rs:+0:19: +0:19
- let mut _2: NotCopy; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _3: NotCopy; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-
- bb0: {
-- _2 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-- _0 = opaque::<NotCopy>(move _1) -> bb1; // scope 0 at $DIR/custom_move_arg.rs:+3:9: +3:41
-+ _0 = opaque::<NotCopy>(_1) -> bb1; // scope 0 at $DIR/custom_move_arg.rs:+3:9: +3:41
- // mir::Constant
- // + span: $DIR/custom_move_arg.rs:16:24: 16:30
- // + literal: Const { ty: fn(NotCopy) {opaque::<NotCopy>}, val: Value(<ZST>) }
- }
-
- bb1: {
-- _3 = move _2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-- _0 = opaque::<NotCopy>(_3) -> bb2; // scope 0 at $DIR/custom_move_arg.rs:+7:9: +7:35
-+ _0 = opaque::<NotCopy>(_1) -> bb2; // scope 0 at $DIR/custom_move_arg.rs:+7:9: +7:35
- // mir::Constant
- // + span: $DIR/custom_move_arg.rs:20:24: 20:30
- // + literal: Const { ty: fn(NotCopy) {opaque::<NotCopy>}, val: Value(<ZST>) }
- }
-
- bb2: {
- return; // scope 0 at $DIR/custom_move_arg.rs:+10:9: +10:17
- }
- }
-
diff --git a/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-abort.diff
new file mode 100644
index 000000000..7ba853010
--- /dev/null
+++ b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-abort.diff
@@ -0,0 +1,25 @@
+- // MIR for `f` before CopyProp
++ // MIR for `f` after CopyProp
+
+ fn f(_1: NotCopy) -> () {
+ let mut _0: ();
+ let mut _2: NotCopy;
+ let mut _3: NotCopy;
+
+ bb0: {
+- _2 = _1;
+- _0 = opaque::<NotCopy>(move _1) -> [return: bb1, unwind unreachable];
++ _0 = opaque::<NotCopy>(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _3 = move _2;
+- _0 = opaque::<NotCopy>(_3) -> [return: bb2, unwind unreachable];
++ _0 = opaque::<NotCopy>(_1) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-unwind.diff
new file mode 100644
index 000000000..eb40183c1
--- /dev/null
+++ b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-unwind.diff
@@ -0,0 +1,25 @@
+- // MIR for `f` before CopyProp
++ // MIR for `f` after CopyProp
+
+ fn f(_1: NotCopy) -> () {
+ let mut _0: ();
+ let mut _2: NotCopy;
+ let mut _3: NotCopy;
+
+ bb0: {
+- _2 = _1;
+- _0 = opaque::<NotCopy>(move _1) -> [return: bb1, unwind continue];
++ _0 = opaque::<NotCopy>(_1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- _3 = move _2;
+- _0 = opaque::<NotCopy>(_3) -> [return: bb2, unwind continue];
++ _0 = opaque::<NotCopy>(_1) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/custom_move_arg.rs b/tests/mir-opt/copy-prop/custom_move_arg.rs
index 29c368df8..8593d9fa9 100644
--- a/tests/mir-opt/copy-prop/custom_move_arg.rs
+++ b/tests/mir-opt/copy-prop/custom_move_arg.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: CopyProp
#![feature(custom_mir, core_intrinsics)]
@@ -13,11 +14,11 @@ struct NotCopy(bool);
fn f(_1: NotCopy) {
mir!({
let _2 = _1;
- Call(RET, bb1, opaque(Move(_1)))
+ Call(RET = opaque(Move(_1)), bb1, UnwindContinue())
}
bb1 = {
let _3 = Move(_2);
- Call(RET, bb2, opaque(_3))
+ Call(RET = opaque(_3), bb2, UnwindContinue())
}
bb2 = {
Return()
diff --git a/tests/mir-opt/copy-prop/cycle.main.CopyProp.diff b/tests/mir-opt/copy-prop/cycle.main.CopyProp.diff
deleted file mode 100644
index 23d92ed1a..000000000
--- a/tests/mir-opt/copy-prop/cycle.main.CopyProp.diff
+++ /dev/null
@@ -1,60 +0,0 @@
-- // MIR for `main` before CopyProp
-+ // MIR for `main` after CopyProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:11: +0:11
- let mut _1: i32; // in scope 0 at $DIR/cycle.rs:+1:9: +1:14
- let mut _4: i32; // in scope 0 at $DIR/cycle.rs:+4:9: +4:10
- let _5: (); // in scope 0 at $DIR/cycle.rs:+6:5: +6:12
- let mut _6: i32; // in scope 0 at $DIR/cycle.rs:+6:10: +6:11
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/cycle.rs:+1:9: +1:14
- let _2: i32; // in scope 1 at $DIR/cycle.rs:+2:9: +2:10
- scope 2 {
- debug y => _2; // in scope 2 at $DIR/cycle.rs:+2:9: +2:10
- let _3: i32; // in scope 2 at $DIR/cycle.rs:+3:9: +3:10
- scope 3 {
-- debug z => _3; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10
-+ debug z => _2; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/cycle.rs:+1:9: +1:14
- _1 = val() -> bb1; // scope 0 at $DIR/cycle.rs:+1:17: +1:22
- // mir::Constant
- // + span: $DIR/cycle.rs:10:17: 10:20
- // + literal: Const { ty: fn() -> i32 {val}, val: Value(<ZST>) }
- }
-
- bb1: {
-- StorageLive(_2); // scope 1 at $DIR/cycle.rs:+2:9: +2:10
- _2 = _1; // scope 1 at $DIR/cycle.rs:+2:13: +2:14
-- StorageLive(_3); // scope 2 at $DIR/cycle.rs:+3:9: +3:10
-- _3 = _2; // scope 2 at $DIR/cycle.rs:+3:13: +3:14
-- StorageLive(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10
-- _4 = _3; // scope 3 at $DIR/cycle.rs:+4:9: +4:10
-- _1 = move _4; // scope 3 at $DIR/cycle.rs:+4:5: +4:10
-- StorageDead(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10
-+ _1 = _2; // scope 3 at $DIR/cycle.rs:+4:5: +4:10
- StorageLive(_5); // scope 3 at $DIR/cycle.rs:+6:5: +6:12
- StorageLive(_6); // scope 3 at $DIR/cycle.rs:+6:10: +6:11
- _6 = _1; // scope 3 at $DIR/cycle.rs:+6:10: +6:11
- _5 = std::mem::drop::<i32>(move _6) -> bb2; // scope 3 at $DIR/cycle.rs:+6:5: +6:12
- // mir::Constant
- // + span: $DIR/cycle.rs:15:5: 15:9
- // + literal: Const { ty: fn(i32) {std::mem::drop::<i32>}, val: Value(<ZST>) }
- }
-
- bb2: {
- StorageDead(_6); // scope 3 at $DIR/cycle.rs:+6:11: +6:12
- StorageDead(_5); // scope 3 at $DIR/cycle.rs:+6:12: +6:13
- _0 = const (); // scope 0 at $DIR/cycle.rs:+0:11: +7:2
-- StorageDead(_3); // scope 2 at $DIR/cycle.rs:+7:1: +7:2
-- StorageDead(_2); // scope 1 at $DIR/cycle.rs:+7:1: +7:2
- StorageDead(_1); // scope 0 at $DIR/cycle.rs:+7:1: +7:2
- return; // scope 0 at $DIR/cycle.rs:+7:2: +7:2
- }
- }
-
diff --git a/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-abort.diff
new file mode 100644
index 000000000..8f97c4e43
--- /dev/null
+++ b/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-abort.diff
@@ -0,0 +1,54 @@
+- // MIR for `main` before CopyProp
++ // MIR for `main` after CopyProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+ let mut _4: i32;
+ let _5: ();
+ let mut _6: i32;
+ scope 1 {
+ debug x => _1;
+ let _2: i32;
+ scope 2 {
+ debug y => _2;
+ let _3: i32;
+ scope 3 {
+- debug z => _3;
++ debug z => _2;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = val() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- StorageLive(_2);
+ _2 = _1;
+- StorageLive(_3);
+- _3 = _2;
+- StorageLive(_4);
+- _4 = _3;
+- _1 = move _4;
+- StorageDead(_4);
++ _1 = _2;
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = _1;
+ _5 = std::mem::drop::<i32>(move _6) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+ _0 = const ();
+- StorageDead(_3);
+- StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-unwind.diff
new file mode 100644
index 000000000..e343b7892
--- /dev/null
+++ b/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-unwind.diff
@@ -0,0 +1,54 @@
+- // MIR for `main` before CopyProp
++ // MIR for `main` after CopyProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+ let mut _4: i32;
+ let _5: ();
+ let mut _6: i32;
+ scope 1 {
+ debug x => _1;
+ let _2: i32;
+ scope 2 {
+ debug y => _2;
+ let _3: i32;
+ scope 3 {
+- debug z => _3;
++ debug z => _2;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = val() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- StorageLive(_2);
+ _2 = _1;
+- StorageLive(_3);
+- _3 = _2;
+- StorageLive(_4);
+- _4 = _3;
+- _1 = move _4;
+- StorageDead(_4);
++ _1 = _2;
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = _1;
+ _5 = std::mem::drop::<i32>(move _6) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+ _0 = const ();
+- StorageDead(_3);
+- StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/cycle.rs b/tests/mir-opt/copy-prop/cycle.rs
index da70f6bec..58e049fde 100644
--- a/tests/mir-opt/copy-prop/cycle.rs
+++ b/tests/mir-opt/copy-prop/cycle.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that cyclic assignments don't hang CopyProp, and result in reasonable code.
// unit-test: CopyProp
fn val() -> i32 {
diff --git a/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.mir b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.mir
deleted file mode 100644
index c56418d88..000000000
--- a/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.mir
+++ /dev/null
@@ -1,29 +0,0 @@
-// MIR for `f` after CopyProp
-
-fn f(_1: usize) -> usize {
- debug a => _1; // in scope 0 at $DIR/dead_stores_79191.rs:+0:6: +0:11
- let mut _0: usize; // return place in scope 0 at $DIR/dead_stores_79191.rs:+0:23: +0:28
- let _2: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+1:9: +1:10
- let mut _3: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+3:9: +3:10
- let mut _4: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+4:8: +4:9
- scope 1 {
- debug b => _2; // in scope 1 at $DIR/dead_stores_79191.rs:+1:9: +1:10
- }
-
- bb0: {
- _2 = _1; // scope 0 at $DIR/dead_stores_79191.rs:+1:13: +1:14
- _1 = const 5_usize; // scope 1 at $DIR/dead_stores_79191.rs:+2:5: +2:10
- _1 = _2; // scope 1 at $DIR/dead_stores_79191.rs:+3:5: +3:10
- StorageLive(_4); // scope 1 at $DIR/dead_stores_79191.rs:+4:8: +4:9
- _4 = _1; // scope 1 at $DIR/dead_stores_79191.rs:+4:8: +4:9
- _0 = id::<usize>(move _4) -> bb1; // scope 1 at $DIR/dead_stores_79191.rs:+4:5: +4:10
- // mir::Constant
- // + span: $DIR/dead_stores_79191.rs:13:5: 13:7
- // + literal: Const { ty: fn(usize) -> usize {id::<usize>}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_4); // scope 1 at $DIR/dead_stores_79191.rs:+4:9: +4:10
- return; // scope 0 at $DIR/dead_stores_79191.rs:+5:2: +5:2
- }
-}
diff --git a/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-abort.mir b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-abort.mir
new file mode 100644
index 000000000..02b88d140
--- /dev/null
+++ b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-abort.mir
@@ -0,0 +1,26 @@
+// MIR for `f` after CopyProp
+
+fn f(_1: usize) -> usize {
+ debug a => _1;
+ let mut _0: usize;
+ let _2: usize;
+ let mut _3: usize;
+ let mut _4: usize;
+ scope 1 {
+ debug b => _2;
+ }
+
+ bb0: {
+ _2 = _1;
+ _1 = const 5_usize;
+ _1 = _2;
+ StorageLive(_4);
+ _4 = _1;
+ _0 = id::<usize>(move _4) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ return;
+ }
+}
diff --git a/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-unwind.mir b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-unwind.mir
new file mode 100644
index 000000000..f8c285ff3
--- /dev/null
+++ b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-unwind.mir
@@ -0,0 +1,26 @@
+// MIR for `f` after CopyProp
+
+fn f(_1: usize) -> usize {
+ debug a => _1;
+ let mut _0: usize;
+ let _2: usize;
+ let mut _3: usize;
+ let mut _4: usize;
+ scope 1 {
+ debug b => _2;
+ }
+
+ bb0: {
+ _2 = _1;
+ _1 = const 5_usize;
+ _1 = _2;
+ StorageLive(_4);
+ _4 = _1;
+ _0 = id::<usize>(move _4) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ return;
+ }
+}
diff --git a/tests/mir-opt/copy-prop/dead_stores_79191.rs b/tests/mir-opt/copy-prop/dead_stores_79191.rs
index 84453c55e..81306ab61 100644
--- a/tests/mir-opt/copy-prop/dead_stores_79191.rs
+++ b/tests/mir-opt/copy-prop/dead_stores_79191.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: CopyProp
fn id<T>(x: T) -> T {
diff --git a/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.mir b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.mir
deleted file mode 100644
index f35542173..000000000
--- a/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.mir
+++ /dev/null
@@ -1,29 +0,0 @@
-// MIR for `f` after CopyProp
-
-fn f(_1: usize) -> usize {
- debug a => _1; // in scope 0 at $DIR/dead_stores_better.rs:+0:10: +0:15
- let mut _0: usize; // return place in scope 0 at $DIR/dead_stores_better.rs:+0:27: +0:32
- let _2: usize; // in scope 0 at $DIR/dead_stores_better.rs:+1:9: +1:10
- let mut _3: usize; // in scope 0 at $DIR/dead_stores_better.rs:+3:9: +3:10
- let mut _4: usize; // in scope 0 at $DIR/dead_stores_better.rs:+4:8: +4:9
- scope 1 {
- debug b => _2; // in scope 1 at $DIR/dead_stores_better.rs:+1:9: +1:10
- }
-
- bb0: {
- _2 = _1; // scope 0 at $DIR/dead_stores_better.rs:+1:13: +1:14
- _1 = const 5_usize; // scope 1 at $DIR/dead_stores_better.rs:+2:5: +2:10
- _1 = _2; // scope 1 at $DIR/dead_stores_better.rs:+3:5: +3:10
- StorageLive(_4); // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9
- _4 = _1; // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9
- _0 = id::<usize>(move _4) -> bb1; // scope 1 at $DIR/dead_stores_better.rs:+4:5: +4:10
- // mir::Constant
- // + span: $DIR/dead_stores_better.rs:17:5: 17:7
- // + literal: Const { ty: fn(usize) -> usize {id::<usize>}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_4); // scope 1 at $DIR/dead_stores_better.rs:+4:9: +4:10
- return; // scope 0 at $DIR/dead_stores_better.rs:+5:2: +5:2
- }
-}
diff --git a/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-abort.mir b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-abort.mir
new file mode 100644
index 000000000..02b88d140
--- /dev/null
+++ b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-abort.mir
@@ -0,0 +1,26 @@
+// MIR for `f` after CopyProp
+
+fn f(_1: usize) -> usize {
+ debug a => _1;
+ let mut _0: usize;
+ let _2: usize;
+ let mut _3: usize;
+ let mut _4: usize;
+ scope 1 {
+ debug b => _2;
+ }
+
+ bb0: {
+ _2 = _1;
+ _1 = const 5_usize;
+ _1 = _2;
+ StorageLive(_4);
+ _4 = _1;
+ _0 = id::<usize>(move _4) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ return;
+ }
+}
diff --git a/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-unwind.mir b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-unwind.mir
new file mode 100644
index 000000000..f8c285ff3
--- /dev/null
+++ b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-unwind.mir
@@ -0,0 +1,26 @@
+// MIR for `f` after CopyProp
+
+fn f(_1: usize) -> usize {
+ debug a => _1;
+ let mut _0: usize;
+ let _2: usize;
+ let mut _3: usize;
+ let mut _4: usize;
+ scope 1 {
+ debug b => _2;
+ }
+
+ bb0: {
+ _2 = _1;
+ _1 = const 5_usize;
+ _1 = _2;
+ StorageLive(_4);
+ _4 = _1;
+ _0 = id::<usize>(move _4) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ return;
+ }
+}
diff --git a/tests/mir-opt/copy-prop/dead_stores_better.rs b/tests/mir-opt/copy-prop/dead_stores_better.rs
index 87b916fd3..7addf6af2 100644
--- a/tests/mir-opt/copy-prop/dead_stores_better.rs
+++ b/tests/mir-opt/copy-prop/dead_stores_better.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// This is a copy of the `dead_stores_79191` test, except that we turn on DSE. This demonstrates
// that that pass enables this one to do more optimizations.
diff --git a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.diff b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.diff
deleted file mode 100644
index e09ccb831..000000000
--- a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.diff
+++ /dev/null
@@ -1,138 +0,0 @@
-- // MIR for `main` before CopyProp
-+ // MIR for `main` after CopyProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/issue_107511.rs:+0:11: +0:11
- let mut _1: i32; // in scope 0 at $DIR/issue_107511.rs:+1:9: +1:16
- let mut _3: std::ops::Range<usize>; // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24
- let mut _4: std::ops::Range<usize>; // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24
- let mut _5: usize; // in scope 0 at $DIR/issue_107511.rs:+6:17: +6:24
- let mut _6: &[i32]; // in scope 0 at $DIR/issue_107511.rs:+6:17: +6:24
- let mut _7: &[i32; 4]; // in scope 0 at $DIR/issue_107511.rs:+6:17: +6:24
- let mut _9: (); // in scope 0 at $DIR/issue_107511.rs:+0:1: +9:2
- let _10: (); // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24
- let mut _11: std::option::Option<usize>; // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24
- let mut _12: &mut std::ops::Range<usize>; // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24
- let mut _13: &mut std::ops::Range<usize>; // in scope 0 at $DIR/issue_107511.rs:+6:14: +6:24
- let mut _14: isize; // in scope 0 at $DIR/issue_107511.rs:+6:5: +8:6
- let mut _15: !; // in scope 0 at $DIR/issue_107511.rs:+6:5: +8:6
- let mut _17: i32; // in scope 0 at $DIR/issue_107511.rs:+7:16: +7:20
- let _18: usize; // in scope 0 at $DIR/issue_107511.rs:+7:18: +7:19
- let mut _19: usize; // in scope 0 at $DIR/issue_107511.rs:+7:16: +7:20
- let mut _20: bool; // in scope 0 at $DIR/issue_107511.rs:+7:16: +7:20
- scope 1 {
- debug sum => _1; // in scope 1 at $DIR/issue_107511.rs:+1:9: +1:16
- let _2: [i32; 4]; // in scope 1 at $DIR/issue_107511.rs:+2:9: +2:10
- scope 2 {
- debug a => _2; // in scope 2 at $DIR/issue_107511.rs:+2:9: +2:10
- let mut _8: std::ops::Range<usize>; // in scope 2 at $DIR/issue_107511.rs:+6:14: +6:24
- scope 3 {
- debug iter => _8; // in scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
- let _16: usize; // in scope 3 at $DIR/issue_107511.rs:+6:9: +6:10
- scope 4 {
- debug i => _16; // in scope 4 at $DIR/issue_107511.rs:+6:9: +6:10
- }
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/issue_107511.rs:+1:9: +1:16
- _1 = const 0_i32; // scope 0 at $DIR/issue_107511.rs:+1:19: +1:20
- StorageLive(_2); // scope 1 at $DIR/issue_107511.rs:+2:9: +2:10
- _2 = [const 0_i32, const 10_i32, const 20_i32, const 30_i32]; // scope 1 at $DIR/issue_107511.rs:+2:13: +2:28
- StorageLive(_3); // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24
- StorageLive(_4); // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24
- StorageLive(_5); // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24
- StorageLive(_6); // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24
- StorageLive(_7); // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24
- _7 = &_2; // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24
- _6 = move _7 as &[i32] (Pointer(Unsize)); // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24
- StorageDead(_7); // scope 2 at $DIR/issue_107511.rs:+6:17: +6:18
- _5 = core::slice::<impl [i32]>::len(move _6) -> bb1; // scope 2 at $DIR/issue_107511.rs:+6:17: +6:24
- // mir::Constant
- // + span: $DIR/issue_107511.rs:11:19: 11:22
- // + literal: Const { ty: for<'a> fn(&'a [i32]) -> usize {core::slice::<impl [i32]>::len}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_6); // scope 2 at $DIR/issue_107511.rs:+6:23: +6:24
- _4 = std::ops::Range::<usize> { start: const 0_usize, end: move _5 }; // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24
- StorageDead(_5); // scope 2 at $DIR/issue_107511.rs:+6:23: +6:24
- _3 = <std::ops::Range<usize> as IntoIterator>::into_iter(move _4) -> bb2; // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24
- // mir::Constant
- // + span: $DIR/issue_107511.rs:11:14: 11:24
- // + literal: Const { ty: fn(std::ops::Range<usize>) -> <std::ops::Range<usize> as IntoIterator>::IntoIter {<std::ops::Range<usize> as IntoIterator>::into_iter}, val: Value(<ZST>) }
- }
-
- bb2: {
- StorageDead(_4); // scope 2 at $DIR/issue_107511.rs:+6:23: +6:24
- StorageLive(_8); // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24
- _8 = move _3; // scope 2 at $DIR/issue_107511.rs:+6:14: +6:24
- goto -> bb3; // scope 3 at $DIR/issue_107511.rs:+6:5: +8:6
- }
-
- bb3: {
-- StorageLive(_10); // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
- StorageLive(_11); // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
- StorageLive(_12); // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
- StorageLive(_13); // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
- _13 = &mut _8; // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
- _12 = &mut (*_13); // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
- _11 = <std::ops::Range<usize> as Iterator>::next(move _12) -> bb4; // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
- // mir::Constant
- // + span: $DIR/issue_107511.rs:11:14: 11:24
- // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range<usize>) -> Option<<std::ops::Range<usize> as Iterator>::Item> {<std::ops::Range<usize> as Iterator>::next}, val: Value(<ZST>) }
- }
-
- bb4: {
- StorageDead(_12); // scope 3 at $DIR/issue_107511.rs:+6:23: +6:24
- _14 = discriminant(_11); // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
- switchInt(move _14) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
- }
-
- bb5: {
-- StorageLive(_16); // scope 3 at $DIR/issue_107511.rs:+6:9: +6:10
- _16 = ((_11 as Some).0: usize); // scope 3 at $DIR/issue_107511.rs:+6:9: +6:10
- StorageLive(_17); // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
-- StorageLive(_18); // scope 4 at $DIR/issue_107511.rs:+7:18: +7:19
-- _18 = _16; // scope 4 at $DIR/issue_107511.rs:+7:18: +7:19
- _19 = Len(_2); // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
-- _20 = Lt(_18, _19); // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
-- assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _18) -> bb8; // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
-+ _20 = Lt(_16, _19); // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
-+ assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> bb8; // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
- }
-
- bb6: {
- unreachable; // scope 3 at $DIR/issue_107511.rs:+6:14: +6:24
- }
-
- bb7: {
- _0 = const (); // scope 3 at $DIR/issue_107511.rs:+6:5: +8:6
- StorageDead(_13); // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6
- StorageDead(_11); // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6
-- StorageDead(_10); // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6
- StorageDead(_8); // scope 2 at $DIR/issue_107511.rs:+8:5: +8:6
- StorageDead(_3); // scope 2 at $DIR/issue_107511.rs:+8:5: +8:6
- StorageDead(_2); // scope 1 at $DIR/issue_107511.rs:+9:1: +9:2
- StorageDead(_1); // scope 0 at $DIR/issue_107511.rs:+9:1: +9:2
- return; // scope 0 at $DIR/issue_107511.rs:+9:2: +9:2
- }
-
- bb8: {
-- _17 = _2[_18]; // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
-+ _17 = _2[_16]; // scope 4 at $DIR/issue_107511.rs:+7:16: +7:20
- _1 = Add(_1, move _17); // scope 4 at $DIR/issue_107511.rs:+7:9: +7:20
- StorageDead(_17); // scope 4 at $DIR/issue_107511.rs:+7:19: +7:20
-- StorageDead(_18); // scope 4 at $DIR/issue_107511.rs:+7:20: +7:21
-- _10 = const (); // scope 4 at $DIR/issue_107511.rs:+6:25: +8:6
-- StorageDead(_16); // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6
- StorageDead(_13); // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6
- StorageDead(_11); // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6
-- StorageDead(_10); // scope 3 at $DIR/issue_107511.rs:+8:5: +8:6
-- _9 = const (); // scope 3 at $DIR/issue_107511.rs:+6:5: +8:6
- goto -> bb3; // scope 3 at $DIR/issue_107511.rs:+6:5: +8:6
- }
- }
-
diff --git a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff
new file mode 100644
index 000000000..a802d0256
--- /dev/null
+++ b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff
@@ -0,0 +1,129 @@
+- // MIR for `main` before CopyProp
++ // MIR for `main` after CopyProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+ let mut _3: std::ops::Range<usize>;
+ let mut _4: std::ops::Range<usize>;
+ let mut _5: usize;
+ let mut _6: &[i32];
+ let mut _7: &[i32; 4];
+ let mut _9: ();
+ let _10: ();
+ let mut _11: std::option::Option<usize>;
+ let mut _12: &mut std::ops::Range<usize>;
+ let mut _13: &mut std::ops::Range<usize>;
+ let mut _14: isize;
+ let mut _15: !;
+ let mut _17: i32;
+ let _18: usize;
+ let mut _19: usize;
+ let mut _20: bool;
+ scope 1 {
+ debug sum => _1;
+ let _2: [i32; 4];
+ scope 2 {
+ debug a => _2;
+ let mut _8: std::ops::Range<usize>;
+ scope 3 {
+ debug iter => _8;
+ let _16: usize;
+ scope 4 {
+ debug i => _16;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 0_i32;
+ StorageLive(_2);
+ _2 = [const 0_i32, const 10_i32, const 20_i32, const 30_i32];
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &_2;
+ _6 = move _7 as &[i32] (PointerCoercion(Unsize));
+ StorageDead(_7);
+ _5 = core::slice::<impl [i32]>::len(move _6) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_6);
+ _4 = std::ops::Range::<usize> { start: const 0_usize, end: move _5 };
+ StorageDead(_5);
+ _3 = <std::ops::Range<usize> as IntoIterator>::into_iter(move _4) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_8);
+ _8 = move _3;
+ goto -> bb3;
+ }
+
+ bb3: {
+- StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = &mut _8;
+ _12 = &mut (*_13);
+ _11 = <std::ops::Range<usize> as Iterator>::next(move _12) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_12);
+ _14 = discriminant(_11);
+ switchInt(move _14) -> [0: bb7, 1: bb5, otherwise: bb6];
+ }
+
+ bb5: {
+- StorageLive(_16);
+ _16 = ((_11 as Some).0: usize);
+ StorageLive(_17);
+- StorageLive(_18);
+- _18 = _16;
+ _19 = Len(_2);
+- _20 = Lt(_18, _19);
+- assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _18) -> [success: bb8, unwind unreachable];
++ _20 = Lt(_16, _19);
++ assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> [success: bb8, unwind unreachable];
+ }
+
+ bb6: {
+ unreachable;
+ }
+
+ bb7: {
+ _0 = const ();
+ StorageDead(_13);
+ StorageDead(_11);
+- StorageDead(_10);
+ StorageDead(_8);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+
+ bb8: {
+- _17 = _2[_18];
++ _17 = _2[_16];
+ _1 = Add(_1, move _17);
+ StorageDead(_17);
+- StorageDead(_18);
+- _10 = const ();
+- StorageDead(_16);
+ StorageDead(_13);
+ StorageDead(_11);
+- StorageDead(_10);
+- _9 = const ();
+ goto -> bb3;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-unwind.diff
new file mode 100644
index 000000000..35f852098
--- /dev/null
+++ b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-unwind.diff
@@ -0,0 +1,129 @@
+- // MIR for `main` before CopyProp
++ // MIR for `main` after CopyProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+ let mut _3: std::ops::Range<usize>;
+ let mut _4: std::ops::Range<usize>;
+ let mut _5: usize;
+ let mut _6: &[i32];
+ let mut _7: &[i32; 4];
+ let mut _9: ();
+ let _10: ();
+ let mut _11: std::option::Option<usize>;
+ let mut _12: &mut std::ops::Range<usize>;
+ let mut _13: &mut std::ops::Range<usize>;
+ let mut _14: isize;
+ let mut _15: !;
+ let mut _17: i32;
+ let _18: usize;
+ let mut _19: usize;
+ let mut _20: bool;
+ scope 1 {
+ debug sum => _1;
+ let _2: [i32; 4];
+ scope 2 {
+ debug a => _2;
+ let mut _8: std::ops::Range<usize>;
+ scope 3 {
+ debug iter => _8;
+ let _16: usize;
+ scope 4 {
+ debug i => _16;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 0_i32;
+ StorageLive(_2);
+ _2 = [const 0_i32, const 10_i32, const 20_i32, const 30_i32];
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &_2;
+ _6 = move _7 as &[i32] (PointerCoercion(Unsize));
+ StorageDead(_7);
+ _5 = core::slice::<impl [i32]>::len(move _6) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_6);
+ _4 = std::ops::Range::<usize> { start: const 0_usize, end: move _5 };
+ StorageDead(_5);
+ _3 = <std::ops::Range<usize> as IntoIterator>::into_iter(move _4) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_8);
+ _8 = move _3;
+ goto -> bb3;
+ }
+
+ bb3: {
+- StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = &mut _8;
+ _12 = &mut (*_13);
+ _11 = <std::ops::Range<usize> as Iterator>::next(move _12) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_12);
+ _14 = discriminant(_11);
+ switchInt(move _14) -> [0: bb7, 1: bb5, otherwise: bb6];
+ }
+
+ bb5: {
+- StorageLive(_16);
+ _16 = ((_11 as Some).0: usize);
+ StorageLive(_17);
+- StorageLive(_18);
+- _18 = _16;
+ _19 = Len(_2);
+- _20 = Lt(_18, _19);
+- assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _18) -> [success: bb8, unwind continue];
++ _20 = Lt(_16, _19);
++ assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> [success: bb8, unwind continue];
+ }
+
+ bb6: {
+ unreachable;
+ }
+
+ bb7: {
+ _0 = const ();
+ StorageDead(_13);
+ StorageDead(_11);
+- StorageDead(_10);
+ StorageDead(_8);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+
+ bb8: {
+- _17 = _2[_18];
++ _17 = _2[_16];
+ _1 = Add(_1, move _17);
+ StorageDead(_17);
+- StorageDead(_18);
+- _10 = const ();
+- StorageDead(_16);
+ StorageDead(_13);
+ StorageDead(_11);
+- StorageDead(_10);
+- _9 = const ();
+ goto -> bb3;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/issue_107511.rs b/tests/mir-opt/copy-prop/issue_107511.rs
index 2b00ff155..53fd93662 100644
--- a/tests/mir-opt/copy-prop/issue_107511.rs
+++ b/tests/mir-opt/copy-prop/issue_107511.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: CopyProp
// EMIT_MIR issue_107511.main.CopyProp.diff
diff --git a/tests/mir-opt/copy-prop/move_arg.f.CopyProp.diff b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.diff
deleted file mode 100644
index 650bd66a7..000000000
--- a/tests/mir-opt/copy-prop/move_arg.f.CopyProp.diff
+++ /dev/null
@@ -1,40 +0,0 @@
-- // MIR for `f` before CopyProp
-+ // MIR for `f` after CopyProp
-
- fn f(_1: T) -> () {
- debug a => _1; // in scope 0 at $DIR/move_arg.rs:+0:19: +0:20
- let mut _0: (); // return place in scope 0 at $DIR/move_arg.rs:+0:25: +0:25
- let _2: T; // in scope 0 at $DIR/move_arg.rs:+1:9: +1:10
- let _3: (); // in scope 0 at $DIR/move_arg.rs:+2:5: +2:12
- let mut _4: T; // in scope 0 at $DIR/move_arg.rs:+2:7: +2:8
- let mut _5: T; // in scope 0 at $DIR/move_arg.rs:+2:10: +2:11
- scope 1 {
-- debug b => _2; // in scope 1 at $DIR/move_arg.rs:+1:9: +1:10
-+ debug b => _1; // in scope 1 at $DIR/move_arg.rs:+1:9: +1:10
- }
-
- bb0: {
-- StorageLive(_2); // scope 0 at $DIR/move_arg.rs:+1:9: +1:10
-- _2 = _1; // scope 0 at $DIR/move_arg.rs:+1:13: +1:14
- StorageLive(_3); // scope 1 at $DIR/move_arg.rs:+2:5: +2:12
-- StorageLive(_4); // scope 1 at $DIR/move_arg.rs:+2:7: +2:8
-- _4 = _1; // scope 1 at $DIR/move_arg.rs:+2:7: +2:8
-- StorageLive(_5); // scope 1 at $DIR/move_arg.rs:+2:10: +2:11
-- _5 = _2; // scope 1 at $DIR/move_arg.rs:+2:10: +2:11
-- _3 = g::<T>(move _4, move _5) -> bb1; // scope 1 at $DIR/move_arg.rs:+2:5: +2:12
-+ _3 = g::<T>(_1, _1) -> bb1; // scope 1 at $DIR/move_arg.rs:+2:5: +2:12
- // mir::Constant
- // + span: $DIR/move_arg.rs:8:5: 8:6
- // + literal: Const { ty: fn(T, T) {g::<T>}, val: Value(<ZST>) }
- }
-
- bb1: {
-- StorageDead(_5); // scope 1 at $DIR/move_arg.rs:+2:11: +2:12
-- StorageDead(_4); // scope 1 at $DIR/move_arg.rs:+2:11: +2:12
- StorageDead(_3); // scope 1 at $DIR/move_arg.rs:+2:12: +2:13
- _0 = const (); // scope 0 at $DIR/move_arg.rs:+0:25: +3:2
-- StorageDead(_2); // scope 0 at $DIR/move_arg.rs:+3:1: +3:2
- return; // scope 0 at $DIR/move_arg.rs:+3:2: +3:2
- }
- }
-
diff --git a/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-abort.diff
new file mode 100644
index 000000000..cf04f213e
--- /dev/null
+++ b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-abort.diff
@@ -0,0 +1,37 @@
+- // MIR for `f` before CopyProp
++ // MIR for `f` after CopyProp
+
+ fn f(_1: T) -> () {
+ debug a => _1;
+ let mut _0: ();
+ let _2: T;
+ let _3: ();
+ let mut _4: T;
+ let mut _5: T;
+ scope 1 {
+- debug b => _2;
++ debug b => _1;
+ }
+
+ bb0: {
+- StorageLive(_2);
+- _2 = _1;
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- StorageLive(_5);
+- _5 = _2;
+- _3 = g::<T>(move _4, move _5) -> [return: bb1, unwind unreachable];
++ _3 = g::<T>(_1, _1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- StorageDead(_5);
+- StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+- StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-unwind.diff
new file mode 100644
index 000000000..0c6a3c6d5
--- /dev/null
+++ b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-unwind.diff
@@ -0,0 +1,37 @@
+- // MIR for `f` before CopyProp
++ // MIR for `f` after CopyProp
+
+ fn f(_1: T) -> () {
+ debug a => _1;
+ let mut _0: ();
+ let _2: T;
+ let _3: ();
+ let mut _4: T;
+ let mut _5: T;
+ scope 1 {
+- debug b => _2;
++ debug b => _1;
+ }
+
+ bb0: {
+- StorageLive(_2);
+- _2 = _1;
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
+- StorageLive(_5);
+- _5 = _2;
+- _3 = g::<T>(move _4, move _5) -> [return: bb1, unwind continue];
++ _3 = g::<T>(_1, _1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- StorageDead(_5);
+- StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+- StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/move_arg.rs b/tests/mir-opt/copy-prop/move_arg.rs
index f88d9a9e7..fc2932a65 100644
--- a/tests/mir-opt/copy-prop/move_arg.rs
+++ b/tests/mir-opt/copy-prop/move_arg.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Test that we do not move multiple times from the same local.
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/move_projection.f.CopyProp.diff b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.diff
deleted file mode 100644
index beb85d68a..000000000
--- a/tests/mir-opt/copy-prop/move_projection.f.CopyProp.diff
+++ /dev/null
@@ -1,31 +0,0 @@
-- // MIR for `f` before CopyProp
-+ // MIR for `f` after CopyProp
-
- fn f(_1: Foo) -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/move_projection.rs:+0:17: +0:21
- let mut _2: Foo; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _3: u8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-
- bb0: {
-- _2 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-- _3 = move (_2.0: u8); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-- _0 = opaque::<Foo>(move _1) -> bb1; // scope 0 at $DIR/move_projection.rs:+6:13: +6:44
-+ _3 = (_1.0: u8); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-+ _0 = opaque::<Foo>(_1) -> bb1; // scope 0 at $DIR/move_projection.rs:+6:13: +6:44
- // mir::Constant
- // + span: $DIR/move_projection.rs:20:28: 20:34
- // + literal: Const { ty: fn(Foo) -> bool {opaque::<Foo>}, val: Value(<ZST>) }
- }
-
- bb1: {
- _0 = opaque::<u8>(move _3) -> bb2; // scope 0 at $DIR/move_projection.rs:+9:13: +9:44
- // mir::Constant
- // + span: $DIR/move_projection.rs:23:28: 23:34
- // + literal: Const { ty: fn(u8) -> bool {opaque::<u8>}, val: Value(<ZST>) }
- }
-
- bb2: {
- return; // scope 0 at $DIR/move_projection.rs:+12:13: +12:21
- }
- }
-
diff --git a/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-abort.diff
new file mode 100644
index 000000000..b2b89968d
--- /dev/null
+++ b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-abort.diff
@@ -0,0 +1,25 @@
+- // MIR for `f` before CopyProp
++ // MIR for `f` after CopyProp
+
+ fn f(_1: Foo) -> bool {
+ let mut _0: bool;
+ let mut _2: Foo;
+ let mut _3: u8;
+
+ bb0: {
+- _2 = _1;
+- _3 = move (_2.0: u8);
+- _0 = opaque::<Foo>(move _1) -> [return: bb1, unwind unreachable];
++ _3 = (_1.0: u8);
++ _0 = opaque::<Foo>(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _0 = opaque::<u8>(move _3) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-unwind.diff
new file mode 100644
index 000000000..ad3889639
--- /dev/null
+++ b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-unwind.diff
@@ -0,0 +1,25 @@
+- // MIR for `f` before CopyProp
++ // MIR for `f` after CopyProp
+
+ fn f(_1: Foo) -> bool {
+ let mut _0: bool;
+ let mut _2: Foo;
+ let mut _3: u8;
+
+ bb0: {
+- _2 = _1;
+- _3 = move (_2.0: u8);
+- _0 = opaque::<Foo>(move _1) -> [return: bb1, unwind continue];
++ _3 = (_1.0: u8);
++ _0 = opaque::<Foo>(_1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ _0 = opaque::<u8>(move _3) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/move_projection.rs b/tests/mir-opt/copy-prop/move_projection.rs
index c158c69e0..438a90ddd 100644
--- a/tests/mir-opt/copy-prop/move_projection.rs
+++ b/tests/mir-opt/copy-prop/move_projection.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: CopyProp
#![feature(custom_mir, core_intrinsics)]
@@ -17,10 +18,10 @@ fn f(a: Foo) -> bool {
let b = a;
// This is a move out of a copy, so must become a copy of `a.0`.
let c = Move(b.0);
- Call(RET, bb1, opaque(Move(a)))
+ Call(RET = opaque(Move(a)), bb1, UnwindContinue())
}
bb1 = {
- Call(RET, ret, opaque(Move(c)))
+ Call(RET = opaque(Move(c)), ret, UnwindContinue())
}
ret = {
Return()
diff --git a/tests/mir-opt/copy-prop/mutate_through_pointer.f.CopyProp.diff b/tests/mir-opt/copy-prop/mutate_through_pointer.f.CopyProp.diff
index 61fdd6f8c..7f6802bee 100644
--- a/tests/mir-opt/copy-prop/mutate_through_pointer.f.CopyProp.diff
+++ b/tests/mir-opt/copy-prop/mutate_through_pointer.f.CopyProp.diff
@@ -2,18 +2,18 @@
+ // MIR for `f` after CopyProp
fn f(_1: bool) -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/mutate_through_pointer.rs:+0:18: +0:22
- let mut _2: bool; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _3: *const bool; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _4: *mut bool; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: bool;
+ let mut _2: bool;
+ let mut _3: *const bool;
+ let mut _4: *mut bool;
bb0: {
- _2 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _3 = &raw const _2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _4 = &raw mut (*_3); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- (*_4) = const false; // scope 0 at $DIR/mutate_through_pointer.rs:+5:9: +5:20
- _0 = _1; // scope 0 at $DIR/mutate_through_pointer.rs:+6:9: +6:16
- return; // scope 0 at $DIR/mutate_through_pointer.rs:+7:9: +7:17
+ _2 = _1;
+ _3 = &raw const _2;
+ _4 = &raw mut (*_3);
+ (*_4) = const false;
+ _0 = _1;
+ return;
}
}
diff --git a/tests/mir-opt/copy-prop/mutate_through_pointer.rs b/tests/mir-opt/copy-prop/mutate_through_pointer.rs
index da142e339..e36a10846 100644
--- a/tests/mir-opt/copy-prop/mutate_through_pointer.rs
+++ b/tests/mir-opt/copy-prop/mutate_through_pointer.rs
@@ -1,3 +1,6 @@
+// skip-filecheck
+// unit-test: CopyProp
+//
// This attempts to mutate `a` via a pointer derived from `addr_of!(a)`. That is UB
// according to Miri. However, the decision to make this UB - and to allow
// rustc to rely on that fact for the purpose of optimizations - has not been
diff --git a/tests/mir-opt/copy-prop/non_dominate.f.CopyProp.diff b/tests/mir-opt/copy-prop/non_dominate.f.CopyProp.diff
index 9760fd374..5bf233594 100644
--- a/tests/mir-opt/copy-prop/non_dominate.f.CopyProp.diff
+++ b/tests/mir-opt/copy-prop/non_dominate.f.CopyProp.diff
@@ -2,28 +2,28 @@
+ // MIR for `f` after CopyProp
fn f(_1: bool) -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/non_dominate.rs:+0:18: +0:22
- let mut _2: bool; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _3: bool; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: bool;
+ let mut _2: bool;
+ let mut _3: bool;
bb0: {
- goto -> bb1; // scope 0 at $DIR/non_dominate.rs:+4:11: +4:20
+ goto -> bb1;
}
bb1: {
- _3 = _1; // scope 0 at $DIR/non_dominate.rs:+5:17: +5:22
- switchInt(_3) -> [0: bb3, otherwise: bb2]; // scope 0 at $DIR/non_dominate.rs:+5:24: +5:58
+ _3 = _1;
+ switchInt(_3) -> [0: bb3, otherwise: bb2];
}
bb2: {
- _2 = _3; // scope 0 at $DIR/non_dominate.rs:+8:17: +8:22
- _1 = const false; // scope 0 at $DIR/non_dominate.rs:+8:24: +8:33
- goto -> bb1; // scope 0 at $DIR/non_dominate.rs:+8:35: +8:44
+ _2 = _3;
+ _1 = const false;
+ goto -> bb1;
}
bb3: {
- _0 = _2; // scope 0 at $DIR/non_dominate.rs:+9:17: +9:24
- return; // scope 0 at $DIR/non_dominate.rs:+9:26: +9:34
+ _0 = _2;
+ return;
}
}
diff --git a/tests/mir-opt/copy-prop/non_dominate.rs b/tests/mir-opt/copy-prop/non_dominate.rs
index c0ea838e1..c26ac444e 100644
--- a/tests/mir-opt/copy-prop/non_dominate.rs
+++ b/tests/mir-opt/copy-prop/non_dominate.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: CopyProp
#![feature(custom_mir, core_intrinsics)]
diff --git a/tests/mir-opt/copy-prop/partial_init.main.CopyProp.diff b/tests/mir-opt/copy-prop/partial_init.main.CopyProp.diff
index 586643905..7094ee391 100644
--- a/tests/mir-opt/copy-prop/partial_init.main.CopyProp.diff
+++ b/tests/mir-opt/copy-prop/partial_init.main.CopyProp.diff
@@ -2,12 +2,12 @@
+ // MIR for `main` after CopyProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/partial_init.rs:+0:15: +0:15
- let mut _1: (isize,); // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: ();
+ let mut _1: (isize,);
bb0: {
- (_1.0: isize) = const 1_isize; // scope 0 at $DIR/partial_init.rs:+4:13: +4:20
- return; // scope 0 at $DIR/partial_init.rs:+5:13: +5:21
+ (_1.0: isize) = const 1_isize;
+ return;
}
}
diff --git a/tests/mir-opt/copy-prop/partial_init.rs b/tests/mir-opt/copy-prop/partial_init.rs
index f5ab9974f..44cc203de 100644
--- a/tests/mir-opt/copy-prop/partial_init.rs
+++ b/tests/mir-opt/copy-prop/partial_init.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: CopyProp
// Verify that we do not ICE on partial initializations.
diff --git a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.diff b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.diff
deleted file mode 100644
index b4a248245..000000000
--- a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.diff
+++ /dev/null
@@ -1,56 +0,0 @@
-- // MIR for `demiraw` before CopyProp
-+ // MIR for `demiraw` after CopyProp
-
- fn demiraw(_1: u8) -> () {
- debug x => _1; // in scope 0 at $DIR/reborrow.rs:+0:12: +0:17
- let mut _0: (); // return place in scope 0 at $DIR/reborrow.rs:+0:23: +0:23
- let _2: *mut u8; // in scope 0 at $DIR/reborrow.rs:+1:9: +1:10
- let mut _4: &mut u8; // in scope 0 at $DIR/reborrow.rs:+2:22: +2:29
- let _6: (); // in scope 0 at $DIR/reborrow.rs:+4:5: +4:14
- let mut _7: *mut u8; // in scope 0 at $DIR/reborrow.rs:+4:12: +4:13
- scope 1 {
- debug a => _2; // in scope 1 at $DIR/reborrow.rs:+1:9: +1:10
- let _3: &mut u8; // in scope 1 at $DIR/reborrow.rs:+2:9: +2:10
- scope 2 {
- debug b => _3; // in scope 2 at $DIR/reborrow.rs:+2:9: +2:10
- let _5: *mut u8; // in scope 2 at $DIR/reborrow.rs:+3:9: +3:10
- scope 4 {
-- debug c => _5; // in scope 4 at $DIR/reborrow.rs:+3:9: +3:10
-+ debug c => _2; // in scope 4 at $DIR/reborrow.rs:+3:9: +3:10
- }
- }
- scope 3 {
- }
- }
-
- bb0: {
-- StorageLive(_2); // scope 0 at $DIR/reborrow.rs:+1:9: +1:10
- _2 = &raw mut _1; // scope 0 at $DIR/reborrow.rs:+1:13: +1:23
- StorageLive(_3); // scope 1 at $DIR/reborrow.rs:+2:9: +2:10
- StorageLive(_4); // scope 1 at $DIR/reborrow.rs:+2:22: +2:29
- _4 = &mut (*_2); // scope 3 at $DIR/reborrow.rs:+2:22: +2:29
- _3 = &mut (*_4); // scope 1 at $DIR/reborrow.rs:+2:22: +2:29
- StorageDead(_4); // scope 1 at $DIR/reborrow.rs:+2:31: +2:32
-- StorageLive(_5); // scope 2 at $DIR/reborrow.rs:+3:9: +3:10
-- _5 = _2; // scope 2 at $DIR/reborrow.rs:+3:13: +3:14
- StorageLive(_6); // scope 4 at $DIR/reborrow.rs:+4:5: +4:14
-- StorageLive(_7); // scope 4 at $DIR/reborrow.rs:+4:12: +4:13
-- _7 = _5; // scope 4 at $DIR/reborrow.rs:+4:12: +4:13
-- _6 = opaque::<*mut u8>(move _7) -> bb1; // scope 4 at $DIR/reborrow.rs:+4:5: +4:14
-+ _6 = opaque::<*mut u8>(_2) -> bb1; // scope 4 at $DIR/reborrow.rs:+4:5: +4:14
- // mir::Constant
- // + span: $DIR/reborrow.rs:39:5: 39:11
- // + literal: Const { ty: fn(*mut u8) {opaque::<*mut u8>}, val: Value(<ZST>) }
- }
-
- bb1: {
-- StorageDead(_7); // scope 4 at $DIR/reborrow.rs:+4:13: +4:14
- StorageDead(_6); // scope 4 at $DIR/reborrow.rs:+4:14: +4:15
- _0 = const (); // scope 0 at $DIR/reborrow.rs:+0:23: +5:2
-- StorageDead(_5); // scope 2 at $DIR/reborrow.rs:+5:1: +5:2
- StorageDead(_3); // scope 1 at $DIR/reborrow.rs:+5:1: +5:2
-- StorageDead(_2); // scope 0 at $DIR/reborrow.rs:+5:1: +5:2
- return; // scope 0 at $DIR/reborrow.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff
new file mode 100644
index 000000000..ffb0c4b23
--- /dev/null
+++ b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff
@@ -0,0 +1,53 @@
+- // MIR for `demiraw` before CopyProp
++ // MIR for `demiraw` after CopyProp
+
+ fn demiraw(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: *mut u8;
+ let mut _4: &mut u8;
+ let _6: ();
+ let mut _7: *mut u8;
+ scope 1 {
+ debug a => _2;
+ let _3: &mut u8;
+ scope 2 {
+ debug b => _3;
+ let _5: *mut u8;
+ scope 4 {
+- debug c => _5;
++ debug c => _2;
+ }
+ }
+ scope 3 {
+ }
+ }
+
+ bb0: {
+- StorageLive(_2);
+ _2 = &raw mut _1;
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &mut (*_2);
+ _3 = &mut (*_4);
+ StorageDead(_4);
+- StorageLive(_5);
+- _5 = _2;
+ StorageLive(_6);
+- StorageLive(_7);
+- _7 = _5;
+- _6 = opaque::<*mut u8>(move _7) -> [return: bb1, unwind unreachable];
++ _6 = opaque::<*mut u8>(_2) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- StorageDead(_7);
+ StorageDead(_6);
+ _0 = const ();
+- StorageDead(_5);
+ StorageDead(_3);
+- StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff
new file mode 100644
index 000000000..66a0f49cf
--- /dev/null
+++ b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff
@@ -0,0 +1,53 @@
+- // MIR for `demiraw` before CopyProp
++ // MIR for `demiraw` after CopyProp
+
+ fn demiraw(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: *mut u8;
+ let mut _4: &mut u8;
+ let _6: ();
+ let mut _7: *mut u8;
+ scope 1 {
+ debug a => _2;
+ let _3: &mut u8;
+ scope 2 {
+ debug b => _3;
+ let _5: *mut u8;
+ scope 4 {
+- debug c => _5;
++ debug c => _2;
+ }
+ }
+ scope 3 {
+ }
+ }
+
+ bb0: {
+- StorageLive(_2);
+ _2 = &raw mut _1;
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &mut (*_2);
+ _3 = &mut (*_4);
+ StorageDead(_4);
+- StorageLive(_5);
+- _5 = _2;
+ StorageLive(_6);
+- StorageLive(_7);
+- _7 = _5;
+- _6 = opaque::<*mut u8>(move _7) -> [return: bb1, unwind continue];
++ _6 = opaque::<*mut u8>(_2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- StorageDead(_7);
+ StorageDead(_6);
+ _0 = const ();
+- StorageDead(_5);
+ StorageDead(_3);
+- StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.diff b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.diff
deleted file mode 100644
index a6a6c05b2..000000000
--- a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.diff
+++ /dev/null
@@ -1,52 +0,0 @@
-- // MIR for `miraw` before CopyProp
-+ // MIR for `miraw` after CopyProp
-
- fn miraw(_1: u8) -> () {
- debug x => _1; // in scope 0 at $DIR/reborrow.rs:+0:10: +0:15
- let mut _0: (); // return place in scope 0 at $DIR/reborrow.rs:+0:21: +0:21
- let _2: *mut u8; // in scope 0 at $DIR/reborrow.rs:+1:9: +1:10
- let _5: (); // in scope 0 at $DIR/reborrow.rs:+4:5: +4:14
- let mut _6: *mut u8; // in scope 0 at $DIR/reborrow.rs:+4:12: +4:13
- scope 1 {
- debug a => _2; // in scope 1 at $DIR/reborrow.rs:+1:9: +1:10
- let _3: *mut u8; // in scope 1 at $DIR/reborrow.rs:+2:9: +2:10
- scope 2 {
- debug b => _3; // in scope 2 at $DIR/reborrow.rs:+2:9: +2:10
- let _4: *mut u8; // in scope 2 at $DIR/reborrow.rs:+3:9: +3:10
- scope 4 {
-- debug c => _4; // in scope 4 at $DIR/reborrow.rs:+3:9: +3:10
-+ debug c => _2; // in scope 4 at $DIR/reborrow.rs:+3:9: +3:10
- }
- }
- scope 3 {
- }
- }
-
- bb0: {
-- StorageLive(_2); // scope 0 at $DIR/reborrow.rs:+1:9: +1:10
- _2 = &raw mut _1; // scope 0 at $DIR/reborrow.rs:+1:13: +1:23
- StorageLive(_3); // scope 1 at $DIR/reborrow.rs:+2:9: +2:10
- _3 = &raw mut (*_2); // scope 3 at $DIR/reborrow.rs:+2:22: +2:33
-- StorageLive(_4); // scope 2 at $DIR/reborrow.rs:+3:9: +3:10
-- _4 = _2; // scope 2 at $DIR/reborrow.rs:+3:13: +3:14
- StorageLive(_5); // scope 4 at $DIR/reborrow.rs:+4:5: +4:14
-- StorageLive(_6); // scope 4 at $DIR/reborrow.rs:+4:12: +4:13
-- _6 = _4; // scope 4 at $DIR/reborrow.rs:+4:12: +4:13
-- _5 = opaque::<*mut u8>(move _6) -> bb1; // scope 4 at $DIR/reborrow.rs:+4:5: +4:14
-+ _5 = opaque::<*mut u8>(_2) -> bb1; // scope 4 at $DIR/reborrow.rs:+4:5: +4:14
- // mir::Constant
- // + span: $DIR/reborrow.rs:31:5: 31:11
- // + literal: Const { ty: fn(*mut u8) {opaque::<*mut u8>}, val: Value(<ZST>) }
- }
-
- bb1: {
-- StorageDead(_6); // scope 4 at $DIR/reborrow.rs:+4:13: +4:14
- StorageDead(_5); // scope 4 at $DIR/reborrow.rs:+4:14: +4:15
- _0 = const (); // scope 0 at $DIR/reborrow.rs:+0:21: +5:2
-- StorageDead(_4); // scope 2 at $DIR/reborrow.rs:+5:1: +5:2
- StorageDead(_3); // scope 1 at $DIR/reborrow.rs:+5:1: +5:2
-- StorageDead(_2); // scope 0 at $DIR/reborrow.rs:+5:1: +5:2
- return; // scope 0 at $DIR/reborrow.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff
new file mode 100644
index 000000000..0777a9135
--- /dev/null
+++ b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff
@@ -0,0 +1,49 @@
+- // MIR for `miraw` before CopyProp
++ // MIR for `miraw` after CopyProp
+
+ fn miraw(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: *mut u8;
+ let _5: ();
+ let mut _6: *mut u8;
+ scope 1 {
+ debug a => _2;
+ let _3: *mut u8;
+ scope 2 {
+ debug b => _3;
+ let _4: *mut u8;
+ scope 4 {
+- debug c => _4;
++ debug c => _2;
+ }
+ }
+ scope 3 {
+ }
+ }
+
+ bb0: {
+- StorageLive(_2);
+ _2 = &raw mut _1;
+ StorageLive(_3);
+ _3 = &raw mut (*_2);
+- StorageLive(_4);
+- _4 = _2;
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = _4;
+- _5 = opaque::<*mut u8>(move _6) -> [return: bb1, unwind unreachable];
++ _5 = opaque::<*mut u8>(_2) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- StorageDead(_6);
+ StorageDead(_5);
+ _0 = const ();
+- StorageDead(_4);
+ StorageDead(_3);
+- StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff
new file mode 100644
index 000000000..f5a512b89
--- /dev/null
+++ b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff
@@ -0,0 +1,49 @@
+- // MIR for `miraw` before CopyProp
++ // MIR for `miraw` after CopyProp
+
+ fn miraw(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: *mut u8;
+ let _5: ();
+ let mut _6: *mut u8;
+ scope 1 {
+ debug a => _2;
+ let _3: *mut u8;
+ scope 2 {
+ debug b => _3;
+ let _4: *mut u8;
+ scope 4 {
+- debug c => _4;
++ debug c => _2;
+ }
+ }
+ scope 3 {
+ }
+ }
+
+ bb0: {
+- StorageLive(_2);
+ _2 = &raw mut _1;
+ StorageLive(_3);
+ _3 = &raw mut (*_2);
+- StorageLive(_4);
+- _4 = _2;
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = _4;
+- _5 = opaque::<*mut u8>(move _6) -> [return: bb1, unwind continue];
++ _5 = opaque::<*mut u8>(_2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- StorageDead(_6);
+ StorageDead(_5);
+ _0 = const ();
+- StorageDead(_4);
+ StorageDead(_3);
+- StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.diff b/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.diff
deleted file mode 100644
index f3d26cc6e..000000000
--- a/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.diff
+++ /dev/null
@@ -1,50 +0,0 @@
-- // MIR for `remut` before CopyProp
-+ // MIR for `remut` after CopyProp
-
- fn remut(_1: u8) -> () {
- debug x => _1; // in scope 0 at $DIR/reborrow.rs:+0:10: +0:15
- let mut _0: (); // return place in scope 0 at $DIR/reborrow.rs:+0:21: +0:21
- let _2: &mut u8; // in scope 0 at $DIR/reborrow.rs:+1:9: +1:10
- let _5: (); // in scope 0 at $DIR/reborrow.rs:+4:5: +4:14
- let mut _6: &mut u8; // in scope 0 at $DIR/reborrow.rs:+4:12: +4:13
- scope 1 {
- debug a => _2; // in scope 1 at $DIR/reborrow.rs:+1:9: +1:10
- let _3: &mut u8; // in scope 1 at $DIR/reborrow.rs:+2:9: +2:10
- scope 2 {
- debug b => _3; // in scope 2 at $DIR/reborrow.rs:+2:9: +2:10
- let _4: &mut u8; // in scope 2 at $DIR/reborrow.rs:+3:9: +3:10
- scope 3 {
-- debug c => _4; // in scope 3 at $DIR/reborrow.rs:+3:9: +3:10
-+ debug c => _2; // in scope 3 at $DIR/reborrow.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
-- StorageLive(_2); // scope 0 at $DIR/reborrow.rs:+1:9: +1:10
- _2 = &mut _1; // scope 0 at $DIR/reborrow.rs:+1:13: +1:19
- StorageLive(_3); // scope 1 at $DIR/reborrow.rs:+2:9: +2:10
- _3 = &mut (*_2); // scope 1 at $DIR/reborrow.rs:+2:13: +2:20
-- StorageLive(_4); // scope 2 at $DIR/reborrow.rs:+3:9: +3:10
-- _4 = move _2; // scope 2 at $DIR/reborrow.rs:+3:13: +3:14
- StorageLive(_5); // scope 3 at $DIR/reborrow.rs:+4:5: +4:14
-- StorageLive(_6); // scope 3 at $DIR/reborrow.rs:+4:12: +4:13
-- _6 = move _4; // scope 3 at $DIR/reborrow.rs:+4:12: +4:13
-- _5 = opaque::<&mut u8>(move _6) -> bb1; // scope 3 at $DIR/reborrow.rs:+4:5: +4:14
-+ _5 = opaque::<&mut u8>(move _2) -> bb1; // scope 3 at $DIR/reborrow.rs:+4:5: +4:14
- // mir::Constant
- // + span: $DIR/reborrow.rs:15:5: 15:11
- // + literal: Const { ty: fn(&mut u8) {opaque::<&mut u8>}, val: Value(<ZST>) }
- }
-
- bb1: {
-- StorageDead(_6); // scope 3 at $DIR/reborrow.rs:+4:13: +4:14
- StorageDead(_5); // scope 3 at $DIR/reborrow.rs:+4:14: +4:15
- _0 = const (); // scope 0 at $DIR/reborrow.rs:+0:21: +5:2
-- StorageDead(_4); // scope 2 at $DIR/reborrow.rs:+5:1: +5:2
- StorageDead(_3); // scope 1 at $DIR/reborrow.rs:+5:1: +5:2
-- StorageDead(_2); // scope 0 at $DIR/reborrow.rs:+5:1: +5:2
- return; // scope 0 at $DIR/reborrow.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-abort.diff
new file mode 100644
index 000000000..2026c1982
--- /dev/null
+++ b/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-abort.diff
@@ -0,0 +1,47 @@
+- // MIR for `remut` before CopyProp
++ // MIR for `remut` after CopyProp
+
+ fn remut(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: &mut u8;
+ let _5: ();
+ let mut _6: &mut u8;
+ scope 1 {
+ debug a => _2;
+ let _3: &mut u8;
+ scope 2 {
+ debug b => _3;
+ let _4: &mut u8;
+ scope 3 {
+- debug c => _4;
++ debug c => _2;
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_2);
+ _2 = &mut _1;
+ StorageLive(_3);
+ _3 = &mut (*_2);
+- StorageLive(_4);
+- _4 = move _2;
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = move _4;
+- _5 = opaque::<&mut u8>(move _6) -> [return: bb1, unwind unreachable];
++ _5 = opaque::<&mut u8>(move _2) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- StorageDead(_6);
+ StorageDead(_5);
+ _0 = const ();
+- StorageDead(_4);
+ StorageDead(_3);
+- StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-unwind.diff
new file mode 100644
index 000000000..67763fdce
--- /dev/null
+++ b/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-unwind.diff
@@ -0,0 +1,47 @@
+- // MIR for `remut` before CopyProp
++ // MIR for `remut` after CopyProp
+
+ fn remut(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: &mut u8;
+ let _5: ();
+ let mut _6: &mut u8;
+ scope 1 {
+ debug a => _2;
+ let _3: &mut u8;
+ scope 2 {
+ debug b => _3;
+ let _4: &mut u8;
+ scope 3 {
+- debug c => _4;
++ debug c => _2;
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_2);
+ _2 = &mut _1;
+ StorageLive(_3);
+ _3 = &mut (*_2);
+- StorageLive(_4);
+- _4 = move _2;
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = move _4;
+- _5 = opaque::<&mut u8>(move _6) -> [return: bb1, unwind continue];
++ _5 = opaque::<&mut u8>(move _2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- StorageDead(_6);
+ StorageDead(_5);
+ _0 = const ();
+- StorageDead(_4);
+ StorageDead(_3);
+- StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.diff b/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.diff
deleted file mode 100644
index 63e42b4dc..000000000
--- a/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.diff
+++ /dev/null
@@ -1,50 +0,0 @@
-- // MIR for `reraw` before CopyProp
-+ // MIR for `reraw` after CopyProp
-
- fn reraw(_1: u8) -> () {
- debug x => _1; // in scope 0 at $DIR/reborrow.rs:+0:10: +0:15
- let mut _0: (); // return place in scope 0 at $DIR/reborrow.rs:+0:21: +0:21
- let _2: &mut u8; // in scope 0 at $DIR/reborrow.rs:+1:9: +1:10
- let _5: (); // in scope 0 at $DIR/reborrow.rs:+4:5: +4:14
- let mut _6: &mut u8; // in scope 0 at $DIR/reborrow.rs:+4:12: +4:13
- scope 1 {
- debug a => _2; // in scope 1 at $DIR/reborrow.rs:+1:9: +1:10
- let _3: *mut u8; // in scope 1 at $DIR/reborrow.rs:+2:9: +2:10
- scope 2 {
- debug b => _3; // in scope 2 at $DIR/reborrow.rs:+2:9: +2:10
- let _4: &mut u8; // in scope 2 at $DIR/reborrow.rs:+3:9: +3:10
- scope 3 {
-- debug c => _4; // in scope 3 at $DIR/reborrow.rs:+3:9: +3:10
-+ debug c => _2; // in scope 3 at $DIR/reborrow.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
-- StorageLive(_2); // scope 0 at $DIR/reborrow.rs:+1:9: +1:10
- _2 = &mut _1; // scope 0 at $DIR/reborrow.rs:+1:13: +1:19
- StorageLive(_3); // scope 1 at $DIR/reborrow.rs:+2:9: +2:10
- _3 = &raw mut (*_2); // scope 1 at $DIR/reborrow.rs:+2:13: +2:24
-- StorageLive(_4); // scope 2 at $DIR/reborrow.rs:+3:9: +3:10
-- _4 = move _2; // scope 2 at $DIR/reborrow.rs:+3:13: +3:14
- StorageLive(_5); // scope 3 at $DIR/reborrow.rs:+4:5: +4:14
-- StorageLive(_6); // scope 3 at $DIR/reborrow.rs:+4:12: +4:13
-- _6 = move _4; // scope 3 at $DIR/reborrow.rs:+4:12: +4:13
-- _5 = opaque::<&mut u8>(move _6) -> bb1; // scope 3 at $DIR/reborrow.rs:+4:5: +4:14
-+ _5 = opaque::<&mut u8>(move _2) -> bb1; // scope 3 at $DIR/reborrow.rs:+4:5: +4:14
- // mir::Constant
- // + span: $DIR/reborrow.rs:23:5: 23:11
- // + literal: Const { ty: fn(&mut u8) {opaque::<&mut u8>}, val: Value(<ZST>) }
- }
-
- bb1: {
-- StorageDead(_6); // scope 3 at $DIR/reborrow.rs:+4:13: +4:14
- StorageDead(_5); // scope 3 at $DIR/reborrow.rs:+4:14: +4:15
- _0 = const (); // scope 0 at $DIR/reborrow.rs:+0:21: +5:2
-- StorageDead(_4); // scope 2 at $DIR/reborrow.rs:+5:1: +5:2
- StorageDead(_3); // scope 1 at $DIR/reborrow.rs:+5:1: +5:2
-- StorageDead(_2); // scope 0 at $DIR/reborrow.rs:+5:1: +5:2
- return; // scope 0 at $DIR/reborrow.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-abort.diff
new file mode 100644
index 000000000..dfc8dd097
--- /dev/null
+++ b/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-abort.diff
@@ -0,0 +1,47 @@
+- // MIR for `reraw` before CopyProp
++ // MIR for `reraw` after CopyProp
+
+ fn reraw(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: &mut u8;
+ let _5: ();
+ let mut _6: &mut u8;
+ scope 1 {
+ debug a => _2;
+ let _3: *mut u8;
+ scope 2 {
+ debug b => _3;
+ let _4: &mut u8;
+ scope 3 {
+- debug c => _4;
++ debug c => _2;
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_2);
+ _2 = &mut _1;
+ StorageLive(_3);
+ _3 = &raw mut (*_2);
+- StorageLive(_4);
+- _4 = move _2;
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = move _4;
+- _5 = opaque::<&mut u8>(move _6) -> [return: bb1, unwind unreachable];
++ _5 = opaque::<&mut u8>(move _2) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- StorageDead(_6);
+ StorageDead(_5);
+ _0 = const ();
+- StorageDead(_4);
+ StorageDead(_3);
+- StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-unwind.diff
new file mode 100644
index 000000000..becc42563
--- /dev/null
+++ b/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-unwind.diff
@@ -0,0 +1,47 @@
+- // MIR for `reraw` before CopyProp
++ // MIR for `reraw` after CopyProp
+
+ fn reraw(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: &mut u8;
+ let _5: ();
+ let mut _6: &mut u8;
+ scope 1 {
+ debug a => _2;
+ let _3: *mut u8;
+ scope 2 {
+ debug b => _3;
+ let _4: &mut u8;
+ scope 3 {
+- debug c => _4;
++ debug c => _2;
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_2);
+ _2 = &mut _1;
+ StorageLive(_3);
+ _3 = &raw mut (*_2);
+- StorageLive(_4);
+- _4 = move _2;
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = move _4;
+- _5 = opaque::<&mut u8>(move _6) -> [return: bb1, unwind continue];
++ _5 = opaque::<&mut u8>(move _2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- StorageDead(_6);
+ StorageDead(_5);
+ _0 = const ();
+- StorageDead(_4);
+ StorageDead(_3);
+- StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/reborrow.rs b/tests/mir-opt/copy-prop/reborrow.rs
index 91b77966b..57c4fb8ad 100644
--- a/tests/mir-opt/copy-prop/reborrow.rs
+++ b/tests/mir-opt/copy-prop/reborrow.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that CopyProp considers reborrows as not mutating the pointer.
// unit-test: CopyProp
diff --git a/tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-abort.mir b/tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-abort.mir
new file mode 100644
index 000000000..25bffbe24
--- /dev/null
+++ b/tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-abort.mir
@@ -0,0 +1,82 @@
+// MIR for `main::{closure#0}` 0 coroutine_drop
+/* coroutine_layout = CoroutineLayout {
+ field_tys: {
+ _0: CoroutineSavedTy {
+ ty: std::string::String,
+ source_info: SourceInfo {
+ span: $DIR/coroutine_drop_cleanup.rs:12:13: 12:15 (#0),
+ scope: scope[0],
+ },
+ ignore_for_traits: false,
+ },
+ },
+ variant_fields: {
+ Unresumed(0): [],
+ Returned (1): [],
+ Panicked (2): [],
+ Suspend0 (3): [_0],
+ },
+ storage_conflicts: BitMatrix(1x1) {
+ (_0, _0),
+ },
+} */
+
+fn main::{closure#0}(_1: *mut {coroutine@$DIR/coroutine_drop_cleanup.rs:11:15: 11:17}) -> () {
+ let mut _0: ();
+ let mut _2: ();
+ let _3: std::string::String;
+ let _4: ();
+ let mut _5: ();
+ let mut _6: ();
+ let mut _7: ();
+ let mut _8: u32;
+ scope 1 {
+ debug _s => (((*_1) as variant#3).0: std::string::String);
+ }
+
+ bb0: {
+ _8 = discriminant((*_1));
+ switchInt(move _8) -> [0: bb5, 3: bb8, otherwise: bb9];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ drop((((*_1) as variant#3).0: std::string::String)) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ nop;
+ goto -> bb6;
+ }
+
+ bb3: {
+ return;
+ }
+
+ bb4: {
+ return;
+ }
+
+ bb5: {
+ goto -> bb7;
+ }
+
+ bb6: {
+ goto -> bb3;
+ }
+
+ bb7: {
+ goto -> bb4;
+ }
+
+ bb8: {
+ StorageLive(_4);
+ StorageLive(_5);
+ goto -> bb1;
+ }
+
+ bb9: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-unwind.mir b/tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-unwind.mir
new file mode 100644
index 000000000..2eac754b1
--- /dev/null
+++ b/tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-unwind.mir
@@ -0,0 +1,91 @@
+// MIR for `main::{closure#0}` 0 coroutine_drop
+/* coroutine_layout = CoroutineLayout {
+ field_tys: {
+ _0: CoroutineSavedTy {
+ ty: std::string::String,
+ source_info: SourceInfo {
+ span: $DIR/coroutine_drop_cleanup.rs:12:13: 12:15 (#0),
+ scope: scope[0],
+ },
+ ignore_for_traits: false,
+ },
+ },
+ variant_fields: {
+ Unresumed(0): [],
+ Returned (1): [],
+ Panicked (2): [],
+ Suspend0 (3): [_0],
+ },
+ storage_conflicts: BitMatrix(1x1) {
+ (_0, _0),
+ },
+} */
+
+fn main::{closure#0}(_1: *mut {coroutine@$DIR/coroutine_drop_cleanup.rs:11:15: 11:17}) -> () {
+ let mut _0: ();
+ let mut _2: ();
+ let _3: std::string::String;
+ let _4: ();
+ let mut _5: ();
+ let mut _6: ();
+ let mut _7: ();
+ let mut _8: u32;
+ scope 1 {
+ debug _s => (((*_1) as variant#3).0: std::string::String);
+ }
+
+ bb0: {
+ _8 = discriminant((*_1));
+ switchInt(move _8) -> [0: bb7, 3: bb10, otherwise: bb11];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ drop((((*_1) as variant#3).0: std::string::String)) -> [return: bb2, unwind: bb5];
+ }
+
+ bb2: {
+ nop;
+ goto -> bb8;
+ }
+
+ bb3: {
+ return;
+ }
+
+ bb4 (cleanup): {
+ resume;
+ }
+
+ bb5 (cleanup): {
+ nop;
+ goto -> bb4;
+ }
+
+ bb6: {
+ return;
+ }
+
+ bb7: {
+ goto -> bb9;
+ }
+
+ bb8: {
+ goto -> bb3;
+ }
+
+ bb9: {
+ goto -> bb6;
+ }
+
+ bb10: {
+ StorageLive(_4);
+ StorageLive(_5);
+ goto -> bb1;
+ }
+
+ bb11: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/coroutine_drop_cleanup.rs b/tests/mir-opt/coroutine_drop_cleanup.rs
new file mode 100644
index 000000000..69984c737
--- /dev/null
+++ b/tests/mir-opt/coroutine_drop_cleanup.rs
@@ -0,0 +1,15 @@
+// skip-filecheck
+#![feature(coroutines, coroutine_trait)]
+
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
+// Regression test for #58892, coroutine drop shims should not have blocks
+// spuriously marked as cleanup
+
+// EMIT_MIR coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.mir
+fn main() {
+ let gen = || {
+ let _s = String::new();
+ yield;
+ };
+}
diff --git a/tests/mir-opt/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir b/tests/mir-opt/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir
new file mode 100644
index 000000000..8369a3e60
--- /dev/null
+++ b/tests/mir-opt/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir
@@ -0,0 +1,83 @@
+// MIR for `main::{closure#0}` before StateTransform
+
+fn main::{closure#0}(_1: {coroutine@$DIR/coroutine_storage_dead_unwind.rs:23:16: 23:18}, _2: ()) -> ()
+yields ()
+ {
+ let mut _0: ();
+ let _3: Foo;
+ let _5: ();
+ let mut _6: ();
+ let _7: ();
+ let mut _8: Foo;
+ let _9: ();
+ let mut _10: Bar;
+ scope 1 {
+ debug a => _3;
+ let _4: Bar;
+ scope 2 {
+ debug b => _4;
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = Foo(const 5_i32);
+ StorageLive(_4);
+ _4 = Bar(const 6_i32);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = ();
+ _5 = yield(move _6) -> [resume: bb1, drop: bb6];
+ }
+
+ bb1: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = move _3;
+ _7 = take::<Foo>(move _8) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = move _4;
+ _9 = take::<Bar>(move _10) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_10);
+ StorageDead(_9);
+ _0 = const ();
+ StorageDead(_4);
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageDead(_3);
+ drop(_1) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ return;
+ }
+
+ bb6: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+ drop(_3) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ StorageDead(_3);
+ drop(_1) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+ coroutine_drop;
+ }
+}
diff --git a/tests/mir-opt/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir b/tests/mir-opt/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir
new file mode 100644
index 000000000..1773db1ab
--- /dev/null
+++ b/tests/mir-opt/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir
@@ -0,0 +1,118 @@
+// MIR for `main::{closure#0}` before StateTransform
+
+fn main::{closure#0}(_1: {coroutine@$DIR/coroutine_storage_dead_unwind.rs:23:16: 23:18}, _2: ()) -> ()
+yields ()
+ {
+ let mut _0: ();
+ let _3: Foo;
+ let _5: ();
+ let mut _6: ();
+ let _7: ();
+ let mut _8: Foo;
+ let _9: ();
+ let mut _10: Bar;
+ scope 1 {
+ debug a => _3;
+ let _4: Bar;
+ scope 2 {
+ debug b => _4;
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = Foo(const 5_i32);
+ StorageLive(_4);
+ _4 = Bar(const 6_i32);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = ();
+ _5 = yield(move _6) -> [resume: bb1, drop: bb6];
+ }
+
+ bb1: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = move _3;
+ _7 = take::<Foo>(move _8) -> [return: bb2, unwind: bb10];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = move _4;
+ _9 = take::<Bar>(move _10) -> [return: bb3, unwind: bb9];
+ }
+
+ bb3: {
+ StorageDead(_10);
+ StorageDead(_9);
+ _0 = const ();
+ StorageDead(_4);
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageDead(_3);
+ drop(_1) -> [return: bb5, unwind: bb14];
+ }
+
+ bb5: {
+ return;
+ }
+
+ bb6: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+ drop(_3) -> [return: bb7, unwind: bb15];
+ }
+
+ bb7: {
+ StorageDead(_3);
+ drop(_1) -> [return: bb8, unwind: bb14];
+ }
+
+ bb8: {
+ coroutine_drop;
+ }
+
+ bb9 (cleanup): {
+ StorageDead(_10);
+ StorageDead(_9);
+ goto -> bb12;
+ }
+
+ bb10 (cleanup): {
+ goto -> bb11;
+ }
+
+ bb11 (cleanup): {
+ StorageDead(_8);
+ StorageDead(_7);
+ goto -> bb12;
+ }
+
+ bb12 (cleanup): {
+ StorageDead(_4);
+ goto -> bb13;
+ }
+
+ bb13 (cleanup): {
+ StorageDead(_3);
+ drop(_1) -> [return: bb14, unwind terminate(cleanup)];
+ }
+
+ bb14 (cleanup): {
+ resume;
+ }
+
+ bb15 (cleanup): {
+ StorageDead(_3);
+ drop(_1) -> [return: bb14, unwind terminate(cleanup)];
+ }
+}
diff --git a/tests/mir-opt/generator_storage_dead_unwind.rs b/tests/mir-opt/coroutine_storage_dead_unwind.rs
index b72170ade..253be1ff6 100644
--- a/tests/mir-opt/generator_storage_dead_unwind.rs
+++ b/tests/mir-opt/coroutine_storage_dead_unwind.rs
@@ -1,11 +1,12 @@
-// ignore-wasm32-bare compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// Test that we generate StorageDead on unwind paths for generators.
+// Test that we generate StorageDead on unwind paths for coroutines.
//
// Basic block and local names can safely change, but the StorageDead statements
// should not go away.
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
struct Foo(i32);
@@ -17,7 +18,7 @@ struct Bar(i32);
fn take<T>(_x: T) {}
-// EMIT_MIR generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir
+// EMIT_MIR coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir
fn main() {
let _gen = || {
let a = Foo(5);
diff --git a/tests/mir-opt/coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir b/tests/mir-opt/coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir
new file mode 100644
index 000000000..165aa3a05
--- /dev/null
+++ b/tests/mir-opt/coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir
@@ -0,0 +1,89 @@
+// MIR for `main::{closure#0}` 0 coroutine_resume
+/* coroutine_layout = CoroutineLayout {
+ field_tys: {
+ _0: CoroutineSavedTy {
+ ty: HasDrop,
+ source_info: SourceInfo {
+ span: $DIR/coroutine_tiny.rs:21:13: 21:15 (#0),
+ scope: scope[0],
+ },
+ ignore_for_traits: false,
+ },
+ },
+ variant_fields: {
+ Unresumed(0): [],
+ Returned (1): [],
+ Panicked (2): [],
+ Suspend0 (3): [_0],
+ },
+ storage_conflicts: BitMatrix(1x1) {
+ (_0, _0),
+ },
+} */
+
+fn main::{closure#0}(_1: Pin<&mut {coroutine@$DIR/coroutine_tiny.rs:20:16: 20:24}>, _2: u8) -> CoroutineState<(), ()> {
+ debug _x => _10;
+ let mut _0: std::ops::CoroutineState<(), ()>;
+ let _3: HasDrop;
+ let mut _4: !;
+ let mut _5: ();
+ let _6: u8;
+ let mut _7: ();
+ let _8: ();
+ let mut _9: ();
+ let _10: u8;
+ let mut _11: u32;
+ scope 1 {
+ debug _d => (((*(_1.0: &mut {coroutine@$DIR/coroutine_tiny.rs:20:16: 20:24})) as variant#3).0: HasDrop);
+ }
+
+ bb0: {
+ _11 = discriminant((*(_1.0: &mut {coroutine@$DIR/coroutine_tiny.rs:20:16: 20:24})));
+ switchInt(move _11) -> [0: bb1, 3: bb5, otherwise: bb6];
+ }
+
+ bb1: {
+ _10 = move _2;
+ nop;
+ (((*(_1.0: &mut {coroutine@$DIR/coroutine_tiny.rs:20:16: 20:24})) as variant#3).0: HasDrop) = HasDrop;
+ StorageLive(_4);
+ goto -> bb2;
+ }
+
+ bb2: {
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = ();
+ _0 = CoroutineState::<(), ()>::Yielded(move _7);
+ StorageDead(_4);
+ StorageDead(_6);
+ StorageDead(_7);
+ discriminant((*(_1.0: &mut {coroutine@$DIR/coroutine_tiny.rs:20:16: 20:24}))) = 3;
+ return;
+ }
+
+ bb3: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_8);
+ _8 = callee() -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_8);
+ _5 = const ();
+ goto -> bb2;
+ }
+
+ bb5: {
+ StorageLive(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _6 = move _2;
+ goto -> bb3;
+ }
+
+ bb6: {
+ unreachable;
+ }
+}
diff --git a/tests/mir-opt/generator_tiny.rs b/tests/mir-opt/coroutine_tiny.rs
index 7dad63a61..0fd785b28 100644
--- a/tests/mir-opt/generator_tiny.rs
+++ b/tests/mir-opt/coroutine_tiny.rs
@@ -1,10 +1,11 @@
-//! Tests that generators that cannot return or unwind don't have unnecessary
+// skip-filecheck
+//! Tests that coroutines that cannot return or unwind don't have unnecessary
//! panic branches.
// compile-flags: -C panic=abort
// no-prefer-dynamic
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
struct HasDrop;
@@ -14,7 +15,7 @@ impl Drop for HasDrop {
fn callee() {}
-// EMIT_MIR generator_tiny.main-{closure#0}.generator_resume.0.mir
+// EMIT_MIR coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir
fn main() {
let _gen = |_x: u8| {
let _d = HasDrop;
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 03df5c950..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(1) 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 c4d389b2d..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(2) 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(4294967293) = 4294967294 + 0 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..3d420f930
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/array_index.rs
@@ -0,0 +1,9 @@
+// skip-filecheck
+// 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..2605c7019
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/boolean_identities.rs
@@ -0,0 +1,11 @@
+// skip-filecheck
+// 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/cast.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/cast.main.DataflowConstProp.diff
index bf9ab8669..0ca446c89 100644
--- a/tests/mir-opt/dataflow-const-prop/cast.main.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/cast.main.DataflowConstProp.diff
@@ -2,36 +2,36 @@
+ // MIR for `main` after DataflowConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/cast.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/cast.rs:+1:9: +1:10
- let mut _3: u8; // in scope 0 at $DIR/cast.rs:+2:13: +2:20
- let mut _4: i32; // in scope 0 at $DIR/cast.rs:+2:13: +2:14
+ let mut _0: ();
+ let _1: i32;
+ let mut _3: u8;
+ let mut _4: i32;
scope 1 {
- debug a => _1; // in scope 1 at $DIR/cast.rs:+1:9: +1:10
- let _2: u8; // in scope 1 at $DIR/cast.rs:+2:9: +2:10
+ debug a => _1;
+ let _2: u8;
scope 2 {
- debug b => _2; // in scope 2 at $DIR/cast.rs:+2:9: +2:10
+ debug b => _2;
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/cast.rs:+1:9: +1:10
- _1 = const 257_i32; // scope 0 at $DIR/cast.rs:+1:13: +1:16
- StorageLive(_2); // scope 1 at $DIR/cast.rs:+2:9: +2:10
- StorageLive(_3); // scope 1 at $DIR/cast.rs:+2:13: +2:20
- StorageLive(_4); // scope 1 at $DIR/cast.rs:+2:13: +2:14
-- _4 = _1; // scope 1 at $DIR/cast.rs:+2:13: +2:14
-- _3 = move _4 as u8 (IntToInt); // scope 1 at $DIR/cast.rs:+2:13: +2:20
-+ _4 = const 257_i32; // scope 1 at $DIR/cast.rs:+2:13: +2:14
-+ _3 = const 1_u8; // scope 1 at $DIR/cast.rs:+2:13: +2:20
- StorageDead(_4); // scope 1 at $DIR/cast.rs:+2:19: +2:20
-- _2 = Add(move _3, const 1_u8); // scope 1 at $DIR/cast.rs:+2:13: +2:24
-+ _2 = const 2_u8; // scope 1 at $DIR/cast.rs:+2:13: +2:24
- StorageDead(_3); // scope 1 at $DIR/cast.rs:+2:23: +2:24
- _0 = const (); // scope 0 at $DIR/cast.rs:+0:11: +3:2
- StorageDead(_2); // scope 1 at $DIR/cast.rs:+3:1: +3:2
- StorageDead(_1); // scope 0 at $DIR/cast.rs:+3:1: +3:2
- return; // scope 0 at $DIR/cast.rs:+3:2: +3:2
+ StorageLive(_1);
+ _1 = const 257_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = _1;
+- _3 = move _4 as u8 (IntToInt);
++ _4 = const 257_i32;
++ _3 = const 1_u8;
+ StorageDead(_4);
+- _2 = Add(move _3, const 1_u8);
++ _2 = const 2_u8;
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/dataflow-const-prop/cast.rs b/tests/mir-opt/dataflow-const-prop/cast.rs
index 484403f7f..c87872609 100644
--- a/tests/mir-opt/dataflow-const-prop/cast.rs
+++ b/tests/mir-opt/dataflow-const-prop/cast.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR cast.main.DataflowConstProp.diff
diff --git a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.diff
deleted file mode 100644
index 944afed8f..000000000
--- a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.diff
+++ /dev/null
@@ -1,80 +0,0 @@
-- // MIR for `main` before DataflowConstProp
-+ // MIR for `main` after DataflowConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/checked.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/checked.rs:+1:9: +1:10
- let mut _4: i32; // in scope 0 at $DIR/checked.rs:+3:13: +3:14
- let mut _5: i32; // in scope 0 at $DIR/checked.rs:+3:17: +3:18
- let mut _6: (i32, bool); // in scope 0 at $DIR/checked.rs:+3:13: +3:18
- let mut _9: i32; // in scope 0 at $DIR/checked.rs:+6:13: +6:14
- let mut _10: (i32, bool); // in scope 0 at $DIR/checked.rs:+6:13: +6:18
- scope 1 {
- debug a => _1; // in scope 1 at $DIR/checked.rs:+1:9: +1:10
- let _2: i32; // in scope 1 at $DIR/checked.rs:+2:9: +2:10
- scope 2 {
- debug b => _2; // in scope 2 at $DIR/checked.rs:+2:9: +2:10
- let _3: i32; // in scope 2 at $DIR/checked.rs:+3:9: +3:10
- scope 3 {
- debug c => _3; // in scope 3 at $DIR/checked.rs:+3:9: +3:10
- let _7: i32; // in scope 3 at $DIR/checked.rs:+5:9: +5:10
- scope 4 {
- debug d => _7; // in scope 4 at $DIR/checked.rs:+5:9: +5:10
- let _8: i32; // in scope 4 at $DIR/checked.rs:+6:9: +6:10
- scope 5 {
- debug e => _8; // in scope 5 at $DIR/checked.rs:+6:9: +6:10
- }
- }
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/checked.rs:+1:9: +1:10
- _1 = const 1_i32; // scope 0 at $DIR/checked.rs:+1:13: +1:14
- StorageLive(_2); // scope 1 at $DIR/checked.rs:+2:9: +2:10
- _2 = const 2_i32; // scope 1 at $DIR/checked.rs:+2:13: +2:14
- StorageLive(_3); // scope 2 at $DIR/checked.rs:+3:9: +3:10
- StorageLive(_4); // scope 2 at $DIR/checked.rs:+3:13: +3:14
-- _4 = _1; // scope 2 at $DIR/checked.rs:+3:13: +3:14
-+ _4 = const 1_i32; // scope 2 at $DIR/checked.rs:+3:13: +3:14
- StorageLive(_5); // scope 2 at $DIR/checked.rs:+3:17: +3:18
-- _5 = _2; // scope 2 at $DIR/checked.rs:+3:17: +3:18
-- _6 = CheckedAdd(_4, _5); // scope 2 at $DIR/checked.rs:+3:13: +3:18
-- assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, move _5) -> bb1; // scope 2 at $DIR/checked.rs:+3:13: +3:18
-+ _5 = const 2_i32; // scope 2 at $DIR/checked.rs:+3:17: +3:18
-+ _6 = CheckedAdd(const 1_i32, const 2_i32); // scope 2 at $DIR/checked.rs:+3:13: +3:18
-+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_i32, const 2_i32) -> bb1; // scope 2 at $DIR/checked.rs:+3:13: +3:18
- }
-
- bb1: {
-- _3 = move (_6.0: i32); // scope 2 at $DIR/checked.rs:+3:13: +3:18
-+ _3 = const 3_i32; // scope 2 at $DIR/checked.rs:+3:13: +3:18
- StorageDead(_5); // scope 2 at $DIR/checked.rs:+3:17: +3:18
- StorageDead(_4); // scope 2 at $DIR/checked.rs:+3:17: +3:18
- StorageLive(_7); // scope 3 at $DIR/checked.rs:+5:9: +5:10
- _7 = const _; // scope 3 at $DIR/checked.rs:+5:13: +5:21
- StorageLive(_8); // scope 4 at $DIR/checked.rs:+6:9: +6:10
- StorageLive(_9); // scope 4 at $DIR/checked.rs:+6:13: +6:14
-- _9 = _7; // scope 4 at $DIR/checked.rs:+6:13: +6:14
-- _10 = CheckedAdd(_9, const 1_i32); // scope 4 at $DIR/checked.rs:+6:13: +6:18
-- assert(!move (_10.1: bool), "attempt to compute `{} + {}`, which would overflow", move _9, const 1_i32) -> bb2; // scope 4 at $DIR/checked.rs:+6:13: +6:18
-+ _9 = const i32::MAX; // scope 4 at $DIR/checked.rs:+6:13: +6:14
-+ _10 = CheckedAdd(const i32::MAX, const 1_i32); // scope 4 at $DIR/checked.rs:+6:13: +6:18
-+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const i32::MAX, const 1_i32) -> bb2; // scope 4 at $DIR/checked.rs:+6:13: +6:18
- }
-
- bb2: {
-- _8 = move (_10.0: i32); // scope 4 at $DIR/checked.rs:+6:13: +6:18
-+ _8 = const i32::MIN; // scope 4 at $DIR/checked.rs:+6:13: +6:18
- StorageDead(_9); // scope 4 at $DIR/checked.rs:+6:17: +6:18
- _0 = const (); // scope 0 at $DIR/checked.rs:+0:11: +7:2
- StorageDead(_8); // scope 4 at $DIR/checked.rs:+7:1: +7:2
- StorageDead(_7); // scope 3 at $DIR/checked.rs:+7:1: +7:2
- StorageDead(_3); // scope 2 at $DIR/checked.rs:+7:1: +7:2
- StorageDead(_2); // scope 1 at $DIR/checked.rs:+7:1: +7:2
- StorageDead(_1); // scope 0 at $DIR/checked.rs:+7:1: +7:2
- return; // scope 0 at $DIR/checked.rs:+7:2: +7:2
- }
- }
-
diff --git a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff
new file mode 100644
index 000000000..4569ffe48
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff
@@ -0,0 +1,88 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _4: i32;
+ let mut _5: i32;
+ let mut _6: (i32, bool);
+ let mut _9: i32;
+ let mut _10: (i32, bool);
+ scope 1 {
+ debug a => _1;
+ let _2: i32;
+ scope 2 {
+ debug b => _2;
+ let _3: i32;
+ scope 3 {
+ debug c => _3;
+ let _7: i32;
+ scope 4 {
+ debug d => _7;
+ let _8: i32;
+ scope 5 {
+ debug e => _8;
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 1_i32;
+ StorageLive(_2);
+ _2 = const 2_i32;
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = _1;
++ _4 = const 1_i32;
+ StorageLive(_5);
+- _5 = _2;
+- _6 = CheckedAdd(_4, _5);
+- assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, move _5) -> [success: bb1, unwind unreachable];
++ _5 = const 2_i32;
++ _6 = const (3_i32, false);
++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_i32, const 2_i32) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _3 = move (_6.0: i32);
++ _3 = const 3_i32;
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_7);
+ _7 = const _;
+ StorageLive(_8);
+ StorageLive(_9);
+- _9 = _7;
+- _10 = CheckedAdd(_9, const 1_i32);
+- assert(!move (_10.1: bool), "attempt to compute `{} + {}`, which would overflow", move _9, const 1_i32) -> [success: bb2, unwind unreachable];
++ _9 = const i32::MAX;
++ _10 = const (i32::MIN, true);
++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const i32::MAX, const 1_i32) -> [success: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- _8 = move (_10.0: i32);
++ _8 = const i32::MIN;
+ StorageDead(_9);
+ _0 = const ();
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 00 00 00 80 01 __ __ __ │ .....░░░
++ }
++
++ ALLOC1 (size: 8, align: 4) {
++ 03 00 00 00 00 __ __ __ │ .....░░░
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff
new file mode 100644
index 000000000..aa7e404eb
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff
@@ -0,0 +1,88 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _4: i32;
+ let mut _5: i32;
+ let mut _6: (i32, bool);
+ let mut _9: i32;
+ let mut _10: (i32, bool);
+ scope 1 {
+ debug a => _1;
+ let _2: i32;
+ scope 2 {
+ debug b => _2;
+ let _3: i32;
+ scope 3 {
+ debug c => _3;
+ let _7: i32;
+ scope 4 {
+ debug d => _7;
+ let _8: i32;
+ scope 5 {
+ debug e => _8;
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 1_i32;
+ StorageLive(_2);
+ _2 = const 2_i32;
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = _1;
++ _4 = const 1_i32;
+ StorageLive(_5);
+- _5 = _2;
+- _6 = CheckedAdd(_4, _5);
+- assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, move _5) -> [success: bb1, unwind continue];
++ _5 = const 2_i32;
++ _6 = const (3_i32, false);
++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_i32, const 2_i32) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _3 = move (_6.0: i32);
++ _3 = const 3_i32;
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_7);
+ _7 = const _;
+ StorageLive(_8);
+ StorageLive(_9);
+- _9 = _7;
+- _10 = CheckedAdd(_9, const 1_i32);
+- assert(!move (_10.1: bool), "attempt to compute `{} + {}`, which would overflow", move _9, const 1_i32) -> [success: bb2, unwind continue];
++ _9 = const i32::MAX;
++ _10 = const (i32::MIN, true);
++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const i32::MAX, const 1_i32) -> [success: bb2, unwind continue];
+ }
+
+ bb2: {
+- _8 = move (_10.0: i32);
++ _8 = const i32::MIN;
+ StorageDead(_9);
+ _0 = const ();
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 00 00 00 80 01 __ __ __ │ .....░░░
++ }
++
++ ALLOC1 (size: 8, align: 4) {
++ 03 00 00 00 00 __ __ __ │ .....░░░
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/checked.rs b/tests/mir-opt/dataflow-const-prop/checked.rs
index 0f9f5a97f..f7fac8890 100644
--- a/tests/mir-opt/dataflow-const-prop/checked.rs
+++ b/tests/mir-opt/dataflow-const-prop/checked.rs
@@ -1,6 +1,7 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
// unit-test: DataflowConstProp
// compile-flags: -Coverflow-checks=on
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR checked.main.DataflowConstProp.diff
#[allow(arithmetic_overflow)]
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..8363783e6
--- /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 std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined std::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: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+- _2 = Box::<[bool]>(_3, const std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+- _1 = A { foo: move _2 };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC2 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
++ }
++
++ ALLOC1 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
+ }
+
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..19326b6a9
--- /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 std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined std::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: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+- _2 = Box::<[bool]>(_3, const std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+- _1 = A { foo: move _2 };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind: bb2];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb2 (cleanup): {
+ resume;
+ }
++ }
++
++ ALLOC2 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
++ }
++
++ ALLOC1 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 01 00 00 00 00 00 00 00 │ ........
+ }
+
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..0d1e2430c
--- /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 std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined std::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: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+- _2 = Box::<[bool]>(_3, const std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+- _1 = A { foo: move _2 };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC2 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
++ }
++
++ ALLOC1 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
++ }
++
++ ALLOC0 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
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..35f1e5ba7
--- /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 std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined std::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: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+- _2 = Box::<[bool]>(_3, const std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+- _1 = A { foo: move _2 };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind: bb2];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb2 (cleanup): {
+ resume;
+ }
++ }
++
++ ALLOC2 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
++ }
++
++ ALLOC1 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
++ }
++
++ ALLOC0 (size: 16, align: 8) {
++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
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..ddfe2e8c8
--- /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 std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined std::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: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+ }
+
+ ALLOC2 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ ALLOC1 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
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..861295faa
--- /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 std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined std::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: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind: bb2];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb2 (cleanup): {
+ resume;
+ }
+ }
+
+ ALLOC2 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ ALLOC1 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
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..cbb639edc
--- /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 std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined std::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: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+ }
+
+ ALLOC2 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
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..656846e9f
--- /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 std::ptr::mut_ptr::<impl *mut [bool; 0]>::is_null) {
+ debug self => _6;
+ let mut _9: *mut u8;
+ scope 15 {
+ scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _9;
+ scope 17 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _9;
+ scope 18 {
+ scope 19 (inlined std::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: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ StorageDead(_4);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ StorageDead(_3);
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind: bb2];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb2 (cleanup): {
+ resume;
+ }
+ }
+
+ ALLOC2 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
+ ALLOC0 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
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..1bb052736
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs
@@ -0,0 +1,18 @@
+// skip-filecheck
+// 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.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..775325c4d
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.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.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.multiple.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.diff
deleted file mode 100644
index c4002d65e..000000000
--- a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.diff
+++ /dev/null
@@ -1,82 +0,0 @@
-- // MIR for `multiple` before DataflowConstProp
-+ // MIR for `multiple` after DataflowConstProp
-
- fn multiple(_1: bool, _2: u8) -> () {
- debug x => _1; // in scope 0 at $DIR/enum.rs:+0:13: +0:14
- debug i => _2; // in scope 0 at $DIR/enum.rs:+0:22: +0:23
- let mut _0: (); // return place in scope 0 at $DIR/enum.rs:+0:29: +0:29
- let _3: std::option::Option<u8>; // in scope 0 at $DIR/enum.rs:+1:9: +1:10
- let mut _4: bool; // in scope 0 at $DIR/enum.rs:+1:16: +1:17
- let mut _5: u8; // in scope 0 at $DIR/enum.rs:+2:14: +2:15
- let mut _7: isize; // in scope 0 at $DIR/enum.rs:+9:23: +9:30
- scope 1 {
- debug e => _3; // in scope 1 at $DIR/enum.rs:+1:9: +1:10
- let _6: u8; // in scope 1 at $DIR/enum.rs:+9:9: +9:10
- let _8: u8; // in scope 1 at $DIR/enum.rs:+9:28: +9:29
- scope 2 {
- debug x => _6; // in scope 2 at $DIR/enum.rs:+9:9: +9:10
- let _9: u8; // in scope 2 at $DIR/enum.rs:+11:9: +11:10
- scope 4 {
- debug y => _9; // in scope 4 at $DIR/enum.rs:+11:9: +11:10
- }
- }
- scope 3 {
- debug i => _8; // in scope 3 at $DIR/enum.rs:+9:28: +9:29
- }
- }
-
- bb0: {
- StorageLive(_3); // scope 0 at $DIR/enum.rs:+1:9: +1:10
- StorageLive(_4); // scope 0 at $DIR/enum.rs:+1:16: +1:17
- _4 = _1; // scope 0 at $DIR/enum.rs:+1:16: +1:17
- switchInt(move _4) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/enum.rs:+1:16: +1:17
- }
-
- bb1: {
- StorageLive(_5); // scope 0 at $DIR/enum.rs:+2:14: +2:15
- _5 = _2; // scope 0 at $DIR/enum.rs:+2:14: +2:15
- _3 = Option::<u8>::Some(move _5); // scope 0 at $DIR/enum.rs:+2:9: +2:16
- StorageDead(_5); // scope 0 at $DIR/enum.rs:+2:15: +2:16
- goto -> bb3; // scope 0 at $DIR/enum.rs:+1:13: +5:6
- }
-
- bb2: {
- _3 = Option::<u8>::None; // scope 0 at $DIR/enum.rs:+4:9: +4:13
- goto -> bb3; // scope 0 at $DIR/enum.rs:+1:13: +5:6
- }
-
- bb3: {
- StorageDead(_4); // scope 0 at $DIR/enum.rs:+5:5: +5:6
- StorageLive(_6); // scope 1 at $DIR/enum.rs:+9:9: +9:10
- _7 = discriminant(_3); // scope 1 at $DIR/enum.rs:+9:19: +9:20
- switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb5]; // scope 1 at $DIR/enum.rs:+9:13: +9:20
- }
-
- bb4: {
- _6 = const 0_u8; // scope 1 at $DIR/enum.rs:+9:45: +9:46
- goto -> bb7; // scope 1 at $DIR/enum.rs:+9:45: +9:46
- }
-
- bb5: {
- unreachable; // scope 1 at $DIR/enum.rs:+9:19: +9:20
- }
-
- bb6: {
- StorageLive(_8); // scope 1 at $DIR/enum.rs:+9:28: +9:29
- _8 = ((_3 as Some).0: u8); // scope 1 at $DIR/enum.rs:+9:28: +9:29
- _6 = _8; // scope 3 at $DIR/enum.rs:+9:34: +9:35
- StorageDead(_8); // scope 1 at $DIR/enum.rs:+9:34: +9:35
- goto -> bb7; // scope 1 at $DIR/enum.rs:+9:34: +9:35
- }
-
- bb7: {
- StorageLive(_9); // scope 2 at $DIR/enum.rs:+11:9: +11:10
- _9 = _6; // scope 2 at $DIR/enum.rs:+11:13: +11:14
- _0 = const (); // scope 0 at $DIR/enum.rs:+0:29: +12:2
- StorageDead(_9); // scope 2 at $DIR/enum.rs:+12:1: +12:2
- StorageDead(_6); // scope 1 at $DIR/enum.rs:+12:1: +12:2
- StorageDead(_3); // scope 0 at $DIR/enum.rs:+12:1: +12:2
- return; // scope 0 at $DIR/enum.rs:+12:2: +12:2
- }
- }
-
diff --git a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..960e69ee9
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.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.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.mutate_discriminant.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.diff
deleted file mode 100644
index 038e6c6bd..000000000
--- a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.diff
+++ /dev/null
@@ -1,26 +0,0 @@
-- // MIR for `mutate_discriminant` before DataflowConstProp
-+ // MIR for `mutate_discriminant` after DataflowConstProp
-
- fn mutate_discriminant() -> u8 {
- let mut _0: u8; // return place in scope 0 at $DIR/enum.rs:+0:29: +0:31
- let mut _1: std::option::Option<NonZeroUsize>; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _2: isize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-
- bb0: {
- discriminant(_1) = 1; // scope 0 at $DIR/enum.rs:+4:13: +4:34
- (((_1 as variant#1).0: NonZeroUsize).0: usize) = const 0_usize; // scope 0 at $DIR/enum.rs:+6:13: +6:64
- _2 = discriminant(_1); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- switchInt(_2) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/enum.rs:+9:13: +12:14
- }
-
- bb1: {
- _0 = const 1_u8; // scope 0 at $DIR/enum.rs:+15:13: +15:20
- return; // scope 0 at $DIR/enum.rs:+16:13: +16:21
- }
-
- bb2: {
- _0 = const 2_u8; // scope 0 at $DIR/enum.rs:+19:13: +19:20
- unreachable; // scope 0 at $DIR/enum.rs:+20:13: +20:26
- }
- }
-
diff --git a/tests/mir-opt/dataflow-const-prop/enum.rs b/tests/mir-opt/dataflow-const-prop/enum.rs
index 79a20d7ef..e35c0e6e8 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.rs
+++ b/tests/mir-opt/dataflow-const-prop/enum.rs
@@ -1,9 +1,12 @@
+// skip-filecheck
// 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 +18,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 +84,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.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..798b0c041
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff
@@ -0,0 +1,68 @@
+- // 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);
++ _1 = const E::V1(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;
+ }
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 00 00 00 00 00 00 00 00 │ ........
+ }
+
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..798b0c041
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff
@@ -0,0 +1,68 @@
+- // 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);
++ _1 = const E::V1(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;
+ }
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 00 00 00 00 00 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.diff
deleted file mode 100644
index 22bdc35d6..000000000
--- a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.diff
+++ /dev/null
@@ -1,63 +0,0 @@
-- // MIR for `simple` before DataflowConstProp
-+ // MIR for `simple` after DataflowConstProp
-
- fn simple() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/enum.rs:+0:13: +0:13
- let _1: E; // in scope 0 at $DIR/enum.rs:+1:9: +1:10
- let mut _3: isize; // in scope 0 at $DIR/enum.rs:+2:23: +2:31
- scope 1 {
- debug e => _1; // in scope 1 at $DIR/enum.rs:+1:9: +1:10
- let _2: i32; // in scope 1 at $DIR/enum.rs:+2:9: +2:10
- let _4: i32; // in scope 1 at $DIR/enum.rs:+2:29: +2:30
- let _5: i32; // in scope 1 at $DIR/enum.rs:+2:44: +2:45
- scope 2 {
- debug x => _2; // in scope 2 at $DIR/enum.rs:+2:9: +2:10
- }
- scope 3 {
- debug x => _4; // in scope 3 at $DIR/enum.rs:+2:29: +2:30
- }
- scope 4 {
- debug x => _5; // in scope 4 at $DIR/enum.rs:+2:44: +2:45
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/enum.rs:+1:9: +1:10
- _1 = E::V1(const 0_i32); // scope 0 at $DIR/enum.rs:+1:13: +1:21
- StorageLive(_2); // scope 1 at $DIR/enum.rs:+2:9: +2:10
-- _3 = discriminant(_1); // scope 1 at $DIR/enum.rs:+2:19: +2:20
-- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 1 at $DIR/enum.rs:+2:13: +2:20
-+ _3 = const 0_isize; // scope 1 at $DIR/enum.rs:+2:19: +2:20
-+ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 1 at $DIR/enum.rs:+2:13: +2:20
- }
-
- bb1: {
- StorageLive(_5); // scope 1 at $DIR/enum.rs:+2:44: +2:45
- _5 = ((_1 as V2).0: i32); // scope 1 at $DIR/enum.rs:+2:44: +2:45
- _2 = _5; // scope 4 at $DIR/enum.rs:+2:50: +2:51
- StorageDead(_5); // scope 1 at $DIR/enum.rs:+2:50: +2:51
- goto -> bb4; // scope 1 at $DIR/enum.rs:+2:50: +2:51
- }
-
- bb2: {
- unreachable; // scope 1 at $DIR/enum.rs:+2:19: +2:20
- }
-
- bb3: {
- StorageLive(_4); // scope 1 at $DIR/enum.rs:+2:29: +2:30
-- _4 = ((_1 as V1).0: i32); // scope 1 at $DIR/enum.rs:+2:29: +2:30
-- _2 = _4; // scope 3 at $DIR/enum.rs:+2:35: +2:36
-+ _4 = const 0_i32; // scope 1 at $DIR/enum.rs:+2:29: +2:30
-+ _2 = const 0_i32; // scope 3 at $DIR/enum.rs:+2:35: +2:36
- StorageDead(_4); // scope 1 at $DIR/enum.rs:+2:35: +2:36
- goto -> bb4; // scope 1 at $DIR/enum.rs:+2:35: +2:36
- }
-
- bb4: {
- _0 = const (); // scope 0 at $DIR/enum.rs:+0:13: +3:2
- StorageDead(_2); // scope 1 at $DIR/enum.rs:+3:1: +3:2
- StorageDead(_1); // scope 0 at $DIR/enum.rs:+3:1: +3:2
- return; // scope 0 at $DIR/enum.rs:+3:2: +3:2
- }
- }
-
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..053981abe
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff
@@ -0,0 +1,131 @@
+- // 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);
++ _1 = const E::V1(0_i32);
+ 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;
+ }
++ }
++
++ ALLOC3 (size: 8, align: 4) {
++ 00 00 00 00 00 00 00 00 │ ........
+ }
+
+ ALLOC2 (static: RC, size: 4, align: 4) {
+ ╾ALLOC0<imm>╼ │ ╾──╼
+ }
+
+ ALLOC0 (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..d862bd93f
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff
@@ -0,0 +1,131 @@
+- // 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);
++ _1 = const E::V1(0_i32);
+ 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;
+ }
++ }
++
++ ALLOC3 (size: 8, align: 4) {
++ 00 00 00 00 00 00 00 00 │ ........
+ }
+
+ ALLOC2 (static: RC, size: 8, align: 8) {
+ ╾ALLOC0<imm>╼ │ ╾──────╼
+ }
+
+ ALLOC0 (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 32489b4bd..355f28b03 100644
--- a/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff
@@ -2,29 +2,29 @@
+ // MIR for `main` after DataflowConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/if.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/if.rs:+1:9: +1:10
- let mut _3: bool; // in scope 0 at $DIR/if.rs:+2:16: +2:22
- let mut _4: i32; // in scope 0 at $DIR/if.rs:+2:16: +2:17
- let mut _6: i32; // in scope 0 at $DIR/if.rs:+3:13: +3:14
- let mut _8: bool; // in scope 0 at $DIR/if.rs:+5:16: +5:22
- let mut _9: i32; // in scope 0 at $DIR/if.rs:+5:16: +5:17
- let mut _10: i32; // in scope 0 at $DIR/if.rs:+5:36: +5:37
- let mut _12: i32; // in scope 0 at $DIR/if.rs:+6:13: +6:14
+ let mut _0: ();
+ let _1: i32;
+ let mut _3: bool;
+ let mut _4: i32;
+ let mut _6: i32;
+ let mut _8: bool;
+ let mut _9: i32;
+ let mut _10: i32;
+ let mut _12: i32;
scope 1 {
- debug a => _1; // in scope 1 at $DIR/if.rs:+1:9: +1:10
- let _2: i32; // in scope 1 at $DIR/if.rs:+2:9: +2:10
+ debug a => _1;
+ let _2: i32;
scope 2 {
- debug b => _2; // in scope 2 at $DIR/if.rs:+2:9: +2:10
- let _5: i32; // in scope 2 at $DIR/if.rs:+3:9: +3:10
+ debug b => _2;
+ let _5: i32;
scope 3 {
- debug c => _5; // in scope 3 at $DIR/if.rs:+3:9: +3:10
- let _7: i32; // in scope 3 at $DIR/if.rs:+5:9: +5:10
+ debug c => _5;
+ let _7: i32;
scope 4 {
- debug d => _7; // in scope 4 at $DIR/if.rs:+5:9: +5:10
- let _11: i32; // in scope 4 at $DIR/if.rs:+6:9: +6:10
+ debug d => _7;
+ let _11: i32;
scope 5 {
- debug e => _11; // in scope 5 at $DIR/if.rs:+6:9: +6:10
+ debug e => _11;
}
}
}
@@ -32,81 +32,83 @@
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/if.rs:+1:9: +1:10
- _1 = const 1_i32; // scope 0 at $DIR/if.rs:+1:13: +1:14
- StorageLive(_2); // scope 1 at $DIR/if.rs:+2:9: +2:10
- StorageLive(_3); // scope 1 at $DIR/if.rs:+2:16: +2:22
- StorageLive(_4); // scope 1 at $DIR/if.rs:+2:16: +2:17
-- _4 = _1; // scope 1 at $DIR/if.rs:+2:16: +2:17
-- _3 = Eq(move _4, const 1_i32); // scope 1 at $DIR/if.rs:+2:16: +2:22
-+ _4 = const 1_i32; // scope 1 at $DIR/if.rs:+2:16: +2:17
-+ _3 = const true; // scope 1 at $DIR/if.rs:+2:16: +2:22
- StorageDead(_4); // scope 1 at $DIR/if.rs:+2:21: +2:22
-- switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/if.rs:+2:16: +2:22
-+ switchInt(const true) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/if.rs:+2:16: +2:22
+ StorageLive(_1);
+ _1 = const 1_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+ 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;
++ switchInt(const true) -> [0: bb2, otherwise: bb1];
}
bb1: {
- _2 = const 2_i32; // scope 1 at $DIR/if.rs:+2:25: +2:26
- goto -> bb3; // scope 1 at $DIR/if.rs:+2:13: +2:39
+ StorageDead(_4);
+ _2 = const 2_i32;
+ goto -> bb3;
}
bb2: {
- _2 = const 3_i32; // scope 1 at $DIR/if.rs:+2:36: +2:37
- goto -> bb3; // scope 1 at $DIR/if.rs:+2:13: +2:39
+ StorageDead(_4);
+ _2 = const 3_i32;
+ goto -> bb3;
}
bb3: {
- StorageDead(_3); // scope 1 at $DIR/if.rs:+2:38: +2:39
- StorageLive(_5); // scope 2 at $DIR/if.rs:+3:9: +3:10
- StorageLive(_6); // scope 2 at $DIR/if.rs:+3:13: +3:14
-- _6 = _2; // scope 2 at $DIR/if.rs:+3:13: +3:14
-- _5 = Add(move _6, const 1_i32); // scope 2 at $DIR/if.rs:+3:13: +3:18
-+ _6 = const 2_i32; // scope 2 at $DIR/if.rs:+3:13: +3:14
-+ _5 = const 3_i32; // scope 2 at $DIR/if.rs:+3:13: +3:18
- StorageDead(_6); // scope 2 at $DIR/if.rs:+3:17: +3:18
- StorageLive(_7); // scope 3 at $DIR/if.rs:+5:9: +5:10
- StorageLive(_8); // scope 3 at $DIR/if.rs:+5:16: +5:22
- StorageLive(_9); // scope 3 at $DIR/if.rs:+5:16: +5:17
-- _9 = _1; // scope 3 at $DIR/if.rs:+5:16: +5:17
-- _8 = Eq(move _9, const 1_i32); // scope 3 at $DIR/if.rs:+5:16: +5:22
-+ _9 = const 1_i32; // scope 3 at $DIR/if.rs:+5:16: +5:17
-+ _8 = const true; // scope 3 at $DIR/if.rs:+5:16: +5:22
- StorageDead(_9); // scope 3 at $DIR/if.rs:+5:21: +5:22
-- switchInt(move _8) -> [0: bb5, otherwise: bb4]; // scope 3 at $DIR/if.rs:+5:16: +5:22
-+ switchInt(const true) -> [0: bb5, otherwise: bb4]; // scope 3 at $DIR/if.rs:+5:16: +5:22
+ StorageDead(_3);
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = _2;
+- _5 = Add(move _6, const 1_i32);
++ _6 = const 2_i32;
++ _5 = const 3_i32;
+ StorageDead(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+ 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;
++ switchInt(const true) -> [0: bb5, otherwise: bb4];
}
bb4: {
-- _7 = _1; // scope 3 at $DIR/if.rs:+5:25: +5:26
-+ _7 = const 1_i32; // scope 3 at $DIR/if.rs:+5:25: +5:26
- goto -> bb6; // scope 3 at $DIR/if.rs:+5:13: +5:43
+ StorageDead(_9);
+- _7 = _1;
++ _7 = const 1_i32;
+ goto -> bb6;
}
bb5: {
- StorageLive(_10); // scope 3 at $DIR/if.rs:+5:36: +5:37
- _10 = _1; // scope 3 at $DIR/if.rs:+5:36: +5:37
- _7 = Add(move _10, const 1_i32); // scope 3 at $DIR/if.rs:+5:36: +5:41
- StorageDead(_10); // scope 3 at $DIR/if.rs:+5:40: +5:41
- goto -> bb6; // scope 3 at $DIR/if.rs:+5:13: +5:43
+ StorageDead(_9);
+ StorageLive(_10);
+ _10 = _1;
+ _7 = Add(move _10, const 1_i32);
+ StorageDead(_10);
+ goto -> bb6;
}
bb6: {
- StorageDead(_8); // scope 3 at $DIR/if.rs:+5:42: +5:43
- StorageLive(_11); // scope 4 at $DIR/if.rs:+6:9: +6:10
- StorageLive(_12); // scope 4 at $DIR/if.rs:+6:13: +6:14
-- _12 = _7; // scope 4 at $DIR/if.rs:+6:13: +6:14
-- _11 = Add(move _12, const 1_i32); // scope 4 at $DIR/if.rs:+6:13: +6:18
-+ _12 = const 1_i32; // scope 4 at $DIR/if.rs:+6:13: +6:14
-+ _11 = const 2_i32; // scope 4 at $DIR/if.rs:+6:13: +6:18
- StorageDead(_12); // scope 4 at $DIR/if.rs:+6:17: +6:18
- _0 = const (); // scope 0 at $DIR/if.rs:+0:11: +7:2
- StorageDead(_11); // scope 4 at $DIR/if.rs:+7:1: +7:2
- StorageDead(_7); // scope 3 at $DIR/if.rs:+7:1: +7:2
- StorageDead(_5); // scope 2 at $DIR/if.rs:+7:1: +7:2
- StorageDead(_2); // scope 1 at $DIR/if.rs:+7:1: +7:2
- StorageDead(_1); // scope 0 at $DIR/if.rs:+7:1: +7:2
- return; // scope 0 at $DIR/if.rs:+7:2: +7:2
+ StorageDead(_8);
+ StorageLive(_11);
+ StorageLive(_12);
+- _12 = _7;
+- _11 = Add(move _12, const 1_i32);
++ _12 = const 1_i32;
++ _11 = const 2_i32;
+ StorageDead(_12);
+ _0 = const ();
+ StorageDead(_11);
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/dataflow-const-prop/if.rs b/tests/mir-opt/dataflow-const-prop/if.rs
index 34fc35790..72aabbccf 100644
--- a/tests/mir-opt/dataflow-const-prop/if.rs
+++ b/tests/mir-opt/dataflow-const-prop/if.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR if.main.DataflowConstProp.diff
diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff
deleted file mode 100644
index 1edcc28e6..000000000
--- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff
+++ /dev/null
@@ -1,39 +0,0 @@
-- // MIR for `main` before DataflowConstProp
-+ // MIR for `main` after DataflowConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inherit_overflow.rs:+0:11: +0:11
- let mut _1: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- let mut _2: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- let mut _3: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- scope 1 {
- }
- scope 2 (inlined <u8 as Add>::add) { // at $DIR/inherit_overflow.rs:9:13: 9:47
- debug self => _2; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
- debug other => _3; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
- let mut _4: (u8, bool); // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- StorageLive(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- _2 = const u8::MAX; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- StorageLive(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- _3 = const 1_u8; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
-- _4 = CheckedAdd(_2, _3); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
-- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> bb1; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
-+ _4 = CheckedAdd(const u8::MAX, const 1_u8); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
-+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> bb1; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
- }
-
- bb1: {
-- _1 = move (_4.0: u8); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
-+ _1 = const 0_u8; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
- StorageDead(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- StorageDead(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
- StorageDead(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:47: +3:48
- _0 = const (); // scope 0 at $DIR/inherit_overflow.rs:+0:11: +4:2
- return; // scope 0 at $DIR/inherit_overflow.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff
new file mode 100644
index 000000000..09fc48043
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff
@@ -0,0 +1,45 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: u8;
+ let mut _2: u8;
+ let mut _3: u8;
+ scope 1 {
+ }
+ scope 2 (inlined #[track_caller] <u8 as Add>::add) {
+ debug self => _2;
+ debug other => _3;
+ let mut _4: (u8, bool);
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const u8::MAX;
+ StorageLive(_3);
+ _3 = const 1_u8;
+ StorageLive(_4);
+- _4 = CheckedAdd(_2, _3);
+- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable];
++ _4 = const (0_u8, true);
++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = move (_4.0: u8);
++ _1 = const 0_u8;
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
++ }
++
++ ALLOC0 (size: 2, align: 1) {
++ 00 01 │ ..
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff
new file mode 100644
index 000000000..c0b26080f
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff
@@ -0,0 +1,45 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: u8;
+ let mut _2: u8;
+ let mut _3: u8;
+ scope 1 {
+ }
+ scope 2 (inlined #[track_caller] <u8 as Add>::add) {
+ debug self => _2;
+ debug other => _3;
+ let mut _4: (u8, bool);
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const u8::MAX;
+ StorageLive(_3);
+ _3 = const 1_u8;
+ StorageLive(_4);
+- _4 = CheckedAdd(_2, _3);
+- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue];
++ _4 = const (0_u8, true);
++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = move (_4.0: u8);
++ _1 = const 0_u8;
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
++ }
++
++ ALLOC0 (size: 2, align: 1) {
++ 00 01 │ ..
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs b/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs
index 90349d527..664cbcb2c 100644
--- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs
+++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DataflowConstProp
// compile-flags: -Zmir-enable-passes=+Inline
diff --git a/tests/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff
index 5a8788497..3f65d3fff 100644
--- a/tests/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff
@@ -2,34 +2,34 @@
+ // MIR for `f` after DataflowConstProp
fn f() -> usize {
- let mut _0: usize; // return place in scope 0 at $DIR/issue_81605.rs:+0:11: +0:16
- let mut _1: usize; // in scope 0 at $DIR/issue_81605.rs:+1:9: +1:33
- let mut _2: bool; // in scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
+ let mut _0: usize;
+ let mut _1: usize;
+ let mut _2: bool;
bb0: {
- StorageLive(_1); // scope 0 at $DIR/issue_81605.rs:+1:9: +1:33
- StorageLive(_2); // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
- _2 = const true; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
-- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
-+ switchInt(const true) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const true;
+- switchInt(move _2) -> [0: bb2, otherwise: bb1];
++ switchInt(const true) -> [0: bb2, otherwise: bb1];
}
bb1: {
- _1 = const 1_usize; // scope 0 at $DIR/issue_81605.rs:+1:19: +1:20
- goto -> bb3; // scope 0 at $DIR/issue_81605.rs:+1:9: +1:33
+ _1 = const 1_usize;
+ goto -> bb3;
}
bb2: {
- _1 = const 2_usize; // scope 0 at $DIR/issue_81605.rs:+1:30: +1:31
- goto -> bb3; // scope 0 at $DIR/issue_81605.rs:+1:9: +1:33
+ _1 = const 2_usize;
+ goto -> bb3;
}
bb3: {
- StorageDead(_2); // scope 0 at $DIR/issue_81605.rs:+1:32: +1:33
-- _0 = Add(const 1_usize, move _1); // scope 0 at $DIR/issue_81605.rs:+1:5: +1:33
-+ _0 = const 2_usize; // scope 0 at $DIR/issue_81605.rs:+1:5: +1:33
- StorageDead(_1); // scope 0 at $DIR/issue_81605.rs:+1:32: +1:33
- return; // scope 0 at $DIR/issue_81605.rs:+2:2: +2:2
+ StorageDead(_2);
+- _0 = Add(const 1_usize, move _1);
++ _0 = const 2_usize;
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/dataflow-const-prop/issue_81605.rs b/tests/mir-opt/dataflow-const-prop/issue_81605.rs
index d75e2a28b..7c5eceb8a 100644
--- a/tests/mir-opt/dataflow-const-prop/issue_81605.rs
+++ b/tests/mir-opt/dataflow-const-prop/issue_81605.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR issue_81605.f.DataflowConstProp.diff
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..d611a54ba
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/large_array_index.rs
@@ -0,0 +1,10 @@
+// skip-filecheck
+// 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..16a45c8e9
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs
@@ -0,0 +1,11 @@
+// skip-filecheck
+// 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..f8f891750
--- /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, 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, [(0, 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, [(0, 2), (0, 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, [(0, 2), (0, 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..d4f8cb667
--- /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, 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, [(0, 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, [(0, 2), (0, 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, [(0, 2), (0, 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..7f166e4fa
--- /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, 0)]);
+ _1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = OffsetOf(Gamma<T>, [(0, 1)]);
+ _3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = OffsetOf(Delta<T>, [(0, 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>, [(0, 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..38ad6f798
--- /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, 0)]);
+ _1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = OffsetOf(Gamma<T>, [(0, 1)]);
+ _3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = OffsetOf(Delta<T>, [(0, 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>, [(0, 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..e71b3f59e
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.rs
@@ -0,0 +1,50 @@
+// skip-filecheck
+// 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/ref_without_sb.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.diff
deleted file mode 100644
index 70ef17afd..000000000
--- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.diff
+++ /dev/null
@@ -1,55 +0,0 @@
-- // MIR for `main` before DataflowConstProp
-+ // MIR for `main` after DataflowConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/ref_without_sb.rs:+0:11: +0:11
- let mut _1: i32; // in scope 0 at $DIR/ref_without_sb.rs:+1:9: +1:14
- let _2: (); // in scope 0 at $DIR/ref_without_sb.rs:+2:5: +2:15
- let mut _3: &i32; // in scope 0 at $DIR/ref_without_sb.rs:+2:12: +2:14
- let _4: &i32; // in scope 0 at $DIR/ref_without_sb.rs:+2:12: +2:14
- let _5: (); // in scope 0 at $DIR/ref_without_sb.rs:+4:5: +4:20
- scope 1 {
- debug a => _1; // in scope 1 at $DIR/ref_without_sb.rs:+1:9: +1:14
- let _6: i32; // in scope 1 at $DIR/ref_without_sb.rs:+6:9: +6:10
- scope 2 {
- debug b => _6; // in scope 2 at $DIR/ref_without_sb.rs:+6:9: +6:10
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/ref_without_sb.rs:+1:9: +1:14
- _1 = const 0_i32; // scope 0 at $DIR/ref_without_sb.rs:+1:17: +1:18
- StorageLive(_2); // scope 1 at $DIR/ref_without_sb.rs:+2:5: +2:15
- StorageLive(_3); // scope 1 at $DIR/ref_without_sb.rs:+2:12: +2:14
- StorageLive(_4); // scope 1 at $DIR/ref_without_sb.rs:+2:12: +2:14
- _4 = &_1; // scope 1 at $DIR/ref_without_sb.rs:+2:12: +2:14
- _3 = &(*_4); // scope 1 at $DIR/ref_without_sb.rs:+2:12: +2:14
- _2 = escape::<i32>(move _3) -> bb1; // scope 1 at $DIR/ref_without_sb.rs:+2:5: +2:15
- // mir::Constant
- // + span: $DIR/ref_without_sb.rs:13:5: 13:11
- // + literal: Const { ty: for<'a> fn(&'a i32) {escape::<i32>}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_3); // scope 1 at $DIR/ref_without_sb.rs:+2:14: +2:15
- StorageDead(_4); // scope 1 at $DIR/ref_without_sb.rs:+2:15: +2:16
- StorageDead(_2); // scope 1 at $DIR/ref_without_sb.rs:+2:15: +2:16
- _1 = const 1_i32; // scope 1 at $DIR/ref_without_sb.rs:+3:5: +3:10
- StorageLive(_5); // scope 1 at $DIR/ref_without_sb.rs:+4:5: +4:20
- _5 = some_function() -> bb2; // scope 1 at $DIR/ref_without_sb.rs:+4:5: +4:20
- // mir::Constant
- // + span: $DIR/ref_without_sb.rs:15:5: 15:18
- // + literal: Const { ty: fn() {some_function}, val: Value(<ZST>) }
- }
-
- bb2: {
- StorageDead(_5); // scope 1 at $DIR/ref_without_sb.rs:+4:20: +4:21
- StorageLive(_6); // scope 1 at $DIR/ref_without_sb.rs:+6:9: +6:10
- _6 = _1; // scope 1 at $DIR/ref_without_sb.rs:+6:13: +6:14
- _0 = const (); // scope 0 at $DIR/ref_without_sb.rs:+0:11: +7:2
- StorageDead(_6); // scope 1 at $DIR/ref_without_sb.rs:+7:1: +7:2
- StorageDead(_1); // scope 0 at $DIR/ref_without_sb.rs:+7:1: +7:2
- return; // scope 0 at $DIR/ref_without_sb.rs:+7:2: +7:2
- }
- }
-
diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff
new file mode 100644
index 000000000..fbbfd61bb
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff
@@ -0,0 +1,49 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+ let _2: ();
+ let mut _3: &i32;
+ let _4: &i32;
+ let _5: ();
+ scope 1 {
+ debug a => _1;
+ let _6: i32;
+ scope 2 {
+ debug b => _6;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 0_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &_1;
+ _3 = &(*_4);
+ _2 = escape::<i32>(move _3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_4);
+ StorageDead(_2);
+ _1 = const 1_i32;
+ StorageLive(_5);
+ _5 = some_function() -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageLive(_6);
+ _6 = _1;
+ _0 = const ();
+ StorageDead(_6);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff
new file mode 100644
index 000000000..4e1d26acf
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff
@@ -0,0 +1,49 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+ let _2: ();
+ let mut _3: &i32;
+ let _4: &i32;
+ let _5: ();
+ scope 1 {
+ debug a => _1;
+ let _6: i32;
+ scope 2 {
+ debug b => _6;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 0_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &_1;
+ _3 = &(*_4);
+ _2 = escape::<i32>(move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_4);
+ StorageDead(_2);
+ _1 = const 1_i32;
+ StorageLive(_5);
+ _5 = some_function() -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageLive(_6);
+ _6 = _1;
+ _0 = const ();
+ StorageDead(_6);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs
index f53de3cf2..2851c0590 100644
--- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs
+++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DataflowConstProp
#[inline(never)]
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..b82448194
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/repeat.rs
@@ -0,0 +1,9 @@
+// skip-filecheck
+// 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/repr_transparent.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff
index 8f045eedf..98bd40ab2 100644
--- a/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff
@@ -2,41 +2,50 @@
+ // MIR for `main` after DataflowConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/repr_transparent.rs:+0:11: +0:11
- let _1: I32; // in scope 0 at $DIR/repr_transparent.rs:+1:9: +1:10
- let mut _3: i32; // in scope 0 at $DIR/repr_transparent.rs:+2:17: +2:26
- let mut _4: i32; // in scope 0 at $DIR/repr_transparent.rs:+2:17: +2:20
- let mut _5: i32; // in scope 0 at $DIR/repr_transparent.rs:+2:23: +2:26
+ let mut _0: ();
+ let _1: I32;
+ let mut _3: i32;
+ let mut _4: i32;
+ let mut _5: i32;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/repr_transparent.rs:+1:9: +1:10
- let _2: I32; // in scope 1 at $DIR/repr_transparent.rs:+2:9: +2:10
+ debug x => _1;
+ let _2: I32;
scope 2 {
- debug y => _2; // in scope 2 at $DIR/repr_transparent.rs:+2:9: +2:10
+ debug y => _2;
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/repr_transparent.rs:+1:9: +1:10
- _1 = I32(const 0_i32); // scope 0 at $DIR/repr_transparent.rs:+1:13: +1:19
- StorageLive(_2); // scope 1 at $DIR/repr_transparent.rs:+2:9: +2:10
- StorageLive(_3); // scope 1 at $DIR/repr_transparent.rs:+2:17: +2:26
- StorageLive(_4); // scope 1 at $DIR/repr_transparent.rs:+2:17: +2:20
-- _4 = (_1.0: i32); // scope 1 at $DIR/repr_transparent.rs:+2:17: +2:20
-+ _4 = const 0_i32; // scope 1 at $DIR/repr_transparent.rs:+2:17: +2:20
- StorageLive(_5); // scope 1 at $DIR/repr_transparent.rs:+2:23: +2:26
-- _5 = (_1.0: i32); // scope 1 at $DIR/repr_transparent.rs:+2:23: +2:26
-- _3 = Add(move _4, move _5); // scope 1 at $DIR/repr_transparent.rs:+2:17: +2:26
-+ _5 = const 0_i32; // scope 1 at $DIR/repr_transparent.rs:+2:23: +2:26
-+ _3 = const 0_i32; // scope 1 at $DIR/repr_transparent.rs:+2:17: +2:26
- StorageDead(_5); // scope 1 at $DIR/repr_transparent.rs:+2:25: +2:26
- StorageDead(_4); // scope 1 at $DIR/repr_transparent.rs:+2:25: +2:26
-- _2 = I32(move _3); // scope 1 at $DIR/repr_transparent.rs:+2:13: +2:27
-+ _2 = I32(const 0_i32); // scope 1 at $DIR/repr_transparent.rs:+2:13: +2:27
- StorageDead(_3); // scope 1 at $DIR/repr_transparent.rs:+2:26: +2:27
- _0 = const (); // scope 0 at $DIR/repr_transparent.rs:+0:11: +3:2
- StorageDead(_2); // scope 1 at $DIR/repr_transparent.rs:+3:1: +3:2
- StorageDead(_1); // scope 0 at $DIR/repr_transparent.rs:+3:1: +3:2
- return; // scope 0 at $DIR/repr_transparent.rs:+3:2: +3:2
+ StorageLive(_1);
+- _1 = I32(const 0_i32);
++ _1 = const I32(0_i32);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = (_1.0: i32);
++ _4 = const 0_i32;
+ StorageLive(_5);
+- _5 = (_1.0: i32);
+- _3 = Add(move _4, move _5);
++ _5 = const 0_i32;
++ _3 = const 0_i32;
+ StorageDead(_5);
+ StorageDead(_4);
+- _2 = I32(move _3);
++ _2 = const I32(0_i32);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
++ }
++
++ ALLOC0 (size: 4, align: 4) {
++ 00 00 00 00 │ ....
++ }
++
++ ALLOC1 (size: 4, align: 4) {
++ 00 00 00 00 │ ....
}
diff --git a/tests/mir-opt/dataflow-const-prop/repr_transparent.rs b/tests/mir-opt/dataflow-const-prop/repr_transparent.rs
index 4ce0ca4df..8cbed6fbb 100644
--- a/tests/mir-opt/dataflow-const-prop/repr_transparent.rs
+++ b/tests/mir-opt/dataflow-const-prop/repr_transparent.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// The struct has scalar ABI, but is not a scalar type.
diff --git a/tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff
index df08eff94..fbdbb3fa3 100644
--- a/tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff
@@ -2,45 +2,45 @@
+ // MIR for `main` after DataflowConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/self_assign.rs:+0:11: +0:11
- let mut _1: i32; // in scope 0 at $DIR/self_assign.rs:+1:9: +1:14
- let mut _2: i32; // in scope 0 at $DIR/self_assign.rs:+2:9: +2:10
- let mut _3: i32; // in scope 0 at $DIR/self_assign.rs:+3:9: +3:10
- let mut _5: &i32; // in scope 0 at $DIR/self_assign.rs:+6:9: +6:10
- let mut _6: i32; // in scope 0 at $DIR/self_assign.rs:+7:9: +7:11
+ let mut _0: ();
+ let mut _1: i32;
+ let mut _2: i32;
+ let mut _3: i32;
+ let mut _5: &i32;
+ let mut _6: i32;
scope 1 {
- debug a => _1; // in scope 1 at $DIR/self_assign.rs:+1:9: +1:14
- let mut _4: &i32; // in scope 1 at $DIR/self_assign.rs:+5:9: +5:14
+ debug a => _1;
+ let mut _4: &i32;
scope 2 {
- debug b => _4; // in scope 2 at $DIR/self_assign.rs:+5:9: +5:14
+ debug b => _4;
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/self_assign.rs:+1:9: +1:14
- _1 = const 0_i32; // scope 0 at $DIR/self_assign.rs:+1:17: +1:18
- StorageLive(_2); // scope 1 at $DIR/self_assign.rs:+2:9: +2:10
- _2 = _1; // scope 1 at $DIR/self_assign.rs:+2:9: +2:10
- _1 = Add(move _2, const 1_i32); // scope 1 at $DIR/self_assign.rs:+2:5: +2:14
- StorageDead(_2); // scope 1 at $DIR/self_assign.rs:+2:13: +2:14
- StorageLive(_3); // scope 1 at $DIR/self_assign.rs:+3:9: +3:10
- _3 = _1; // scope 1 at $DIR/self_assign.rs:+3:9: +3:10
- _1 = move _3; // scope 1 at $DIR/self_assign.rs:+3:5: +3:10
- StorageDead(_3); // scope 1 at $DIR/self_assign.rs:+3:9: +3:10
- StorageLive(_4); // scope 1 at $DIR/self_assign.rs:+5:9: +5:14
- _4 = &_1; // scope 1 at $DIR/self_assign.rs:+5:17: +5:19
- StorageLive(_5); // scope 2 at $DIR/self_assign.rs:+6:9: +6:10
- _5 = _4; // scope 2 at $DIR/self_assign.rs:+6:9: +6:10
- _4 = move _5; // scope 2 at $DIR/self_assign.rs:+6:5: +6:10
- StorageDead(_5); // scope 2 at $DIR/self_assign.rs:+6:9: +6:10
- StorageLive(_6); // scope 2 at $DIR/self_assign.rs:+7:9: +7:11
- _6 = (*_4); // scope 2 at $DIR/self_assign.rs:+7:9: +7:11
- _1 = move _6; // scope 2 at $DIR/self_assign.rs:+7:5: +7:11
- StorageDead(_6); // scope 2 at $DIR/self_assign.rs:+7:10: +7:11
- _0 = const (); // scope 0 at $DIR/self_assign.rs:+0:11: +8:2
- StorageDead(_4); // scope 1 at $DIR/self_assign.rs:+8:1: +8:2
- StorageDead(_1); // scope 0 at $DIR/self_assign.rs:+8:1: +8:2
- return; // scope 0 at $DIR/self_assign.rs:+8:2: +8:2
+ StorageLive(_1);
+ _1 = const 0_i32;
+ StorageLive(_2);
+ _2 = _1;
+ _1 = Add(move _2, const 1_i32);
+ StorageDead(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _1 = move _3;
+ StorageDead(_3);
+ StorageLive(_4);
+ _4 = &_1;
+ StorageLive(_5);
+ _5 = _4;
+ _4 = move _5;
+ StorageDead(_5);
+ StorageLive(_6);
+ _6 = (*_4);
+ _1 = move _6;
+ StorageDead(_6);
+ _0 = const ();
+ StorageDead(_4);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/dataflow-const-prop/self_assign.rs b/tests/mir-opt/dataflow-const-prop/self_assign.rs
index 8de2195f9..c5866c4a9 100644
--- a/tests/mir-opt/dataflow-const-prop/self_assign.rs
+++ b/tests/mir-opt/dataflow-const-prop/self_assign.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR self_assign.main.DataflowConstProp.diff
diff --git a/tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff
index c09e4061e..e2468a964 100644
--- a/tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff
@@ -2,22 +2,22 @@
+ // MIR for `main` after DataflowConstProp
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/self_assign_add.rs:+0:11: +0:11
- let mut _1: i32; // in scope 0 at $DIR/self_assign_add.rs:+1:9: +1:14
+ let mut _0: ();
+ let mut _1: i32;
scope 1 {
- debug a => _1; // in scope 1 at $DIR/self_assign_add.rs:+1:9: +1:14
+ debug a => _1;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/self_assign_add.rs:+1:9: +1:14
- _1 = const 0_i32; // scope 0 at $DIR/self_assign_add.rs:+1:17: +1:18
-- _1 = Add(_1, const 1_i32); // scope 1 at $DIR/self_assign_add.rs:+2:5: +2:11
-- _1 = Add(_1, const 1_i32); // scope 1 at $DIR/self_assign_add.rs:+3:5: +3:11
-+ _1 = const 1_i32; // scope 1 at $DIR/self_assign_add.rs:+2:5: +2:11
-+ _1 = const 2_i32; // scope 1 at $DIR/self_assign_add.rs:+3:5: +3:11
- _0 = const (); // scope 0 at $DIR/self_assign_add.rs:+0:11: +4:2
- StorageDead(_1); // scope 0 at $DIR/self_assign_add.rs:+4:1: +4:2
- return; // scope 0 at $DIR/self_assign_add.rs:+4:2: +4:2
+ StorageLive(_1);
+ _1 = const 0_i32;
+- _1 = Add(_1, const 1_i32);
+- _1 = Add(_1, const 1_i32);
++ _1 = const 1_i32;
++ _1 = const 2_i32;
+ _0 = const ();
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/dataflow-const-prop/self_assign_add.rs b/tests/mir-opt/dataflow-const-prop/self_assign_add.rs
index e32827624..cfe1458e4 100644
--- a/tests/mir-opt/dataflow-const-prop/self_assign_add.rs
+++ b/tests/mir-opt/dataflow-const-prop/self_assign_add.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR self_assign_add.main.DataflowConstProp.diff
diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.diff
deleted file mode 100644
index 6ca569f3d..000000000
--- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.diff
+++ /dev/null
@@ -1,54 +0,0 @@
-- // MIR for `main` before DataflowConstProp
-+ // MIR for `main` after DataflowConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/sibling_ptr.rs:+0:11: +0:11
- let mut _1: (u8, u8); // in scope 0 at $DIR/sibling_ptr.rs:+1:9: +1:14
- let _2: (); // in scope 0 at $DIR/sibling_ptr.rs:+2:5: +5:6
- let mut _4: *mut u8; // in scope 0 at $DIR/sibling_ptr.rs:+4:10: +4:18
- let mut _5: *mut u8; // in scope 0 at $DIR/sibling_ptr.rs:+4:10: +4:11
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/sibling_ptr.rs:+1:9: +1:14
- let _6: u8; // in scope 1 at $DIR/sibling_ptr.rs:+6:9: +6:11
- scope 2 {
- let _3: *mut u8; // in scope 2 at $DIR/sibling_ptr.rs:+3:13: +3:14
- scope 3 {
- debug p => _3; // in scope 3 at $DIR/sibling_ptr.rs:+3:13: +3:14
- }
- }
- scope 4 {
- debug x1 => _6; // in scope 4 at $DIR/sibling_ptr.rs:+6:9: +6:11
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/sibling_ptr.rs:+1:9: +1:14
- _1 = (const 0_u8, const 0_u8); // scope 0 at $DIR/sibling_ptr.rs:+1:27: +1:33
- StorageLive(_2); // scope 1 at $DIR/sibling_ptr.rs:+2:5: +5:6
- StorageLive(_3); // scope 2 at $DIR/sibling_ptr.rs:+3:13: +3:14
- _3 = &raw mut (_1.0: u8); // scope 2 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- StorageLive(_4); // scope 3 at $DIR/sibling_ptr.rs:+4:10: +4:18
- StorageLive(_5); // scope 3 at $DIR/sibling_ptr.rs:+4:10: +4:11
- _5 = _3; // scope 3 at $DIR/sibling_ptr.rs:+4:10: +4:11
- _4 = ptr::mut_ptr::<impl *mut u8>::add(move _5, const 1_usize) -> bb1; // scope 3 at $DIR/sibling_ptr.rs:+4:10: +4:18
- // mir::Constant
- // + span: $DIR/sibling_ptr.rs:16:12: 16:15
- // + literal: Const { ty: unsafe fn(*mut u8, usize) -> *mut u8 {ptr::mut_ptr::<impl *mut u8>::add}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_5); // scope 3 at $DIR/sibling_ptr.rs:+4:17: +4:18
- (*_4) = const 1_u8; // scope 3 at $DIR/sibling_ptr.rs:+4:9: +4:22
- StorageDead(_4); // scope 3 at $DIR/sibling_ptr.rs:+4:22: +4:23
- _2 = const (); // scope 2 at $DIR/sibling_ptr.rs:+2:5: +5:6
- StorageDead(_3); // scope 2 at $DIR/sibling_ptr.rs:+5:5: +5:6
- StorageDead(_2); // scope 1 at $DIR/sibling_ptr.rs:+5:5: +5:6
- StorageLive(_6); // scope 1 at $DIR/sibling_ptr.rs:+6:9: +6:11
- _6 = (_1.1: u8); // scope 1 at $DIR/sibling_ptr.rs:+6:14: +6:17
- _0 = const (); // scope 0 at $DIR/sibling_ptr.rs:+0:11: +7:2
- StorageDead(_6); // scope 1 at $DIR/sibling_ptr.rs:+7:1: +7:2
- StorageDead(_1); // scope 0 at $DIR/sibling_ptr.rs:+7:1: +7:2
- return; // scope 0 at $DIR/sibling_ptr.rs:+7:2: +7:2
- }
- }
-
diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff
new file mode 100644
index 000000000..9b0093c45
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff
@@ -0,0 +1,51 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: (u8, u8);
+ let _2: ();
+ let mut _4: *mut u8;
+ let mut _5: *mut u8;
+ scope 1 {
+ debug x => _1;
+ let _6: u8;
+ scope 2 {
+ let _3: *mut u8;
+ scope 3 {
+ debug p => _3;
+ }
+ }
+ scope 4 {
+ debug x1 => _6;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = (const 0_u8, const 0_u8);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &raw mut (_1.0: u8);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _3;
+ _4 = std::ptr::mut_ptr::<impl *mut u8>::add(move _5, const 1_usize) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ (*_4) = const 1_u8;
+ StorageDead(_4);
+ _2 = const ();
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_6);
+ _6 = (_1.1: u8);
+ _0 = const ();
+ StorageDead(_6);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff
new file mode 100644
index 000000000..635a21425
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff
@@ -0,0 +1,51 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: (u8, u8);
+ let _2: ();
+ let mut _4: *mut u8;
+ let mut _5: *mut u8;
+ scope 1 {
+ debug x => _1;
+ let _6: u8;
+ scope 2 {
+ let _3: *mut u8;
+ scope 3 {
+ debug p => _3;
+ }
+ }
+ scope 4 {
+ debug x1 => _6;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = (const 0_u8, const 0_u8);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &raw mut (_1.0: u8);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _3;
+ _4 = std::ptr::mut_ptr::<impl *mut u8>::add(move _5, const 1_usize) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ (*_4) = const 1_u8;
+ StorageDead(_4);
+ _2 = const ();
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_6);
+ _6 = (_1.1: u8);
+ _0 = const ();
+ StorageDead(_6);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs
index 81fc3c2f4..68aff5286 100644
--- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs
+++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// This attempts to modify `x.1` via a pointer derived from `addr_of_mut!(x.0)`.
// According to Miri, that is UB. However, T-opsem has not finalized that
// decision and as such we cannot rely on it in optimizations. Consequently,
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..86266ef5d
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/slice_len.rs
@@ -0,0 +1,13 @@
+// skip-filecheck
+// 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..0f461f515
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff
@@ -0,0 +1,247 @@
+- // 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 _10: SmallStruct;
+ let mut _14: &&SmallStruct;
+ let mut _16: f32;
+ let mut _17: std::option::Option<S>;
+ let mut _18: &[f32];
+ let mut _22: BigStruct;
+ let mut _26: &&BigStruct;
+ let mut _28: f32;
+ let mut _29: std::option::Option<S>;
+ let mut _30: &[f32];
+ let mut _31: &SmallStruct;
+ let mut _32: &SmallStruct;
+ let mut _33: &SmallStruct;
+ let mut _34: &SmallStruct;
+ let mut _35: &BigStruct;
+ let mut _36: &BigStruct;
+ let mut _37: &BigStruct;
+ let mut _38: &BigStruct;
+ scope 1 {
+ debug s => _1;
+ let _2: i32;
+ scope 2 {
+ debug a => _2;
+ let _4: i32;
+ scope 3 {
+ debug b => _4;
+ let _7: f32;
+ let _8: std::option::Option<S>;
+ let _9: &[f32];
+ scope 4 {
+ debug a => _7;
+ debug b => _8;
+ debug c => _9;
+ let _11: f32;
+ let _12: std::option::Option<S>;
+ let _13: &[f32];
+ scope 5 {
+ debug a => _11;
+ debug b => _12;
+ debug c => _13;
+ let _15: SmallStruct;
+ scope 6 {
+ debug ss => _15;
+ let _19: f32;
+ let _20: std::option::Option<S>;
+ let _21: &[f32];
+ scope 7 {
+ debug a => _19;
+ debug b => _20;
+ debug c => _21;
+ let _23: f32;
+ let _24: std::option::Option<S>;
+ let _25: &[f32];
+ scope 8 {
+ debug a => _23;
+ debug b => _24;
+ debug c => _25;
+ let _27: BigStruct;
+ scope 9 {
+ debug bs => _27;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = S(const 1_i32);
++ _1 = const S(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(_10);
+ _10 = const _;
+ StorageLive(_7);
+- _7 = (_10.0: f32);
++ _7 = const 4f32;
+ StorageLive(_8);
+- _8 = (_10.1: std::option::Option<S>);
++ _8 = const Option::<S>::Some(S(1_i32));
+ StorageLive(_9);
+ _9 = (_10.2: &[f32]);
+ StorageDead(_10);
+ StorageLive(_14);
+ _14 = const {ALLOC4: &&SmallStruct};
+ _31 = deref_copy (*_14);
+ StorageLive(_11);
+ _32 = deref_copy (*_14);
+- _11 = ((*_32).0: f32);
++ _11 = const 9f32;
+ StorageLive(_12);
+ _33 = deref_copy (*_14);
+ _12 = ((*_33).1: std::option::Option<S>);
+ StorageLive(_13);
+ _34 = deref_copy (*_14);
+ _13 = ((*_34).2: &[f32]);
+ StorageDead(_14);
+ StorageLive(_15);
+ StorageLive(_16);
+- _16 = _11;
++ _16 = const 9f32;
+ StorageLive(_17);
+ _17 = _12;
+ StorageLive(_18);
+ _18 = _13;
+- _15 = SmallStruct(move _16, move _17, move _18);
++ _15 = SmallStruct(const 9f32, move _17, move _18);
+ StorageDead(_18);
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_22);
+ _22 = const _;
+ StorageLive(_19);
+- _19 = (_22.0: f32);
++ _19 = const 25f32;
+ StorageLive(_20);
+ _20 = (_22.1: std::option::Option<S>);
+ StorageLive(_21);
+ _21 = (_22.2: &[f32]);
+ StorageDead(_22);
+ StorageLive(_26);
+ _26 = const {ALLOC5: &&BigStruct};
+ _35 = deref_copy (*_26);
+ StorageLive(_23);
+ _36 = deref_copy (*_26);
+- _23 = ((*_36).0: f32);
++ _23 = const 82f32;
+ StorageLive(_24);
+ _37 = deref_copy (*_26);
+- _24 = ((*_37).1: std::option::Option<S>);
++ _24 = const Option::<S>::Some(S(35_i32));
+ StorageLive(_25);
+ _38 = deref_copy (*_26);
+ _25 = ((*_38).2: &[f32]);
+ StorageDead(_26);
+ StorageLive(_27);
+ StorageLive(_28);
+- _28 = _23;
++ _28 = const 82f32;
+ StorageLive(_29);
+- _29 = _24;
++ _29 = const Option::<S>::Some(S(35_i32));
+ StorageLive(_30);
+ _30 = _25;
+- _27 = BigStruct(move _28, move _29, move _30);
++ _27 = BigStruct(const 82f32, const Option::<S>::Some(S(35_i32)), move _30);
+ StorageDead(_30);
+ StorageDead(_29);
+ StorageDead(_28);
+ _0 = const ();
+ StorageDead(_27);
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_19);
+ StorageDead(_15);
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC6 (size: 8, align: 4) {
++ 01 00 00 00 23 00 00 00 │ ....#...
++ }
++
++ ALLOC7 (size: 8, align: 4) {
++ 01 00 00 00 23 00 00 00 │ ....#...
++ }
++
++ ALLOC8 (size: 8, align: 4) {
++ 01 00 00 00 23 00 00 00 │ ....#...
++ }
++
++ ALLOC9 (size: 8, align: 4) {
++ 01 00 00 00 01 00 00 00 │ ........
++ }
++
++ ALLOC10 (size: 4, align: 4) {
++ 01 00 00 00 │ ....
+ }
+
+ ALLOC5 (static: BIG_STAT, size: 4, align: 4) {
+ ╾ALLOC0<imm>╼ │ ╾──╼
+ }
+
+ ALLOC0 (size: 20, align: 4) {
+ 0x00 │ 01 00 00 00 23 00 00 00 ╾ALLOC1<imm>╼ 02 00 00 00 │ ....#...╾──╼....
+ 0x10 │ 00 00 a4 42 │ ...B
+ }
+
+ ALLOC1 (size: 8, align: 4) {
+ 00 00 34 42 00 00 90 42 │ ..4B...B
+ }
+
+ ALLOC4 (static: SMALL_STAT, size: 4, align: 4) {
+ ╾ALLOC2<imm>╼ │ ╾──╼
+ }
+
+ ALLOC2 (size: 20, align: 4) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC3<imm>╼ 01 00 00 00 │ ....░░░░╾──╼....
+ 0x10 │ 00 00 10 41 │ ...A
+ }
+
+ ALLOC3 (size: 4, align: 4) {
+ 00 00 50 41 │ ..PA
+ }
+
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..3c40ec8bf
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff
@@ -0,0 +1,247 @@
+- // 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 _10: SmallStruct;
+ let mut _14: &&SmallStruct;
+ let mut _16: f32;
+ let mut _17: std::option::Option<S>;
+ let mut _18: &[f32];
+ let mut _22: BigStruct;
+ let mut _26: &&BigStruct;
+ let mut _28: f32;
+ let mut _29: std::option::Option<S>;
+ let mut _30: &[f32];
+ let mut _31: &SmallStruct;
+ let mut _32: &SmallStruct;
+ let mut _33: &SmallStruct;
+ let mut _34: &SmallStruct;
+ let mut _35: &BigStruct;
+ let mut _36: &BigStruct;
+ let mut _37: &BigStruct;
+ let mut _38: &BigStruct;
+ scope 1 {
+ debug s => _1;
+ let _2: i32;
+ scope 2 {
+ debug a => _2;
+ let _4: i32;
+ scope 3 {
+ debug b => _4;
+ let _7: f32;
+ let _8: std::option::Option<S>;
+ let _9: &[f32];
+ scope 4 {
+ debug a => _7;
+ debug b => _8;
+ debug c => _9;
+ let _11: f32;
+ let _12: std::option::Option<S>;
+ let _13: &[f32];
+ scope 5 {
+ debug a => _11;
+ debug b => _12;
+ debug c => _13;
+ let _15: SmallStruct;
+ scope 6 {
+ debug ss => _15;
+ let _19: f32;
+ let _20: std::option::Option<S>;
+ let _21: &[f32];
+ scope 7 {
+ debug a => _19;
+ debug b => _20;
+ debug c => _21;
+ let _23: f32;
+ let _24: std::option::Option<S>;
+ let _25: &[f32];
+ scope 8 {
+ debug a => _23;
+ debug b => _24;
+ debug c => _25;
+ let _27: BigStruct;
+ scope 9 {
+ debug bs => _27;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = S(const 1_i32);
++ _1 = const S(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(_10);
+ _10 = const _;
+ StorageLive(_7);
+- _7 = (_10.0: f32);
++ _7 = const 4f32;
+ StorageLive(_8);
+- _8 = (_10.1: std::option::Option<S>);
++ _8 = const Option::<S>::Some(S(1_i32));
+ StorageLive(_9);
+ _9 = (_10.2: &[f32]);
+ StorageDead(_10);
+ StorageLive(_14);
+ _14 = const {ALLOC4: &&SmallStruct};
+ _31 = deref_copy (*_14);
+ StorageLive(_11);
+ _32 = deref_copy (*_14);
+- _11 = ((*_32).0: f32);
++ _11 = const 9f32;
+ StorageLive(_12);
+ _33 = deref_copy (*_14);
+ _12 = ((*_33).1: std::option::Option<S>);
+ StorageLive(_13);
+ _34 = deref_copy (*_14);
+ _13 = ((*_34).2: &[f32]);
+ StorageDead(_14);
+ StorageLive(_15);
+ StorageLive(_16);
+- _16 = _11;
++ _16 = const 9f32;
+ StorageLive(_17);
+ _17 = _12;
+ StorageLive(_18);
+ _18 = _13;
+- _15 = SmallStruct(move _16, move _17, move _18);
++ _15 = SmallStruct(const 9f32, move _17, move _18);
+ StorageDead(_18);
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_22);
+ _22 = const _;
+ StorageLive(_19);
+- _19 = (_22.0: f32);
++ _19 = const 25f32;
+ StorageLive(_20);
+ _20 = (_22.1: std::option::Option<S>);
+ StorageLive(_21);
+ _21 = (_22.2: &[f32]);
+ StorageDead(_22);
+ StorageLive(_26);
+ _26 = const {ALLOC5: &&BigStruct};
+ _35 = deref_copy (*_26);
+ StorageLive(_23);
+ _36 = deref_copy (*_26);
+- _23 = ((*_36).0: f32);
++ _23 = const 82f32;
+ StorageLive(_24);
+ _37 = deref_copy (*_26);
+- _24 = ((*_37).1: std::option::Option<S>);
++ _24 = const Option::<S>::Some(S(35_i32));
+ StorageLive(_25);
+ _38 = deref_copy (*_26);
+ _25 = ((*_38).2: &[f32]);
+ StorageDead(_26);
+ StorageLive(_27);
+ StorageLive(_28);
+- _28 = _23;
++ _28 = const 82f32;
+ StorageLive(_29);
+- _29 = _24;
++ _29 = const Option::<S>::Some(S(35_i32));
+ StorageLive(_30);
+ _30 = _25;
+- _27 = BigStruct(move _28, move _29, move _30);
++ _27 = BigStruct(const 82f32, const Option::<S>::Some(S(35_i32)), move _30);
+ StorageDead(_30);
+ StorageDead(_29);
+ StorageDead(_28);
+ _0 = const ();
+ StorageDead(_27);
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_19);
+ StorageDead(_15);
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC6 (size: 8, align: 4) {
++ 01 00 00 00 23 00 00 00 │ ....#...
++ }
++
++ ALLOC7 (size: 8, align: 4) {
++ 01 00 00 00 23 00 00 00 │ ....#...
++ }
++
++ ALLOC8 (size: 8, align: 4) {
++ 01 00 00 00 23 00 00 00 │ ....#...
++ }
++
++ ALLOC9 (size: 8, align: 4) {
++ 01 00 00 00 01 00 00 00 │ ........
++ }
++
++ ALLOC10 (size: 4, align: 4) {
++ 01 00 00 00 │ ....
+ }
+
+ ALLOC5 (static: BIG_STAT, size: 8, align: 8) {
+ ╾ALLOC0<imm>╼ │ ╾──────╼
+ }
+
+ ALLOC0 (size: 32, align: 8) {
+ 0x00 │ 01 00 00 00 23 00 00 00 ╾ALLOC1<imm>╼ │ ....#...╾──────╼
+ 0x10 │ 02 00 00 00 00 00 00 00 00 00 a4 42 __ __ __ __ │ ...........B░░░░
+ }
+
+ ALLOC1 (size: 8, align: 4) {
+ 00 00 34 42 00 00 90 42 │ ..4B...B
+ }
+
+ ALLOC4 (static: SMALL_STAT, size: 8, align: 8) {
+ ╾ALLOC2<imm>╼ │ ╾──────╼
+ }
+
+ ALLOC2 (size: 32, align: 8) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC3<imm>╼ │ ....░░░░╾──────╼
+ 0x10 │ 01 00 00 00 00 00 00 00 00 00 10 41 __ __ __ __ │ ...........A░░░░
+ }
+
+ ALLOC3 (size: 4, align: 4) {
+ 00 00 50 41 │ ..PA
+ }
+
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 53c62c081..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: (); // return place in scope 0 at $DIR/struct.rs:+0:11: +0:11
- let mut _1: S; // in scope 0 at $DIR/struct.rs:+1:9: +1:14
- let mut _3: i32; // in scope 0 at $DIR/struct.rs:+2:13: +2:16
- let mut _5: i32; // in scope 0 at $DIR/struct.rs:+4:13: +4:14
- let mut _6: i32; // in scope 0 at $DIR/struct.rs:+4:17: +4:20
- scope 1 {
- debug s => _1; // in scope 1 at $DIR/struct.rs:+1:9: +1:14
- let _2: i32; // in scope 1 at $DIR/struct.rs:+2:9: +2:10
- scope 2 {
- debug a => _2; // in scope 2 at $DIR/struct.rs:+2:9: +2:10
- let _4: i32; // in scope 2 at $DIR/struct.rs:+4:9: +4:10
- scope 3 {
- debug b => _4; // in scope 3 at $DIR/struct.rs:+4:9: +4:10
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/struct.rs:+1:9: +1:14
- _1 = S(const 1_i32); // scope 0 at $DIR/struct.rs:+1:17: +1:21
- StorageLive(_2); // scope 1 at $DIR/struct.rs:+2:9: +2:10
- StorageLive(_3); // scope 1 at $DIR/struct.rs:+2:13: +2:16
-- _3 = (_1.0: i32); // scope 1 at $DIR/struct.rs:+2:13: +2:16
-- _2 = Add(move _3, const 2_i32); // scope 1 at $DIR/struct.rs:+2:13: +2:20
-+ _3 = const 1_i32; // scope 1 at $DIR/struct.rs:+2:13: +2:16
-+ _2 = const 3_i32; // scope 1 at $DIR/struct.rs:+2:13: +2:20
- StorageDead(_3); // scope 1 at $DIR/struct.rs:+2:19: +2:20
- (_1.0: i32) = const 3_i32; // scope 2 at $DIR/struct.rs:+3:5: +3:12
- StorageLive(_4); // scope 2 at $DIR/struct.rs:+4:9: +4:10
- StorageLive(_5); // scope 2 at $DIR/struct.rs:+4:13: +4:14
-- _5 = _2; // scope 2 at $DIR/struct.rs:+4:13: +4:14
-+ _5 = const 3_i32; // scope 2 at $DIR/struct.rs:+4:13: +4:14
- StorageLive(_6); // scope 2 at $DIR/struct.rs:+4:17: +4:20
-- _6 = (_1.0: i32); // scope 2 at $DIR/struct.rs:+4:17: +4:20
-- _4 = Add(move _5, move _6); // scope 2 at $DIR/struct.rs:+4:13: +4:20
-+ _6 = const 3_i32; // scope 2 at $DIR/struct.rs:+4:17: +4:20
-+ _4 = const 6_i32; // scope 2 at $DIR/struct.rs:+4:13: +4:20
- StorageDead(_6); // scope 2 at $DIR/struct.rs:+4:19: +4:20
- StorageDead(_5); // scope 2 at $DIR/struct.rs:+4:19: +4:20
- _0 = const (); // scope 0 at $DIR/struct.rs:+0:11: +5:2
- StorageDead(_4); // scope 2 at $DIR/struct.rs:+5:1: +5:2
- StorageDead(_2); // scope 1 at $DIR/struct.rs:+5:1: +5:2
- StorageDead(_1); // scope 0 at $DIR/struct.rs:+5:1: +5:2
- return; // scope 0 at $DIR/struct.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/dataflow-const-prop/struct.rs b/tests/mir-opt/dataflow-const-prop/struct.rs
index 841b279e0..043981a29 100644
--- a/tests/mir-opt/dataflow-const-prop/struct.rs
+++ b/tests/mir-opt/dataflow-const-prop/struct.rs
@@ -1,11 +1,38 @@
+// skip-filecheck
// unit-test: DataflowConstProp
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+#[derive(Copy, Clone)]
struct S(i32);
+#[derive(Copy, Clone)]
+struct SmallStruct(f32, Option<S>, &'static [f32]);
+
+#[derive(Copy, Clone)]
+struct BigStruct(f32, Option<S>, &'static [f32]);
+
// 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 SMALL_VAL: SmallStruct = SmallStruct(4., Some(S(1)), &[]);
+ let SmallStruct(a, b, c) = SMALL_VAL;
+
+ static SMALL_STAT: &SmallStruct = &SmallStruct(9., None, &[13.]);
+ let SmallStruct(a, b, c) = *SMALL_STAT;
+
+ let ss = SmallStruct(a, b, c);
+
+ const BIG_VAL: BigStruct = BigStruct(25., None, &[]);
+ let BigStruct(a, b, c) = BIG_VAL;
+
+ static BIG_STAT: &BigStruct = &BigStruct(82., Some(S(35)), &[45., 72.]);
+ let BigStruct(a, b, c) = *BIG_STAT;
+
+ // We arbitrarily limit the size of synthetized values to 4 pointers.
+ // `BigStruct` can be read, but we will keep a MIR aggregate for this.
+ let bs = BigStruct(a, b, c);
}
diff --git a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff
deleted file mode 100644
index 9854beaeb..000000000
--- a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.diff
+++ /dev/null
@@ -1,40 +0,0 @@
-- // MIR for `main` before DataflowConstProp
-+ // MIR for `main` after DataflowConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/terminator.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/terminator.rs:+1:9: +1:10
- let _2: (); // in scope 0 at $DIR/terminator.rs:+3:5: +3:15
- let mut _3: i32; // in scope 0 at $DIR/terminator.rs:+3:9: +3:14
- let mut _4: i32; // in scope 0 at $DIR/terminator.rs:+3:9: +3:10
- scope 1 {
- debug a => _1; // in scope 1 at $DIR/terminator.rs:+1:9: +1:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/terminator.rs:+1:9: +1:10
- _1 = const 1_i32; // scope 0 at $DIR/terminator.rs:+1:13: +1:14
- StorageLive(_2); // scope 1 at $DIR/terminator.rs:+3:5: +3:15
- StorageLive(_3); // scope 1 at $DIR/terminator.rs:+3:9: +3:14
- StorageLive(_4); // scope 1 at $DIR/terminator.rs:+3:9: +3:10
-- _4 = _1; // scope 1 at $DIR/terminator.rs:+3:9: +3:10
-- _3 = Add(move _4, const 1_i32); // scope 1 at $DIR/terminator.rs:+3:9: +3:14
-+ _4 = const 1_i32; // scope 1 at $DIR/terminator.rs:+3:9: +3:10
-+ _3 = const 2_i32; // scope 1 at $DIR/terminator.rs:+3:9: +3:14
- StorageDead(_4); // scope 1 at $DIR/terminator.rs:+3:13: +3:14
-- _2 = foo(move _3) -> bb1; // scope 1 at $DIR/terminator.rs:+3:5: +3:15
-+ _2 = foo(const 2_i32) -> bb1; // scope 1 at $DIR/terminator.rs:+3:5: +3:15
- // mir::Constant
- // + span: $DIR/terminator.rs:10:5: 10:8
- // + literal: Const { ty: fn(i32) {foo}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_3); // scope 1 at $DIR/terminator.rs:+3:14: +3:15
- StorageDead(_2); // scope 1 at $DIR/terminator.rs:+3:15: +3:16
- _0 = const (); // scope 0 at $DIR/terminator.rs:+0:11: +4:2
- StorageDead(_1); // scope 0 at $DIR/terminator.rs:+4:1: +4:2
- return; // scope 0 at $DIR/terminator.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff
new file mode 100644
index 000000000..c0f378cc2
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff
@@ -0,0 +1,37 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let _2: ();
+ let mut _3: i32;
+ let mut _4: i32;
+ scope 1 {
+ debug a => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 1_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = _1;
+- _3 = Add(move _4, const 1_i32);
++ _4 = const 1_i32;
++ _3 = const 2_i32;
+ StorageDead(_4);
+- _2 = foo(move _3) -> [return: bb1, unwind unreachable];
++ _2 = foo(const 2_i32) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff
new file mode 100644
index 000000000..395620fec
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff
@@ -0,0 +1,37 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let _2: ();
+ let mut _3: i32;
+ let mut _4: i32;
+ scope 1 {
+ debug a => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 1_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = _1;
+- _3 = Add(move _4, const 1_i32);
++ _4 = const 1_i32;
++ _3 = const 2_i32;
+ StorageDead(_4);
+- _2 = foo(move _3) -> [return: bb1, unwind continue];
++ _2 = foo(const 2_i32) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/terminator.rs b/tests/mir-opt/dataflow-const-prop/terminator.rs
index 4f001df35..92a42f22c 100644
--- a/tests/mir-opt/dataflow-const-prop/terminator.rs
+++ b/tests/mir-opt/dataflow-const-prop/terminator.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DataflowConstProp
fn foo(n: i32) {}
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..bb85e4586
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.rs
@@ -0,0 +1,85 @@
+// 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 {
+ // CHECK-LABEL: fn less_as_i8(
+ // FIXME-CHECK: _0 = const -1_i8;
+ unsafe { transmute(std::cmp::Ordering::Less) }
+}
+
+// EMIT_MIR transmute.from_char.DataflowConstProp.diff
+pub fn from_char() -> i32 {
+ // CHECK-LABEL: fn from_char(
+ // CHECK: _0 = const 82_i32;
+ unsafe { transmute('R') }
+}
+
+// EMIT_MIR transmute.valid_char.DataflowConstProp.diff
+pub fn valid_char() -> char {
+ // CHECK-LABEL: fn valid_char(
+ // CHECK: _0 = const 'R';
+ unsafe { transmute(0x52_u32) }
+}
+
+// EMIT_MIR transmute.invalid_char.DataflowConstProp.diff
+pub unsafe fn invalid_char() -> char {
+ // CHECK-LABEL: fn invalid_char(
+ // CHECK: _0 = const {transmute(0x7fffffff): char};
+ unsafe { transmute(i32::MAX) }
+}
+
+// EMIT_MIR transmute.invalid_bool.DataflowConstProp.diff
+pub unsafe fn invalid_bool() -> bool {
+ // CHECK-LABEL: fn invalid_bool(
+ // CHECK: _0 = const {transmute(0xff): bool};
+ unsafe { transmute(-1_i8) }
+}
+
+// EMIT_MIR transmute.undef_union_as_integer.DataflowConstProp.diff
+pub unsafe fn undef_union_as_integer() -> u32 {
+ // CHECK-LABEL: fn undef_union_as_integer(
+ // CHECK: _1 = Union32 {
+ // CHECK: _0 = move _1 as u32 (Transmute);
+ union Union32 { value: u32, unit: () }
+ unsafe { transmute(Union32 { unit: () }) }
+}
+
+// EMIT_MIR transmute.unreachable_direct.DataflowConstProp.diff
+pub unsafe fn unreachable_direct() -> ! {
+ // CHECK-LABEL: fn unreachable_direct(
+ // CHECK: = const ();
+ // CHECK: = const ZeroSized: Never;
+ let x: Never = unsafe { transmute(()) };
+ match x {}
+}
+
+// EMIT_MIR transmute.unreachable_ref.DataflowConstProp.diff
+pub unsafe fn unreachable_ref() -> ! {
+ // CHECK-LABEL: fn unreachable_ref(
+ // CHECK: = const {0x1 as &Never};
+ let x: &Never = unsafe { transmute(1_usize) };
+ match *x {}
+}
+
+// EMIT_MIR transmute.unreachable_mut.DataflowConstProp.diff
+pub unsafe fn unreachable_mut() -> ! {
+ // CHECK-LABEL: fn unreachable_mut(
+ // CHECK: = const {0x1 as &mut Never};
+ let x: &mut Never = unsafe { transmute(1_usize) };
+ match *x {}
+}
+
+// EMIT_MIR transmute.unreachable_box.DataflowConstProp.diff
+pub unsafe fn unreachable_box() -> ! {
+ // CHECK-LABEL: fn unreachable_box(
+ // CHECK: = const Box::<Never>(
+ 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..fb28aa8f6
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff
@@ -0,0 +1,24 @@
+- // 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 };
++ _2 = const ();
++ _1 = Union32 { value: const () };
+ 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..fb28aa8f6
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff
@@ -0,0 +1,24 @@
+- // 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 };
++ _2 = const ();
++ _1 = Union32 { value: const () };
+ 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..5d17c47ae
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff
@@ -0,0 +1,22 @@
+- // MIR for `unreachable_box` before DataflowConstProp
++ // MIR for `unreachable_box` after DataflowConstProp
+
+ fn unreachable_box() -> ! {
+ let mut _0: !;
+ let _1: std::boxed::Box<Never>;
+ let mut _2: *const 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);
+ _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
+ 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..5d17c47ae
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff
@@ -0,0 +1,22 @@
+- // MIR for `unreachable_box` before DataflowConstProp
++ // MIR for `unreachable_box` after DataflowConstProp
+
+ fn unreachable_box() -> ! {
+ let mut _0: !;
+ let _1: std::boxed::Box<Never>;
+ let mut _2: *const 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);
+ _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
+ 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..c8d4d6edb
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff
@@ -0,0 +1,24 @@
+- // 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);
++ _2 = const ();
++ _1 = const ZeroSized: Never;
+ 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..c8d4d6edb
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff
@@ -0,0 +1,24 @@
+- // 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);
++ _2 = const ();
++ _1 = const ZeroSized: Never;
+ 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/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff
new file mode 100644
index 000000000..f5723cac7
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff
@@ -0,0 +1,112 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: (i32, i32);
+ let mut _3: i32;
+ let mut _4: i32;
+ let mut _5: i32;
+ let mut _7: i32;
+ let mut _8: i32;
+ let mut _9: i32;
+ let mut _10: i32;
+ let mut _12: i32;
+ let mut _13: (i32, i32);
+ let mut _14: i32;
+ scope 1 {
+ debug a => _1;
+ let _2: i32;
+ scope 2 {
+ debug b => _2;
+ let _6: i32;
+ scope 3 {
+ debug c => _6;
+ let _11: (i32, (i32, i32), i32);
+ scope 4 {
+ debug d => _11;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = (const 1_i32, const 2_i32);
++ _1 = const (1_i32, 2_i32);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = (_1.0: i32);
++ _4 = const 1_i32;
+ StorageLive(_5);
+- _5 = (_1.1: i32);
+- _3 = Add(move _4, move _5);
++ _5 = const 2_i32;
++ _3 = const 3_i32;
+ StorageDead(_5);
+ StorageDead(_4);
+- _2 = Add(move _3, const 3_i32);
++ _2 = const 6_i32;
+ StorageDead(_3);
+- _1 = (const 2_i32, const 3_i32);
++ _1 = const (2_i32, 3_i32);
+ StorageLive(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+- _8 = (_1.0: i32);
++ _8 = const 2_i32;
+ StorageLive(_9);
+- _9 = (_1.1: i32);
+- _7 = Add(move _8, move _9);
++ _9 = const 3_i32;
++ _7 = const 5_i32;
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_10);
+- _10 = _2;
+- _6 = Add(move _7, move _10);
++ _10 = const 6_i32;
++ _6 = const 11_i32;
+ StorageDead(_10);
+ StorageDead(_7);
+ StorageLive(_11);
+ StorageLive(_12);
+- _12 = _2;
++ _12 = const 6_i32;
+ StorageLive(_13);
+- _13 = _1;
++ _13 = const (2_i32, 3_i32);
+ StorageLive(_14);
+- _14 = _6;
+- _11 = (move _12, move _13, move _14);
++ _14 = const 11_i32;
++ _11 = (const 6_i32, const (2_i32, 3_i32), const 11_i32);
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageDead(_12);
+ _0 = const ();
+ StorageDead(_11);
+ StorageDead(_6);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 02 00 00 00 03 00 00 00 │ ........
++ }
++
++ ALLOC1 (size: 8, align: 4) {
++ 02 00 00 00 03 00 00 00 │ ........
++ }
++
++ ALLOC2 (size: 8, align: 4) {
++ 02 00 00 00 03 00 00 00 │ ........
++ }
++
++ ALLOC3 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..f5723cac7
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff
@@ -0,0 +1,112 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: (i32, i32);
+ let mut _3: i32;
+ let mut _4: i32;
+ let mut _5: i32;
+ let mut _7: i32;
+ let mut _8: i32;
+ let mut _9: i32;
+ let mut _10: i32;
+ let mut _12: i32;
+ let mut _13: (i32, i32);
+ let mut _14: i32;
+ scope 1 {
+ debug a => _1;
+ let _2: i32;
+ scope 2 {
+ debug b => _2;
+ let _6: i32;
+ scope 3 {
+ debug c => _6;
+ let _11: (i32, (i32, i32), i32);
+ scope 4 {
+ debug d => _11;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = (const 1_i32, const 2_i32);
++ _1 = const (1_i32, 2_i32);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = (_1.0: i32);
++ _4 = const 1_i32;
+ StorageLive(_5);
+- _5 = (_1.1: i32);
+- _3 = Add(move _4, move _5);
++ _5 = const 2_i32;
++ _3 = const 3_i32;
+ StorageDead(_5);
+ StorageDead(_4);
+- _2 = Add(move _3, const 3_i32);
++ _2 = const 6_i32;
+ StorageDead(_3);
+- _1 = (const 2_i32, const 3_i32);
++ _1 = const (2_i32, 3_i32);
+ StorageLive(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+- _8 = (_1.0: i32);
++ _8 = const 2_i32;
+ StorageLive(_9);
+- _9 = (_1.1: i32);
+- _7 = Add(move _8, move _9);
++ _9 = const 3_i32;
++ _7 = const 5_i32;
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_10);
+- _10 = _2;
+- _6 = Add(move _7, move _10);
++ _10 = const 6_i32;
++ _6 = const 11_i32;
+ StorageDead(_10);
+ StorageDead(_7);
+ StorageLive(_11);
+ StorageLive(_12);
+- _12 = _2;
++ _12 = const 6_i32;
+ StorageLive(_13);
+- _13 = _1;
++ _13 = const (2_i32, 3_i32);
+ StorageLive(_14);
+- _14 = _6;
+- _11 = (move _12, move _13, move _14);
++ _14 = const 11_i32;
++ _11 = (const 6_i32, const (2_i32, 3_i32), const 11_i32);
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageDead(_12);
+ _0 = const ();
+ StorageDead(_11);
+ StorageDead(_6);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 02 00 00 00 03 00 00 00 │ ........
++ }
++
++ ALLOC1 (size: 8, align: 4) {
++ 02 00 00 00 03 00 00 00 │ ........
++ }
++
++ ALLOC2 (size: 8, align: 4) {
++ 02 00 00 00 03 00 00 00 │ ........
++ }
++
++ ALLOC3 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.diff
deleted file mode 100644
index 8ce4ce4ba..000000000
--- a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.diff
+++ /dev/null
@@ -1,71 +0,0 @@
-- // MIR for `main` before DataflowConstProp
-+ // MIR for `main` after DataflowConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/tuple.rs:+0:11: +0:11
- let mut _1: (i32, i32); // in scope 0 at $DIR/tuple.rs:+1:9: +1:14
- let mut _3: i32; // in scope 0 at $DIR/tuple.rs:+2:13: +2:22
- let mut _4: i32; // in scope 0 at $DIR/tuple.rs:+2:13: +2:16
- let mut _5: i32; // in scope 0 at $DIR/tuple.rs:+2:19: +2:22
- let mut _7: i32; // in scope 0 at $DIR/tuple.rs:+4:13: +4:22
- let mut _8: i32; // in scope 0 at $DIR/tuple.rs:+4:13: +4:16
- let mut _9: i32; // in scope 0 at $DIR/tuple.rs:+4:19: +4:22
- let mut _10: i32; // in scope 0 at $DIR/tuple.rs:+4:25: +4:26
- scope 1 {
- debug a => _1; // in scope 1 at $DIR/tuple.rs:+1:9: +1:14
- let _2: i32; // in scope 1 at $DIR/tuple.rs:+2:9: +2:10
- scope 2 {
- debug b => _2; // in scope 2 at $DIR/tuple.rs:+2:9: +2:10
- let _6: i32; // in scope 2 at $DIR/tuple.rs:+4:9: +4:10
- scope 3 {
- debug c => _6; // in scope 3 at $DIR/tuple.rs:+4:9: +4:10
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/tuple.rs:+1:9: +1:14
- _1 = (const 1_i32, const 2_i32); // scope 0 at $DIR/tuple.rs:+1:17: +1:23
- StorageLive(_2); // scope 1 at $DIR/tuple.rs:+2:9: +2:10
- StorageLive(_3); // scope 1 at $DIR/tuple.rs:+2:13: +2:22
- StorageLive(_4); // scope 1 at $DIR/tuple.rs:+2:13: +2:16
-- _4 = (_1.0: i32); // scope 1 at $DIR/tuple.rs:+2:13: +2:16
-+ _4 = const 1_i32; // scope 1 at $DIR/tuple.rs:+2:13: +2:16
- StorageLive(_5); // scope 1 at $DIR/tuple.rs:+2:19: +2:22
-- _5 = (_1.1: i32); // scope 1 at $DIR/tuple.rs:+2:19: +2:22
-- _3 = Add(move _4, move _5); // scope 1 at $DIR/tuple.rs:+2:13: +2:22
-+ _5 = const 2_i32; // scope 1 at $DIR/tuple.rs:+2:19: +2:22
-+ _3 = const 3_i32; // scope 1 at $DIR/tuple.rs:+2:13: +2:22
- StorageDead(_5); // scope 1 at $DIR/tuple.rs:+2:21: +2:22
- StorageDead(_4); // scope 1 at $DIR/tuple.rs:+2:21: +2:22
-- _2 = Add(move _3, const 3_i32); // scope 1 at $DIR/tuple.rs:+2:13: +2:26
-+ _2 = const 6_i32; // scope 1 at $DIR/tuple.rs:+2:13: +2:26
- StorageDead(_3); // scope 1 at $DIR/tuple.rs:+2:25: +2:26
- _1 = (const 2_i32, const 3_i32); // scope 2 at $DIR/tuple.rs:+3:5: +3:15
- StorageLive(_6); // scope 2 at $DIR/tuple.rs:+4:9: +4:10
- StorageLive(_7); // scope 2 at $DIR/tuple.rs:+4:13: +4:22
- StorageLive(_8); // scope 2 at $DIR/tuple.rs:+4:13: +4:16
-- _8 = (_1.0: i32); // scope 2 at $DIR/tuple.rs:+4:13: +4:16
-+ _8 = const 2_i32; // scope 2 at $DIR/tuple.rs:+4:13: +4:16
- StorageLive(_9); // scope 2 at $DIR/tuple.rs:+4:19: +4:22
-- _9 = (_1.1: i32); // scope 2 at $DIR/tuple.rs:+4:19: +4:22
-- _7 = Add(move _8, move _9); // scope 2 at $DIR/tuple.rs:+4:13: +4:22
-+ _9 = const 3_i32; // scope 2 at $DIR/tuple.rs:+4:19: +4:22
-+ _7 = const 5_i32; // scope 2 at $DIR/tuple.rs:+4:13: +4:22
- StorageDead(_9); // scope 2 at $DIR/tuple.rs:+4:21: +4:22
- StorageDead(_8); // scope 2 at $DIR/tuple.rs:+4:21: +4:22
- StorageLive(_10); // scope 2 at $DIR/tuple.rs:+4:25: +4:26
-- _10 = _2; // scope 2 at $DIR/tuple.rs:+4:25: +4:26
-- _6 = Add(move _7, move _10); // scope 2 at $DIR/tuple.rs:+4:13: +4:26
-+ _10 = const 6_i32; // scope 2 at $DIR/tuple.rs:+4:25: +4:26
-+ _6 = const 11_i32; // scope 2 at $DIR/tuple.rs:+4:13: +4:26
- StorageDead(_10); // scope 2 at $DIR/tuple.rs:+4:25: +4:26
- StorageDead(_7); // scope 2 at $DIR/tuple.rs:+4:25: +4:26
- _0 = const (); // scope 0 at $DIR/tuple.rs:+0:11: +5:2
- StorageDead(_6); // scope 2 at $DIR/tuple.rs:+5:1: +5:2
- StorageDead(_2); // scope 1 at $DIR/tuple.rs:+5:1: +5:2
- StorageDead(_1); // scope 0 at $DIR/tuple.rs:+5:1: +5:2
- return; // scope 0 at $DIR/tuple.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/dataflow-const-prop/tuple.rs b/tests/mir-opt/dataflow-const-prop/tuple.rs
index 92c70eab0..bb706eafe 100644
--- a/tests/mir-opt/dataflow-const-prop/tuple.rs
+++ b/tests/mir-opt/dataflow-const-prop/tuple.rs
@@ -1,4 +1,6 @@
+// skip-filecheck
// unit-test: DataflowConstProp
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR tuple.main.DataflowConstProp.diff
fn main() {
@@ -6,4 +8,6 @@ fn main() {
let b = a.0 + a.1 + 3;
a = (2, 3);
let c = a.0 + a.1 + b;
+
+ let d = (b, a, c);
}
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.move_simple.DeadStoreElimination.panic-abort.diff b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-abort.diff
new file mode 100644
index 000000000..8f799b33f
--- /dev/null
+++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-abort.diff
@@ -0,0 +1,23 @@
+- // MIR for `move_simple` before DeadStoreElimination
++ // MIR for `move_simple` after DeadStoreElimination
+
+ fn move_simple(_1: i32) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+- let mut _3: i32;
+- let mut _4: i32;
+
+ bb0: {
+ StorageLive(_2);
+- _2 = use_both(_1, _1) -> [return: bb1, unwind unreachable];
++ _2 = use_both(_1, move _1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-unwind.diff b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-unwind.diff
new file mode 100644
index 000000000..0551d663b
--- /dev/null
+++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination.panic-unwind.diff
@@ -0,0 +1,23 @@
+- // MIR for `move_simple` before DeadStoreElimination
++ // MIR for `move_simple` after DeadStoreElimination
+
+ fn move_simple(_1: i32) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+- let mut _3: i32;
+- let mut _4: i32;
+
+ bb0: {
+ StorageLive(_2);
+- _2 = use_both(_1, _1) -> [return: bb1, unwind continue];
++ _2 = use_both(_1, move _1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ _0 = const ();
+ 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
new file mode 100644
index 000000000..b2eb64756
--- /dev/null
+++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs
@@ -0,0 +1,42 @@
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// 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) {}
+
+// EMIT_MIR call_arg_copy.move_simple.DeadStoreElimination.diff
+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, UnwindContinue())
+ }
+ ret = {
+ Return()
+ }
+ )
+}
+
+fn main() {
+ move_simple(1);
+ move_packed(Packed { x: 0, y: 1 });
+}
diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff
index 2776ff51d..cf73358dc 100644
--- a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff
+++ b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff
@@ -2,75 +2,28 @@
+ // MIR for `cycle` after DeadStoreElimination
fn cycle(_1: i32, _2: i32, _3: i32) -> () {
- debug x => _1; // in scope 0 at $DIR/cycle.rs:+0:10: +0:15
- debug y => _2; // in scope 0 at $DIR/cycle.rs:+0:22: +0:27
- debug z => _3; // in scope 0 at $DIR/cycle.rs:+0:34: +0:39
- let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:46: +0:46
-- let mut _4: (); // in scope 0 at $DIR/cycle.rs:+0:1: +9:2
-- let mut _5: bool; // in scope 0 at $DIR/cycle.rs:+3:11: +3:17
-- let _6: i32; // in scope 0 at $DIR/cycle.rs:+4:13: +4:17
-- let mut _7: i32; // in scope 0 at $DIR/cycle.rs:+5:13: +5:14
-- let mut _8: i32; // in scope 0 at $DIR/cycle.rs:+6:13: +6:14
-- let mut _9: i32; // in scope 0 at $DIR/cycle.rs:+7:13: +7:17
-- let mut _10: !; // in scope 0 at $DIR/cycle.rs:+3:5: +8:6
-- let _11: (); // in scope 0 at $DIR/cycle.rs:+3:5: +8:6
-- let mut _12: !; // in scope 0 at $DIR/cycle.rs:+3:5: +8:6
-+ let mut _4: bool; // in scope 0 at $DIR/cycle.rs:+3:11: +3:17
-+ let _5: i32; // in scope 0 at $DIR/cycle.rs:+4:13: +4:17
- scope 1 {
-- debug temp => _6; // in scope 1 at $DIR/cycle.rs:+4:13: +4:17
-+ debug temp => _5; // in scope 1 at $DIR/cycle.rs:+4:13: +4:17
- }
+ let mut _0: ();
+ let mut _4: bool;
+- let mut _5: i32;
bb0: {
- goto -> bb1; // scope 0 at $DIR/cycle.rs:+3:5: +8:6
+ _4 = cond() -> [return: bb1, unwind continue];
}
bb1: {
-- StorageLive(_5); // scope 0 at $DIR/cycle.rs:+3:11: +3:17
-- _5 = cond() -> bb2; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
-+ StorageLive(_4); // scope 0 at $DIR/cycle.rs:+3:11: +3:17
-+ _4 = cond() -> bb2; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
- // mir::Constant
- // + span: $DIR/cycle.rs:13:11: 13:15
- // + literal: Const { ty: fn() -> bool {cond}, val: Value(<ZST>) }
+ switchInt(_4) -> [1: bb2, otherwise: bb3];
}
bb2: {
-- switchInt(move _5) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
-+ switchInt(move _4) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17
+- _5 = _3;
+- _3 = _2;
+- _2 = _1;
+- _1 = _5;
+ _4 = cond() -> [return: bb1, unwind continue];
}
bb3: {
-- StorageLive(_6); // scope 0 at $DIR/cycle.rs:+4:13: +4:17
-- _6 = _3; // scope 0 at $DIR/cycle.rs:+4:20: +4:21
-- StorageLive(_7); // scope 1 at $DIR/cycle.rs:+5:13: +5:14
-- _7 = _2; // scope 1 at $DIR/cycle.rs:+5:13: +5:14
-- _3 = move _7; // scope 1 at $DIR/cycle.rs:+5:9: +5:14
-- StorageDead(_7); // scope 1 at $DIR/cycle.rs:+5:13: +5:14
-- StorageLive(_8); // scope 1 at $DIR/cycle.rs:+6:13: +6:14
-- _8 = _1; // scope 1 at $DIR/cycle.rs:+6:13: +6:14
-- _2 = move _8; // scope 1 at $DIR/cycle.rs:+6:9: +6:14
-- StorageDead(_8); // scope 1 at $DIR/cycle.rs:+6:13: +6:14
-- StorageLive(_9); // scope 1 at $DIR/cycle.rs:+7:13: +7:17
-- _9 = _6; // scope 1 at $DIR/cycle.rs:+7:13: +7:17
-- _1 = move _9; // scope 1 at $DIR/cycle.rs:+7:9: +7:17
-- StorageDead(_9); // scope 1 at $DIR/cycle.rs:+7:16: +7:17
-- _4 = const (); // scope 0 at $DIR/cycle.rs:+3:18: +8:6
-- StorageDead(_6); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
-+ StorageLive(_5); // scope 0 at $DIR/cycle.rs:+4:13: +4:17
- StorageDead(_5); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
-+ StorageDead(_4); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
- goto -> bb1; // scope 0 at $DIR/cycle.rs:+3:5: +8:6
- }
-
- bb4: {
-- StorageLive(_11); // scope 0 at $DIR/cycle.rs:+3:5: +8:6
- _0 = const (); // scope 0 at $DIR/cycle.rs:+3:5: +8:6
-- StorageDead(_11); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
-- StorageDead(_5); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
-+ StorageDead(_4); // scope 0 at $DIR/cycle.rs:+8:5: +8:6
- return; // scope 0 at $DIR/cycle.rs:+9:2: +9:2
+ return;
}
}
diff --git a/tests/mir-opt/dead-store-elimination/cycle.rs b/tests/mir-opt/dead-store-elimination/cycle.rs
index 570bfe84d..c9ad06a9d 100644
--- a/tests/mir-opt/dead-store-elimination/cycle.rs
+++ b/tests/mir-opt/dead-store-elimination/cycle.rs
@@ -1,21 +1,41 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// This example is interesting because the non-transitive version of `MaybeLiveLocals` would
+// report that *all* of these stores are live.
+//
+// needs-unwind
// unit-test: DeadStoreElimination
+#![feature(core_intrinsics, custom_mir)]
+use std::intrinsics::mir::*;
+
#[inline(never)]
fn cond() -> bool {
false
}
// EMIT_MIR cycle.cycle.DeadStoreElimination.diff
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
fn cycle(mut x: i32, mut y: i32, mut z: i32) {
- // This example is interesting because the non-transitive version of `MaybeLiveLocals` would
- // report that *all* of these stores are live.
- while cond() {
- let temp = z;
- z = y;
- y = x;
- x = temp;
- }
+ // We use custom MIR to avoid generating debuginfo, that would force to preserve writes.
+ mir!(
+ let condition: bool;
+ {
+ Call(condition = cond(), bb1, UnwindContinue())
+ }
+ bb1 = {
+ match condition { true => bb2, _ => ret }
+ }
+ bb2 = {
+ let temp = z;
+ z = y;
+ y = x;
+ x = temp;
+ Call(condition = cond(), bb1, UnwindContinue())
+ }
+ ret = {
+ Return()
+ }
+ )
}
fn main() {
diff --git a/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff b/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff
index 761c074ed..213051877 100644
--- a/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff
+++ b/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff
@@ -2,24 +2,18 @@
+ // MIR for `main` after DeadStoreElimination
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/place_mention.rs:+0:11: +0:11
- let mut _1: (&str, &str); // in scope 0 at $DIR/place_mention.rs:+3:18: +3:36
+ let mut _0: ();
+ let mut _1: (&str, &str);
scope 1 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/place_mention.rs:+3:18: +3:36
- _1 = (const "Hello", const "World"); // scope 0 at $DIR/place_mention.rs:+3:18: +3:36
- // mir::Constant
- // + span: $DIR/place_mention.rs:8:19: 8:26
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- // mir::Constant
- // + span: $DIR/place_mention.rs:8:28: 8:35
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- PlaceMention(_1); // scope 0 at $DIR/place_mention.rs:+3:18: +3:36
- StorageDead(_1); // scope 0 at $DIR/place_mention.rs:+3:36: +3:37
- _0 = const (); // scope 0 at $DIR/place_mention.rs:+0:11: +4:2
- return; // scope 0 at $DIR/place_mention.rs:+4:2: +4:2
+ StorageLive(_1);
+ _1 = (const "Hello", const "World");
+ PlaceMention(_1);
+ StorageDead(_1);
+ _0 = const ();
+ return;
}
}
diff --git a/tests/mir-opt/dead-store-elimination/place_mention.rs b/tests/mir-opt/dead-store-elimination/place_mention.rs
index 59dc74454..4813cf7ee 100644
--- a/tests/mir-opt/dead-store-elimination/place_mention.rs
+++ b/tests/mir-opt/dead-store-elimination/place_mention.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DeadStoreElimination
// compile-flags: -Zmir-keep-place-mention
diff --git a/tests/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff b/tests/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff
index 89f1846b4..31f727e5f 100644
--- a/tests/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff
+++ b/tests/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination.diff
@@ -2,34 +2,34 @@
+ // MIR for `pointer_to_int` after DeadStoreElimination
fn pointer_to_int(_1: *mut i32) -> () {
- debug p => _1; // in scope 0 at $DIR/provenance_soundness.rs:+0:19: +0:20
- let mut _0: (); // return place in scope 0 at $DIR/provenance_soundness.rs:+0:32: +0:32
- let _2: usize; // in scope 0 at $DIR/provenance_soundness.rs:+1:9: +1:11
- let mut _3: *mut i32; // in scope 0 at $DIR/provenance_soundness.rs:+1:14: +1:15
- let mut _5: *mut i32; // in scope 0 at $DIR/provenance_soundness.rs:+2:14: +2:15
+ debug p => _1;
+ let mut _0: ();
+ let _2: usize;
+ let mut _3: *mut i32;
+ let mut _5: *mut i32;
scope 1 {
- debug _x => _2; // in scope 1 at $DIR/provenance_soundness.rs:+1:9: +1:11
- let _4: isize; // in scope 1 at $DIR/provenance_soundness.rs:+2:9: +2:11
+ debug _x => _2;
+ let _4: isize;
scope 2 {
- debug _y => _4; // in scope 2 at $DIR/provenance_soundness.rs:+2:9: +2:11
+ debug _y => _4;
}
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/provenance_soundness.rs:+1:9: +1:11
- StorageLive(_3); // scope 0 at $DIR/provenance_soundness.rs:+1:14: +1:15
- _3 = _1; // scope 0 at $DIR/provenance_soundness.rs:+1:14: +1:15
- _2 = move _3 as usize (PointerExposeAddress); // scope 0 at $DIR/provenance_soundness.rs:+1:14: +1:24
- StorageDead(_3); // scope 0 at $DIR/provenance_soundness.rs:+1:23: +1:24
- StorageLive(_4); // scope 1 at $DIR/provenance_soundness.rs:+2:9: +2:11
- StorageLive(_5); // scope 1 at $DIR/provenance_soundness.rs:+2:14: +2:15
- _5 = _1; // scope 1 at $DIR/provenance_soundness.rs:+2:14: +2:15
- _4 = move _5 as isize (PointerExposeAddress); // scope 1 at $DIR/provenance_soundness.rs:+2:14: +2:24
- StorageDead(_5); // scope 1 at $DIR/provenance_soundness.rs:+2:23: +2:24
- _0 = const (); // scope 0 at $DIR/provenance_soundness.rs:+0:32: +3:2
- StorageDead(_4); // scope 1 at $DIR/provenance_soundness.rs:+3:1: +3:2
- StorageDead(_2); // scope 0 at $DIR/provenance_soundness.rs:+3:1: +3:2
- return; // scope 0 at $DIR/provenance_soundness.rs:+3:2: +3:2
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _2 = move _3 as usize (PointerExposeAddress);
+ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ _4 = move _5 as isize (PointerExposeAddress);
+ StorageDead(_5);
+ _0 = const ();
+ StorageDead(_4);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/dead-store-elimination/provenance_soundness.retags.DeadStoreElimination.diff b/tests/mir-opt/dead-store-elimination/provenance_soundness.retags.DeadStoreElimination.diff
index b5f98233b..e1ebc39aa 100644
--- a/tests/mir-opt/dead-store-elimination/provenance_soundness.retags.DeadStoreElimination.diff
+++ b/tests/mir-opt/dead-store-elimination/provenance_soundness.retags.DeadStoreElimination.diff
@@ -2,13 +2,13 @@
+ // MIR for `retags` after DeadStoreElimination
fn retags(_1: &mut i32) -> () {
- debug _r => _1; // in scope 0 at $DIR/provenance_soundness.rs:+0:11: +0:13
- let mut _0: (); // return place in scope 0 at $DIR/provenance_soundness.rs:+0:25: +0:25
+ debug _r => _1;
+ let mut _0: ();
bb0: {
- Retag([fn entry] _1); // scope 0 at $DIR/provenance_soundness.rs:+0:11: +0:13
- _0 = const (); // scope 0 at $DIR/provenance_soundness.rs:+0:25: +0:27
- return; // scope 0 at $DIR/provenance_soundness.rs:+0:27: +0:27
+ Retag([fn entry] _1);
+ _0 = const ();
+ return;
}
}
diff --git a/tests/mir-opt/dead-store-elimination/provenance_soundness.rs b/tests/mir-opt/dead-store-elimination/provenance_soundness.rs
index 11314e990..24ffbe980 100644
--- a/tests/mir-opt/dead-store-elimination/provenance_soundness.rs
+++ b/tests/mir-opt/dead-store-elimination/provenance_soundness.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DeadStoreElimination
// compile-flags: -Zmir-emit-retag
diff --git a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff
deleted file mode 100644
index c4ebf1ca8..000000000
--- a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff
+++ /dev/null
@@ -1,100 +0,0 @@
-- // MIR for `is_line_doc_comment_2` before DeduplicateBlocks
-+ // MIR for `is_line_doc_comment_2` after DeduplicateBlocks
-
- fn is_line_doc_comment_2(_1: &str) -> bool {
- debug s => _1; // in scope 0 at $DIR/deduplicate_blocks.rs:+0:36: +0:37
- let mut _0: bool; // return place in scope 0 at $DIR/deduplicate_blocks.rs:+0:48: +0:52
- let mut _2: &[u8]; // in scope 0 at $DIR/deduplicate_blocks.rs:+1:11: +1:23
- let mut _3: &str; // in scope 0 at $DIR/deduplicate_blocks.rs:+1:11: +1:23
- let mut _4: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31
- let mut _5: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31
- let mut _6: bool; // in scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31
- let mut _7: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37
- let mut _8: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37
- let mut _9: bool; // in scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/deduplicate_blocks.rs:+1:11: +1:23
- StorageLive(_3); // scope 0 at $DIR/deduplicate_blocks.rs:+1:11: +1:23
- _3 = &(*_1); // scope 0 at $DIR/deduplicate_blocks.rs:+1:11: +1:23
- _2 = core::str::<impl str>::as_bytes(move _3) -> bb1; // scope 0 at $DIR/deduplicate_blocks.rs:+1:11: +1:23
- // mir::Constant
- // + span: $DIR/deduplicate_blocks.rs:6:13: 6:21
- // + literal: Const { ty: for<'a> fn(&'a str) -> &'a [u8] {core::str::<impl str>::as_bytes}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_3); // scope 0 at $DIR/deduplicate_blocks.rs:+1:22: +1:23
- _7 = Len((*_2)); // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37
- _8 = const 4_usize; // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37
- _9 = Ge(move _7, move _8); // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37
- switchInt(move _9) -> [0: bb6, otherwise: bb2]; // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37
- }
-
- bb2: {
- switchInt((*_2)[0 of 4]) -> [47: bb3, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
- }
-
- bb3: {
- switchInt((*_2)[1 of 4]) -> [47: bb4, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
- }
-
- bb4: {
- switchInt((*_2)[2 of 4]) -> [47: bb5, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
- }
-
- bb5: {
-- switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
-+ switchInt((*_2)[3 of 4]) -> [47: bb10, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
- }
-
- bb6: {
- _4 = Len((*_2)); // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31
- _5 = const 3_usize; // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31
- _6 = Ge(move _4, move _5); // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31
- switchInt(move _6) -> [0: bb10, otherwise: bb7]; // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31
- }
-
- bb7: {
- switchInt((*_2)[0 of 3]) -> [47: bb8, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
- }
-
- bb8: {
- switchInt((*_2)[1 of 3]) -> [47: bb9, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
- }
-
- bb9: {
-- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb13, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
-+ switchInt((*_2)[2 of 3]) -> [47: bb11, 33: bb11, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23
- }
-
- bb10: {
-- _0 = const false; // scope 0 at $DIR/deduplicate_blocks.rs:+5:14: +5:19
-- goto -> bb14; // scope 0 at $DIR/deduplicate_blocks.rs:+5:14: +5:19
-- }
--
-- bb11: {
- _0 = const false; // scope 0 at $DIR/deduplicate_blocks.rs:+2:41: +2:46
-- goto -> bb14; // scope 0 at $DIR/deduplicate_blocks.rs:+2:41: +2:46
-+ goto -> bb12; // scope 0 at $DIR/deduplicate_blocks.rs:+2:41: +2:46
- }
-
-- bb12: {
-- _0 = const true; // scope 0 at $DIR/deduplicate_blocks.rs:+3:35: +3:39
-- goto -> bb14; // scope 0 at $DIR/deduplicate_blocks.rs:+3:35: +3:39
-- }
--
-- bb13: {
-+ bb11: {
- _0 = const true; // scope 0 at $DIR/deduplicate_blocks.rs:+4:35: +4:39
-- goto -> bb14; // scope 0 at $DIR/deduplicate_blocks.rs:+4:35: +4:39
-+ goto -> bb12; // scope 0 at $DIR/deduplicate_blocks.rs:+4:35: +4:39
- }
-
-- bb14: {
-+ bb12: {
- StorageDead(_2); // scope 0 at $DIR/deduplicate_blocks.rs:+7:1: +7:2
- return; // scope 0 at $DIR/deduplicate_blocks.rs:+7:2: +7:2
- }
- }
-
diff --git a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff
new file mode 100644
index 000000000..5c4fc06a2
--- /dev/null
+++ b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff
@@ -0,0 +1,96 @@
+- // MIR for `is_line_doc_comment_2` before DeduplicateBlocks
++ // MIR for `is_line_doc_comment_2` after DeduplicateBlocks
+
+ fn is_line_doc_comment_2(_1: &str) -> bool {
+ debug s => _1;
+ let mut _0: bool;
+ let mut _2: &[u8];
+ let mut _3: &str;
+ let mut _4: usize;
+ let mut _5: usize;
+ let mut _6: bool;
+ let mut _7: usize;
+ let mut _8: usize;
+ let mut _9: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &(*_1);
+ _2 = core::str::<impl str>::as_bytes(move _3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ _7 = Len((*_2));
+ _8 = const 4_usize;
+ _9 = Ge(move _7, move _8);
+ switchInt(move _9) -> [0: bb6, otherwise: bb2];
+ }
+
+ bb2: {
+ switchInt((*_2)[0 of 4]) -> [47: bb3, otherwise: bb6];
+ }
+
+ bb3: {
+ switchInt((*_2)[1 of 4]) -> [47: bb4, otherwise: bb6];
+ }
+
+ bb4: {
+ switchInt((*_2)[2 of 4]) -> [47: bb5, otherwise: bb6];
+ }
+
+ bb5: {
+- switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb6];
++ switchInt((*_2)[3 of 4]) -> [47: bb10, otherwise: bb6];
+ }
+
+ bb6: {
+ _4 = Len((*_2));
+ _5 = const 3_usize;
+ _6 = Ge(move _4, move _5);
+ switchInt(move _6) -> [0: bb10, otherwise: bb7];
+ }
+
+ bb7: {
+ switchInt((*_2)[0 of 3]) -> [47: bb8, otherwise: bb10];
+ }
+
+ bb8: {
+ switchInt((*_2)[1 of 3]) -> [47: bb9, otherwise: bb10];
+ }
+
+ bb9: {
+- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb13, otherwise: bb10];
++ switchInt((*_2)[2 of 3]) -> [47: bb11, 33: bb11, otherwise: bb10];
+ }
+
+ bb10: {
+ _0 = const false;
+- goto -> bb14;
++ goto -> bb12;
+ }
+
+ bb11: {
+- _0 = const false;
+- goto -> bb14;
+- }
+-
+- bb12: {
+ _0 = const true;
+- goto -> bb14;
++ goto -> bb12;
+ }
+
+- bb13: {
+- _0 = const true;
+- goto -> bb14;
+- }
+-
+- bb14: {
++ bb12: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff
new file mode 100644
index 000000000..3d9aa8290
--- /dev/null
+++ b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff
@@ -0,0 +1,96 @@
+- // MIR for `is_line_doc_comment_2` before DeduplicateBlocks
++ // MIR for `is_line_doc_comment_2` after DeduplicateBlocks
+
+ fn is_line_doc_comment_2(_1: &str) -> bool {
+ debug s => _1;
+ let mut _0: bool;
+ let mut _2: &[u8];
+ let mut _3: &str;
+ let mut _4: usize;
+ let mut _5: usize;
+ let mut _6: bool;
+ let mut _7: usize;
+ let mut _8: usize;
+ let mut _9: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &(*_1);
+ _2 = core::str::<impl str>::as_bytes(move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ _7 = Len((*_2));
+ _8 = const 4_usize;
+ _9 = Ge(move _7, move _8);
+ switchInt(move _9) -> [0: bb6, otherwise: bb2];
+ }
+
+ bb2: {
+ switchInt((*_2)[0 of 4]) -> [47: bb3, otherwise: bb6];
+ }
+
+ bb3: {
+ switchInt((*_2)[1 of 4]) -> [47: bb4, otherwise: bb6];
+ }
+
+ bb4: {
+ switchInt((*_2)[2 of 4]) -> [47: bb5, otherwise: bb6];
+ }
+
+ bb5: {
+- switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb6];
++ switchInt((*_2)[3 of 4]) -> [47: bb10, otherwise: bb6];
+ }
+
+ bb6: {
+ _4 = Len((*_2));
+ _5 = const 3_usize;
+ _6 = Ge(move _4, move _5);
+ switchInt(move _6) -> [0: bb10, otherwise: bb7];
+ }
+
+ bb7: {
+ switchInt((*_2)[0 of 3]) -> [47: bb8, otherwise: bb10];
+ }
+
+ bb8: {
+ switchInt((*_2)[1 of 3]) -> [47: bb9, otherwise: bb10];
+ }
+
+ bb9: {
+- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb13, otherwise: bb10];
++ switchInt((*_2)[2 of 3]) -> [47: bb11, 33: bb11, otherwise: bb10];
+ }
+
+ bb10: {
+ _0 = const false;
+- goto -> bb14;
++ goto -> bb12;
+ }
+
+ bb11: {
+- _0 = const false;
+- goto -> bb14;
+- }
+-
+- bb12: {
+ _0 = const true;
+- goto -> bb14;
++ goto -> bb12;
+ }
+
+- bb13: {
+- _0 = const true;
+- goto -> bb14;
+- }
+-
+- bb14: {
++ bb12: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/deduplicate_blocks.rs b/tests/mir-opt/deduplicate_blocks.rs
index 46012e19a..d3b89102f 100644
--- a/tests/mir-opt/deduplicate_blocks.rs
+++ b/tests/mir-opt/deduplicate_blocks.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DeduplicateBlocks
// EMIT_MIR deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff
diff --git a/tests/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir b/tests/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir
index 97826ed19..1e4f74850 100644
--- a/tests/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir
+++ b/tests/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir
@@ -1,74 +1,65 @@
// MIR for `foo` after PreCodegen
fn foo(_1: Option<String>) -> i32 {
- debug s => _1; // in scope 0 at $DIR/string.rs:+0:12: +0:13
- let mut _0: i32; // return place in scope 0 at $DIR/string.rs:+0:34: +0:37
- let mut _2: &std::string::String; // in scope 0 at $DIR/string.rs:+2:14: +2:17
- let mut _3: &str; // in scope 0 at $DIR/string.rs:+2:14: +2:17
- let mut _4: bool; // in scope 0 at $DIR/string.rs:+2:14: +2:17
- let mut _5: isize; // in scope 0 at $DIR/string.rs:+2:9: +2:18
- let _6: std::option::Option<std::string::String>; // in scope 0 at $DIR/string.rs:+3:9: +3:10
- let mut _7: bool; // in scope 0 at $DIR/string.rs:+5:1: +5:2
+ debug s => _1;
+ let mut _0: i32;
+ let mut _2: bool;
+ let mut _3: isize;
+ let mut _4: &std::string::String;
+ let mut _5: &str;
+ let mut _6: bool;
+ let _7: std::option::Option<std::string::String>;
scope 1 {
- debug s => _6; // in scope 1 at $DIR/string.rs:+3:9: +3:10
+ debug s => _7;
}
bb0: {
- _7 = const false; // scope 0 at $DIR/string.rs:+1:11: +1:12
- _7 = const true; // scope 0 at $DIR/string.rs:+1:11: +1:12
- _5 = discriminant(_1); // scope 0 at $DIR/string.rs:+1:11: +1:12
- switchInt(move _5) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/string.rs:+1:5: +1:12
+ _2 = const false;
+ _2 = const true;
+ _3 = discriminant(_1);
+ switchInt(move _3) -> [1: bb1, otherwise: bb5];
}
bb1: {
- StorageLive(_6); // scope 0 at $DIR/string.rs:+3:9: +3:10
- _7 = const false; // scope 0 at $DIR/string.rs:+3:9: +3:10
- _6 = move _1; // scope 0 at $DIR/string.rs:+3:9: +3:10
- _0 = const 4321_i32; // scope 1 at $DIR/string.rs:+3:14: +3:18
- drop(_6) -> [return: bb6, unwind unreachable]; // scope 0 at $DIR/string.rs:+3:17: +3:18
+ _4 = &((_1 as Some).0: std::string::String);
+ _5 = <String as Deref>::deref(move _4) -> [return: bb2, unwind unreachable];
}
bb2: {
- _2 = &((_1 as Some).0: std::string::String); // scope 0 at $DIR/string.rs:+2:14: +2:17
- _3 = <String as Deref>::deref(move _2) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/string.rs:+2:14: +2:17
- // mir::Constant
- // + span: $DIR/string.rs:9:14: 9:17
- // + literal: Const { ty: for<'a> fn(&'a String) -> &'a <String as Deref>::Target {<String as Deref>::deref}, val: Value(<ZST>) }
+ _6 = <str as PartialEq>::eq(_5, const "a") -> [return: bb3, unwind unreachable];
}
bb3: {
- _4 = <str as PartialEq>::eq(_3, const "a") -> [return: bb4, unwind unreachable]; // scope 0 at $DIR/string.rs:+2:14: +2:17
- // mir::Constant
- // + span: $DIR/string.rs:9:14: 9:17
- // + literal: Const { ty: for<'a, 'b> fn(&'a str, &'b str) -> bool {<str as PartialEq>::eq}, val: Value(<ZST>) }
- // mir::Constant
- // + span: $DIR/string.rs:9:14: 9:17
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
+ switchInt(move _6) -> [0: bb5, otherwise: bb4];
}
bb4: {
- switchInt(move _4) -> [0: bb1, otherwise: bb5]; // scope 0 at $DIR/string.rs:+2:14: +2:17
+ _0 = const 1234_i32;
+ goto -> bb7;
}
bb5: {
- _0 = const 1234_i32; // scope 0 at $DIR/string.rs:+2:22: +2:26
- goto -> bb9; // scope 0 at $DIR/string.rs:+2:22: +2:26
+ StorageLive(_7);
+ _2 = const false;
+ _7 = move _1;
+ _0 = const 4321_i32;
+ drop(_7) -> [return: bb6, unwind unreachable];
}
bb6: {
- StorageDead(_6); // scope 0 at $DIR/string.rs:+3:17: +3:18
- goto -> bb9; // scope 0 at $DIR/string.rs:+3:17: +3:18
+ StorageDead(_7);
+ goto -> bb7;
}
bb7: {
- return; // scope 0 at $DIR/string.rs:+5:2: +5:2
+ switchInt(_2) -> [0: bb9, otherwise: bb8];
}
bb8: {
- drop(_1) -> [return: bb7, unwind unreachable]; // scope 0 at $DIR/string.rs:+5:1: +5:2
+ drop(_1) -> [return: bb9, unwind unreachable];
}
bb9: {
- switchInt(_7) -> [0: bb7, otherwise: bb8]; // scope 0 at $DIR/string.rs:+5:1: +5:2
+ return;
}
}
diff --git a/tests/mir-opt/deref-patterns/string.rs b/tests/mir-opt/deref-patterns/string.rs
index 3a99c44aa..0c8385b5c 100644
--- a/tests/mir-opt/deref-patterns/string.rs
+++ b/tests/mir-opt/deref-patterns/string.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z mir-opt-level=0 -C panic=abort
#![feature(string_deref_patterns)]
diff --git a/tests/mir-opt/derefer_complex_case.main.Derefer.diff b/tests/mir-opt/derefer_complex_case.main.Derefer.diff
deleted file mode 100644
index fa3eeedc4..000000000
--- a/tests/mir-opt/derefer_complex_case.main.Derefer.diff
+++ /dev/null
@@ -1,105 +0,0 @@
-- // MIR for `main` before Derefer
-+ // MIR for `main` after Derefer
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/derefer_complex_case.rs:+0:11: +0:11
- let mut _1: std::slice::Iter<'_, i32>; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- let mut _2: &[i32; 2]; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- let _3: [i32; 2]; // in scope 0 at $DIR/derefer_complex_case.rs:+1:18: +1:26
- let mut _4: std::slice::Iter<'_, i32>; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- let mut _5: (); // in scope 0 at $DIR/derefer_complex_case.rs:+0:1: +2:2
- let _6: (); // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- let mut _7: std::option::Option<&i32>; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- let mut _8: &mut std::slice::Iter<'_, i32>; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- let mut _9: &mut std::slice::Iter<'_, i32>; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- let mut _10: isize; // in scope 0 at $DIR/derefer_complex_case.rs:+1:5: +1:40
- let mut _11: !; // in scope 0 at $DIR/derefer_complex_case.rs:+1:5: +1:40
- let mut _13: i32; // in scope 0 at $DIR/derefer_complex_case.rs:+1:34: +1:37
- let mut _14: &[i32; 2]; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
-+ let mut _15: &i32; // in scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- scope 1 {
- debug iter => _4; // in scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- let _12: i32; // in scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13
- scope 2 {
- debug foo => _12; // in scope 2 at $DIR/derefer_complex_case.rs:+1:10: +1:13
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- StorageLive(_2); // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- _14 = const _; // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- // mir::Constant
- // + span: $DIR/derefer_complex_case.rs:6:17: 6:26
- // + literal: Const { ty: &[i32; 2], val: Unevaluated(main, [], Some(promoted[0])) }
- _2 = &(*_14); // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- _1 = <&[i32; 2] as IntoIterator>::into_iter(move _2) -> bb1; // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- // mir::Constant
- // + span: $DIR/derefer_complex_case.rs:6:17: 6:26
- // + literal: Const { ty: fn(&[i32; 2]) -> <&[i32; 2] as IntoIterator>::IntoIter {<&[i32; 2] as IntoIterator>::into_iter}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/derefer_complex_case.rs:+1:25: +1:26
- StorageLive(_4); // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- _4 = move _1; // scope 0 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- goto -> bb2; // scope 1 at $DIR/derefer_complex_case.rs:+1:5: +1:40
- }
-
- bb2: {
- StorageLive(_6); // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- StorageLive(_7); // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- StorageLive(_8); // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- StorageLive(_9); // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- _9 = &mut _4; // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- _8 = &mut (*_9); // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- _7 = <std::slice::Iter<'_, i32> as Iterator>::next(move _8) -> bb3; // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- // mir::Constant
- // + span: $DIR/derefer_complex_case.rs:6:17: 6:26
- // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, i32>) -> Option<<std::slice::Iter<'_, i32> as Iterator>::Item> {<std::slice::Iter<'_, i32> as Iterator>::next}, val: Value(<ZST>) }
- }
-
- bb3: {
- StorageDead(_8); // scope 1 at $DIR/derefer_complex_case.rs:+1:25: +1:26
- _10 = discriminant(_7); // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- }
-
- bb4: {
- StorageLive(_12); // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13
-- _12 = (*((_7 as Some).0: &i32)); // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13
-+ _15 = deref_copy ((_7 as Some).0: &i32); // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13
-+ _12 = (*_15); // scope 1 at $DIR/derefer_complex_case.rs:+1:10: +1:13
- StorageLive(_13); // scope 2 at $DIR/derefer_complex_case.rs:+1:34: +1:37
- _13 = _12; // scope 2 at $DIR/derefer_complex_case.rs:+1:34: +1:37
- _6 = std::mem::drop::<i32>(move _13) -> bb7; // scope 2 at $DIR/derefer_complex_case.rs:+1:29: +1:38
- // mir::Constant
- // + span: $DIR/derefer_complex_case.rs:6:29: 6:33
- // + literal: Const { ty: fn(i32) {std::mem::drop::<i32>}, val: Value(<ZST>) }
- }
-
- bb5: {
- unreachable; // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26
- }
-
- bb6: {
- _0 = const (); // scope 1 at $DIR/derefer_complex_case.rs:+1:5: +1:40
- StorageDead(_9); // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40
- StorageDead(_7); // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40
- StorageDead(_6); // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40
- StorageDead(_4); // scope 0 at $DIR/derefer_complex_case.rs:+1:39: +1:40
- StorageDead(_1); // scope 0 at $DIR/derefer_complex_case.rs:+1:39: +1:40
- return; // scope 0 at $DIR/derefer_complex_case.rs:+2:2: +2:2
- }
-
- bb7: {
- StorageDead(_13); // scope 2 at $DIR/derefer_complex_case.rs:+1:37: +1:38
- StorageDead(_12); // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40
- StorageDead(_9); // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40
- StorageDead(_7); // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40
- StorageDead(_6); // scope 1 at $DIR/derefer_complex_case.rs:+1:39: +1:40
- _5 = const (); // scope 1 at $DIR/derefer_complex_case.rs:+1:5: +1:40
- goto -> bb2; // scope 1 at $DIR/derefer_complex_case.rs:+1:5: +1:40
- }
- }
-
diff --git a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff
new file mode 100644
index 000000000..0fad716a2
--- /dev/null
+++ b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff
@@ -0,0 +1,99 @@
+- // MIR for `main` before Derefer
++ // MIR for `main` after Derefer
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: std::slice::Iter<'_, i32>;
+ let mut _2: &[i32; 2];
+ let _3: [i32; 2];
+ let mut _4: std::slice::Iter<'_, i32>;
+ let mut _5: ();
+ let _6: ();
+ let mut _7: std::option::Option<&i32>;
+ let mut _8: &mut std::slice::Iter<'_, i32>;
+ let mut _9: &mut std::slice::Iter<'_, i32>;
+ let mut _10: isize;
+ let mut _11: !;
+ let mut _13: i32;
+ let mut _14: &[i32; 2];
++ let mut _15: &i32;
+ scope 1 {
+ debug iter => _4;
+ let _12: i32;
+ scope 2 {
+ debug foo => _12;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _14 = const _;
+ _2 = &(*_14);
+ _1 = <&[i32; 2] as IntoIterator>::into_iter(move _2) -> [return: bb1, unwind: bb8];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ PlaceMention(_1);
+ StorageLive(_4);
+ _4 = move _1;
+ goto -> bb2;
+ }
+
+ bb2: {
+ StorageLive(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = &mut _4;
+ _8 = &mut (*_9);
+ _7 = <std::slice::Iter<'_, i32> as Iterator>::next(move _8) -> [return: bb3, unwind: bb8];
+ }
+
+ bb3: {
+ StorageDead(_8);
+ PlaceMention(_7);
+ _10 = discriminant(_7);
+ switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5];
+ }
+
+ bb4: {
+ StorageLive(_12);
+- _12 = (*((_7 as Some).0: &i32));
++ _15 = deref_copy ((_7 as Some).0: &i32);
++ _12 = (*_15);
+ StorageLive(_13);
+ _13 = _12;
+ _6 = std::mem::drop::<i32>(move _13) -> [return: bb7, unwind: bb8];
+ }
+
+ bb5: {
+ unreachable;
+ }
+
+ bb6: {
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_1);
+ return;
+ }
+
+ bb7: {
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_9);
+ StorageDead(_7);
+ StorageDead(_6);
+ _5 = const ();
+ goto -> bb2;
+ }
+
+ bb8 (cleanup): {
+ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff
new file mode 100644
index 000000000..ae5656f02
--- /dev/null
+++ b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff
@@ -0,0 +1,95 @@
+- // MIR for `main` before Derefer
++ // MIR for `main` after Derefer
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: std::slice::Iter<'_, i32>;
+ let mut _2: &[i32; 2];
+ let _3: [i32; 2];
+ let mut _4: std::slice::Iter<'_, i32>;
+ let mut _5: ();
+ let _6: ();
+ let mut _7: std::option::Option<&i32>;
+ let mut _8: &mut std::slice::Iter<'_, i32>;
+ let mut _9: &mut std::slice::Iter<'_, i32>;
+ let mut _10: isize;
+ let mut _11: !;
+ let mut _13: i32;
+ let mut _14: &[i32; 2];
++ let mut _15: &i32;
+ scope 1 {
+ debug iter => _4;
+ let _12: i32;
+ scope 2 {
+ debug foo => _12;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _14 = const _;
+ _2 = &(*_14);
+ _1 = <&[i32; 2] as IntoIterator>::into_iter(move _2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ PlaceMention(_1);
+ StorageLive(_4);
+ _4 = move _1;
+ goto -> bb2;
+ }
+
+ bb2: {
+ StorageLive(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = &mut _4;
+ _8 = &mut (*_9);
+ _7 = <std::slice::Iter<'_, i32> as Iterator>::next(move _8) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_8);
+ PlaceMention(_7);
+ _10 = discriminant(_7);
+ switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5];
+ }
+
+ bb4: {
+ StorageLive(_12);
+- _12 = (*((_7 as Some).0: &i32));
++ _15 = deref_copy ((_7 as Some).0: &i32);
++ _12 = (*_15);
+ StorageLive(_13);
+ _13 = _12;
+ _6 = std::mem::drop::<i32>(move _13) -> [return: bb7, unwind continue];
+ }
+
+ bb5: {
+ unreachable;
+ }
+
+ bb6: {
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_1);
+ return;
+ }
+
+ bb7: {
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_9);
+ StorageDead(_7);
+ StorageDead(_6);
+ _5 = const ();
+ goto -> bb2;
+ }
+ }
+
diff --git a/tests/mir-opt/derefer_complex_case.rs b/tests/mir-opt/derefer_complex_case.rs
index dc48cee95..6097d8739 100644
--- a/tests/mir-opt/derefer_complex_case.rs
+++ b/tests/mir-opt/derefer_complex_case.rs
@@ -1,6 +1,7 @@
+// skip-filecheck
// unit-test: Derefer
// EMIT_MIR derefer_complex_case.main.Derefer.diff
-// ignore-wasm32
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
fn main() {
for &foo in &[42, 43] { drop(foo) }
diff --git a/tests/mir-opt/derefer_inline_test.main.Derefer.diff b/tests/mir-opt/derefer_inline_test.main.Derefer.diff
deleted file mode 100644
index 426d4fb21..000000000
--- a/tests/mir-opt/derefer_inline_test.main.Derefer.diff
+++ /dev/null
@@ -1,45 +0,0 @@
-- // MIR for `main` before Derefer
-+ // MIR for `main` after Derefer
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/derefer_inline_test.rs:+0:11: +0:11
- let _1: std::boxed::Box<std::boxed::Box<u32>>; // in scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:18
- let mut _2: std::boxed::Box<u32>; // in scope 0 at $DIR/derefer_inline_test.rs:+1:14: +1:17
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:18
- StorageLive(_2); // scope 0 at $DIR/derefer_inline_test.rs:+1:14: +1:17
- _2 = f() -> bb1; // scope 0 at $DIR/derefer_inline_test.rs:+1:14: +1:17
- // mir::Constant
- // + span: $DIR/derefer_inline_test.rs:10:14: 10:15
- // + literal: Const { ty: fn() -> Box<u32> {f}, val: Value(<ZST>) }
- }
-
- bb1: {
- _1 = Box::<Box<u32>>::new(move _2) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/derefer_inline_test.rs:+1:5: +1:18
- // mir::Constant
- // + span: $DIR/derefer_inline_test.rs:10:5: 10:13
- // + user_ty: UserType(0)
- // + literal: Const { ty: fn(Box<u32>) -> Box<Box<u32>> {Box::<Box<u32>>::new}, val: Value(<ZST>) }
- }
-
- bb2: {
- StorageDead(_2); // scope 0 at $DIR/derefer_inline_test.rs:+1:17: +1:18
- drop(_1) -> bb3; // scope 0 at $DIR/derefer_inline_test.rs:+1:18: +1:19
- }
-
- bb3: {
- StorageDead(_1); // scope 0 at $DIR/derefer_inline_test.rs:+1:18: +1:19
- _0 = const (); // scope 0 at $DIR/derefer_inline_test.rs:+0:11: +2:2
- return; // scope 0 at $DIR/derefer_inline_test.rs:+2:2: +2:2
- }
-
- bb4 (cleanup): {
- drop(_2) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/derefer_inline_test.rs:+1:17: +1:18
- }
-
- bb5 (cleanup): {
- resume; // scope 0 at $DIR/derefer_inline_test.rs:+0:1: +2:2
- }
- }
-
diff --git a/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff
new file mode 100644
index 000000000..8ac6acd0e
--- /dev/null
+++ b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-abort.diff
@@ -0,0 +1,38 @@
+- // MIR for `main` before Derefer
++ // MIR for `main` after Derefer
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::boxed::Box<std::boxed::Box<u32>>;
+ let mut _2: std::boxed::Box<u32>;
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = f() -> [return: bb1, unwind: bb5];
+ }
+
+ bb1: {
+ _1 = Box::<Box<u32>>::new(move _2) -> [return: bb2, unwind: bb4];
+ }
+
+ bb2: {
+ StorageDead(_2);
+ drop(_1) -> [return: bb3, unwind: bb5];
+ }
+
+ bb3: {
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
+
+ bb4 (cleanup): {
+ drop(_2) -> [return: bb5, unwind terminate(cleanup)];
+ }
+
+ bb5 (cleanup): {
+ resume;
+ }
+ }
+
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
new file mode 100644
index 000000000..aa9fcb505
--- /dev/null
+++ b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff
@@ -0,0 +1,38 @@
+- // MIR for `main` before Derefer
++ // MIR for `main` after Derefer
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::boxed::Box<std::boxed::Box<u32>>;
+ let mut _2: std::boxed::Box<u32>;
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = f() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ _1 = Box::<Box<u32>>::new(move _2) -> [return: bb2, unwind: bb4];
+ }
+
+ bb2: {
+ StorageDead(_2);
+ drop(_1) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
+
+ bb4 (cleanup): {
+ drop(_2) -> [return: bb5, unwind terminate(cleanup)];
+ }
+
+ bb5 (cleanup): {
+ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/derefer_inline_test.rs b/tests/mir-opt/derefer_inline_test.rs
index 38311d4d0..713c051f4 100644
--- a/tests/mir-opt/derefer_inline_test.rs
+++ b/tests/mir-opt/derefer_inline_test.rs
@@ -1,6 +1,7 @@
+// skip-filecheck
// unit-test: Derefer
// EMIT_MIR derefer_inline_test.main.Derefer.diff
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#[inline]
fn f() -> Box<u32> {
diff --git a/tests/mir-opt/derefer_terminator_test.main.Derefer.diff b/tests/mir-opt/derefer_terminator_test.main.Derefer.diff
deleted file mode 100644
index ab2388d13..000000000
--- a/tests/mir-opt/derefer_terminator_test.main.Derefer.diff
+++ /dev/null
@@ -1,92 +0,0 @@
-- // MIR for `main` before Derefer
-+ // MIR for `main` after Derefer
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/derefer_terminator_test.rs:+0:11: +0:11
- let _1: bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+1:9: +1:10
- let _3: (); // in scope 0 at $DIR/derefer_terminator_test.rs:+3:5: +6:6
- let mut _4: &&&&bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+3:15: +3:22
- let _5: &&&bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+3:17: +3:21
- let _6: &&bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+3:18: +3:21
- let _7: &bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+3:19: +3:21
-+ let mut _10: &&&bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+3:15: +3:22
-+ let mut _11: &&bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+3:15: +3:22
-+ let mut _12: &bool; // in scope 0 at $DIR/derefer_terminator_test.rs:+3:15: +3:22
- scope 1 {
- debug b => _1; // in scope 1 at $DIR/derefer_terminator_test.rs:+1:9: +1:10
- let _2: bool; // in scope 1 at $DIR/derefer_terminator_test.rs:+2:9: +2:10
- scope 2 {
- debug d => _2; // in scope 2 at $DIR/derefer_terminator_test.rs:+2:9: +2:10
- let _8: i32; // in scope 2 at $DIR/derefer_terminator_test.rs:+4:22: +4:23
- let _9: i32; // in scope 2 at $DIR/derefer_terminator_test.rs:+7:9: +7:10
- scope 3 {
- debug x => _8; // in scope 3 at $DIR/derefer_terminator_test.rs:+4:22: +4:23
- }
- scope 4 {
- debug y => _9; // in scope 4 at $DIR/derefer_terminator_test.rs:+7:9: +7:10
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/derefer_terminator_test.rs:+1:9: +1:10
- _1 = foo() -> bb1; // scope 0 at $DIR/derefer_terminator_test.rs:+1:13: +1:18
- // mir::Constant
- // + span: $DIR/derefer_terminator_test.rs:6:13: 6:16
- // + literal: Const { ty: fn() -> bool {foo}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageLive(_2); // scope 1 at $DIR/derefer_terminator_test.rs:+2:9: +2:10
- _2 = foo() -> bb2; // scope 1 at $DIR/derefer_terminator_test.rs:+2:13: +2:18
- // mir::Constant
- // + span: $DIR/derefer_terminator_test.rs:7:13: 7:16
- // + literal: Const { ty: fn() -> bool {foo}, val: Value(<ZST>) }
- }
-
- bb2: {
- StorageLive(_3); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +6:6
- StorageLive(_4); // scope 2 at $DIR/derefer_terminator_test.rs:+3:15: +3:22
- StorageLive(_5); // scope 2 at $DIR/derefer_terminator_test.rs:+3:17: +3:21
- StorageLive(_6); // scope 2 at $DIR/derefer_terminator_test.rs:+3:18: +3:21
- StorageLive(_7); // scope 2 at $DIR/derefer_terminator_test.rs:+3:19: +3:21
- _7 = &_1; // scope 2 at $DIR/derefer_terminator_test.rs:+3:19: +3:21
- _6 = &_7; // scope 2 at $DIR/derefer_terminator_test.rs:+3:18: +3:21
- _5 = &_6; // scope 2 at $DIR/derefer_terminator_test.rs:+3:17: +3:21
- _4 = &_5; // scope 2 at $DIR/derefer_terminator_test.rs:+3:15: +3:22
-- switchInt((*(*(*(*_4))))) -> [0: bb3, otherwise: bb4]; // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22
-+ _10 = deref_copy (*_4); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22
-+ _11 = deref_copy (*_10); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22
-+ _12 = deref_copy (*_11); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22
-+ switchInt((*_12)) -> [0: bb3, otherwise: bb4]; // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22
- }
-
- bb3: {
- _3 = const (); // scope 2 at $DIR/derefer_terminator_test.rs:+5:18: +5:20
- goto -> bb5; // scope 2 at $DIR/derefer_terminator_test.rs:+5:18: +5:20
- }
-
- bb4: {
- StorageLive(_8); // scope 2 at $DIR/derefer_terminator_test.rs:+4:22: +4:23
- _8 = const 5_i32; // scope 2 at $DIR/derefer_terminator_test.rs:+4:26: +4:27
- _3 = const (); // scope 2 at $DIR/derefer_terminator_test.rs:+4:17: +4:29
- StorageDead(_8); // scope 2 at $DIR/derefer_terminator_test.rs:+4:28: +4:29
- goto -> bb5; // scope 2 at $DIR/derefer_terminator_test.rs:+4:28: +4:29
- }
-
- bb5: {
- StorageDead(_7); // scope 2 at $DIR/derefer_terminator_test.rs:+6:5: +6:6
- StorageDead(_6); // scope 2 at $DIR/derefer_terminator_test.rs:+6:5: +6:6
- StorageDead(_5); // scope 2 at $DIR/derefer_terminator_test.rs:+6:5: +6:6
- StorageDead(_4); // scope 2 at $DIR/derefer_terminator_test.rs:+6:5: +6:6
- StorageDead(_3); // scope 2 at $DIR/derefer_terminator_test.rs:+6:5: +6:6
- StorageLive(_9); // scope 2 at $DIR/derefer_terminator_test.rs:+7:9: +7:10
- _9 = const 42_i32; // scope 2 at $DIR/derefer_terminator_test.rs:+7:13: +7:15
- _0 = const (); // scope 0 at $DIR/derefer_terminator_test.rs:+0:11: +8:2
- StorageDead(_9); // scope 2 at $DIR/derefer_terminator_test.rs:+8:1: +8:2
- StorageDead(_2); // scope 1 at $DIR/derefer_terminator_test.rs:+8:1: +8:2
- StorageDead(_1); // scope 0 at $DIR/derefer_terminator_test.rs:+8:1: +8:2
- return; // scope 0 at $DIR/derefer_terminator_test.rs:+8:2: +8:2
- }
- }
-
diff --git a/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff
new file mode 100644
index 000000000..f4c034517
--- /dev/null
+++ b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff
@@ -0,0 +1,98 @@
+- // MIR for `main` before Derefer
++ // MIR for `main` after Derefer
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: bool;
+ let _3: ();
+ let mut _4: &&&&bool;
+ let _5: &&&bool;
+ let _6: &&bool;
+ let _7: &bool;
++ let mut _10: &&&bool;
++ let mut _11: &&bool;
++ let mut _12: &bool;
++ let mut _13: &&&bool;
++ let mut _14: &&bool;
++ let mut _15: &bool;
+ scope 1 {
+ debug b => _1;
+ let _2: bool;
+ scope 2 {
+ debug d => _2;
+ let _8: i32;
+ let _9: i32;
+ scope 3 {
+ debug x => _8;
+ }
+ scope 4 {
+ debug y => _9;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = foo() -> [return: bb1, unwind: bb6];
+ }
+
+ bb1: {
+ StorageLive(_2);
+ _2 = foo() -> [return: bb2, unwind: bb6];
+ }
+
+ bb2: {
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &_1;
+ _6 = &_7;
+ _5 = &_6;
+ _4 = &_5;
+- PlaceMention((*(*(*(*_4)))));
+- switchInt((*(*(*(*_4))))) -> [0: bb3, otherwise: bb4];
++ _10 = deref_copy (*_4);
++ _11 = deref_copy (*_10);
++ _12 = deref_copy (*_11);
++ PlaceMention((*_12));
++ _13 = deref_copy (*_4);
++ _14 = deref_copy (*_13);
++ _15 = deref_copy (*_14);
++ switchInt((*_15)) -> [0: bb3, otherwise: bb4];
+ }
+
+ bb3: {
+ _3 = const ();
+ goto -> bb5;
+ }
+
+ bb4: {
+ StorageLive(_8);
+ _8 = const 5_i32;
+ _3 = const ();
+ StorageDead(_8);
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageLive(_9);
+ _9 = const 42_i32;
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+
+ bb6 (cleanup): {
+ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff
new file mode 100644
index 000000000..e3c0c6b7d
--- /dev/null
+++ b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff
@@ -0,0 +1,94 @@
+- // MIR for `main` before Derefer
++ // MIR for `main` after Derefer
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: bool;
+ let _3: ();
+ let mut _4: &&&&bool;
+ let _5: &&&bool;
+ let _6: &&bool;
+ let _7: &bool;
++ let mut _10: &&&bool;
++ let mut _11: &&bool;
++ let mut _12: &bool;
++ let mut _13: &&&bool;
++ let mut _14: &&bool;
++ let mut _15: &bool;
+ scope 1 {
+ debug b => _1;
+ let _2: bool;
+ scope 2 {
+ debug d => _2;
+ let _8: i32;
+ let _9: i32;
+ scope 3 {
+ debug x => _8;
+ }
+ scope 4 {
+ debug y => _9;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = foo() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageLive(_2);
+ _2 = foo() -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &_1;
+ _6 = &_7;
+ _5 = &_6;
+ _4 = &_5;
+- PlaceMention((*(*(*(*_4)))));
+- switchInt((*(*(*(*_4))))) -> [0: bb3, otherwise: bb4];
++ _10 = deref_copy (*_4);
++ _11 = deref_copy (*_10);
++ _12 = deref_copy (*_11);
++ PlaceMention((*_12));
++ _13 = deref_copy (*_4);
++ _14 = deref_copy (*_13);
++ _15 = deref_copy (*_14);
++ switchInt((*_15)) -> [0: bb3, otherwise: bb4];
+ }
+
+ bb3: {
+ _3 = const ();
+ goto -> bb5;
+ }
+
+ bb4: {
+ StorageLive(_8);
+ _8 = const 5_i32;
+ _3 = const ();
+ StorageDead(_8);
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageLive(_9);
+ _9 = const 42_i32;
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/derefer_terminator_test.rs b/tests/mir-opt/derefer_terminator_test.rs
index d6750c29d..3780ff5df 100644
--- a/tests/mir-opt/derefer_terminator_test.rs
+++ b/tests/mir-opt/derefer_terminator_test.rs
@@ -1,6 +1,7 @@
+// skip-filecheck
// unit-test: Derefer
// EMIT_MIR derefer_terminator_test.main.Derefer.diff
-// ignore-wasm32
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
fn main() {
let b = foo();
diff --git a/tests/mir-opt/derefer_test.main.Derefer.diff b/tests/mir-opt/derefer_test.main.Derefer.diff
index 87306d818..c50b74051 100644
--- a/tests/mir-opt/derefer_test.main.Derefer.diff
+++ b/tests/mir-opt/derefer_test.main.Derefer.diff
@@ -2,49 +2,49 @@
+ // MIR for `main` after Derefer
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/derefer_test.rs:+0:11: +0:11
- let mut _1: (i32, i32); // in scope 0 at $DIR/derefer_test.rs:+1:9: +1:14
- let mut _3: &mut (i32, i32); // in scope 0 at $DIR/derefer_test.rs:+2:22: +2:28
-+ let mut _6: &mut (i32, i32); // in scope 0 at $DIR/derefer_test.rs:+2:9: +2:14
-+ let mut _7: &mut (i32, i32); // in scope 0 at $DIR/derefer_test.rs:+2:9: +2:14
+ let mut _0: ();
+ let mut _1: (i32, i32);
+ let mut _3: &mut (i32, i32);
++ let mut _6: &mut (i32, i32);
++ let mut _7: &mut (i32, i32);
scope 1 {
- debug a => _1; // in scope 1 at $DIR/derefer_test.rs:+1:9: +1:14
- let mut _2: (i32, &mut (i32, i32)); // in scope 1 at $DIR/derefer_test.rs:+2:9: +2:14
+ debug a => _1;
+ let mut _2: (i32, &mut (i32, i32));
scope 2 {
- debug b => _2; // in scope 2 at $DIR/derefer_test.rs:+2:9: +2:14
- let _4: &mut i32; // in scope 2 at $DIR/derefer_test.rs:+3:9: +3:10
+ debug b => _2;
+ let _4: &mut i32;
scope 3 {
- debug x => _4; // in scope 3 at $DIR/derefer_test.rs:+3:9: +3:10
- let _5: &mut i32; // in scope 3 at $DIR/derefer_test.rs:+4:9: +4:10
+ debug x => _4;
+ let _5: &mut i32;
scope 4 {
- debug y => _5; // in scope 4 at $DIR/derefer_test.rs:+4:9: +4:10
+ debug y => _5;
}
}
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/derefer_test.rs:+1:9: +1:14
- _1 = (const 42_i32, const 43_i32); // scope 0 at $DIR/derefer_test.rs:+1:17: +1:24
- StorageLive(_2); // scope 1 at $DIR/derefer_test.rs:+2:9: +2:14
- StorageLive(_3); // scope 1 at $DIR/derefer_test.rs:+2:22: +2:28
- _3 = &mut _1; // scope 1 at $DIR/derefer_test.rs:+2:22: +2:28
- _2 = (const 99_i32, move _3); // scope 1 at $DIR/derefer_test.rs:+2:17: +2:29
- StorageDead(_3); // scope 1 at $DIR/derefer_test.rs:+2:28: +2:29
- StorageLive(_4); // scope 2 at $DIR/derefer_test.rs:+3:9: +3:10
-- _4 = &mut ((*(_2.1: &mut (i32, i32))).0: i32); // scope 2 at $DIR/derefer_test.rs:+3:13: +3:26
-+ _6 = deref_copy (_2.1: &mut (i32, i32)); // scope 2 at $DIR/derefer_test.rs:+3:13: +3:26
-+ _4 = &mut ((*_6).0: i32); // scope 2 at $DIR/derefer_test.rs:+3:13: +3:26
- StorageLive(_5); // scope 3 at $DIR/derefer_test.rs:+4:9: +4:10
-- _5 = &mut ((*(_2.1: &mut (i32, i32))).1: i32); // scope 3 at $DIR/derefer_test.rs:+4:13: +4:26
-+ _7 = deref_copy (_2.1: &mut (i32, i32)); // scope 3 at $DIR/derefer_test.rs:+4:13: +4:26
-+ _5 = &mut ((*_7).1: i32); // scope 3 at $DIR/derefer_test.rs:+4:13: +4:26
- _0 = const (); // scope 0 at $DIR/derefer_test.rs:+0:11: +5:2
- StorageDead(_5); // scope 3 at $DIR/derefer_test.rs:+5:1: +5:2
- StorageDead(_4); // scope 2 at $DIR/derefer_test.rs:+5:1: +5:2
- StorageDead(_2); // scope 1 at $DIR/derefer_test.rs:+5:1: +5:2
- StorageDead(_1); // scope 0 at $DIR/derefer_test.rs:+5:1: +5:2
- return; // scope 0 at $DIR/derefer_test.rs:+5:2: +5:2
+ StorageLive(_1);
+ _1 = (const 42_i32, const 43_i32);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &mut _1;
+ _2 = (const 99_i32, move _3);
+ StorageDead(_3);
+ StorageLive(_4);
+- _4 = &mut ((*(_2.1: &mut (i32, i32))).0: i32);
++ _6 = deref_copy (_2.1: &mut (i32, i32));
++ _4 = &mut ((*_6).0: i32);
+ StorageLive(_5);
+- _5 = &mut ((*(_2.1: &mut (i32, i32))).1: i32);
++ _7 = deref_copy (_2.1: &mut (i32, i32));
++ _5 = &mut ((*_7).1: i32);
+ _0 = const ();
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/derefer_test.rs b/tests/mir-opt/derefer_test.rs
index fad0fe8eb..171925bb1 100644
--- a/tests/mir-opt/derefer_test.rs
+++ b/tests/mir-opt/derefer_test.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: Derefer
// EMIT_MIR derefer_test.main.Derefer.diff
fn main() {
diff --git a/tests/mir-opt/derefer_test_multiple.main.Derefer.diff b/tests/mir-opt/derefer_test_multiple.main.Derefer.diff
index 3e40db118..796131696 100644
--- a/tests/mir-opt/derefer_test_multiple.main.Derefer.diff
+++ b/tests/mir-opt/derefer_test_multiple.main.Derefer.diff
@@ -2,34 +2,34 @@
+ // MIR for `main` after Derefer
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/derefer_test_multiple.rs:+0:12: +0:12
- let mut _1: (i32, i32); // in scope 0 at $DIR/derefer_test_multiple.rs:+1:9: +1:14
- let mut _3: &mut (i32, i32); // in scope 0 at $DIR/derefer_test_multiple.rs:+2:22: +2:28
- let mut _5: &mut (i32, &mut (i32, i32)); // in scope 0 at $DIR/derefer_test_multiple.rs:+3:22: +3:28
- let mut _7: &mut (i32, &mut (i32, &mut (i32, i32))); // in scope 0 at $DIR/derefer_test_multiple.rs:+4:22: +4:28
-+ let mut _10: &mut (i32, &mut (i32, &mut (i32, i32))); // in scope 0 at $DIR/derefer_test_multiple.rs:+4:9: +4:14
-+ let mut _11: &mut (i32, &mut (i32, i32)); // in scope 0 at $DIR/derefer_test_multiple.rs:+4:9: +4:14
-+ let mut _12: &mut (i32, i32); // in scope 0 at $DIR/derefer_test_multiple.rs:+4:9: +4:14
-+ let mut _13: &mut (i32, &mut (i32, &mut (i32, i32))); // in scope 0 at $DIR/derefer_test_multiple.rs:+4:9: +4:14
-+ let mut _14: &mut (i32, &mut (i32, i32)); // in scope 0 at $DIR/derefer_test_multiple.rs:+4:9: +4:14
-+ let mut _15: &mut (i32, i32); // in scope 0 at $DIR/derefer_test_multiple.rs:+4:9: +4:14
+ let mut _0: ();
+ let mut _1: (i32, i32);
+ let mut _3: &mut (i32, i32);
+ let mut _5: &mut (i32, &mut (i32, i32));
+ let mut _7: &mut (i32, &mut (i32, &mut (i32, i32)));
++ let mut _10: &mut (i32, &mut (i32, &mut (i32, i32)));
++ let mut _11: &mut (i32, &mut (i32, i32));
++ let mut _12: &mut (i32, i32);
++ let mut _13: &mut (i32, &mut (i32, &mut (i32, i32)));
++ let mut _14: &mut (i32, &mut (i32, i32));
++ let mut _15: &mut (i32, i32);
scope 1 {
- debug a => _1; // in scope 1 at $DIR/derefer_test_multiple.rs:+1:9: +1:14
- let mut _2: (i32, &mut (i32, i32)); // in scope 1 at $DIR/derefer_test_multiple.rs:+2:9: +2:14
+ debug a => _1;
+ let mut _2: (i32, &mut (i32, i32));
scope 2 {
- debug b => _2; // in scope 2 at $DIR/derefer_test_multiple.rs:+2:9: +2:14
- let mut _4: (i32, &mut (i32, &mut (i32, i32))); // in scope 2 at $DIR/derefer_test_multiple.rs:+3:9: +3:14
+ debug b => _2;
+ let mut _4: (i32, &mut (i32, &mut (i32, i32)));
scope 3 {
- debug c => _4; // in scope 3 at $DIR/derefer_test_multiple.rs:+3:9: +3:14
- let mut _6: (i32, &mut (i32, &mut (i32, &mut (i32, i32)))); // in scope 3 at $DIR/derefer_test_multiple.rs:+4:9: +4:14
+ debug c => _4;
+ let mut _6: (i32, &mut (i32, &mut (i32, &mut (i32, i32))));
scope 4 {
- debug d => _6; // in scope 4 at $DIR/derefer_test_multiple.rs:+4:9: +4:14
- let _8: &mut i32; // in scope 4 at $DIR/derefer_test_multiple.rs:+5:9: +5:10
+ debug d => _6;
+ let _8: &mut i32;
scope 5 {
- debug x => _8; // in scope 5 at $DIR/derefer_test_multiple.rs:+5:9: +5:10
- let _9: &mut i32; // in scope 5 at $DIR/derefer_test_multiple.rs:+6:9: +6:10
+ debug x => _8;
+ let _9: &mut i32;
scope 6 {
- debug y => _9; // in scope 6 at $DIR/derefer_test_multiple.rs:+6:9: +6:10
+ debug y => _9;
}
}
}
@@ -38,43 +38,43 @@
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/derefer_test_multiple.rs:+1:9: +1:14
- _1 = (const 42_i32, const 43_i32); // scope 0 at $DIR/derefer_test_multiple.rs:+1:17: +1:25
- StorageLive(_2); // scope 1 at $DIR/derefer_test_multiple.rs:+2:9: +2:14
- StorageLive(_3); // scope 1 at $DIR/derefer_test_multiple.rs:+2:22: +2:28
- _3 = &mut _1; // scope 1 at $DIR/derefer_test_multiple.rs:+2:22: +2:28
- _2 = (const 99_i32, move _3); // scope 1 at $DIR/derefer_test_multiple.rs:+2:17: +2:29
- StorageDead(_3); // scope 1 at $DIR/derefer_test_multiple.rs:+2:28: +2:29
- StorageLive(_4); // scope 2 at $DIR/derefer_test_multiple.rs:+3:9: +3:14
- StorageLive(_5); // scope 2 at $DIR/derefer_test_multiple.rs:+3:22: +3:28
- _5 = &mut _2; // scope 2 at $DIR/derefer_test_multiple.rs:+3:22: +3:28
- _4 = (const 11_i32, move _5); // scope 2 at $DIR/derefer_test_multiple.rs:+3:17: +3:29
- StorageDead(_5); // scope 2 at $DIR/derefer_test_multiple.rs:+3:28: +3:29
- StorageLive(_6); // scope 3 at $DIR/derefer_test_multiple.rs:+4:9: +4:14
- StorageLive(_7); // scope 3 at $DIR/derefer_test_multiple.rs:+4:22: +4:28
- _7 = &mut _4; // scope 3 at $DIR/derefer_test_multiple.rs:+4:22: +4:28
- _6 = (const 13_i32, move _7); // scope 3 at $DIR/derefer_test_multiple.rs:+4:17: +4:29
- StorageDead(_7); // scope 3 at $DIR/derefer_test_multiple.rs:+4:28: +4:29
- StorageLive(_8); // scope 4 at $DIR/derefer_test_multiple.rs:+5:9: +5:10
-- _8 = &mut ((*((*((*(_6.1: &mut (i32, &mut (i32, &mut (i32, i32))))).1: &mut (i32, &mut (i32, i32)))).1: &mut (i32, i32))).1: i32); // scope 4 at $DIR/derefer_test_multiple.rs:+5:13: +5:30
-+ _10 = deref_copy (_6.1: &mut (i32, &mut (i32, &mut (i32, i32)))); // scope 4 at $DIR/derefer_test_multiple.rs:+5:13: +5:30
-+ _11 = deref_copy ((*_10).1: &mut (i32, &mut (i32, i32))); // scope 4 at $DIR/derefer_test_multiple.rs:+5:13: +5:30
-+ _12 = deref_copy ((*_11).1: &mut (i32, i32)); // scope 4 at $DIR/derefer_test_multiple.rs:+5:13: +5:30
-+ _8 = &mut ((*_12).1: i32); // scope 4 at $DIR/derefer_test_multiple.rs:+5:13: +5:30
- StorageLive(_9); // scope 5 at $DIR/derefer_test_multiple.rs:+6:9: +6:10
-- _9 = &mut ((*((*((*(_6.1: &mut (i32, &mut (i32, &mut (i32, i32))))).1: &mut (i32, &mut (i32, i32)))).1: &mut (i32, i32))).1: i32); // scope 5 at $DIR/derefer_test_multiple.rs:+6:13: +6:30
-+ _13 = deref_copy (_6.1: &mut (i32, &mut (i32, &mut (i32, i32)))); // scope 5 at $DIR/derefer_test_multiple.rs:+6:13: +6:30
-+ _14 = deref_copy ((*_13).1: &mut (i32, &mut (i32, i32))); // scope 5 at $DIR/derefer_test_multiple.rs:+6:13: +6:30
-+ _15 = deref_copy ((*_14).1: &mut (i32, i32)); // scope 5 at $DIR/derefer_test_multiple.rs:+6:13: +6:30
-+ _9 = &mut ((*_15).1: i32); // scope 5 at $DIR/derefer_test_multiple.rs:+6:13: +6:30
- _0 = const (); // scope 0 at $DIR/derefer_test_multiple.rs:+0:12: +7:2
- StorageDead(_9); // scope 5 at $DIR/derefer_test_multiple.rs:+7:1: +7:2
- StorageDead(_8); // scope 4 at $DIR/derefer_test_multiple.rs:+7:1: +7:2
- StorageDead(_6); // scope 3 at $DIR/derefer_test_multiple.rs:+7:1: +7:2
- StorageDead(_4); // scope 2 at $DIR/derefer_test_multiple.rs:+7:1: +7:2
- StorageDead(_2); // scope 1 at $DIR/derefer_test_multiple.rs:+7:1: +7:2
- StorageDead(_1); // scope 0 at $DIR/derefer_test_multiple.rs:+7:1: +7:2
- return; // scope 0 at $DIR/derefer_test_multiple.rs:+7:2: +7:2
+ StorageLive(_1);
+ _1 = (const 42_i32, const 43_i32);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &mut _1;
+ _2 = (const 99_i32, move _3);
+ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = &mut _2;
+ _4 = (const 11_i32, move _5);
+ StorageDead(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &mut _4;
+ _6 = (const 13_i32, move _7);
+ StorageDead(_7);
+ StorageLive(_8);
+- _8 = &mut ((*((*((*(_6.1: &mut (i32, &mut (i32, &mut (i32, i32))))).1: &mut (i32, &mut (i32, i32)))).1: &mut (i32, i32))).1: i32);
++ _10 = deref_copy (_6.1: &mut (i32, &mut (i32, &mut (i32, i32))));
++ _11 = deref_copy ((*_10).1: &mut (i32, &mut (i32, i32)));
++ _12 = deref_copy ((*_11).1: &mut (i32, i32));
++ _8 = &mut ((*_12).1: i32);
+ StorageLive(_9);
+- _9 = &mut ((*((*((*(_6.1: &mut (i32, &mut (i32, &mut (i32, i32))))).1: &mut (i32, &mut (i32, i32)))).1: &mut (i32, i32))).1: i32);
++ _13 = deref_copy (_6.1: &mut (i32, &mut (i32, &mut (i32, i32))));
++ _14 = deref_copy ((*_13).1: &mut (i32, &mut (i32, i32)));
++ _15 = deref_copy ((*_14).1: &mut (i32, i32));
++ _9 = &mut ((*_15).1: i32);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/derefer_test_multiple.rs b/tests/mir-opt/derefer_test_multiple.rs
index 0b3888b07..ac778a9c9 100644
--- a/tests/mir-opt/derefer_test_multiple.rs
+++ b/tests/mir-opt/derefer_test_multiple.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: Derefer
// EMIT_MIR derefer_test_multiple.main.Derefer.diff
fn main () {
diff --git a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff
deleted file mode 100644
index b7416d389..000000000
--- a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff
+++ /dev/null
@@ -1,75 +0,0 @@
-- // MIR for `foo` before DestinationPropagation
-+ // MIR for `foo` after DestinationPropagation
-
- fn foo() -> i32 {
- let mut _0: i32; // return place in scope 0 at $DIR/branch.rs:+0:13: +0:16
- let _1: i32; // in scope 0 at $DIR/branch.rs:+1:9: +1:10
- let mut _3: bool; // in scope 0 at $DIR/branch.rs:+3:16: +3:22
- let _4: i32; // in scope 0 at $DIR/branch.rs:+6:9: +6:14
- scope 1 {
-- debug x => _1; // in scope 1 at $DIR/branch.rs:+1:9: +1:10
-+ debug x => _0; // in scope 1 at $DIR/branch.rs:+1:9: +1:10
- let _2: i32; // in scope 1 at $DIR/branch.rs:+3:9: +3:10
- scope 2 {
-- debug y => _2; // in scope 2 at $DIR/branch.rs:+3:9: +3:10
-+ debug y => _0; // in scope 2 at $DIR/branch.rs:+3:9: +3:10
- }
- }
-
- bb0: {
-- StorageLive(_1); // scope 0 at $DIR/branch.rs:+1:9: +1:10
-- _1 = val() -> bb1; // scope 0 at $DIR/branch.rs:+1:13: +1:18
-+ nop; // scope 0 at $DIR/branch.rs:+1:9: +1:10
-+ _0 = val() -> bb1; // scope 0 at $DIR/branch.rs:+1:13: +1:18
- // mir::Constant
- // + span: $DIR/branch.rs:14:13: 14:16
- // + literal: Const { ty: fn() -> i32 {val}, val: Value(<ZST>) }
- }
-
- bb1: {
-- StorageLive(_2); // scope 1 at $DIR/branch.rs:+3:9: +3:10
-+ nop; // scope 1 at $DIR/branch.rs:+3:9: +3:10
- StorageLive(_3); // scope 1 at $DIR/branch.rs:+3:16: +3:22
- _3 = cond() -> bb2; // scope 1 at $DIR/branch.rs:+3:16: +3:22
- // mir::Constant
- // + span: $DIR/branch.rs:16:16: 16:20
- // + literal: Const { ty: fn() -> bool {cond}, val: Value(<ZST>) }
- }
-
- bb2: {
- switchInt(move _3) -> [0: bb4, otherwise: bb3]; // scope 1 at $DIR/branch.rs:+3:16: +3:22
- }
-
- bb3: {
-- _2 = _1; // scope 1 at $DIR/branch.rs:+4:9: +4:10
-+ nop; // scope 1 at $DIR/branch.rs:+4:9: +4:10
- goto -> bb6; // scope 1 at $DIR/branch.rs:+3:13: +8:6
- }
-
- bb4: {
- StorageLive(_4); // scope 1 at $DIR/branch.rs:+6:9: +6:14
- _4 = val() -> bb5; // scope 1 at $DIR/branch.rs:+6:9: +6:14
- // mir::Constant
- // + span: $DIR/branch.rs:19:9: 19:12
- // + literal: Const { ty: fn() -> i32 {val}, val: Value(<ZST>) }
- }
-
- bb5: {
- StorageDead(_4); // scope 1 at $DIR/branch.rs:+6:14: +6:15
-- _2 = _1; // scope 1 at $DIR/branch.rs:+7:9: +7:10
-+ nop; // scope 1 at $DIR/branch.rs:+7:9: +7:10
- goto -> bb6; // scope 1 at $DIR/branch.rs:+3:13: +8:6
- }
-
- bb6: {
- StorageDead(_3); // scope 1 at $DIR/branch.rs:+8:5: +8:6
-- _0 = _2; // scope 2 at $DIR/branch.rs:+10:5: +10:6
-- StorageDead(_2); // scope 1 at $DIR/branch.rs:+11:1: +11:2
-- StorageDead(_1); // scope 0 at $DIR/branch.rs:+11:1: +11:2
-+ nop; // scope 2 at $DIR/branch.rs:+10:5: +10:6
-+ nop; // scope 1 at $DIR/branch.rs:+11:1: +11:2
-+ nop; // scope 0 at $DIR/branch.rs:+11:1: +11:2
- return; // scope 0 at $DIR/branch.rs:+11:2: +11:2
- }
- }
-
diff --git a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff
new file mode 100644
index 000000000..10ec3aa55
--- /dev/null
+++ b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff
@@ -0,0 +1,66 @@
+- // MIR for `foo` before DestinationPropagation
++ // MIR for `foo` after DestinationPropagation
+
+ fn foo() -> i32 {
+ let mut _0: i32;
+ let _1: i32;
+ let mut _3: bool;
+ let _4: i32;
+ scope 1 {
+- debug x => _1;
++ debug x => _0;
+ let _2: i32;
+ scope 2 {
+- debug y => _2;
++ debug y => _0;
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
+- _1 = val() -> [return: bb1, unwind unreachable];
++ nop;
++ _0 = val() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- StorageLive(_2);
++ nop;
+ StorageLive(_3);
+ _3 = cond() -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ switchInt(move _3) -> [0: bb4, otherwise: bb3];
+ }
+
+ bb3: {
+- _2 = _1;
++ nop;
+ goto -> bb6;
+ }
+
+ bb4: {
+ StorageLive(_4);
+ _4 = val() -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_4);
+- _2 = _1;
++ nop;
+ goto -> bb6;
+ }
+
+ bb6: {
+ StorageDead(_3);
+- _0 = _2;
+- StorageDead(_2);
+- StorageDead(_1);
++ nop;
++ nop;
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff
new file mode 100644
index 000000000..759c1cabf
--- /dev/null
+++ b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff
@@ -0,0 +1,66 @@
+- // MIR for `foo` before DestinationPropagation
++ // MIR for `foo` after DestinationPropagation
+
+ fn foo() -> i32 {
+ let mut _0: i32;
+ let _1: i32;
+ let mut _3: bool;
+ let _4: i32;
+ scope 1 {
+- debug x => _1;
++ debug x => _0;
+ let _2: i32;
+ scope 2 {
+- debug y => _2;
++ debug y => _0;
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
+- _1 = val() -> [return: bb1, unwind continue];
++ nop;
++ _0 = val() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- StorageLive(_2);
++ nop;
+ StorageLive(_3);
+ _3 = cond() -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ switchInt(move _3) -> [0: bb4, otherwise: bb3];
+ }
+
+ bb3: {
+- _2 = _1;
++ nop;
+ goto -> bb6;
+ }
+
+ bb4: {
+ StorageLive(_4);
+ _4 = val() -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_4);
+- _2 = _1;
++ nop;
+ goto -> bb6;
+ }
+
+ bb6: {
+ StorageDead(_3);
+- _0 = _2;
+- StorageDead(_2);
+- StorageDead(_1);
++ nop;
++ nop;
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/branch.rs b/tests/mir-opt/dest-prop/branch.rs
index 7e4276e66..d8c74a0aa 100644
--- a/tests/mir-opt/dest-prop/branch.rs
+++ b/tests/mir-opt/dest-prop/branch.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that assignment in both branches of an `if` are eliminated.
// unit-test: DestinationPropagation
fn val() -> i32 {
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff
deleted file mode 100644
index 4343a5935..000000000
--- a/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.diff
+++ /dev/null
@@ -1,26 +0,0 @@
-- // MIR for `arg_src` before DestinationPropagation
-+ // MIR for `arg_src` after DestinationPropagation
-
- fn arg_src(_1: i32) -> i32 {
- debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:12: +0:17
- let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:27: +0:30
- let _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
- scope 1 {
-- debug y => _2; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
-+ debug y => _0; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
- }
-
- bb0: {
-- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
-- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14
-+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
-+ _0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14
- _1 = const 123_i32; // scope 1 at $DIR/copy_propagation_arg.rs:+2:5: +2:12
-- _0 = _2; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6
-- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+4:1: +4:2
-+ nop; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6
-+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+4:1: +4:2
- return; // scope 0 at $DIR/copy_propagation_arg.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-abort.diff
new file mode 100644
index 000000000..1aed07f9e
--- /dev/null
+++ b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-abort.diff
@@ -0,0 +1,26 @@
+- // MIR for `arg_src` before DestinationPropagation
++ // MIR for `arg_src` after DestinationPropagation
+
+ fn arg_src(_1: i32) -> i32 {
+ debug x => _1;
+ let mut _0: i32;
+ let _2: i32;
+ scope 1 {
+- debug y => _2;
++ debug y => _0;
+ }
+
+ bb0: {
+- StorageLive(_2);
+- _2 = _1;
++ nop;
++ _0 = _1;
+ _1 = const 123_i32;
+- _0 = _2;
+- StorageDead(_2);
++ nop;
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.diff
new file mode 100644
index 000000000..1aed07f9e
--- /dev/null
+++ b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.diff
@@ -0,0 +1,26 @@
+- // MIR for `arg_src` before DestinationPropagation
++ // MIR for `arg_src` after DestinationPropagation
+
+ fn arg_src(_1: i32) -> i32 {
+ debug x => _1;
+ let mut _0: i32;
+ let _2: i32;
+ scope 1 {
+- debug y => _2;
++ debug y => _0;
+ }
+
+ bb0: {
+- StorageLive(_2);
+- _2 = _1;
++ nop;
++ _0 = _1;
+ _1 = const 123_i32;
+- _0 = _2;
+- StorageDead(_2);
++ nop;
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff
deleted file mode 100644
index a61e741f7..000000000
--- a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.diff
+++ /dev/null
@@ -1,32 +0,0 @@
-- // MIR for `bar` before DestinationPropagation
-+ // MIR for `bar` after DestinationPropagation
-
- fn bar(_1: u8) -> () {
- debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13
- let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +0:19
- let _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13
- let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13
-- StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12
-- _3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12
-- _2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13
-+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12
-+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:11: +1:12
-+ _2 = dummy(move _1) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:5: +1:13
- // mir::Constant
- // + span: $DIR/copy_propagation_arg.rs:17:5: 17:10
- // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(<ZST>) }
- }
-
- bb1: {
-- StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+1:12: +1:13
-+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+1:12: +1:13
- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14
- _1 = const 5_u8; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10
- _0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +3:2
- return; // scope 0 at $DIR/copy_propagation_arg.rs:+3:2: +3:2
- }
- }
-
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff
new file mode 100644
index 000000000..641dea594
--- /dev/null
+++ b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff
@@ -0,0 +1,29 @@
+- // MIR for `bar` before DestinationPropagation
++ // MIR for `bar` after DestinationPropagation
+
+ fn bar(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: u8;
+ let mut _3: u8;
+
+ bb0: {
+ StorageLive(_2);
+- StorageLive(_3);
+- _3 = _1;
+- _2 = dummy(move _3) -> [return: bb1, unwind unreachable];
++ nop;
++ nop;
++ _2 = dummy(move _1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- StorageDead(_3);
++ nop;
+ StorageDead(_2);
+ _1 = const 5_u8;
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff
new file mode 100644
index 000000000..8b2835c8c
--- /dev/null
+++ b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff
@@ -0,0 +1,29 @@
+- // MIR for `bar` before DestinationPropagation
++ // MIR for `bar` after DestinationPropagation
+
+ fn bar(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: u8;
+ let mut _3: u8;
+
+ bb0: {
+ StorageLive(_2);
+- StorageLive(_3);
+- _3 = _1;
+- _2 = dummy(move _3) -> [return: bb1, unwind continue];
++ nop;
++ nop;
++ _2 = dummy(move _1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- StorageDead(_3);
++ nop;
+ StorageDead(_2);
+ _1 = const 5_u8;
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff
deleted file mode 100644
index bc88787e6..000000000
--- a/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.diff
+++ /dev/null
@@ -1,22 +0,0 @@
-- // MIR for `baz` before DestinationPropagation
-+ // MIR for `baz` after DestinationPropagation
-
- fn baz(_1: i32) -> i32 {
- debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13
- let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:23: +0:26
- let mut _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
-
- bb0: {
-- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
-- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
-- _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10
-- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
-+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
-+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
-+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:10
-+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:10
- _0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+3:5: +3:6
- return; // scope 0 at $DIR/copy_propagation_arg.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-abort.diff
new file mode 100644
index 000000000..4cddaec01
--- /dev/null
+++ b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-abort.diff
@@ -0,0 +1,22 @@
+- // MIR for `baz` before DestinationPropagation
++ // MIR for `baz` after DestinationPropagation
+
+ fn baz(_1: i32) -> i32 {
+ debug x => _1;
+ let mut _0: i32;
+ let mut _2: i32;
+
+ bb0: {
+- StorageLive(_2);
+- _2 = _1;
+- _1 = move _2;
+- StorageDead(_2);
++ nop;
++ nop;
++ nop;
++ nop;
+ _0 = _1;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff
new file mode 100644
index 000000000..4cddaec01
--- /dev/null
+++ b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff
@@ -0,0 +1,22 @@
+- // MIR for `baz` before DestinationPropagation
++ // MIR for `baz` after DestinationPropagation
+
+ fn baz(_1: i32) -> i32 {
+ debug x => _1;
+ let mut _0: i32;
+ let mut _2: i32;
+
+ bb0: {
+- StorageLive(_2);
+- _2 = _1;
+- _1 = move _2;
+- StorageDead(_2);
++ nop;
++ nop;
++ nop;
++ nop;
+ _0 = _1;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff
deleted file mode 100644
index c7fbecac5..000000000
--- a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.diff
+++ /dev/null
@@ -1,32 +0,0 @@
-- // MIR for `foo` before DestinationPropagation
-+ // MIR for `foo` after DestinationPropagation
-
- fn foo(_1: u8) -> () {
- debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:+0:8: +0:13
- let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +0:19
- let mut _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17
- let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16
-
- bb0: {
-- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17
-+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17
- StorageLive(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16
- _3 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:15: +2:16
-- _2 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17
-+ _1 = dummy(move _3) -> bb1; // scope 0 at $DIR/copy_propagation_arg.rs:+2:9: +2:17
- // mir::Constant
- // + span: $DIR/copy_propagation_arg.rs:12:9: 12:14
- // + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_3); // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17
-- _1 = move _2; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:17
-- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17
-+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:5: +2:17
-+ nop; // scope 0 at $DIR/copy_propagation_arg.rs:+2:16: +2:17
- _0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:+0:19: +3:2
- return; // scope 0 at $DIR/copy_propagation_arg.rs:+3:2: +3:2
- }
- }
-
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff
new file mode 100644
index 000000000..54875cade
--- /dev/null
+++ b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff
@@ -0,0 +1,29 @@
+- // MIR for `foo` before DestinationPropagation
++ // MIR for `foo` after DestinationPropagation
+
+ fn foo(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let mut _2: u8;
+ let mut _3: u8;
+
+ bb0: {
+- StorageLive(_2);
++ nop;
+ StorageLive(_3);
+ _3 = _1;
+- _2 = dummy(move _3) -> [return: bb1, unwind unreachable];
++ _1 = dummy(move _3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+- _1 = move _2;
+- StorageDead(_2);
++ nop;
++ nop;
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff
new file mode 100644
index 000000000..b4c8a8927
--- /dev/null
+++ b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff
@@ -0,0 +1,29 @@
+- // MIR for `foo` before DestinationPropagation
++ // MIR for `foo` after DestinationPropagation
+
+ fn foo(_1: u8) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let mut _2: u8;
+ let mut _3: u8;
+
+ bb0: {
+- StorageLive(_2);
++ nop;
+ StorageLive(_3);
+ _3 = _1;
+- _2 = dummy(move _3) -> [return: bb1, unwind continue];
++ _1 = dummy(move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+- _1 = move _2;
+- StorageDead(_2);
++ nop;
++ nop;
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.rs b/tests/mir-opt/dest-prop/copy_propagation_arg.rs
index 57cb328c2..435cf07ab 100644
--- a/tests/mir-opt/dest-prop/copy_propagation_arg.rs
+++ b/tests/mir-opt/dest-prop/copy_propagation_arg.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that DestinationPropagation does not propagate an assignment to a function argument
// (doing so can break usages of the original argument value)
// unit-test: DestinationPropagation
diff --git a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff
deleted file mode 100644
index b06f069a2..000000000
--- a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff
+++ /dev/null
@@ -1,77 +0,0 @@
-- // MIR for `main` before DestinationPropagation
-+ // MIR for `main` after DestinationPropagation
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:11: +0:11
- let mut _1: i32; // in scope 0 at $DIR/cycle.rs:+1:9: +1:14
- let mut _4: i32; // in scope 0 at $DIR/cycle.rs:+4:9: +4:10
- let _5: (); // in scope 0 at $DIR/cycle.rs:+6:5: +6:12
- let mut _6: i32; // in scope 0 at $DIR/cycle.rs:+6:10: +6:11
- scope 1 {
-- debug x => _1; // in scope 1 at $DIR/cycle.rs:+1:9: +1:14
-+ debug x => _6; // in scope 1 at $DIR/cycle.rs:+1:9: +1:14
- let _2: i32; // in scope 1 at $DIR/cycle.rs:+2:9: +2:10
- scope 2 {
-- debug y => _2; // in scope 2 at $DIR/cycle.rs:+2:9: +2:10
-+ debug y => _6; // in scope 2 at $DIR/cycle.rs:+2:9: +2:10
- let _3: i32; // in scope 2 at $DIR/cycle.rs:+3:9: +3:10
- scope 3 {
-- debug z => _3; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10
-+ debug z => _6; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
-- StorageLive(_1); // scope 0 at $DIR/cycle.rs:+1:9: +1:14
-- _1 = val() -> bb1; // scope 0 at $DIR/cycle.rs:+1:17: +1:22
-+ nop; // scope 0 at $DIR/cycle.rs:+1:9: +1:14
-+ _6 = val() -> bb1; // scope 0 at $DIR/cycle.rs:+1:17: +1:22
- // mir::Constant
- // + span: $DIR/cycle.rs:10:17: 10:20
- // + literal: Const { ty: fn() -> i32 {val}, val: Value(<ZST>) }
- }
-
- bb1: {
-- StorageLive(_2); // scope 1 at $DIR/cycle.rs:+2:9: +2:10
-- _2 = _1; // scope 1 at $DIR/cycle.rs:+2:13: +2:14
-- StorageLive(_3); // scope 2 at $DIR/cycle.rs:+3:9: +3:10
-- _3 = _2; // scope 2 at $DIR/cycle.rs:+3:13: +3:14
-- StorageLive(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10
-- _4 = _3; // scope 3 at $DIR/cycle.rs:+4:9: +4:10
-- _1 = move _4; // scope 3 at $DIR/cycle.rs:+4:5: +4:10
-- StorageDead(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10
-+ nop; // scope 1 at $DIR/cycle.rs:+2:9: +2:10
-+ nop; // scope 1 at $DIR/cycle.rs:+2:13: +2:14
-+ nop; // scope 2 at $DIR/cycle.rs:+3:9: +3:10
-+ nop; // scope 2 at $DIR/cycle.rs:+3:13: +3:14
-+ nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10
-+ nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10
-+ nop; // scope 3 at $DIR/cycle.rs:+4:5: +4:10
-+ nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10
- StorageLive(_5); // scope 3 at $DIR/cycle.rs:+6:5: +6:12
-- StorageLive(_6); // scope 3 at $DIR/cycle.rs:+6:10: +6:11
-- _6 = _1; // scope 3 at $DIR/cycle.rs:+6:10: +6:11
-+ nop; // scope 3 at $DIR/cycle.rs:+6:10: +6:11
-+ nop; // scope 3 at $DIR/cycle.rs:+6:10: +6:11
- _5 = std::mem::drop::<i32>(move _6) -> bb2; // scope 3 at $DIR/cycle.rs:+6:5: +6:12
- // mir::Constant
- // + span: $DIR/cycle.rs:15:5: 15:9
- // + literal: Const { ty: fn(i32) {std::mem::drop::<i32>}, val: Value(<ZST>) }
- }
-
- bb2: {
-- StorageDead(_6); // scope 3 at $DIR/cycle.rs:+6:11: +6:12
-+ nop; // scope 3 at $DIR/cycle.rs:+6:11: +6:12
- StorageDead(_5); // scope 3 at $DIR/cycle.rs:+6:12: +6:13
- _0 = const (); // scope 0 at $DIR/cycle.rs:+0:11: +7:2
-- StorageDead(_3); // scope 2 at $DIR/cycle.rs:+7:1: +7:2
-- StorageDead(_2); // scope 1 at $DIR/cycle.rs:+7:1: +7:2
-- StorageDead(_1); // scope 0 at $DIR/cycle.rs:+7:1: +7:2
-+ nop; // scope 2 at $DIR/cycle.rs:+7:1: +7:2
-+ nop; // scope 1 at $DIR/cycle.rs:+7:1: +7:2
-+ nop; // scope 0 at $DIR/cycle.rs:+7:1: +7:2
- return; // scope 0 at $DIR/cycle.rs:+7:2: +7:2
- }
- }
-
diff --git a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff
new file mode 100644
index 000000000..98b4ee866
--- /dev/null
+++ b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff
@@ -0,0 +1,71 @@
+- // MIR for `main` before DestinationPropagation
++ // MIR for `main` after DestinationPropagation
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+ let mut _4: i32;
+ let _5: ();
+ let mut _6: i32;
+ scope 1 {
+- debug x => _1;
++ debug x => _6;
+ let _2: i32;
+ scope 2 {
+- debug y => _2;
++ debug y => _6;
+ let _3: i32;
+ scope 3 {
+- debug z => _3;
++ debug z => _6;
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
+- _1 = val() -> [return: bb1, unwind unreachable];
++ nop;
++ _6 = val() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- StorageLive(_2);
+- _2 = _1;
+- StorageLive(_3);
+- _3 = _2;
+- StorageLive(_4);
+- _4 = _3;
+- _1 = move _4;
+- StorageDead(_4);
++ nop;
++ nop;
++ nop;
++ nop;
++ nop;
++ nop;
++ nop;
++ nop;
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = _1;
++ nop;
++ nop;
+ _5 = std::mem::drop::<i32>(move _6) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- StorageDead(_6);
++ nop;
+ StorageDead(_5);
+ _0 = const ();
+- StorageDead(_3);
+- StorageDead(_2);
+- StorageDead(_1);
++ nop;
++ nop;
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff
new file mode 100644
index 000000000..6f6e01d37
--- /dev/null
+++ b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff
@@ -0,0 +1,71 @@
+- // MIR for `main` before DestinationPropagation
++ // MIR for `main` after DestinationPropagation
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+ let mut _4: i32;
+ let _5: ();
+ let mut _6: i32;
+ scope 1 {
+- debug x => _1;
++ debug x => _6;
+ let _2: i32;
+ scope 2 {
+- debug y => _2;
++ debug y => _6;
+ let _3: i32;
+ scope 3 {
+- debug z => _3;
++ debug z => _6;
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
+- _1 = val() -> [return: bb1, unwind continue];
++ nop;
++ _6 = val() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- StorageLive(_2);
+- _2 = _1;
+- StorageLive(_3);
+- _3 = _2;
+- StorageLive(_4);
+- _4 = _3;
+- _1 = move _4;
+- StorageDead(_4);
++ nop;
++ nop;
++ nop;
++ nop;
++ nop;
++ nop;
++ nop;
++ nop;
+ StorageLive(_5);
+- StorageLive(_6);
+- _6 = _1;
++ nop;
++ nop;
+ _5 = std::mem::drop::<i32>(move _6) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+- StorageDead(_6);
++ nop;
+ StorageDead(_5);
+ _0 = const ();
+- StorageDead(_3);
+- StorageDead(_2);
+- StorageDead(_1);
++ nop;
++ nop;
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/cycle.rs b/tests/mir-opt/dest-prop/cycle.rs
index 3aea19d80..77cff062c 100644
--- a/tests/mir-opt/dest-prop/cycle.rs
+++ b/tests/mir-opt/dest-prop/cycle.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that cyclic assignments don't hang DestinationPropagation, and result in reasonable code.
// unit-test: DestinationPropagation
fn val() -> i32 {
diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.mir b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.mir
deleted file mode 100644
index b9d4b59d2..000000000
--- a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.mir
+++ /dev/null
@@ -1,34 +0,0 @@
-// MIR for `f` after DestinationPropagation
-
-fn f(_1: usize) -> usize {
- debug a => _1; // in scope 0 at $DIR/dead_stores_79191.rs:+0:6: +0:11
- let mut _0: usize; // return place in scope 0 at $DIR/dead_stores_79191.rs:+0:23: +0:28
- let _2: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+1:9: +1:10
- let mut _3: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+3:9: +3:10
- let mut _4: usize; // in scope 0 at $DIR/dead_stores_79191.rs:+4:8: +4:9
- scope 1 {
- debug b => _3; // in scope 1 at $DIR/dead_stores_79191.rs:+1:9: +1:10
- }
-
- bb0: {
- nop; // scope 0 at $DIR/dead_stores_79191.rs:+1:9: +1:10
- _3 = _1; // scope 0 at $DIR/dead_stores_79191.rs:+1:13: +1:14
- _1 = const 5_usize; // scope 1 at $DIR/dead_stores_79191.rs:+2:5: +2:10
- nop; // scope 1 at $DIR/dead_stores_79191.rs:+3:9: +3:10
- nop; // scope 1 at $DIR/dead_stores_79191.rs:+3:9: +3:10
- _1 = move _3; // scope 1 at $DIR/dead_stores_79191.rs:+3:5: +3:10
- nop; // scope 1 at $DIR/dead_stores_79191.rs:+3:9: +3:10
- nop; // scope 1 at $DIR/dead_stores_79191.rs:+4:8: +4:9
- nop; // scope 1 at $DIR/dead_stores_79191.rs:+4:8: +4:9
- _0 = id::<usize>(move _1) -> bb1; // scope 1 at $DIR/dead_stores_79191.rs:+4:5: +4:10
- // mir::Constant
- // + span: $DIR/dead_stores_79191.rs:13:5: 13:7
- // + literal: Const { ty: fn(usize) -> usize {id::<usize>}, val: Value(<ZST>) }
- }
-
- bb1: {
- nop; // scope 1 at $DIR/dead_stores_79191.rs:+4:9: +4:10
- nop; // scope 0 at $DIR/dead_stores_79191.rs:+5:1: +5:2
- return; // scope 0 at $DIR/dead_stores_79191.rs:+5:2: +5:2
- }
-}
diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir
new file mode 100644
index 000000000..eb160fc19
--- /dev/null
+++ b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir
@@ -0,0 +1,31 @@
+// MIR for `f` after DestinationPropagation
+
+fn f(_1: usize) -> usize {
+ debug a => _1;
+ let mut _0: usize;
+ let _2: usize;
+ let mut _3: usize;
+ let mut _4: usize;
+ scope 1 {
+ debug b => _3;
+ }
+
+ bb0: {
+ nop;
+ _3 = _1;
+ _1 = const 5_usize;
+ nop;
+ nop;
+ _1 = move _3;
+ nop;
+ nop;
+ nop;
+ _0 = id::<usize>(move _1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ nop;
+ nop;
+ return;
+ }
+}
diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir
new file mode 100644
index 000000000..9147de2ec
--- /dev/null
+++ b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir
@@ -0,0 +1,31 @@
+// MIR for `f` after DestinationPropagation
+
+fn f(_1: usize) -> usize {
+ debug a => _1;
+ let mut _0: usize;
+ let _2: usize;
+ let mut _3: usize;
+ let mut _4: usize;
+ scope 1 {
+ debug b => _3;
+ }
+
+ bb0: {
+ nop;
+ _3 = _1;
+ _1 = const 5_usize;
+ nop;
+ nop;
+ _1 = move _3;
+ nop;
+ nop;
+ nop;
+ _0 = id::<usize>(move _1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ nop;
+ nop;
+ return;
+ }
+}
diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.rs b/tests/mir-opt/dest-prop/dead_stores_79191.rs
index 9d4814838..a6fd542d3 100644
--- a/tests/mir-opt/dest-prop/dead_stores_79191.rs
+++ b/tests/mir-opt/dest-prop/dead_stores_79191.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DestinationPropagation
fn id<T>(x: T) -> T {
diff --git a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.mir b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.mir
deleted file mode 100644
index 9eb0e09bf..000000000
--- a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.mir
+++ /dev/null
@@ -1,33 +0,0 @@
-// MIR for `f` after DestinationPropagation
-
-fn f(_1: usize) -> usize {
- debug a => _1; // in scope 0 at $DIR/dead_stores_better.rs:+0:10: +0:15
- let mut _0: usize; // return place in scope 0 at $DIR/dead_stores_better.rs:+0:27: +0:32
- let _2: usize; // in scope 0 at $DIR/dead_stores_better.rs:+1:9: +1:10
- let mut _3: usize; // in scope 0 at $DIR/dead_stores_better.rs:+3:9: +3:10
- let mut _4: usize; // in scope 0 at $DIR/dead_stores_better.rs:+4:8: +4:9
- scope 1 {
- debug b => _1; // in scope 1 at $DIR/dead_stores_better.rs:+1:9: +1:10
- }
-
- bb0: {
- nop; // scope 0 at $DIR/dead_stores_better.rs:+1:9: +1:10
- nop; // scope 0 at $DIR/dead_stores_better.rs:+1:13: +1:14
- nop; // scope 1 at $DIR/dead_stores_better.rs:+3:9: +3:10
- nop; // scope 1 at $DIR/dead_stores_better.rs:+3:9: +3:10
- nop; // scope 1 at $DIR/dead_stores_better.rs:+3:5: +3:10
- nop; // scope 1 at $DIR/dead_stores_better.rs:+3:9: +3:10
- nop; // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9
- nop; // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9
- _0 = id::<usize>(move _1) -> bb1; // scope 1 at $DIR/dead_stores_better.rs:+4:5: +4:10
- // mir::Constant
- // + span: $DIR/dead_stores_better.rs:17:5: 17:7
- // + literal: Const { ty: fn(usize) -> usize {id::<usize>}, val: Value(<ZST>) }
- }
-
- bb1: {
- nop; // scope 1 at $DIR/dead_stores_better.rs:+4:9: +4:10
- nop; // scope 0 at $DIR/dead_stores_better.rs:+5:1: +5:2
- return; // scope 0 at $DIR/dead_stores_better.rs:+5:2: +5:2
- }
-}
diff --git a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir
new file mode 100644
index 000000000..eb160fc19
--- /dev/null
+++ b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir
@@ -0,0 +1,31 @@
+// MIR for `f` after DestinationPropagation
+
+fn f(_1: usize) -> usize {
+ debug a => _1;
+ let mut _0: usize;
+ let _2: usize;
+ let mut _3: usize;
+ let mut _4: usize;
+ scope 1 {
+ debug b => _3;
+ }
+
+ bb0: {
+ nop;
+ _3 = _1;
+ _1 = const 5_usize;
+ nop;
+ nop;
+ _1 = move _3;
+ nop;
+ nop;
+ nop;
+ _0 = id::<usize>(move _1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ nop;
+ nop;
+ return;
+ }
+}
diff --git a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir
new file mode 100644
index 000000000..9147de2ec
--- /dev/null
+++ b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir
@@ -0,0 +1,31 @@
+// MIR for `f` after DestinationPropagation
+
+fn f(_1: usize) -> usize {
+ debug a => _1;
+ let mut _0: usize;
+ let _2: usize;
+ let mut _3: usize;
+ let mut _4: usize;
+ scope 1 {
+ debug b => _3;
+ }
+
+ bb0: {
+ nop;
+ _3 = _1;
+ _1 = const 5_usize;
+ nop;
+ nop;
+ _1 = move _3;
+ nop;
+ nop;
+ nop;
+ _0 = id::<usize>(move _1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ nop;
+ nop;
+ return;
+ }
+}
diff --git a/tests/mir-opt/dest-prop/dead_stores_better.rs b/tests/mir-opt/dest-prop/dead_stores_better.rs
index 72d406bfd..c9895f35c 100644
--- a/tests/mir-opt/dest-prop/dead_stores_better.rs
+++ b/tests/mir-opt/dest-prop/dead_stores_better.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// This is a copy of the `dead_stores_79191` test, except that we turn on DSE. This demonstrates
// that that pass enables this one to do more optimizations.
diff --git a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.diff b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.diff
deleted file mode 100644
index c2a3a0025..000000000
--- a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.diff
+++ /dev/null
@@ -1,43 +0,0 @@
-- // MIR for `nrvo` before DestinationPropagation
-+ // MIR for `nrvo` after DestinationPropagation
-
- fn nrvo(_1: for<'a> fn(&'a mut [u8; 1024])) -> [u8; 1024] {
- debug init => _1; // in scope 0 at $DIR/simple.rs:+0:9: +0:13
- let mut _0: [u8; 1024]; // return place in scope 0 at $DIR/simple.rs:+0:39: +0:49
- let mut _2: [u8; 1024]; // in scope 0 at $DIR/simple.rs:+1:9: +1:16
- let _3: (); // in scope 0 at $DIR/simple.rs:+2:5: +2:19
- let mut _4: for<'a> fn(&'a mut [u8; 1024]); // in scope 0 at $DIR/simple.rs:+2:5: +2:9
- let mut _5: &mut [u8; 1024]; // in scope 0 at $DIR/simple.rs:+2:10: +2:18
- let mut _6: &mut [u8; 1024]; // in scope 0 at $DIR/simple.rs:+2:10: +2:18
- scope 1 {
- debug buf => _2; // in scope 1 at $DIR/simple.rs:+1:9: +1:16
- }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/simple.rs:+1:9: +1:16
- _2 = [const 0_u8; 1024]; // scope 0 at $DIR/simple.rs:+1:19: +1:28
- StorageLive(_3); // scope 1 at $DIR/simple.rs:+2:5: +2:19
-- StorageLive(_4); // scope 1 at $DIR/simple.rs:+2:5: +2:9
-- _4 = _1; // scope 1 at $DIR/simple.rs:+2:5: +2:9
-+ nop; // scope 1 at $DIR/simple.rs:+2:5: +2:9
-+ nop; // scope 1 at $DIR/simple.rs:+2:5: +2:9
- StorageLive(_5); // scope 1 at $DIR/simple.rs:+2:10: +2:18
- StorageLive(_6); // scope 1 at $DIR/simple.rs:+2:10: +2:18
- _6 = &mut _2; // scope 1 at $DIR/simple.rs:+2:10: +2:18
- _5 = &mut (*_6); // scope 1 at $DIR/simple.rs:+2:10: +2:18
-- _3 = move _4(move _5) -> bb1; // scope 1 at $DIR/simple.rs:+2:5: +2:19
-+ _3 = move _1(move _5) -> bb1; // scope 1 at $DIR/simple.rs:+2:5: +2:19
- }
-
- bb1: {
- StorageDead(_5); // scope 1 at $DIR/simple.rs:+2:18: +2:19
-- StorageDead(_4); // scope 1 at $DIR/simple.rs:+2:18: +2:19
-+ nop; // scope 1 at $DIR/simple.rs:+2:18: +2:19
- StorageDead(_6); // scope 1 at $DIR/simple.rs:+2:19: +2:20
- StorageDead(_3); // scope 1 at $DIR/simple.rs:+2:19: +2:20
- _0 = _2; // scope 1 at $DIR/simple.rs:+3:5: +3:8
- StorageDead(_2); // scope 0 at $DIR/simple.rs:+4:1: +4:2
- return; // scope 0 at $DIR/simple.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff
new file mode 100644
index 000000000..4d34f43fd
--- /dev/null
+++ b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff
@@ -0,0 +1,43 @@
+- // MIR for `nrvo` before DestinationPropagation
++ // MIR for `nrvo` after DestinationPropagation
+
+ fn nrvo(_1: for<'a> fn(&'a mut [u8; 1024])) -> [u8; 1024] {
+ debug init => _1;
+ let mut _0: [u8; 1024];
+ let mut _2: [u8; 1024];
+ let _3: ();
+ let mut _4: for<'a> fn(&'a mut [u8; 1024]);
+ let mut _5: &mut [u8; 1024];
+ let mut _6: &mut [u8; 1024];
+ scope 1 {
+ debug buf => _2;
+ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = [const 0_u8; 1024];
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
++ nop;
++ nop;
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = &mut _2;
+ _5 = &mut (*_6);
+- _3 = move _4(move _5) -> [return: bb1, unwind unreachable];
++ _3 = move _1(move _5) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_5);
+- StorageDead(_4);
++ nop;
+ StorageDead(_6);
+ StorageDead(_3);
+ _0 = _2;
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff
new file mode 100644
index 000000000..9c3cbef38
--- /dev/null
+++ b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff
@@ -0,0 +1,43 @@
+- // MIR for `nrvo` before DestinationPropagation
++ // MIR for `nrvo` after DestinationPropagation
+
+ fn nrvo(_1: for<'a> fn(&'a mut [u8; 1024])) -> [u8; 1024] {
+ debug init => _1;
+ let mut _0: [u8; 1024];
+ let mut _2: [u8; 1024];
+ let _3: ();
+ let mut _4: for<'a> fn(&'a mut [u8; 1024]);
+ let mut _5: &mut [u8; 1024];
+ let mut _6: &mut [u8; 1024];
+ scope 1 {
+ debug buf => _2;
+ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = [const 0_u8; 1024];
+ StorageLive(_3);
+- StorageLive(_4);
+- _4 = _1;
++ nop;
++ nop;
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = &mut _2;
+ _5 = &mut (*_6);
+- _3 = move _4(move _5) -> [return: bb1, unwind continue];
++ _3 = move _1(move _5) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_5);
+- StorageDead(_4);
++ nop;
+ StorageDead(_6);
+ StorageDead(_3);
+ _0 = _2;
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/simple.rs b/tests/mir-opt/dest-prop/simple.rs
index 3a4aec34e..03d209626 100644
--- a/tests/mir-opt/dest-prop/simple.rs
+++ b/tests/mir-opt/dest-prop/simple.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too.
// unit-test: DestinationPropagation
// EMIT_MIR simple.nrvo.DestinationPropagation.diff
diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.diff
deleted file mode 100644
index 457fc8308..000000000
--- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.diff
+++ /dev/null
@@ -1,35 +0,0 @@
-- // MIR for `main` before DestinationPropagation
-+ // MIR for `main` after DestinationPropagation
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/union.rs:+0:11: +0:11
- let _1: main::Un; // in scope 0 at $DIR/union.rs:+5:9: +5:11
- let mut _2: u32; // in scope 0 at $DIR/union.rs:+5:23: +5:28
- let mut _3: u32; // in scope 0 at $DIR/union.rs:+7:10: +7:26
- scope 1 {
- debug un => _1; // in scope 1 at $DIR/union.rs:+5:9: +5:11
- scope 2 {
- }
- scope 3 (inlined std::mem::drop::<u32>) { // at $DIR/union.rs:16:5: 16:27
- debug _x => _3; // in scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/union.rs:+5:9: +5:11
- StorageLive(_2); // scope 0 at $DIR/union.rs:+5:23: +5:28
- _2 = val() -> bb1; // scope 0 at $DIR/union.rs:+5:23: +5:28
- // mir::Constant
- // + span: $DIR/union.rs:14:23: 14:26
- // + literal: Const { ty: fn() -> u32 {val}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/union.rs:+5:29: +5:30
- StorageLive(_3); // scope 1 at $DIR/union.rs:+7:10: +7:26
- StorageDead(_3); // scope 1 at $DIR/union.rs:+7:26: +7:27
- StorageDead(_1); // scope 0 at $DIR/union.rs:+8:1: +8:2
- return; // scope 0 at $DIR/union.rs:+8:2: +8:2
- }
- }
-
diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff
new file mode 100644
index 000000000..142e08f4d
--- /dev/null
+++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff
@@ -0,0 +1,25 @@
+- // MIR for `main` before DestinationPropagation
++ // MIR for `main` after DestinationPropagation
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: main::Un;
+ scope 1 {
+ debug un => _1;
+ scope 2 {
+ }
+ scope 4 (inlined std::mem::drop::<u32>) {
+ debug _x => const 1_u32;
+ }
+ }
+ scope 3 (inlined val) {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = Un { us: const 1_u32 };
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff
new file mode 100644
index 000000000..142e08f4d
--- /dev/null
+++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff
@@ -0,0 +1,25 @@
+- // MIR for `main` before DestinationPropagation
++ // MIR for `main` after DestinationPropagation
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: main::Un;
+ scope 1 {
+ debug un => _1;
+ scope 2 {
+ }
+ scope 4 (inlined std::mem::drop::<u32>) {
+ debug _x => const 1_u32;
+ }
+ }
+ scope 3 (inlined val) {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = Un { us: const 1_u32 };
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/union.rs b/tests/mir-opt/dest-prop/union.rs
index 062d02d06..6d3e6d7fa 100644
--- a/tests/mir-opt/dest-prop/union.rs
+++ b/tests/mir-opt/dest-prop/union.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that we can propagate into places that are projections into unions
// compile-flags: -Zunsound-mir-opts
fn val() -> u32 {
diff --git a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.diff b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.diff
deleted file mode 100644
index ae63d724d..000000000
--- a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.diff
+++ /dev/null
@@ -1,86 +0,0 @@
-- // MIR for `f` before DestinationPropagation
-+ // MIR for `f` after DestinationPropagation
-
- fn f(_1: T) -> () {
- debug a => _1; // in scope 0 at $DIR/unreachable.rs:+0:19: +0:20
- let mut _0: (); // return place in scope 0 at $DIR/unreachable.rs:+0:25: +0:25
- let _2: T; // in scope 0 at $DIR/unreachable.rs:+1:9: +1:10
- let mut _3: bool; // in scope 0 at $DIR/unreachable.rs:+2:8: +2:13
- let _4: (); // in scope 0 at $DIR/unreachable.rs:+3:9: +3:16
- let mut _5: T; // in scope 0 at $DIR/unreachable.rs:+3:11: +3:12
- let mut _6: T; // in scope 0 at $DIR/unreachable.rs:+3:14: +3:15
- let _7: (); // in scope 0 at $DIR/unreachable.rs:+5:9: +5:16
- let mut _8: T; // in scope 0 at $DIR/unreachable.rs:+5:11: +5:12
- let mut _9: T; // in scope 0 at $DIR/unreachable.rs:+5:14: +5:15
- scope 1 {
-- debug b => _2; // in scope 1 at $DIR/unreachable.rs:+1:9: +1:10
-+ debug b => _1; // in scope 1 at $DIR/unreachable.rs:+1:9: +1:10
- }
-
- bb0: {
-- StorageLive(_2); // scope 0 at $DIR/unreachable.rs:+1:9: +1:10
-- _2 = _1; // scope 0 at $DIR/unreachable.rs:+1:13: +1:14
-+ nop; // scope 0 at $DIR/unreachable.rs:+1:9: +1:10
-+ nop; // scope 0 at $DIR/unreachable.rs:+1:13: +1:14
- StorageLive(_3); // scope 1 at $DIR/unreachable.rs:+2:8: +2:13
- _3 = const false; // scope 1 at $DIR/unreachable.rs:+2:8: +2:13
-- goto -> bb3; // scope 1 at $DIR/unreachable.rs:+2:8: +2:13
-+ goto -> bb1; // scope 1 at $DIR/unreachable.rs:+2:8: +2:13
- }
-
- bb1: {
-- StorageLive(_4); // scope 1 at $DIR/unreachable.rs:+3:9: +3:16
-- StorageLive(_5); // scope 1 at $DIR/unreachable.rs:+3:11: +3:12
-- _5 = _1; // scope 1 at $DIR/unreachable.rs:+3:11: +3:12
-- StorageLive(_6); // scope 1 at $DIR/unreachable.rs:+3:14: +3:15
-- _6 = _2; // scope 1 at $DIR/unreachable.rs:+3:14: +3:15
-- _4 = g::<T>(move _5, move _6) -> bb2; // scope 1 at $DIR/unreachable.rs:+3:9: +3:16
-- // mir::Constant
-- // + span: $DIR/unreachable.rs:12:9: 12:10
-- // + literal: Const { ty: fn(T, T) {g::<T>}, val: Value(<ZST>) }
-- }
--
-- bb2: {
-- StorageDead(_6); // scope 1 at $DIR/unreachable.rs:+3:15: +3:16
-- StorageDead(_5); // scope 1 at $DIR/unreachable.rs:+3:15: +3:16
-- StorageDead(_4); // scope 1 at $DIR/unreachable.rs:+3:16: +3:17
-- _0 = const (); // scope 1 at $DIR/unreachable.rs:+2:14: +4:6
-- goto -> bb5; // scope 1 at $DIR/unreachable.rs:+2:5: +6:6
-- }
--
-- bb3: {
- StorageLive(_7); // scope 1 at $DIR/unreachable.rs:+5:9: +5:16
-- StorageLive(_8); // scope 1 at $DIR/unreachable.rs:+5:11: +5:12
-- _8 = _2; // scope 1 at $DIR/unreachable.rs:+5:11: +5:12
-+ nop; // scope 1 at $DIR/unreachable.rs:+5:11: +5:12
-+ nop; // scope 1 at $DIR/unreachable.rs:+5:11: +5:12
- StorageLive(_9); // scope 1 at $DIR/unreachable.rs:+5:14: +5:15
-- _9 = _2; // scope 1 at $DIR/unreachable.rs:+5:14: +5:15
-- _7 = g::<T>(move _8, move _9) -> bb4; // scope 1 at $DIR/unreachable.rs:+5:9: +5:16
-+ _9 = _1; // scope 1 at $DIR/unreachable.rs:+5:14: +5:15
-+ _7 = g::<T>(move _1, move _9) -> bb2; // scope 1 at $DIR/unreachable.rs:+5:9: +5:16
- // mir::Constant
- // + span: $DIR/unreachable.rs:14:9: 14:10
- // + literal: Const { ty: fn(T, T) {g::<T>}, val: Value(<ZST>) }
- }
-
-- bb4: {
-+ bb2: {
- StorageDead(_9); // scope 1 at $DIR/unreachable.rs:+5:15: +5:16
-- StorageDead(_8); // scope 1 at $DIR/unreachable.rs:+5:15: +5:16
-+ nop; // scope 1 at $DIR/unreachable.rs:+5:15: +5:16
- StorageDead(_7); // scope 1 at $DIR/unreachable.rs:+5:16: +5:17
- _0 = const (); // scope 1 at $DIR/unreachable.rs:+4:12: +6:6
-- goto -> bb5; // scope 1 at $DIR/unreachable.rs:+2:5: +6:6
-+ goto -> bb3; // scope 1 at $DIR/unreachable.rs:+2:5: +6:6
- }
-
-- bb5: {
-+ bb3: {
- StorageDead(_3); // scope 1 at $DIR/unreachable.rs:+6:5: +6:6
-- StorageDead(_2); // scope 0 at $DIR/unreachable.rs:+7:1: +7:2
-+ nop; // scope 0 at $DIR/unreachable.rs:+7:1: +7:2
- return; // scope 0 at $DIR/unreachable.rs:+7:2: +7:2
- }
- }
-
diff --git a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff
new file mode 100644
index 000000000..97ca82509
--- /dev/null
+++ b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-abort.diff
@@ -0,0 +1,80 @@
+- // MIR for `f` before DestinationPropagation
++ // MIR for `f` after DestinationPropagation
+
+ fn f(_1: T) -> () {
+ debug a => _1;
+ let mut _0: ();
+ let _2: T;
+ let mut _3: bool;
+ let _4: ();
+ let mut _5: T;
+ let mut _6: T;
+ let _7: ();
+ let mut _8: T;
+ let mut _9: T;
+ scope 1 {
+- debug b => _2;
++ debug b => _1;
+ }
+
+ bb0: {
+- StorageLive(_2);
+- _2 = _1;
++ nop;
++ nop;
+ StorageLive(_3);
+ _3 = const false;
+- goto -> bb3;
++ goto -> bb1;
+ }
+
+ bb1: {
+- StorageLive(_4);
+- StorageLive(_5);
+- _5 = _1;
+- StorageLive(_6);
+- _6 = _2;
+- _4 = g::<T>(move _5, move _6) -> [return: bb2, unwind unreachable];
+- }
+-
+- bb2: {
+- StorageDead(_6);
+- StorageDead(_5);
+- StorageDead(_4);
+- _0 = const ();
+- goto -> bb5;
+- }
+-
+- bb3: {
+ StorageLive(_7);
+- StorageLive(_8);
+- _8 = _2;
++ nop;
++ nop;
+ StorageLive(_9);
+- _9 = _2;
+- _7 = g::<T>(move _8, move _9) -> [return: bb4, unwind unreachable];
++ _9 = _1;
++ _7 = g::<T>(move _1, move _9) -> [return: bb2, unwind unreachable];
+ }
+
+- bb4: {
++ bb2: {
+ StorageDead(_9);
+- StorageDead(_8);
++ nop;
+ StorageDead(_7);
+ _0 = const ();
+- goto -> bb5;
++ goto -> bb3;
+ }
+
+- bb5: {
++ bb3: {
+ StorageDead(_3);
+- StorageDead(_2);
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff
new file mode 100644
index 000000000..7f730a77b
--- /dev/null
+++ b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff
@@ -0,0 +1,80 @@
+- // MIR for `f` before DestinationPropagation
++ // MIR for `f` after DestinationPropagation
+
+ fn f(_1: T) -> () {
+ debug a => _1;
+ let mut _0: ();
+ let _2: T;
+ let mut _3: bool;
+ let _4: ();
+ let mut _5: T;
+ let mut _6: T;
+ let _7: ();
+ let mut _8: T;
+ let mut _9: T;
+ scope 1 {
+- debug b => _2;
++ debug b => _1;
+ }
+
+ bb0: {
+- StorageLive(_2);
+- _2 = _1;
++ nop;
++ nop;
+ StorageLive(_3);
+ _3 = const false;
+- goto -> bb3;
++ goto -> bb1;
+ }
+
+ bb1: {
+- StorageLive(_4);
+- StorageLive(_5);
+- _5 = _1;
+- StorageLive(_6);
+- _6 = _2;
+- _4 = g::<T>(move _5, move _6) -> [return: bb2, unwind continue];
+- }
+-
+- bb2: {
+- StorageDead(_6);
+- StorageDead(_5);
+- StorageDead(_4);
+- _0 = const ();
+- goto -> bb5;
+- }
+-
+- bb3: {
+ StorageLive(_7);
+- StorageLive(_8);
+- _8 = _2;
++ nop;
++ nop;
+ StorageLive(_9);
+- _9 = _2;
+- _7 = g::<T>(move _8, move _9) -> [return: bb4, unwind continue];
++ _9 = _1;
++ _7 = g::<T>(move _1, move _9) -> [return: bb2, unwind continue];
+ }
+
+- bb4: {
++ bb2: {
+ StorageDead(_9);
+- StorageDead(_8);
++ nop;
+ StorageDead(_7);
+ _0 = const ();
+- goto -> bb5;
++ goto -> bb3;
+ }
+
+- bb5: {
++ bb3: {
+ StorageDead(_3);
+- StorageDead(_2);
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dest-prop/unreachable.rs b/tests/mir-opt/dest-prop/unreachable.rs
index c73d11ae3..a47d2a0c8 100644
--- a/tests/mir-opt/dest-prop/unreachable.rs
+++ b/tests/mir-opt/dest-prop/unreachable.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that unreachable code is removed after the destination propagation.
// Regression test for issue #105428.
//
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..788c2f55d
--- /dev/null
+++ b/tests/mir-opt/dont_inline_type_id.rs
@@ -0,0 +1,16 @@
+// skip-filecheck
+// 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/dont_yeet_assert.generic.InstSimplify.diff b/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff
deleted file mode 100644
index cadf05152..000000000
--- a/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff
+++ /dev/null
@@ -1,23 +0,0 @@
-- // MIR for `generic` before InstSimplify
-+ // MIR for `generic` after InstSimplify
-
- fn generic() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/dont_yeet_assert.rs:+0:21: +0:21
- let _1: (); // in scope 0 at $DIR/dont_yeet_assert.rs:+1:5: +1:61
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/dont_yeet_assert.rs:+1:5: +1:61
- _1 = assert_mem_uninitialized_valid::<&T>() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/dont_yeet_assert.rs:+1:5: +1:61
- // mir::Constant
- // + span: $DIR/dont_yeet_assert.rs:10:5: 10:59
- // + user_ty: UserType(0)
- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_mem_uninitialized_valid::<&T>}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_1); // scope 0 at $DIR/dont_yeet_assert.rs:+1:61: +1:62
- _0 = const (); // scope 0 at $DIR/dont_yeet_assert.rs:+0:21: +2:2
- return; // scope 0 at $DIR/dont_yeet_assert.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/dont_yeet_assert.rs b/tests/mir-opt/dont_yeet_assert.rs
deleted file mode 100644
index 38cc5a293..000000000
--- a/tests/mir-opt/dont_yeet_assert.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// compile-flags: --crate-type=lib
-// unit-test: InstSimplify
-
-#![feature(core_intrinsics)]
-
-// Want to make sure this assertion isn't compiled away in generic code.
-
-// EMIT_MIR dont_yeet_assert.generic.InstSimplify.diff
-pub fn generic<T>() {
- core::intrinsics::assert_mem_uninitialized_valid::<&T>();
-}
diff --git a/tests/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff
index 5383d1be1..7a374c567 100644
--- a/tests/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff
+++ b/tests/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff
@@ -2,75 +2,75 @@
+ // MIR for `opt1` after EarlyOtherwiseBranch
fn opt1(_1: Option<u32>, _2: Option<u32>) -> u32 {
- debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:+0:9: +0:10
- debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:+0:25: +0:26
- let mut _0: u32; // return place in scope 0 at $DIR/early_otherwise_branch.rs:+0:44: +0:47
- let mut _3: (std::option::Option<u32>, std::option::Option<u32>); // in scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
- let mut _4: std::option::Option<u32>; // in scope 0 at $DIR/early_otherwise_branch.rs:+1:12: +1:13
- let mut _5: std::option::Option<u32>; // in scope 0 at $DIR/early_otherwise_branch.rs:+1:15: +1:16
- let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:+2:19: +2:26
- let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:+2:10: +2:17
- let _8: u32; // in scope 0 at $DIR/early_otherwise_branch.rs:+2:15: +2:16
- let _9: u32; // in scope 0 at $DIR/early_otherwise_branch.rs:+2:24: +2:25
-+ let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ let mut _11: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
+ debug x => _1;
+ debug y => _2;
+ let mut _0: u32;
+ let mut _3: (std::option::Option<u32>, std::option::Option<u32>);
+ let mut _4: std::option::Option<u32>;
+ let mut _5: std::option::Option<u32>;
+ let mut _6: isize;
+ let mut _7: isize;
+ let _8: u32;
+ let _9: u32;
++ let mut _10: isize;
++ let mut _11: bool;
scope 1 {
- debug a => _8; // in scope 1 at $DIR/early_otherwise_branch.rs:+2:15: +2:16
- debug b => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:+2:24: +2:25
+ debug a => _8;
+ debug b => _9;
}
bb0: {
- StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
- StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:+1:12: +1:13
- _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:+1:12: +1:13
- StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:+1:15: +1:16
- _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:+1:15: +1:16
- _3 = (move _4, move _5); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
- StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17
- StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17
- _7 = discriminant((_3.0: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
-- switchInt(move _7) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ _10 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ _11 = Ne(_7, move _10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ switchInt(move _11) -> [0: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ _5 = _2;
+ _3 = (move _4, move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ _7 = discriminant((_3.0: std::option::Option<u32>));
+- switchInt(move _7) -> [1: bb2, otherwise: bb1];
++ StorageLive(_10);
++ _10 = discriminant((_3.1: std::option::Option<u32>));
++ StorageLive(_11);
++ _11 = Ne(_7, move _10);
++ StorageDead(_10);
++ switchInt(move _11) -> [0: bb4, otherwise: bb1];
}
bb1: {
-+ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+3:14: +3:15
- _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch.rs:+3:14: +3:15
-- goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:+3:14: +3:15
-+ goto -> bb3; // scope 0 at $DIR/early_otherwise_branch.rs:+3:14: +3:15
++ StorageDead(_11);
+ _0 = const 1_u32;
+- goto -> bb4;
++ goto -> bb3;
}
bb2: {
-- _6 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
-- switchInt(move _6) -> [1: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
+- _6 = discriminant((_3.1: std::option::Option<u32>));
+- switchInt(move _6) -> [1: bb3, otherwise: bb1];
- }
-
- bb3: {
- StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch.rs:+2:15: +2:16
- _8 = (((_3.0: std::option::Option<u32>) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch.rs:+2:15: +2:16
- StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:+2:24: +2:25
- _9 = (((_3.1: std::option::Option<u32>) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch.rs:+2:24: +2:25
- _0 = const 0_u32; // scope 1 at $DIR/early_otherwise_branch.rs:+2:31: +2:32
- StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:+2:31: +2:32
- StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch.rs:+2:31: +2:32
-- goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:+2:31: +2:32
-+ goto -> bb3; // scope 0 at $DIR/early_otherwise_branch.rs:+2:31: +2:32
+ StorageLive(_8);
+ _8 = (((_3.0: std::option::Option<u32>) as Some).0: u32);
+ StorageLive(_9);
+ _9 = (((_3.1: std::option::Option<u32>) as Some).0: u32);
+ _0 = const 0_u32;
+ StorageDead(_9);
+ StorageDead(_8);
+- goto -> bb4;
++ goto -> bb3;
}
- bb4: {
+ bb3: {
- StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:+5:1: +5:2
- return; // scope 0 at $DIR/early_otherwise_branch.rs:+5:2: +5:2
+ StorageDead(_3);
+ return;
+ }
+
+ bb4: {
-+ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ switchInt(_7) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
++ StorageDead(_11);
++ switchInt(_7) -> [1: bb2, otherwise: bb1];
}
}
diff --git a/tests/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff
index b3e21ff49..21f58a14a 100644
--- a/tests/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff
+++ b/tests/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff
@@ -2,89 +2,89 @@
+ // MIR for `opt2` after EarlyOtherwiseBranch
fn opt2(_1: Option<u32>, _2: Option<u32>) -> u32 {
- debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:+0:9: +0:10
- debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:+0:25: +0:26
- let mut _0: u32; // return place in scope 0 at $DIR/early_otherwise_branch.rs:+0:44: +0:47
- let mut _3: (std::option::Option<u32>, std::option::Option<u32>); // in scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
- let mut _4: std::option::Option<u32>; // in scope 0 at $DIR/early_otherwise_branch.rs:+1:12: +1:13
- let mut _5: std::option::Option<u32>; // in scope 0 at $DIR/early_otherwise_branch.rs:+1:15: +1:16
- let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:+3:16: +3:20
- let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:+2:19: +2:26
- let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:+2:10: +2:17
- let _9: u32; // in scope 0 at $DIR/early_otherwise_branch.rs:+2:15: +2:16
- let _10: u32; // in scope 0 at $DIR/early_otherwise_branch.rs:+2:24: +2:25
-+ let mut _11: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ let mut _12: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
+ debug x => _1;
+ debug y => _2;
+ let mut _0: u32;
+ let mut _3: (std::option::Option<u32>, std::option::Option<u32>);
+ let mut _4: std::option::Option<u32>;
+ let mut _5: std::option::Option<u32>;
+ let mut _6: isize;
+ let mut _7: isize;
+ let mut _8: isize;
+ let _9: u32;
+ let _10: u32;
++ let mut _11: isize;
++ let mut _12: bool;
scope 1 {
- debug a => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:+2:15: +2:16
- debug b => _10; // in scope 1 at $DIR/early_otherwise_branch.rs:+2:24: +2:25
+ debug a => _9;
+ debug b => _10;
}
bb0: {
- StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
- StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:+1:12: +1:13
- _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:+1:12: +1:13
- StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:+1:15: +1:16
- _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:+1:15: +1:16
- _3 = (move _4, move _5); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
- StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17
- StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17
- _8 = discriminant((_3.0: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
-- switchInt(move _8) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ _11 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ _12 = Ne(_8, move _11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ switchInt(move _12) -> [0: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ _5 = _2;
+ _3 = (move _4, move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ _8 = discriminant((_3.0: std::option::Option<u32>));
+- switchInt(move _8) -> [0: bb1, 1: bb3, otherwise: bb2];
++ StorageLive(_11);
++ _11 = discriminant((_3.1: std::option::Option<u32>));
++ StorageLive(_12);
++ _12 = Ne(_8, move _11);
++ StorageDead(_11);
++ switchInt(move _12) -> [0: bb5, otherwise: bb1];
}
bb1: {
-- _6 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
-- switchInt(move _6) -> [0: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
+- _6 = discriminant((_3.1: std::option::Option<u32>));
+- switchInt(move _6) -> [0: bb5, otherwise: bb2];
- }
-
- bb2: {
-+ StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch.rs:+4:14: +4:15
- _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch.rs:+4:14: +4:15
-- goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:+4:14: +4:15
-+ goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:+4:14: +4:15
++ StorageDead(_12);
+ _0 = const 1_u32;
+- goto -> bb6;
++ goto -> bb4;
}
- bb3: {
-- _7 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
-- switchInt(move _7) -> [1: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
+- _7 = discriminant((_3.1: std::option::Option<u32>));
+- switchInt(move _7) -> [1: bb4, otherwise: bb2];
- }
-
- bb4: {
+ bb2: {
- StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:+2:15: +2:16
- _9 = (((_3.0: std::option::Option<u32>) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch.rs:+2:15: +2:16
- StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:+2:24: +2:25
- _10 = (((_3.1: std::option::Option<u32>) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch.rs:+2:24: +2:25
- _0 = const 0_u32; // scope 1 at $DIR/early_otherwise_branch.rs:+2:31: +2:32
- StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:+2:31: +2:32
- StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:+2:31: +2:32
-- goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:+2:31: +2:32
-+ goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:+2:31: +2:32
+ StorageLive(_9);
+ _9 = (((_3.0: std::option::Option<u32>) as Some).0: u32);
+ StorageLive(_10);
+ _10 = (((_3.1: std::option::Option<u32>) as Some).0: u32);
+ _0 = const 0_u32;
+ StorageDead(_10);
+ StorageDead(_9);
+- goto -> bb6;
++ goto -> bb4;
}
- bb5: {
+ bb3: {
- _0 = const 0_u32; // scope 0 at $DIR/early_otherwise_branch.rs:+3:25: +3:26
-- goto -> bb6; // scope 0 at $DIR/early_otherwise_branch.rs:+3:25: +3:26
-+ goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:+3:25: +3:26
+ _0 = const 0_u32;
+- goto -> bb6;
++ goto -> bb4;
}
- bb6: {
+ bb4: {
- StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:+6:1: +6:2
- return; // scope 0 at $DIR/early_otherwise_branch.rs:+6:2: +6:2
+ StorageDead(_3);
+ return;
+ }
+
+ bb5: {
-+ StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ switchInt(_8) -> [0: bb3, 1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
++ StorageDead(_12);
++ switchInt(_8) -> [0: bb3, 1: bb2, otherwise: bb1];
}
}
diff --git a/tests/mir-opt/early_otherwise_branch.opt3.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch.opt3.EarlyOtherwiseBranch.diff
index e098a88eb..e058c409c 100644
--- a/tests/mir-opt/early_otherwise_branch.opt3.EarlyOtherwiseBranch.diff
+++ b/tests/mir-opt/early_otherwise_branch.opt3.EarlyOtherwiseBranch.diff
@@ -2,75 +2,75 @@
+ // MIR for `opt3` after EarlyOtherwiseBranch
fn opt3(_1: Option<u32>, _2: Option<bool>) -> u32 {
- debug x => _1; // in scope 0 at $DIR/early_otherwise_branch.rs:+0:9: +0:10
- debug y => _2; // in scope 0 at $DIR/early_otherwise_branch.rs:+0:25: +0:26
- let mut _0: u32; // return place in scope 0 at $DIR/early_otherwise_branch.rs:+0:45: +0:48
- let mut _3: (std::option::Option<u32>, std::option::Option<bool>); // in scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
- let mut _4: std::option::Option<u32>; // in scope 0 at $DIR/early_otherwise_branch.rs:+1:12: +1:13
- let mut _5: std::option::Option<bool>; // in scope 0 at $DIR/early_otherwise_branch.rs:+1:15: +1:16
- let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:+2:19: +2:26
- let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:+2:10: +2:17
- let _8: u32; // in scope 0 at $DIR/early_otherwise_branch.rs:+2:15: +2:16
- let _9: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:+2:24: +2:25
-+ let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ let mut _11: bool; // in scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
+ debug x => _1;
+ debug y => _2;
+ let mut _0: u32;
+ let mut _3: (std::option::Option<u32>, std::option::Option<bool>);
+ let mut _4: std::option::Option<u32>;
+ let mut _5: std::option::Option<bool>;
+ let mut _6: isize;
+ let mut _7: isize;
+ let _8: u32;
+ let _9: bool;
++ let mut _10: isize;
++ let mut _11: bool;
scope 1 {
- debug a => _8; // in scope 1 at $DIR/early_otherwise_branch.rs:+2:15: +2:16
- debug b => _9; // in scope 1 at $DIR/early_otherwise_branch.rs:+2:24: +2:25
+ debug a => _8;
+ debug b => _9;
}
bb0: {
- StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
- StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch.rs:+1:12: +1:13
- _4 = _1; // scope 0 at $DIR/early_otherwise_branch.rs:+1:12: +1:13
- StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch.rs:+1:15: +1:16
- _5 = _2; // scope 0 at $DIR/early_otherwise_branch.rs:+1:15: +1:16
- _3 = (move _4, move _5); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
- StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17
- StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17
- _7 = discriminant((_3.0: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
-- switchInt(move _7) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ _10 = discriminant((_3.1: std::option::Option<bool>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ _11 = Ne(_7, move _10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ switchInt(move _11) -> [0: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ _5 = _2;
+ _3 = (move _4, move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ _7 = discriminant((_3.0: std::option::Option<u32>));
+- switchInt(move _7) -> [1: bb2, otherwise: bb1];
++ StorageLive(_10);
++ _10 = discriminant((_3.1: std::option::Option<bool>));
++ StorageLive(_11);
++ _11 = Ne(_7, move _10);
++ StorageDead(_10);
++ switchInt(move _11) -> [0: bb4, otherwise: bb1];
}
bb1: {
-+ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+3:14: +3:15
- _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch.rs:+3:14: +3:15
-- goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:+3:14: +3:15
-+ goto -> bb3; // scope 0 at $DIR/early_otherwise_branch.rs:+3:14: +3:15
++ StorageDead(_11);
+ _0 = const 1_u32;
+- goto -> bb4;
++ goto -> bb3;
}
bb2: {
-- _6 = discriminant((_3.1: std::option::Option<bool>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17
-- switchInt(move _6) -> [1: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
+- _6 = discriminant((_3.1: std::option::Option<bool>));
+- switchInt(move _6) -> [1: bb3, otherwise: bb1];
- }
-
- bb3: {
- StorageLive(_8); // scope 0 at $DIR/early_otherwise_branch.rs:+2:15: +2:16
- _8 = (((_3.0: std::option::Option<u32>) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch.rs:+2:15: +2:16
- StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch.rs:+2:24: +2:25
- _9 = (((_3.1: std::option::Option<bool>) as Some).0: bool); // scope 0 at $DIR/early_otherwise_branch.rs:+2:24: +2:25
- _0 = const 0_u32; // scope 1 at $DIR/early_otherwise_branch.rs:+2:31: +2:32
- StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch.rs:+2:31: +2:32
- StorageDead(_8); // scope 0 at $DIR/early_otherwise_branch.rs:+2:31: +2:32
-- goto -> bb4; // scope 0 at $DIR/early_otherwise_branch.rs:+2:31: +2:32
-+ goto -> bb3; // scope 0 at $DIR/early_otherwise_branch.rs:+2:31: +2:32
+ StorageLive(_8);
+ _8 = (((_3.0: std::option::Option<u32>) as Some).0: u32);
+ StorageLive(_9);
+ _9 = (((_3.1: std::option::Option<bool>) as Some).0: bool);
+ _0 = const 0_u32;
+ StorageDead(_9);
+ StorageDead(_8);
+- goto -> bb4;
++ goto -> bb3;
}
- bb4: {
+ bb3: {
- StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch.rs:+5:1: +5:2
- return; // scope 0 at $DIR/early_otherwise_branch.rs:+5:2: +5:2
+ StorageDead(_3);
+ return;
+ }
+
+ bb4: {
-+ StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
-+ switchInt(_7) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17
++ StorageDead(_11);
++ switchInt(_7) -> [1: bb2, otherwise: bb1];
}
}
diff --git a/tests/mir-opt/early_otherwise_branch.rs b/tests/mir-opt/early_otherwise_branch.rs
index 7be9fbd03..b48516c5a 100644
--- a/tests/mir-opt/early_otherwise_branch.rs
+++ b/tests/mir-opt/early_otherwise_branch.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: EarlyOtherwiseBranch
// EMIT_MIR early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff
fn opt1(x: Option<u32>, y: Option<u32>) -> u32 {
diff --git a/tests/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff
index ec3b4bbdf..f98d68e6f 100644
--- a/tests/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff
+++ b/tests/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff
@@ -2,96 +2,96 @@
+ // MIR for `opt1` after EarlyOtherwiseBranch
fn opt1(_1: Option<u32>, _2: Option<u32>, _3: Option<u32>) -> u32 {
- debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+0:9: +0:10
- debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+0:25: +0:26
- debug z => _3; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+0:41: +0:42
- let mut _0: u32; // return place in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+0:60: +0:63
- let mut _4: (std::option::Option<u32>, std::option::Option<u32>, std::option::Option<u32>); // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:11: +1:20
- let mut _5: std::option::Option<u32>; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:12: +1:13
- let mut _6: std::option::Option<u32>; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:15: +1:16
- let mut _7: std::option::Option<u32>; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:18: +1:19
- let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:28: +2:35
- let mut _9: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:19: +2:26
- let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:10: +2:17
- let _11: u32; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:15: +2:16
- let _12: u32; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:24: +2:25
- let _13: u32; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:33: +2:34
-+ let mut _14: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
-+ let mut _15: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
-+ let mut _16: isize; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
-+ let mut _17: bool; // in scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
+ debug x => _1;
+ debug y => _2;
+ debug z => _3;
+ let mut _0: u32;
+ let mut _4: (std::option::Option<u32>, std::option::Option<u32>, std::option::Option<u32>);
+ let mut _5: std::option::Option<u32>;
+ let mut _6: std::option::Option<u32>;
+ let mut _7: std::option::Option<u32>;
+ let mut _8: isize;
+ let mut _9: isize;
+ let mut _10: isize;
+ let _11: u32;
+ let _12: u32;
+ let _13: u32;
++ let mut _14: isize;
++ let mut _15: bool;
++ let mut _16: isize;
++ let mut _17: bool;
scope 1 {
- debug a => _11; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:15: +2:16
- debug b => _12; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:24: +2:25
- debug c => _13; // in scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:33: +2:34
+ debug a => _11;
+ debug b => _12;
+ debug c => _13;
}
bb0: {
- StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:11: +1:20
- StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:12: +1:13
- _5 = _1; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:12: +1:13
- StorageLive(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:15: +1:16
- _6 = _2; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:15: +1:16
- StorageLive(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:18: +1:19
- _7 = _3; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:18: +1:19
- _4 = (move _5, move _6, move _7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:11: +1:20
- StorageDead(_7); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:19: +1:20
- StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:19: +1:20
- StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:19: +1:20
- _10 = discriminant((_4.0: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:11: +1:20
-- switchInt(move _10) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
-+ StorageLive(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
-+ _14 = discriminant((_4.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
-+ StorageLive(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
-+ _15 = Ne(_10, move _14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
-+ StorageDead(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
-+ switchInt(move _15) -> [0: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ StorageLive(_6);
+ _6 = _2;
+ StorageLive(_7);
+ _7 = _3;
+ _4 = (move _5, move _6, move _7);
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_5);
+ _10 = discriminant((_4.0: std::option::Option<u32>));
+- switchInt(move _10) -> [1: bb2, otherwise: bb1];
++ StorageLive(_14);
++ _14 = discriminant((_4.1: std::option::Option<u32>));
++ StorageLive(_15);
++ _15 = Ne(_10, move _14);
++ StorageDead(_14);
++ switchInt(move _15) -> [0: bb5, otherwise: bb1];
}
bb1: {
-+ StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+3:14: +3:15
-+ StorageDead(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+3:14: +3:15
- _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+3:14: +3:15
-- goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+3:14: +3:15
-+ goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+3:14: +3:15
++ StorageDead(_17);
++ StorageDead(_15);
+ _0 = const 1_u32;
+- goto -> bb5;
++ goto -> bb4;
}
bb2: {
-- _9 = discriminant((_4.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:11: +1:20
-- switchInt(move _9) -> [1: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
+- _9 = discriminant((_4.1: std::option::Option<u32>));
+- switchInt(move _9) -> [1: bb3, otherwise: bb1];
- }
-
- bb3: {
- _8 = discriminant((_4.2: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:11: +1:20
-- switchInt(move _8) -> [1: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
-+ switchInt(move _8) -> [1: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
+ _8 = discriminant((_4.2: std::option::Option<u32>));
+- switchInt(move _8) -> [1: bb4, otherwise: bb1];
++ switchInt(move _8) -> [1: bb3, otherwise: bb1];
}
- bb4: {
+ bb3: {
- StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:15: +2:16
- _11 = (((_4.0: std::option::Option<u32>) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:15: +2:16
- StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:24: +2:25
- _12 = (((_4.1: std::option::Option<u32>) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:24: +2:25
- StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:33: +2:34
- _13 = (((_4.2: std::option::Option<u32>) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:33: +2:34
- _0 = const 0_u32; // scope 1 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:40: +2:41
- StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:40: +2:41
- StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:40: +2:41
- StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:40: +2:41
-- goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:40: +2:41
-+ goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+2:40: +2:41
+ StorageLive(_11);
+ _11 = (((_4.0: std::option::Option<u32>) as Some).0: u32);
+ StorageLive(_12);
+ _12 = (((_4.1: std::option::Option<u32>) as Some).0: u32);
+ StorageLive(_13);
+ _13 = (((_4.2: std::option::Option<u32>) as Some).0: u32);
+ _0 = const 0_u32;
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_11);
+- goto -> bb5;
++ goto -> bb4;
}
- bb5: {
+ bb4: {
- StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+5:1: +5:2
- return; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+5:2: +5:2
+ StorageDead(_4);
+ return;
+ }
+
+ bb5: {
-+ StorageDead(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
-+ switchInt(_10) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20
++ StorageDead(_15);
++ switchInt(_10) -> [1: bb2, otherwise: bb1];
}
}
diff --git a/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs b/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs
index 76055e133..2a0fba9be 100644
--- a/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs
+++ b/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: EarlyOtherwiseBranch
// EMIT_MIR early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff
diff --git a/tests/mir-opt/early_otherwise_branch_68867.rs b/tests/mir-opt/early_otherwise_branch_68867.rs
index a6a56f3a9..f27527b96 100644
--- a/tests/mir-opt/early_otherwise_branch_68867.rs
+++ b/tests/mir-opt/early_otherwise_branch_68867.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: EarlyOtherwiseBranch
// FIXME: This test was broken by the derefer change.
diff --git a/tests/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff
index a91d0d7cf..0c94794fa 100644
--- a/tests/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff
+++ b/tests/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff
@@ -2,216 +2,216 @@
+ // MIR for `try_sum` after EarlyOtherwiseBranch
fn try_sum(_1: &ViewportPercentageLength, _2: &ViewportPercentageLength) -> Result<ViewportPercentageLength, ()> {
- debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+1:5: +1:6
- debug other => _2; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+2:5: +2:10
- let mut _0: std::result::Result<ViewportPercentageLength, ()>; // return place in scope 0 at $DIR/early_otherwise_branch_68867.rs:+3:6: +3:42
- let mut _3: ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +11:6
- let mut _4: (&ViewportPercentageLength, &ViewportPercentageLength); // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- let mut _5: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:15: +5:16
- let mut _6: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:18: +5:23
- let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:21: +6:30
- let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:21: +7:30
- let mut _9: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:23: +8:34
- let mut _10: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:23: +9:34
- let mut _11: isize; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:11: +6:18
- let _12: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17
- let _13: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29
- let mut _14: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:49
- let mut _15: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:41
- let mut _16: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:44: +6:49
- let _17: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17
- let _18: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29
- let mut _19: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:49
- let mut _20: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:41
- let mut _21: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:44: +7:49
- let _22: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19
- let _23: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33
- let mut _24: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:55
- let mut _25: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:47
- let mut _26: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:50: +8:55
- let _27: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19
- let _28: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33
- let mut _29: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:55
- let mut _30: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:47
- let mut _31: f32; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:50: +9:55
- let mut _32: !; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+10:14: +10:28
- let mut _33: (); // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+10:25: +10:27
- let mut _34: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- let mut _35: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- let mut _36: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- let mut _37: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- let mut _38: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- let mut _39: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- let mut _40: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- let mut _41: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- let mut _42: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- let mut _43: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- let mut _44: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- let mut _45: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- let mut _46: &ViewportPercentageLength; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
+ debug x => _1;
+ debug other => _2;
+ let mut _0: std::result::Result<ViewportPercentageLength, ()>;
+ let mut _3: ViewportPercentageLength;
+ let mut _4: (&ViewportPercentageLength, &ViewportPercentageLength);
+ let mut _5: &ViewportPercentageLength;
+ let mut _6: &ViewportPercentageLength;
+ let mut _7: isize;
+ let mut _8: isize;
+ let mut _9: isize;
+ let mut _10: isize;
+ let mut _11: isize;
+ let _12: f32;
+ let _13: f32;
+ let mut _14: f32;
+ let mut _15: f32;
+ let mut _16: f32;
+ let _17: f32;
+ let _18: f32;
+ let mut _19: f32;
+ let mut _20: f32;
+ let mut _21: f32;
+ let _22: f32;
+ let _23: f32;
+ let mut _24: f32;
+ let mut _25: f32;
+ let mut _26: f32;
+ let _27: f32;
+ let _28: f32;
+ let mut _29: f32;
+ let mut _30: f32;
+ let mut _31: f32;
+ let mut _32: !;
+ let mut _33: ();
+ let mut _34: &ViewportPercentageLength;
+ let mut _35: &ViewportPercentageLength;
+ let mut _36: &ViewportPercentageLength;
+ let mut _37: &ViewportPercentageLength;
+ let mut _38: &ViewportPercentageLength;
+ let mut _39: &ViewportPercentageLength;
+ let mut _40: &ViewportPercentageLength;
+ let mut _41: &ViewportPercentageLength;
+ let mut _42: &ViewportPercentageLength;
+ let mut _43: &ViewportPercentageLength;
+ let mut _44: &ViewportPercentageLength;
+ let mut _45: &ViewportPercentageLength;
+ let mut _46: &ViewportPercentageLength;
scope 1 {
- debug one => _12; // in scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17
- debug other => _13; // in scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29
+ debug one => _12;
+ debug other => _13;
}
scope 2 {
- debug one => _17; // in scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17
- debug other => _18; // in scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29
+ debug one => _17;
+ debug other => _18;
}
scope 3 {
- debug one => _22; // in scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19
- debug other => _23; // in scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33
+ debug one => _22;
+ debug other => _23;
}
scope 4 {
- debug one => _27; // in scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19
- debug other => _28; // in scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33
+ debug one => _27;
+ debug other => _28;
}
bb0: {
- StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +11:6
- StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:15: +5:16
- _5 = _1; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:15: +5:16
- StorageLive(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:18: +5:23
- _6 = _2; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:18: +5:23
- _4 = (move _5, move _6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:23: +5:24
- StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:23: +5:24
- _34 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- _11 = discriminant((*_34)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- switchInt(move _11) -> [0: bb1, 1: bb3, 2: bb4, 3: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ StorageLive(_6);
+ _6 = _2;
+ _4 = (move _5, move _6);
+ StorageDead(_6);
+ StorageDead(_5);
+ _34 = deref_copy (_4.0: &ViewportPercentageLength);
+ _11 = discriminant((*_34));
+ switchInt(move _11) -> [0: bb1, 1: bb3, 2: bb4, 3: bb5, otherwise: bb2];
}
bb1: {
- _35 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- _7 = discriminant((*_35)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- switchInt(move _7) -> [0: bb6, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
+ _35 = deref_copy (_4.1: &ViewportPercentageLength);
+ _7 = discriminant((*_35));
+ switchInt(move _7) -> [0: bb6, otherwise: bb2];
}
bb2: {
- StorageLive(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+10:25: +10:27
- _33 = (); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+10:25: +10:27
- _0 = Result::<ViewportPercentageLength, ()>::Err(move _33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+10:21: +10:28
- StorageDead(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+10:27: +10:28
- StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+11:6: +11:7
- StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:1: +12:2
- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:2: +12:2
+ StorageLive(_33);
+ _33 = ();
+ _0 = Result::<ViewportPercentageLength, ()>::Err(move _33);
+ StorageDead(_33);
+ StorageDead(_3);
+ StorageDead(_4);
+ goto -> bb11;
}
bb3: {
- _36 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- _8 = discriminant((*_36)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- switchInt(move _8) -> [1: bb7, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
+ _36 = deref_copy (_4.1: &ViewportPercentageLength);
+ _8 = discriminant((*_36));
+ switchInt(move _8) -> [1: bb7, otherwise: bb2];
}
bb4: {
- _37 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- _9 = discriminant((*_37)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- switchInt(move _9) -> [2: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
+ _37 = deref_copy (_4.1: &ViewportPercentageLength);
+ _9 = discriminant((*_37));
+ switchInt(move _9) -> [2: bb8, otherwise: bb2];
}
bb5: {
- _38 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- _10 = discriminant((*_38)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
- switchInt(move _10) -> [3: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
+ _38 = deref_copy (_4.1: &ViewportPercentageLength);
+ _10 = discriminant((*_38));
+ switchInt(move _10) -> [3: bb9, otherwise: bb2];
}
bb6: {
- StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17
- _39 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17
- _12 = (((*_39) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:14: +6:17
- StorageLive(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29
- _40 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29
- _13 = (((*_40) as Vw).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:24: +6:29
- StorageLive(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:49
- StorageLive(_15); // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:41
- _15 = _12; // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:41
- StorageLive(_16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:44: +6:49
- _16 = _13; // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:44: +6:49
- _14 = Add(move _15, move _16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:38: +6:49
- StorageDead(_16); // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:48: +6:49
- StorageDead(_15); // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:48: +6:49
- _3 = ViewportPercentageLength::Vw(move _14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:35: +6:50
- StorageDead(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:+6:49: +6:50
- StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:49: +6:50
- StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:49: +6:50
- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+6:49: +6:50
+ StorageLive(_12);
+ _39 = deref_copy (_4.0: &ViewportPercentageLength);
+ _12 = (((*_39) as Vw).0: f32);
+ StorageLive(_13);
+ _40 = deref_copy (_4.1: &ViewportPercentageLength);
+ _13 = (((*_40) as Vw).0: f32);
+ StorageLive(_14);
+ StorageLive(_15);
+ _15 = _12;
+ StorageLive(_16);
+ _16 = _13;
+ _14 = Add(move _15, move _16);
+ StorageDead(_16);
+ StorageDead(_15);
+ _3 = ViewportPercentageLength::Vw(move _14);
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageDead(_12);
+ goto -> bb10;
}
bb7: {
- StorageLive(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17
- _41 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17
- _17 = (((*_41) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:14: +7:17
- StorageLive(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29
- _42 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29
- _18 = (((*_42) as Vh).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:24: +7:29
- StorageLive(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:49
- StorageLive(_20); // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:41
- _20 = _17; // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:41
- StorageLive(_21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:44: +7:49
- _21 = _18; // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:44: +7:49
- _19 = Add(move _20, move _21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:38: +7:49
- StorageDead(_21); // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:48: +7:49
- StorageDead(_20); // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:48: +7:49
- _3 = ViewportPercentageLength::Vh(move _19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:35: +7:50
- StorageDead(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:+7:49: +7:50
- StorageDead(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:49: +7:50
- StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:49: +7:50
- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+7:49: +7:50
+ StorageLive(_17);
+ _41 = deref_copy (_4.0: &ViewportPercentageLength);
+ _17 = (((*_41) as Vh).0: f32);
+ StorageLive(_18);
+ _42 = deref_copy (_4.1: &ViewportPercentageLength);
+ _18 = (((*_42) as Vh).0: f32);
+ StorageLive(_19);
+ StorageLive(_20);
+ _20 = _17;
+ StorageLive(_21);
+ _21 = _18;
+ _19 = Add(move _20, move _21);
+ StorageDead(_21);
+ StorageDead(_20);
+ _3 = ViewportPercentageLength::Vh(move _19);
+ StorageDead(_19);
+ StorageDead(_18);
+ StorageDead(_17);
+ goto -> bb10;
}
bb8: {
- StorageLive(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19
- _43 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19
- _22 = (((*_43) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:16: +8:19
- StorageLive(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33
- _44 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33
- _23 = (((*_44) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:28: +8:33
- StorageLive(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:55
- StorageLive(_25); // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:47
- _25 = _22; // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:47
- StorageLive(_26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:50: +8:55
- _26 = _23; // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:50: +8:55
- _24 = Add(move _25, move _26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:44: +8:55
- StorageDead(_26); // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:54: +8:55
- StorageDead(_25); // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:54: +8:55
- _3 = ViewportPercentageLength::Vmin(move _24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:39: +8:56
- StorageDead(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:+8:55: +8:56
- StorageDead(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:55: +8:56
- StorageDead(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:55: +8:56
- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+8:55: +8:56
+ StorageLive(_22);
+ _43 = deref_copy (_4.0: &ViewportPercentageLength);
+ _22 = (((*_43) as Vmin).0: f32);
+ StorageLive(_23);
+ _44 = deref_copy (_4.1: &ViewportPercentageLength);
+ _23 = (((*_44) as Vmin).0: f32);
+ StorageLive(_24);
+ StorageLive(_25);
+ _25 = _22;
+ StorageLive(_26);
+ _26 = _23;
+ _24 = Add(move _25, move _26);
+ StorageDead(_26);
+ StorageDead(_25);
+ _3 = ViewportPercentageLength::Vmin(move _24);
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageDead(_22);
+ goto -> bb10;
}
bb9: {
- StorageLive(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19
- _45 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19
- _27 = (((*_45) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:16: +9:19
- StorageLive(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33
- _46 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33
- _28 = (((*_46) as Vmax).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:28: +9:33
- StorageLive(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:55
- StorageLive(_30); // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:47
- _30 = _27; // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:47
- StorageLive(_31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:50: +9:55
- _31 = _28; // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:50: +9:55
- _29 = Add(move _30, move _31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:44: +9:55
- StorageDead(_31); // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:54: +9:55
- StorageDead(_30); // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:54: +9:55
- _3 = ViewportPercentageLength::Vmax(move _29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:39: +9:56
- StorageDead(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:+9:55: +9:56
- StorageDead(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:55: +9:56
- StorageDead(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:55: +9:56
- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+9:55: +9:56
+ StorageLive(_27);
+ _45 = deref_copy (_4.0: &ViewportPercentageLength);
+ _27 = (((*_45) as Vmax).0: f32);
+ StorageLive(_28);
+ _46 = deref_copy (_4.1: &ViewportPercentageLength);
+ _28 = (((*_46) as Vmax).0: f32);
+ StorageLive(_29);
+ StorageLive(_30);
+ _30 = _27;
+ StorageLive(_31);
+ _31 = _28;
+ _29 = Add(move _30, move _31);
+ StorageDead(_31);
+ StorageDead(_30);
+ _3 = ViewportPercentageLength::Vmax(move _29);
+ StorageDead(_29);
+ StorageDead(_28);
+ StorageDead(_27);
+ goto -> bb10;
}
bb10: {
- _0 = Result::<ViewportPercentageLength, ()>::Ok(move _3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:5: +11:7
- StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+11:6: +11:7
- StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:1: +12:2
- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:2: +12:2
+ _0 = Result::<ViewportPercentageLength, ()>::Ok(move _3);
+ StorageDead(_3);
+ StorageDead(_4);
+ goto -> bb11;
}
bb11: {
- return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:2: +12:2
+ return;
}
}
diff --git a/tests/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff
index 6468eb5f8..09cdce718 100644
--- a/tests/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff
+++ b/tests/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff
@@ -2,92 +2,92 @@
+ // MIR for `noopt1` after EarlyOtherwiseBranch
fn noopt1(_1: Option<u32>, _2: Option<u32>) -> u32 {
- debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:+0:11: +0:12
- debug y => _2; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:+0:27: +0:28
- let mut _0: u32; // return place in scope 0 at $DIR/early_otherwise_branch_noopt.rs:+0:46: +0:49
- let mut _3: (std::option::Option<u32>, std::option::Option<u32>); // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:11: +1:17
- let mut _4: std::option::Option<u32>; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:12: +1:13
- let mut _5: std::option::Option<u32>; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:15: +1:16
- let mut _6: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:+4:16: +4:23
- let mut _7: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:+2:19: +2:26
- let mut _8: isize; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:+2:10: +2:17
- let _9: u32; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:+2:15: +2:16
- let _10: u32; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:+2:24: +2:25
- let _11: u32; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:+3:15: +3:16
- let _12: u32; // in scope 0 at $DIR/early_otherwise_branch_noopt.rs:+4:21: +4:22
+ debug x => _1;
+ debug y => _2;
+ let mut _0: u32;
+ let mut _3: (std::option::Option<u32>, std::option::Option<u32>);
+ let mut _4: std::option::Option<u32>;
+ let mut _5: std::option::Option<u32>;
+ let mut _6: isize;
+ let mut _7: isize;
+ let mut _8: isize;
+ let _9: u32;
+ let _10: u32;
+ let _11: u32;
+ let _12: u32;
scope 1 {
- debug a => _9; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:+2:15: +2:16
- debug b => _10; // in scope 1 at $DIR/early_otherwise_branch_noopt.rs:+2:24: +2:25
+ debug a => _9;
+ debug b => _10;
}
scope 2 {
- debug a => _11; // in scope 2 at $DIR/early_otherwise_branch_noopt.rs:+3:15: +3:16
+ debug a => _11;
}
scope 3 {
- debug b => _12; // in scope 3 at $DIR/early_otherwise_branch_noopt.rs:+4:21: +4:22
+ debug b => _12;
}
bb0: {
- StorageLive(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:11: +1:17
- StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:12: +1:13
- _4 = _1; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:12: +1:13
- StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:15: +1:16
- _5 = _2; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:15: +1:16
- _3 = (move _4, move _5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:11: +1:17
- StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:16: +1:17
- StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:16: +1:17
- _8 = discriminant((_3.0: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:11: +1:17
- switchInt(move _8) -> [0: bb1, 1: bb4, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:5: +1:17
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ _5 = _2;
+ _3 = (move _4, move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ _8 = discriminant((_3.0: std::option::Option<u32>));
+ switchInt(move _8) -> [0: bb1, 1: bb4, otherwise: bb3];
}
bb1: {
- _6 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:11: +1:17
- switchInt(move _6) -> [0: bb2, 1: bb7, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:5: +1:17
+ _6 = discriminant((_3.1: std::option::Option<u32>));
+ switchInt(move _6) -> [0: bb2, 1: bb7, otherwise: bb3];
}
bb2: {
- _0 = const 3_u32; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+5:25: +5:26
- goto -> bb8; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+5:25: +5:26
+ _0 = const 3_u32;
+ goto -> bb8;
}
bb3: {
- unreachable; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:11: +1:17
+ unreachable;
}
bb4: {
- _7 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:11: +1:17
- switchInt(move _7) -> [0: bb6, 1: bb5, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:5: +1:17
+ _7 = discriminant((_3.1: std::option::Option<u32>));
+ switchInt(move _7) -> [0: bb6, 1: bb5, otherwise: bb3];
}
bb5: {
- StorageLive(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+2:15: +2:16
- _9 = (((_3.0: std::option::Option<u32>) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+2:15: +2:16
- StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+2:24: +2:25
- _10 = (((_3.1: std::option::Option<u32>) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+2:24: +2:25
- _0 = const 0_u32; // scope 1 at $DIR/early_otherwise_branch_noopt.rs:+2:31: +2:32
- StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+2:31: +2:32
- StorageDead(_9); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+2:31: +2:32
- goto -> bb8; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+2:31: +2:32
+ StorageLive(_9);
+ _9 = (((_3.0: std::option::Option<u32>) as Some).0: u32);
+ StorageLive(_10);
+ _10 = (((_3.1: std::option::Option<u32>) as Some).0: u32);
+ _0 = const 0_u32;
+ StorageDead(_10);
+ StorageDead(_9);
+ goto -> bb8;
}
bb6: {
- StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+3:15: +3:16
- _11 = (((_3.0: std::option::Option<u32>) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+3:15: +3:16
- _0 = const 1_u32; // scope 2 at $DIR/early_otherwise_branch_noopt.rs:+3:28: +3:29
- StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+3:28: +3:29
- goto -> bb8; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+3:28: +3:29
+ StorageLive(_11);
+ _11 = (((_3.0: std::option::Option<u32>) as Some).0: u32);
+ _0 = const 1_u32;
+ StorageDead(_11);
+ goto -> bb8;
}
bb7: {
- StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+4:21: +4:22
- _12 = (((_3.1: std::option::Option<u32>) as Some).0: u32); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+4:21: +4:22
- _0 = const 2_u32; // scope 3 at $DIR/early_otherwise_branch_noopt.rs:+4:28: +4:29
- StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+4:28: +4:29
- goto -> bb8; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+4:28: +4:29
+ StorageLive(_12);
+ _12 = (((_3.1: std::option::Option<u32>) as Some).0: u32);
+ _0 = const 2_u32;
+ StorageDead(_12);
+ goto -> bb8;
}
bb8: {
- StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+7:1: +7:2
- return; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+7:2: +7:2
+ StorageDead(_3);
+ return;
}
}
diff --git a/tests/mir-opt/early_otherwise_branch_noopt.rs b/tests/mir-opt/early_otherwise_branch_noopt.rs
index ef766bbd4..351640c27 100644
--- a/tests/mir-opt/early_otherwise_branch_noopt.rs
+++ b/tests/mir-opt/early_otherwise_branch_noopt.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: EarlyOtherwiseBranch
// must not optimize as it does not follow the pattern of
diff --git a/tests/mir-opt/early_otherwise_branch_soundness.no_deref_ptr.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_soundness.no_deref_ptr.EarlyOtherwiseBranch.diff
index a3fa2529b..b24ff6ec7 100644
--- a/tests/mir-opt/early_otherwise_branch_soundness.no_deref_ptr.EarlyOtherwiseBranch.diff
+++ b/tests/mir-opt/early_otherwise_branch_soundness.no_deref_ptr.EarlyOtherwiseBranch.diff
@@ -2,46 +2,46 @@
+ // MIR for `no_deref_ptr` after EarlyOtherwiseBranch
fn no_deref_ptr(_1: Option<i32>, _2: *const Option<i32>) -> i32 {
- debug a => _1; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:+0:24: +0:25
- debug b => _2; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:+0:40: +0:41
- let mut _0: i32; // return place in scope 0 at $DIR/early_otherwise_branch_soundness.rs:+0:66: +0:69
- let mut _3: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:+3:9: +3:16
- let mut _4: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:+4:13: +4:20
- let _5: i32; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:+4:18: +4:19
+ debug a => _1;
+ debug b => _2;
+ let mut _0: i32;
+ let mut _3: isize;
+ let mut _4: isize;
+ let _5: i32;
scope 1 {
- debug v => _5; // in scope 1 at $DIR/early_otherwise_branch_soundness.rs:+4:18: +4:19
+ debug v => _5;
}
bb0: {
- _3 = discriminant(_1); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+1:11: +1:12
- switchInt(move _3) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+1:5: +1:12
+ _3 = discriminant(_1);
+ switchInt(move _3) -> [1: bb2, otherwise: bb1];
}
bb1: {
- _0 = const 0_i32; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+7:14: +7:15
- goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+7:14: +7:15
+ _0 = const 0_i32;
+ goto -> bb5;
}
bb2: {
- _4 = discriminant((*_2)); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+3:26: +3:28
- switchInt(move _4) -> [1: bb4, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+3:20: +3:28
+ _4 = discriminant((*_2));
+ switchInt(move _4) -> [1: bb4, otherwise: bb3];
}
bb3: {
- _0 = const 0_i32; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+5:18: +5:19
- goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+5:18: +5:19
+ _0 = const 0_i32;
+ goto -> bb5;
}
bb4: {
- StorageLive(_5); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+4:18: +4:19
- _5 = (((*_2) as Some).0: i32); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+4:18: +4:19
- _0 = _5; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+4:24: +4:25
- StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+4:24: +4:25
- goto -> bb5; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+4:24: +4:25
+ StorageLive(_5);
+ _5 = (((*_2) as Some).0: i32);
+ _0 = _5;
+ StorageDead(_5);
+ goto -> bb5;
}
bb5: {
- return; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+9:2: +9:2
+ return;
}
}
diff --git a/tests/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff
index 6d0224b54..c3ea975ce 100644
--- a/tests/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff
+++ b/tests/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff
@@ -2,37 +2,37 @@
+ // MIR for `no_downcast` after EarlyOtherwiseBranch
fn no_downcast(_1: &E<'_>) -> u32 {
- debug e => _1; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:+0:16: +0:17
- let mut _0: u32; // return place in scope 0 at $DIR/early_otherwise_branch_soundness.rs:+0:26: +0:29
- let mut _2: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:+1:20: +1:30
- let mut _3: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31
- let mut _4: &E<'_>; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:+0:16: +0:17
+ debug e => _1;
+ let mut _0: u32;
+ let mut _2: isize;
+ let mut _3: isize;
+ let mut _4: &E<'_>;
scope 1 {
}
bb0: {
- _3 = discriminant((*_1)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31
- switchInt(move _3) -> [1: bb1, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31
+ _3 = discriminant((*_1));
+ switchInt(move _3) -> [1: bb1, otherwise: bb3];
}
bb1: {
- _4 = deref_copy (((*_1) as Some).0: &E<'_>); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31
- _2 = discriminant((*_4)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31
- switchInt(move _2) -> [1: bb2, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31
+ _4 = deref_copy (((*_1) as Some).0: &E<'_>);
+ _2 = discriminant((*_4));
+ switchInt(move _2) -> [1: bb2, otherwise: bb3];
}
bb2: {
- _0 = const 1_u32; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:38: +1:39
- goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+1:5: +1:52
+ _0 = const 1_u32;
+ goto -> bb4;
}
bb3: {
- _0 = const 2_u32; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+1:49: +1:50
- goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+1:5: +1:52
+ _0 = const 2_u32;
+ goto -> bb4;
}
bb4: {
- return; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+2:2: +2:2
+ return;
}
}
diff --git a/tests/mir-opt/early_otherwise_branch_soundness.rs b/tests/mir-opt/early_otherwise_branch_soundness.rs
index cd4589232..02c25a1bd 100644
--- a/tests/mir-opt/early_otherwise_branch_soundness.rs
+++ b/tests/mir-opt/early_otherwise_branch_soundness.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: EarlyOtherwiseBranch
// Tests various cases that the `early_otherwise_branch` opt should *not* optimize
diff --git a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff
index b139deeee..775a60f1c 100644
--- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff
+++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff
@@ -2,67 +2,71 @@
+ // MIR for `cand` after EnumSizeOpt
fn cand() -> Candidate {
- let mut _0: Candidate; // return place in scope 0 at $DIR/enum_opt.rs:+0:18: +0:27
- let mut _1: Candidate; // in scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- let mut _2: Candidate; // in scope 0 at $DIR/enum_opt.rs:+2:7: +2:34
- let mut _3: [u8; 8196]; // in scope 0 at $DIR/enum_opt.rs:+2:24: +2:33
-+ let mut _4: [usize; 2]; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _5: isize; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _6: usize; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _7: usize; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _8: *mut Candidate; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _9: *mut u8; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _10: *const Candidate; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _11: *const u8; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _12: [usize; 2]; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _13: isize; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _14: usize; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _15: usize; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _16: *mut Candidate; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _17: *mut u8; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _18: *const Candidate; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _19: *const u8; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
+ let mut _0: Candidate;
+ let mut _1: Candidate;
+ let mut _2: Candidate;
+ let mut _3: [u8; 8196];
++ let mut _4: [usize; 2];
++ let mut _5: isize;
++ let mut _6: usize;
++ let mut _7: usize;
++ let mut _8: *mut Candidate;
++ let mut _9: *mut u8;
++ let mut _10: *const Candidate;
++ let mut _11: *const u8;
++ let mut _12: [usize; 2];
++ let mut _13: isize;
++ let mut _14: usize;
++ let mut _15: usize;
++ let mut _16: *mut Candidate;
++ let mut _17: *mut u8;
++ let mut _18: *const Candidate;
++ let mut _19: *const u8;
scope 1 {
- debug a => _1; // in scope 1 at $DIR/enum_opt.rs:+1:7: +1:12
+ debug a => _1;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- _1 = Candidate::Small(const 1_u8); // scope 0 at $DIR/enum_opt.rs:+1:15: +1:34
- StorageLive(_2); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:34
- StorageLive(_3); // scope 1 at $DIR/enum_opt.rs:+2:24: +2:33
- _3 = [const 1_u8; 8196]; // scope 1 at $DIR/enum_opt.rs:+2:24: +2:33
- _2 = Candidate::Large(move _3); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:34
- StorageDead(_3); // scope 1 at $DIR/enum_opt.rs:+2:33: +2:34
-- _1 = move _2; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ StorageLive(_4); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _4 = const [2_usize, 8197_usize]; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _5 = discriminant(_2); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _6 = _5 as usize (IntToInt); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _7 = _4[_6]; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _8 = &raw mut _1; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _9 = _8 as *mut u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _10 = &raw const _2; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _11 = _10 as *const u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ Deinit(_8); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ copy_nonoverlapping(dst = _9, src = _11, count = _7); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ StorageDead(_4); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
- StorageDead(_2); // scope 1 at $DIR/enum_opt.rs:+2:33: +2:34
-- _0 = move _1; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ StorageLive(_12); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _12 = const [2_usize, 8197_usize]; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _13 = discriminant(_1); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _14 = _13 as usize (IntToInt); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _15 = _12[_14]; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _16 = &raw mut _0; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _17 = _16 as *mut u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _18 = &raw const _1; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _19 = _18 as *const u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ Deinit(_16); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ copy_nonoverlapping(dst = _17, src = _19, count = _15); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ StorageDead(_12); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
- StorageDead(_1); // scope 0 at $DIR/enum_opt.rs:+4:1: +4:2
- return; // scope 0 at $DIR/enum_opt.rs:+4:2: +4:2
+ StorageLive(_1);
+ _1 = Candidate::Small(const 1_u8);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 1_u8; 8196];
+ _2 = Candidate::Large(move _3);
+ StorageDead(_3);
+- _1 = move _2;
++ StorageLive(_4);
++ _4 = const [2_usize, 8197_usize];
++ _5 = discriminant(_2);
++ _6 = _5 as usize (IntToInt);
++ _7 = _4[_6];
++ _8 = &raw mut _1;
++ _9 = _8 as *mut u8 (PtrToPtr);
++ _10 = &raw const _2;
++ _11 = _10 as *const u8 (PtrToPtr);
++ Deinit(_8);
++ copy_nonoverlapping(dst = _9, src = _11, count = _7);
++ StorageDead(_4);
+ StorageDead(_2);
+- _0 = move _1;
++ StorageLive(_12);
++ _12 = const [2_usize, 8197_usize];
++ _13 = discriminant(_1);
++ _14 = _13 as usize (IntToInt);
++ _15 = _12[_14];
++ _16 = &raw mut _0;
++ _17 = _16 as *mut u8 (PtrToPtr);
++ _18 = &raw const _1;
++ _19 = _18 as *const u8 (PtrToPtr);
++ Deinit(_16);
++ copy_nonoverlapping(dst = _17, src = _19, count = _15);
++ StorageDead(_12);
+ StorageDead(_1);
+ return;
}
++ }
++
++ ALLOC0 (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 b139deeee..c4b575799 100644
--- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff
+++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff
@@ -2,67 +2,71 @@
+ // MIR for `cand` after EnumSizeOpt
fn cand() -> Candidate {
- let mut _0: Candidate; // return place in scope 0 at $DIR/enum_opt.rs:+0:18: +0:27
- let mut _1: Candidate; // in scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- let mut _2: Candidate; // in scope 0 at $DIR/enum_opt.rs:+2:7: +2:34
- let mut _3: [u8; 8196]; // in scope 0 at $DIR/enum_opt.rs:+2:24: +2:33
-+ let mut _4: [usize; 2]; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _5: isize; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _6: usize; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _7: usize; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _8: *mut Candidate; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _9: *mut u8; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _10: *const Candidate; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _11: *const u8; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:34
-+ let mut _12: [usize; 2]; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _13: isize; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _14: usize; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _15: usize; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _16: *mut Candidate; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _17: *mut u8; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _18: *const Candidate; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _19: *const u8; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
+ let mut _0: Candidate;
+ let mut _1: Candidate;
+ let mut _2: Candidate;
+ let mut _3: [u8; 8196];
++ let mut _4: [usize; 2];
++ let mut _5: isize;
++ let mut _6: usize;
++ let mut _7: usize;
++ let mut _8: *mut Candidate;
++ let mut _9: *mut u8;
++ let mut _10: *const Candidate;
++ let mut _11: *const u8;
++ let mut _12: [usize; 2];
++ let mut _13: isize;
++ let mut _14: usize;
++ let mut _15: usize;
++ let mut _16: *mut Candidate;
++ let mut _17: *mut u8;
++ let mut _18: *const Candidate;
++ let mut _19: *const u8;
scope 1 {
- debug a => _1; // in scope 1 at $DIR/enum_opt.rs:+1:7: +1:12
+ debug a => _1;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- _1 = Candidate::Small(const 1_u8); // scope 0 at $DIR/enum_opt.rs:+1:15: +1:34
- StorageLive(_2); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:34
- StorageLive(_3); // scope 1 at $DIR/enum_opt.rs:+2:24: +2:33
- _3 = [const 1_u8; 8196]; // scope 1 at $DIR/enum_opt.rs:+2:24: +2:33
- _2 = Candidate::Large(move _3); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:34
- StorageDead(_3); // scope 1 at $DIR/enum_opt.rs:+2:33: +2:34
-- _1 = move _2; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ StorageLive(_4); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _4 = const [2_usize, 8197_usize]; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _5 = discriminant(_2); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _6 = _5 as usize (IntToInt); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _7 = _4[_6]; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _8 = &raw mut _1; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _9 = _8 as *mut u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _10 = &raw const _2; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ _11 = _10 as *const u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ Deinit(_8); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ copy_nonoverlapping(dst = _9, src = _11, count = _7); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
-+ StorageDead(_4); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
- StorageDead(_2); // scope 1 at $DIR/enum_opt.rs:+2:33: +2:34
-- _0 = move _1; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ StorageLive(_12); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _12 = const [2_usize, 8197_usize]; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _13 = discriminant(_1); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _14 = _13 as usize (IntToInt); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _15 = _12[_14]; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _16 = &raw mut _0; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _17 = _16 as *mut u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _18 = &raw const _1; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _19 = _18 as *const u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ Deinit(_16); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ copy_nonoverlapping(dst = _17, src = _19, count = _15); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ StorageDead(_12); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
- StorageDead(_1); // scope 0 at $DIR/enum_opt.rs:+4:1: +4:2
- return; // scope 0 at $DIR/enum_opt.rs:+4:2: +4:2
+ StorageLive(_1);
+ _1 = Candidate::Small(const 1_u8);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 1_u8; 8196];
+ _2 = Candidate::Large(move _3);
+ StorageDead(_3);
+- _1 = move _2;
++ StorageLive(_4);
++ _4 = const [2_usize, 8197_usize];
++ _5 = discriminant(_2);
++ _6 = _5 as usize (IntToInt);
++ _7 = _4[_6];
++ _8 = &raw mut _1;
++ _9 = _8 as *mut u8 (PtrToPtr);
++ _10 = &raw const _2;
++ _11 = _10 as *const u8 (PtrToPtr);
++ Deinit(_8);
++ copy_nonoverlapping(dst = _9, src = _11, count = _7);
++ StorageDead(_4);
+ StorageDead(_2);
+- _0 = move _1;
++ StorageLive(_12);
++ _12 = const [2_usize, 8197_usize];
++ _13 = discriminant(_1);
++ _14 = _13 as usize (IntToInt);
++ _15 = _12[_14];
++ _16 = &raw mut _0;
++ _17 = _16 as *mut u8 (PtrToPtr);
++ _18 = &raw const _1;
++ _19 = _18 as *const u8 (PtrToPtr);
++ Deinit(_16);
++ copy_nonoverlapping(dst = _17, src = _19, count = _15);
++ StorageDead(_12);
+ StorageDead(_1);
+ return;
}
++ }
++
++ ALLOC0 (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.invalid.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.invalid.EnumSizeOpt.32bit.diff
index a80001149..b627fd279 100644
--- a/tests/mir-opt/enum_opt.invalid.EnumSizeOpt.32bit.diff
+++ b/tests/mir-opt/enum_opt.invalid.EnumSizeOpt.32bit.diff
@@ -2,27 +2,27 @@
+ // MIR for `invalid` after EnumSizeOpt
fn invalid() -> InvalidIdxs {
- let mut _0: InvalidIdxs; // return place in scope 0 at $DIR/enum_opt.rs:+0:21: +0:32
- let mut _1: InvalidIdxs; // in scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- let mut _2: InvalidIdxs; // in scope 0 at $DIR/enum_opt.rs:+2:7: +2:36
- let mut _3: [u64; 1024]; // in scope 0 at $DIR/enum_opt.rs:+2:26: +2:35
+ let mut _0: InvalidIdxs;
+ let mut _1: InvalidIdxs;
+ let mut _2: InvalidIdxs;
+ let mut _3: [u64; 1024];
scope 1 {
- debug a => _1; // in scope 1 at $DIR/enum_opt.rs:+1:7: +1:12
+ debug a => _1;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- _1 = InvalidIdxs::A; // scope 0 at $DIR/enum_opt.rs:+1:15: +1:29
- StorageLive(_2); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:36
- StorageLive(_3); // scope 1 at $DIR/enum_opt.rs:+2:26: +2:35
- _3 = [const 0_u64; 1024]; // scope 1 at $DIR/enum_opt.rs:+2:26: +2:35
- _2 = InvalidIdxs::Large(move _3); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:36
- StorageDead(_3); // scope 1 at $DIR/enum_opt.rs:+2:35: +2:36
- _1 = move _2; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:36
- StorageDead(_2); // scope 1 at $DIR/enum_opt.rs:+2:35: +2:36
- _0 = move _1; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
- StorageDead(_1); // scope 0 at $DIR/enum_opt.rs:+4:1: +4:2
- return; // scope 0 at $DIR/enum_opt.rs:+4:2: +4:2
+ StorageLive(_1);
+ _1 = InvalidIdxs::A;
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 0_u64; 1024];
+ _2 = InvalidIdxs::Large(move _3);
+ StorageDead(_3);
+ _1 = move _2;
+ StorageDead(_2);
+ _0 = move _1;
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/enum_opt.invalid.EnumSizeOpt.64bit.diff b/tests/mir-opt/enum_opt.invalid.EnumSizeOpt.64bit.diff
index a80001149..b627fd279 100644
--- a/tests/mir-opt/enum_opt.invalid.EnumSizeOpt.64bit.diff
+++ b/tests/mir-opt/enum_opt.invalid.EnumSizeOpt.64bit.diff
@@ -2,27 +2,27 @@
+ // MIR for `invalid` after EnumSizeOpt
fn invalid() -> InvalidIdxs {
- let mut _0: InvalidIdxs; // return place in scope 0 at $DIR/enum_opt.rs:+0:21: +0:32
- let mut _1: InvalidIdxs; // in scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- let mut _2: InvalidIdxs; // in scope 0 at $DIR/enum_opt.rs:+2:7: +2:36
- let mut _3: [u64; 1024]; // in scope 0 at $DIR/enum_opt.rs:+2:26: +2:35
+ let mut _0: InvalidIdxs;
+ let mut _1: InvalidIdxs;
+ let mut _2: InvalidIdxs;
+ let mut _3: [u64; 1024];
scope 1 {
- debug a => _1; // in scope 1 at $DIR/enum_opt.rs:+1:7: +1:12
+ debug a => _1;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- _1 = InvalidIdxs::A; // scope 0 at $DIR/enum_opt.rs:+1:15: +1:29
- StorageLive(_2); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:36
- StorageLive(_3); // scope 1 at $DIR/enum_opt.rs:+2:26: +2:35
- _3 = [const 0_u64; 1024]; // scope 1 at $DIR/enum_opt.rs:+2:26: +2:35
- _2 = InvalidIdxs::Large(move _3); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:36
- StorageDead(_3); // scope 1 at $DIR/enum_opt.rs:+2:35: +2:36
- _1 = move _2; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:36
- StorageDead(_2); // scope 1 at $DIR/enum_opt.rs:+2:35: +2:36
- _0 = move _1; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
- StorageDead(_1); // scope 0 at $DIR/enum_opt.rs:+4:1: +4:2
- return; // scope 0 at $DIR/enum_opt.rs:+4:2: +4:2
+ StorageLive(_1);
+ _1 = InvalidIdxs::A;
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 0_u64; 1024];
+ _2 = InvalidIdxs::Large(move _3);
+ StorageDead(_3);
+ _1 = move _2;
+ StorageDead(_2);
+ _0 = move _1;
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/enum_opt.rs b/tests/mir-opt/enum_opt.rs
index 2768d7080..7738c4310 100644
--- a/tests/mir-opt/enum_opt.rs
+++ b/tests/mir-opt/enum_opt.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: EnumSizeOpt
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// compile-flags: -Zunsound-mir-opts
diff --git a/tests/mir-opt/enum_opt.trunc.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.trunc.EnumSizeOpt.32bit.diff
index 1ef79044d..100a73e56 100644
--- a/tests/mir-opt/enum_opt.trunc.EnumSizeOpt.32bit.diff
+++ b/tests/mir-opt/enum_opt.trunc.EnumSizeOpt.32bit.diff
@@ -2,36 +2,36 @@
+ // MIR for `trunc` after EnumSizeOpt
fn trunc() -> NotTrunctable {
- let mut _0: NotTrunctable; // return place in scope 0 at $DIR/enum_opt.rs:+0:19: +0:32
- let mut _1: NotTrunctable; // in scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- let mut _2: NotTrunctable; // in scope 0 at $DIR/enum_opt.rs:+2:7: +2:34
- let mut _3: [u8; 1024]; // in scope 0 at $DIR/enum_opt.rs:+2:24: +2:33
- let mut _4: NotTrunctable; // in scope 0 at $DIR/enum_opt.rs:+3:7: +3:34
- let mut _5: [u8; 4096]; // in scope 0 at $DIR/enum_opt.rs:+3:24: +3:33
+ let mut _0: NotTrunctable;
+ let mut _1: NotTrunctable;
+ let mut _2: NotTrunctable;
+ let mut _3: [u8; 1024];
+ let mut _4: NotTrunctable;
+ let mut _5: [u8; 4096];
scope 1 {
- debug a => _1; // in scope 1 at $DIR/enum_opt.rs:+1:7: +1:12
+ debug a => _1;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- _1 = NotTrunctable::A; // scope 0 at $DIR/enum_opt.rs:+1:15: +1:31
- StorageLive(_2); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:34
- StorageLive(_3); // scope 1 at $DIR/enum_opt.rs:+2:24: +2:33
- _3 = [const 0_u8; 1024]; // scope 1 at $DIR/enum_opt.rs:+2:24: +2:33
- _2 = NotTrunctable::B(move _3); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:34
- StorageDead(_3); // scope 1 at $DIR/enum_opt.rs:+2:33: +2:34
- _1 = move _2; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
- StorageDead(_2); // scope 1 at $DIR/enum_opt.rs:+2:33: +2:34
- StorageLive(_4); // scope 1 at $DIR/enum_opt.rs:+3:7: +3:34
- StorageLive(_5); // scope 1 at $DIR/enum_opt.rs:+3:24: +3:33
- _5 = [const 0_u8; 4096]; // scope 1 at $DIR/enum_opt.rs:+3:24: +3:33
- _4 = NotTrunctable::C(move _5); // scope 1 at $DIR/enum_opt.rs:+3:7: +3:34
- StorageDead(_5); // scope 1 at $DIR/enum_opt.rs:+3:33: +3:34
- _1 = move _4; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:34
- StorageDead(_4); // scope 1 at $DIR/enum_opt.rs:+3:33: +3:34
- _0 = move _1; // scope 1 at $DIR/enum_opt.rs:+4:3: +4:4
- StorageDead(_1); // scope 0 at $DIR/enum_opt.rs:+5:1: +5:2
- return; // scope 0 at $DIR/enum_opt.rs:+5:2: +5:2
+ StorageLive(_1);
+ _1 = NotTrunctable::A;
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 0_u8; 1024];
+ _2 = NotTrunctable::B(move _3);
+ StorageDead(_3);
+ _1 = move _2;
+ StorageDead(_2);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = [const 0_u8; 4096];
+ _4 = NotTrunctable::C(move _5);
+ StorageDead(_5);
+ _1 = move _4;
+ StorageDead(_4);
+ _0 = move _1;
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/enum_opt.trunc.EnumSizeOpt.64bit.diff b/tests/mir-opt/enum_opt.trunc.EnumSizeOpt.64bit.diff
index 1ef79044d..100a73e56 100644
--- a/tests/mir-opt/enum_opt.trunc.EnumSizeOpt.64bit.diff
+++ b/tests/mir-opt/enum_opt.trunc.EnumSizeOpt.64bit.diff
@@ -2,36 +2,36 @@
+ // MIR for `trunc` after EnumSizeOpt
fn trunc() -> NotTrunctable {
- let mut _0: NotTrunctable; // return place in scope 0 at $DIR/enum_opt.rs:+0:19: +0:32
- let mut _1: NotTrunctable; // in scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- let mut _2: NotTrunctable; // in scope 0 at $DIR/enum_opt.rs:+2:7: +2:34
- let mut _3: [u8; 1024]; // in scope 0 at $DIR/enum_opt.rs:+2:24: +2:33
- let mut _4: NotTrunctable; // in scope 0 at $DIR/enum_opt.rs:+3:7: +3:34
- let mut _5: [u8; 4096]; // in scope 0 at $DIR/enum_opt.rs:+3:24: +3:33
+ let mut _0: NotTrunctable;
+ let mut _1: NotTrunctable;
+ let mut _2: NotTrunctable;
+ let mut _3: [u8; 1024];
+ let mut _4: NotTrunctable;
+ let mut _5: [u8; 4096];
scope 1 {
- debug a => _1; // in scope 1 at $DIR/enum_opt.rs:+1:7: +1:12
+ debug a => _1;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- _1 = NotTrunctable::A; // scope 0 at $DIR/enum_opt.rs:+1:15: +1:31
- StorageLive(_2); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:34
- StorageLive(_3); // scope 1 at $DIR/enum_opt.rs:+2:24: +2:33
- _3 = [const 0_u8; 1024]; // scope 1 at $DIR/enum_opt.rs:+2:24: +2:33
- _2 = NotTrunctable::B(move _3); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:34
- StorageDead(_3); // scope 1 at $DIR/enum_opt.rs:+2:33: +2:34
- _1 = move _2; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:34
- StorageDead(_2); // scope 1 at $DIR/enum_opt.rs:+2:33: +2:34
- StorageLive(_4); // scope 1 at $DIR/enum_opt.rs:+3:7: +3:34
- StorageLive(_5); // scope 1 at $DIR/enum_opt.rs:+3:24: +3:33
- _5 = [const 0_u8; 4096]; // scope 1 at $DIR/enum_opt.rs:+3:24: +3:33
- _4 = NotTrunctable::C(move _5); // scope 1 at $DIR/enum_opt.rs:+3:7: +3:34
- StorageDead(_5); // scope 1 at $DIR/enum_opt.rs:+3:33: +3:34
- _1 = move _4; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:34
- StorageDead(_4); // scope 1 at $DIR/enum_opt.rs:+3:33: +3:34
- _0 = move _1; // scope 1 at $DIR/enum_opt.rs:+4:3: +4:4
- StorageDead(_1); // scope 0 at $DIR/enum_opt.rs:+5:1: +5:2
- return; // scope 0 at $DIR/enum_opt.rs:+5:2: +5:2
+ StorageLive(_1);
+ _1 = NotTrunctable::A;
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 0_u8; 1024];
+ _2 = NotTrunctable::B(move _3);
+ StorageDead(_3);
+ _1 = move _2;
+ StorageDead(_2);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = [const 0_u8; 4096];
+ _4 = NotTrunctable::C(move _5);
+ StorageDead(_5);
+ _1 = move _4;
+ StorageDead(_4);
+ _0 = move _1;
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff
index ad9f12cf9..f7d0d1fb5 100644
--- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff
+++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff
@@ -2,67 +2,71 @@
+ // MIR for `unin` after EnumSizeOpt
fn unin() -> NoData {
- let mut _0: NoData; // return place in scope 0 at $DIR/enum_opt.rs:+0:18: +0:24
- let mut _1: NoData; // in scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- let mut _2: NoData; // in scope 0 at $DIR/enum_opt.rs:+2:7: +2:31
- let mut _3: [u8; 8196]; // in scope 0 at $DIR/enum_opt.rs:+2:21: +2:30
-+ let mut _4: [usize; 2]; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _5: isize; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _6: usize; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _7: usize; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _8: *mut NoData; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _9: *mut u8; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _10: *const NoData; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _11: *const u8; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _12: [usize; 2]; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _13: isize; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _14: usize; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _15: usize; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _16: *mut NoData; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _17: *mut u8; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _18: *const NoData; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _19: *const u8; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
+ let mut _0: NoData;
+ let mut _1: NoData;
+ let mut _2: NoData;
+ let mut _3: [u8; 8196];
++ let mut _4: [usize; 2];
++ let mut _5: isize;
++ let mut _6: usize;
++ let mut _7: usize;
++ let mut _8: *mut NoData;
++ let mut _9: *mut u8;
++ let mut _10: *const NoData;
++ let mut _11: *const u8;
++ let mut _12: [usize; 2];
++ let mut _13: isize;
++ let mut _14: usize;
++ let mut _15: usize;
++ let mut _16: *mut NoData;
++ let mut _17: *mut u8;
++ let mut _18: *const NoData;
++ let mut _19: *const u8;
scope 1 {
- debug a => _1; // in scope 1 at $DIR/enum_opt.rs:+1:7: +1:12
+ debug a => _1;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- _1 = NoData::None; // scope 0 at $DIR/enum_opt.rs:+1:15: +1:27
- StorageLive(_2); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:31
- StorageLive(_3); // scope 1 at $DIR/enum_opt.rs:+2:21: +2:30
- _3 = [const 1_u8; 8196]; // scope 1 at $DIR/enum_opt.rs:+2:21: +2:30
- _2 = NoData::Large(move _3); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:31
- StorageDead(_3); // scope 1 at $DIR/enum_opt.rs:+2:30: +2:31
-- _1 = move _2; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ StorageLive(_4); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _4 = const [8197_usize, 1_usize]; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _5 = discriminant(_2); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _6 = _5 as usize (IntToInt); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _7 = _4[_6]; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _8 = &raw mut _1; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _9 = _8 as *mut u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _10 = &raw const _2; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _11 = _10 as *const u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ Deinit(_8); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ copy_nonoverlapping(dst = _9, src = _11, count = _7); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ StorageDead(_4); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
- StorageDead(_2); // scope 1 at $DIR/enum_opt.rs:+2:30: +2:31
-- _0 = move _1; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ StorageLive(_12); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _12 = const [8197_usize, 1_usize]; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _13 = discriminant(_1); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _14 = _13 as usize (IntToInt); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _15 = _12[_14]; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _16 = &raw mut _0; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _17 = _16 as *mut u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _18 = &raw const _1; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _19 = _18 as *const u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ Deinit(_16); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ copy_nonoverlapping(dst = _17, src = _19, count = _15); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ StorageDead(_12); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
- StorageDead(_1); // scope 0 at $DIR/enum_opt.rs:+4:1: +4:2
- return; // scope 0 at $DIR/enum_opt.rs:+4:2: +4:2
+ StorageLive(_1);
+ _1 = NoData::None;
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 1_u8; 8196];
+ _2 = NoData::Large(move _3);
+ StorageDead(_3);
+- _1 = move _2;
++ StorageLive(_4);
++ _4 = const [8197_usize, 1_usize];
++ _5 = discriminant(_2);
++ _6 = _5 as usize (IntToInt);
++ _7 = _4[_6];
++ _8 = &raw mut _1;
++ _9 = _8 as *mut u8 (PtrToPtr);
++ _10 = &raw const _2;
++ _11 = _10 as *const u8 (PtrToPtr);
++ Deinit(_8);
++ copy_nonoverlapping(dst = _9, src = _11, count = _7);
++ StorageDead(_4);
+ StorageDead(_2);
+- _0 = move _1;
++ StorageLive(_12);
++ _12 = const [8197_usize, 1_usize];
++ _13 = discriminant(_1);
++ _14 = _13 as usize (IntToInt);
++ _15 = _12[_14];
++ _16 = &raw mut _0;
++ _17 = _16 as *mut u8 (PtrToPtr);
++ _18 = &raw const _1;
++ _19 = _18 as *const u8 (PtrToPtr);
++ Deinit(_16);
++ copy_nonoverlapping(dst = _17, src = _19, count = _15);
++ StorageDead(_12);
+ StorageDead(_1);
+ return;
}
++ }
++
++ ALLOC0 (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 ad9f12cf9..15f1bd0df 100644
--- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff
+++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff
@@ -2,67 +2,71 @@
+ // MIR for `unin` after EnumSizeOpt
fn unin() -> NoData {
- let mut _0: NoData; // return place in scope 0 at $DIR/enum_opt.rs:+0:18: +0:24
- let mut _1: NoData; // in scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- let mut _2: NoData; // in scope 0 at $DIR/enum_opt.rs:+2:7: +2:31
- let mut _3: [u8; 8196]; // in scope 0 at $DIR/enum_opt.rs:+2:21: +2:30
-+ let mut _4: [usize; 2]; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _5: isize; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _6: usize; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _7: usize; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _8: *mut NoData; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _9: *mut u8; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _10: *const NoData; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _11: *const u8; // in scope 0 at $DIR/enum_opt.rs:+2:3: +2:31
-+ let mut _12: [usize; 2]; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _13: isize; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _14: usize; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _15: usize; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _16: *mut NoData; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _17: *mut u8; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _18: *const NoData; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
-+ let mut _19: *const u8; // in scope 0 at $DIR/enum_opt.rs:+3:3: +3:4
+ let mut _0: NoData;
+ let mut _1: NoData;
+ let mut _2: NoData;
+ let mut _3: [u8; 8196];
++ let mut _4: [usize; 2];
++ let mut _5: isize;
++ let mut _6: usize;
++ let mut _7: usize;
++ let mut _8: *mut NoData;
++ let mut _9: *mut u8;
++ let mut _10: *const NoData;
++ let mut _11: *const u8;
++ let mut _12: [usize; 2];
++ let mut _13: isize;
++ let mut _14: usize;
++ let mut _15: usize;
++ let mut _16: *mut NoData;
++ let mut _17: *mut u8;
++ let mut _18: *const NoData;
++ let mut _19: *const u8;
scope 1 {
- debug a => _1; // in scope 1 at $DIR/enum_opt.rs:+1:7: +1:12
+ debug a => _1;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/enum_opt.rs:+1:7: +1:12
- _1 = NoData::None; // scope 0 at $DIR/enum_opt.rs:+1:15: +1:27
- StorageLive(_2); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:31
- StorageLive(_3); // scope 1 at $DIR/enum_opt.rs:+2:21: +2:30
- _3 = [const 1_u8; 8196]; // scope 1 at $DIR/enum_opt.rs:+2:21: +2:30
- _2 = NoData::Large(move _3); // scope 1 at $DIR/enum_opt.rs:+2:7: +2:31
- StorageDead(_3); // scope 1 at $DIR/enum_opt.rs:+2:30: +2:31
-- _1 = move _2; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ StorageLive(_4); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _4 = const [8197_usize, 1_usize]; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _5 = discriminant(_2); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _6 = _5 as usize (IntToInt); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _7 = _4[_6]; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _8 = &raw mut _1; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _9 = _8 as *mut u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _10 = &raw const _2; // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ _11 = _10 as *const u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ Deinit(_8); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ copy_nonoverlapping(dst = _9, src = _11, count = _7); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
-+ StorageDead(_4); // scope 1 at $DIR/enum_opt.rs:+2:3: +2:31
- StorageDead(_2); // scope 1 at $DIR/enum_opt.rs:+2:30: +2:31
-- _0 = move _1; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ StorageLive(_12); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _12 = const [8197_usize, 1_usize]; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _13 = discriminant(_1); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _14 = _13 as usize (IntToInt); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _15 = _12[_14]; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _16 = &raw mut _0; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _17 = _16 as *mut u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _18 = &raw const _1; // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ _19 = _18 as *const u8 (PtrToPtr); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ Deinit(_16); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ copy_nonoverlapping(dst = _17, src = _19, count = _15); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
-+ StorageDead(_12); // scope 1 at $DIR/enum_opt.rs:+3:3: +3:4
- StorageDead(_1); // scope 0 at $DIR/enum_opt.rs:+4:1: +4:2
- return; // scope 0 at $DIR/enum_opt.rs:+4:2: +4:2
+ StorageLive(_1);
+ _1 = NoData::None;
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = [const 1_u8; 8196];
+ _2 = NoData::Large(move _3);
+ StorageDead(_3);
+- _1 = move _2;
++ StorageLive(_4);
++ _4 = const [8197_usize, 1_usize];
++ _5 = discriminant(_2);
++ _6 = _5 as usize (IntToInt);
++ _7 = _4[_6];
++ _8 = &raw mut _1;
++ _9 = _8 as *mut u8 (PtrToPtr);
++ _10 = &raw const _2;
++ _11 = _10 as *const u8 (PtrToPtr);
++ Deinit(_8);
++ copy_nonoverlapping(dst = _9, src = _11, count = _7);
++ StorageDead(_4);
+ StorageDead(_2);
+- _0 = move _1;
++ StorageLive(_12);
++ _12 = const [8197_usize, 1_usize];
++ _13 = discriminant(_1);
++ _14 = _13 as usize (IntToInt);
++ _15 = _12[_14];
++ _16 = &raw mut _0;
++ _17 = _16 as *mut u8 (PtrToPtr);
++ _18 = &raw const _1;
++ _19 = _18 as *const u8 (PtrToPtr);
++ Deinit(_16);
++ copy_nonoverlapping(dst = _17, src = _19, count = _15);
++ StorageDead(_12);
+ StorageDead(_1);
+ return;
}
++ }
++
++ ALLOC0 (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
deleted file mode 100644
index 4ef413200..000000000
--- a/tests/mir-opt/equal_true.opt.InstSimplify.diff
+++ /dev/null
@@ -1,35 +0,0 @@
-- // MIR for `opt` before InstSimplify
-+ // MIR for `opt` after InstSimplify
-
- fn opt(_1: bool) -> i32 {
- debug x => _1; // in scope 0 at $DIR/equal_true.rs:+0:8: +0:9
- let mut _0: i32; // return place in scope 0 at $DIR/equal_true.rs:+0:20: +0:23
- let mut _2: bool; // in scope 0 at $DIR/equal_true.rs:+1:8: +1:17
- let mut _3: bool; // in scope 0 at $DIR/equal_true.rs:+1:8: +1:9
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/equal_true.rs:+1:8: +1:17
- StorageLive(_3); // scope 0 at $DIR/equal_true.rs:+1:8: +1:9
- _3 = _1; // scope 0 at $DIR/equal_true.rs:+1:8: +1:9
-- _2 = Eq(move _3, const true); // scope 0 at $DIR/equal_true.rs:+1:8: +1:17
-+ _2 = move _3; // scope 0 at $DIR/equal_true.rs:+1:8: +1:17
- StorageDead(_3); // scope 0 at $DIR/equal_true.rs:+1:16: +1:17
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/equal_true.rs:+1:8: +1:17
- }
-
- bb1: {
- _0 = const 0_i32; // scope 0 at $DIR/equal_true.rs:+1:20: +1:21
- goto -> bb3; // scope 0 at $DIR/equal_true.rs:+1:5: +1:34
- }
-
- bb2: {
- _0 = const 1_i32; // scope 0 at $DIR/equal_true.rs:+1:31: +1:32
- goto -> bb3; // scope 0 at $DIR/equal_true.rs:+1:5: +1:34
- }
-
- bb3: {
- StorageDead(_2); // scope 0 at $DIR/equal_true.rs:+1:33: +1:34
- return; // scope 0 at $DIR/equal_true.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/equal_true.rs b/tests/mir-opt/equal_true.rs
deleted file mode 100644
index fbb5d8d37..000000000
--- a/tests/mir-opt/equal_true.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// unit-test InstSimplify
-
-// EMIT_MIR equal_true.opt.InstSimplify.diff
-
-fn opt(x: bool) -> i32 {
- if x == true { 0 } else { 1 }
-}
-
-fn main() {
- opt(true);
-}
diff --git a/tests/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir b/tests/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir
index ab9550499..596dcef85 100644
--- a/tests/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir
@@ -1,83 +1,83 @@
// MIR for `match_tuple` after SimplifyCfg-initial
fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 {
- debug x => _1; // in scope 0 at $DIR/exponential_or.rs:+0:16: +0:17
- let mut _0: u32; // return place in scope 0 at $DIR/exponential_or.rs:+0:53: +0:56
- let mut _2: isize; // in scope 0 at $DIR/exponential_or.rs:+2:37: +2:48
- let mut _3: bool; // in scope 0 at $DIR/exponential_or.rs:+2:70: +2:77
- let mut _4: bool; // in scope 0 at $DIR/exponential_or.rs:+2:70: +2:77
- let mut _5: bool; // in scope 0 at $DIR/exponential_or.rs:+2:62: +2:67
- let mut _6: bool; // in scope 0 at $DIR/exponential_or.rs:+2:62: +2:67
- let _7: u32; // in scope 0 at $DIR/exponential_or.rs:+2:10: +2:11
- let _8: u32; // in scope 0 at $DIR/exponential_or.rs:+2:57: +2:58
- let mut _9: u32; // in scope 0 at $DIR/exponential_or.rs:+2:83: +2:84
- let mut _10: u32; // in scope 0 at $DIR/exponential_or.rs:+2:87: +2:88
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: isize;
+ let mut _3: bool;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: bool;
+ let _7: u32;
+ let _8: u32;
+ let mut _9: u32;
+ let mut _10: u32;
scope 1 {
- debug y => _7; // in scope 1 at $DIR/exponential_or.rs:+2:10: +2:11
- debug z => _8; // in scope 1 at $DIR/exponential_or.rs:+2:57: +2:58
+ debug y => _7;
+ debug z => _8;
}
bb0: {
- FakeRead(ForMatchedPlace(None), _1); // scope 0 at $DIR/exponential_or.rs:+1:11: +1:12
- switchInt((_1.0: u32)) -> [1: bb2, 4: bb2, otherwise: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:15: +2:20
+ PlaceMention(_1);
+ switchInt((_1.0: u32)) -> [1: bb2, 4: bb2, otherwise: bb1];
}
bb1: {
- _0 = const 0_u32; // scope 0 at $DIR/exponential_or.rs:+3:14: +3:15
- goto -> bb10; // scope 0 at $DIR/exponential_or.rs:+3:14: +3:15
+ _0 = const 0_u32;
+ goto -> bb10;
}
bb2: {
- _2 = discriminant((_1.2: std::option::Option<i32>)); // scope 0 at $DIR/exponential_or.rs:+2:37: +2:55
- switchInt(move _2) -> [0: bb4, 1: bb3, otherwise: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:37: +2:55
+ _2 = discriminant((_1.2: std::option::Option<i32>));
+ switchInt(move _2) -> [0: bb4, 1: bb3, otherwise: bb1];
}
bb3: {
- switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1: bb4, 8: bb4, otherwise: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:37: +2:55
+ switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1: bb4, 8: bb4, otherwise: bb1];
}
bb4: {
- _5 = Le(const 6_u32, (_1.3: u32)); // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67
- switchInt(move _5) -> [0: bb6, otherwise: bb5]; // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67
+ _5 = Le(const 6_u32, (_1.3: u32));
+ switchInt(move _5) -> [0: bb5, otherwise: bb7];
}
bb5: {
- _6 = Le((_1.3: u32), const 9_u32); // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67
- switchInt(move _6) -> [0: bb6, otherwise: bb8]; // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67
+ _3 = Le(const 13_u32, (_1.3: u32));
+ switchInt(move _3) -> [0: bb1, otherwise: bb6];
}
bb6: {
- _3 = Le(const 13_u32, (_1.3: u32)); // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77
- switchInt(move _3) -> [0: bb1, otherwise: bb7]; // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77
+ _4 = Le((_1.3: u32), const 16_u32);
+ switchInt(move _4) -> [0: bb1, otherwise: bb8];
}
bb7: {
- _4 = Le((_1.3: u32), const 16_u32); // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77
- switchInt(move _4) -> [0: bb1, otherwise: bb8]; // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77
+ _6 = Le((_1.3: u32), const 9_u32);
+ switchInt(move _6) -> [0: bb5, otherwise: bb8];
}
bb8: {
- falseEdge -> [real: bb9, imaginary: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:9: +2:79
+ falseEdge -> [real: bb9, imaginary: bb1];
}
bb9: {
- StorageLive(_7); // scope 0 at $DIR/exponential_or.rs:+2:10: +2:11
- _7 = (_1.0: u32); // scope 0 at $DIR/exponential_or.rs:+2:10: +2:11
- StorageLive(_8); // scope 0 at $DIR/exponential_or.rs:+2:57: +2:58
- _8 = (_1.3: u32); // scope 0 at $DIR/exponential_or.rs:+2:57: +2:58
- StorageLive(_9); // scope 1 at $DIR/exponential_or.rs:+2:83: +2:84
- _9 = _7; // scope 1 at $DIR/exponential_or.rs:+2:83: +2:84
- StorageLive(_10); // scope 1 at $DIR/exponential_or.rs:+2:87: +2:88
- _10 = _8; // scope 1 at $DIR/exponential_or.rs:+2:87: +2:88
- _0 = BitXor(move _9, move _10); // scope 1 at $DIR/exponential_or.rs:+2:83: +2:88
- StorageDead(_10); // scope 1 at $DIR/exponential_or.rs:+2:87: +2:88
- StorageDead(_9); // scope 1 at $DIR/exponential_or.rs:+2:87: +2:88
- StorageDead(_8); // scope 0 at $DIR/exponential_or.rs:+2:87: +2:88
- StorageDead(_7); // scope 0 at $DIR/exponential_or.rs:+2:87: +2:88
- goto -> bb10; // scope 0 at $DIR/exponential_or.rs:+2:87: +2:88
+ StorageLive(_7);
+ _7 = (_1.0: u32);
+ StorageLive(_8);
+ _8 = (_1.3: u32);
+ StorageLive(_9);
+ _9 = _7;
+ StorageLive(_10);
+ _10 = _8;
+ _0 = BitXor(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ goto -> bb10;
}
bb10: {
- return; // scope 0 at $DIR/exponential_or.rs:+5:2: +5:2
+ return;
}
}
diff --git a/tests/mir-opt/exponential_or.rs b/tests/mir-opt/exponential_or.rs
index 0b8be8385..89963b9bd 100644
--- a/tests/mir-opt/exponential_or.rs
+++ b/tests/mir-opt/exponential_or.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that simple or-patterns don't get expanded to exponentially large CFGs
// EMIT_MIR exponential_or.match_tuple.SimplifyCfg-initial.after.mir
diff --git a/tests/mir-opt/fn_ptr_shim.core.ops-function-Fn-call.AddMovesForPackedDrops.before.mir b/tests/mir-opt/fn_ptr_shim.core.ops-function-Fn-call.AddMovesForPackedDrops.before.mir
index c63433d36..5fddfd494 100644
--- a/tests/mir-opt/fn_ptr_shim.core.ops-function-Fn-call.AddMovesForPackedDrops.before.mir
+++ b/tests/mir-opt/fn_ptr_shim.core.ops-function-Fn-call.AddMovesForPackedDrops.before.mir
@@ -1,13 +1,13 @@
// MIR for `std::ops::Fn::call` before AddMovesForPackedDrops
-fn std::ops::Fn::call(_1: *const fn(), _2: ()) -> <fn() as FnOnce<()>>::Output {
- let mut _0: <fn() as std::ops::FnOnce<()>>::Output; // return place in scope 0 at $SRC_DIR/core/src/ops/function.rs:+0:5: +0:67
+fn std::ops::Fn::call(_1: &fn(), _2: ()) -> <fn() as FnOnce<()>>::Output {
+ let mut _0: <fn() as std::ops::FnOnce<()>>::Output;
bb0: {
- _0 = move (*_1)() -> bb1; // scope 0 at $SRC_DIR/core/src/ops/function.rs:+0:5: +0:67
+ _0 = move (*_1)() -> [return: bb1, unwind continue];
}
bb1: {
- return; // scope 0 at $SRC_DIR/core/src/ops/function.rs:+0:5: +0:67
+ return;
}
}
diff --git a/tests/mir-opt/fn_ptr_shim.rs b/tests/mir-opt/fn_ptr_shim.rs
index 64fbdc9de..c82260bae 100644
--- a/tests/mir-opt/fn_ptr_shim.rs
+++ b/tests/mir-opt/fn_ptr_shim.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Zmir-opt-level=0
// Tests that the `<fn() as Fn>` shim does not create a `Call` terminator with a `Self` callee
diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff
deleted file mode 100644
index 8a4a16825..000000000
--- a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff
+++ /dev/null
@@ -1,129 +0,0 @@
-- // MIR for `float_to_exponential_common` before ConstProp
-+ // MIR for `float_to_exponential_common` after ConstProp
-
- fn float_to_exponential_common(_1: &mut Formatter<'_>, _2: &T, _3: bool) -> Result<(), std::fmt::Error> {
- debug fmt => _1; // in scope 0 at $DIR/funky_arms.rs:+0:35: +0:38
- debug num => _2; // in scope 0 at $DIR/funky_arms.rs:+0:60: +0:63
- debug upper => _3; // in scope 0 at $DIR/funky_arms.rs:+0:69: +0:74
- let mut _0: std::result::Result<(), std::fmt::Error>; // return place in scope 0 at $DIR/funky_arms.rs:+0:85: +0:91
- let _4: bool; // in scope 0 at $DIR/funky_arms.rs:+4:9: +4:19
- let mut _5: &std::fmt::Formatter<'_>; // in scope 0 at $DIR/funky_arms.rs:+4:22: +4:37
- let mut _7: std::option::Option<usize>; // in scope 0 at $DIR/funky_arms.rs:+13:30: +13:45
- let mut _8: &std::fmt::Formatter<'_>; // in scope 0 at $DIR/funky_arms.rs:+13:30: +13:45
- let mut _9: isize; // in scope 0 at $DIR/funky_arms.rs:+13:12: +13:27
- let mut _11: &mut std::fmt::Formatter<'_>; // in scope 0 at $DIR/funky_arms.rs:+15:43: +15:46
- let mut _12: &T; // in scope 0 at $DIR/funky_arms.rs:+15:48: +15:51
- let mut _13: core::num::flt2dec::Sign; // in scope 0 at $DIR/funky_arms.rs:+15:53: +15:57
- let mut _14: u32; // in scope 0 at $DIR/funky_arms.rs:+15:59: +15:79
- let mut _15: u32; // in scope 0 at $DIR/funky_arms.rs:+15:59: +15:75
- let mut _16: usize; // in scope 0 at $DIR/funky_arms.rs:+15:59: +15:68
- let mut _17: bool; // in scope 0 at $DIR/funky_arms.rs:+15:81: +15:86
- let mut _18: &mut std::fmt::Formatter<'_>; // in scope 0 at $DIR/funky_arms.rs:+17:46: +17:49
- let mut _19: &T; // in scope 0 at $DIR/funky_arms.rs:+17:51: +17:54
- let mut _20: core::num::flt2dec::Sign; // in scope 0 at $DIR/funky_arms.rs:+17:56: +17:60
- let mut _21: bool; // in scope 0 at $DIR/funky_arms.rs:+17:62: +17:67
- scope 1 {
- debug force_sign => _4; // in scope 1 at $DIR/funky_arms.rs:+4:9: +4:19
- let _6: core::num::flt2dec::Sign; // in scope 1 at $DIR/funky_arms.rs:+8:9: +8:13
- scope 2 {
- debug sign => _6; // in scope 2 at $DIR/funky_arms.rs:+8:9: +8:13
- scope 3 {
- debug precision => _10; // in scope 3 at $DIR/funky_arms.rs:+13:17: +13:26
- let _10: usize; // in scope 3 at $DIR/funky_arms.rs:+13:17: +13:26
- }
- }
- }
-
- bb0: {
- StorageLive(_4); // scope 0 at $DIR/funky_arms.rs:+4:9: +4:19
- StorageLive(_5); // scope 0 at $DIR/funky_arms.rs:+4:22: +4:37
- _5 = &(*_1); // scope 0 at $DIR/funky_arms.rs:+4:22: +4:37
- _4 = Formatter::<'_>::sign_plus(move _5) -> bb1; // scope 0 at $DIR/funky_arms.rs:+4:22: +4:37
- // mir::Constant
- // + span: $DIR/funky_arms.rs:16:26: 16:35
- // + literal: Const { ty: for<'a> fn(&'a Formatter<'_>) -> bool {Formatter::<'_>::sign_plus}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_5); // scope 0 at $DIR/funky_arms.rs:+4:36: +4:37
- StorageLive(_6); // scope 1 at $DIR/funky_arms.rs:+8:9: +8:13
- switchInt(_4) -> [0: bb3, otherwise: bb2]; // scope 1 at $DIR/funky_arms.rs:+8:16: +8:32
- }
-
- bb2: {
-- _6 = MinusPlus; // scope 1 at $DIR/funky_arms.rs:+10:17: +10:41
-+ _6 = const MinusPlus; // scope 1 at $DIR/funky_arms.rs:+10:17: +10:41
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: Sign, val: Value(Scalar(0x01)) }
- goto -> bb4; // scope 1 at $DIR/funky_arms.rs:+10:17: +10:41
- }
-
- bb3: {
-- _6 = Minus; // scope 1 at $DIR/funky_arms.rs:+9:18: +9:38
-+ _6 = const Minus; // scope 1 at $DIR/funky_arms.rs:+9:18: +9:38
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: Sign, val: Value(Scalar(0x00)) }
- goto -> bb4; // scope 1 at $DIR/funky_arms.rs:+9:18: +9:38
- }
-
- bb4: {
- StorageLive(_7); // scope 3 at $DIR/funky_arms.rs:+13:30: +13:45
- StorageLive(_8); // scope 3 at $DIR/funky_arms.rs:+13:30: +13:45
- _8 = &(*_1); // scope 3 at $DIR/funky_arms.rs:+13:30: +13:45
- _7 = Formatter::<'_>::precision(move _8) -> bb5; // scope 3 at $DIR/funky_arms.rs:+13:30: +13:45
- // mir::Constant
- // + span: $DIR/funky_arms.rs:25:34: 25:43
- // + literal: Const { ty: for<'a> fn(&'a Formatter<'_>) -> Option<usize> {Formatter::<'_>::precision}, val: Value(<ZST>) }
- }
-
- bb5: {
- StorageDead(_8); // scope 3 at $DIR/funky_arms.rs:+13:44: +13:45
- _9 = discriminant(_7); // scope 3 at $DIR/funky_arms.rs:+13:12: +13:27
- switchInt(move _9) -> [1: bb6, otherwise: bb8]; // scope 3 at $DIR/funky_arms.rs:+13:12: +13:27
- }
-
- bb6: {
- _10 = ((_7 as Some).0: usize); // scope 3 at $DIR/funky_arms.rs:+13:17: +13:26
- StorageLive(_13); // scope 3 at $DIR/funky_arms.rs:+15:53: +15:57
- _13 = _6; // scope 3 at $DIR/funky_arms.rs:+15:53: +15:57
- StorageLive(_14); // scope 3 at $DIR/funky_arms.rs:+15:59: +15:79
- StorageLive(_15); // scope 3 at $DIR/funky_arms.rs:+15:59: +15:75
- _15 = _10 as u32 (IntToInt); // scope 3 at $DIR/funky_arms.rs:+15:59: +15:75
- _14 = Add(move _15, const 1_u32); // scope 3 at $DIR/funky_arms.rs:+15:59: +15:79
- StorageDead(_15); // scope 3 at $DIR/funky_arms.rs:+15:78: +15:79
- _0 = float_to_exponential_common_exact::<T>(_1, _2, move _13, move _14, _3) -> bb7; // scope 3 at $DIR/funky_arms.rs:+15:9: +15:87
- // mir::Constant
- // + span: $DIR/funky_arms.rs:27:9: 27:42
- // + literal: Const { ty: for<'a, 'b, 'c> fn(&'a mut Formatter<'b>, &'c T, Sign, u32, bool) -> Result<(), std::fmt::Error> {float_to_exponential_common_exact::<T>}, val: Value(<ZST>) }
- }
-
- bb7: {
- StorageDead(_14); // scope 3 at $DIR/funky_arms.rs:+15:86: +15:87
- StorageDead(_13); // scope 3 at $DIR/funky_arms.rs:+15:86: +15:87
- goto -> bb10; // scope 2 at $DIR/funky_arms.rs:+13:5: +18:6
- }
-
- bb8: {
- StorageLive(_20); // scope 2 at $DIR/funky_arms.rs:+17:56: +17:60
- _20 = _6; // scope 2 at $DIR/funky_arms.rs:+17:56: +17:60
- _0 = float_to_exponential_common_shortest::<T>(_1, _2, move _20, _3) -> bb9; // scope 2 at $DIR/funky_arms.rs:+17:9: +17:68
- // mir::Constant
- // + span: $DIR/funky_arms.rs:29:9: 29:45
- // + literal: Const { ty: for<'a, 'b, 'c> fn(&'a mut Formatter<'b>, &'c T, Sign, bool) -> Result<(), std::fmt::Error> {float_to_exponential_common_shortest::<T>}, val: Value(<ZST>) }
- }
-
- bb9: {
- StorageDead(_20); // scope 2 at $DIR/funky_arms.rs:+17:67: +17:68
- goto -> bb10; // scope 2 at $DIR/funky_arms.rs:+13:5: +18:6
- }
-
- bb10: {
- StorageDead(_6); // scope 1 at $DIR/funky_arms.rs:+19:1: +19:2
- StorageDead(_4); // scope 0 at $DIR/funky_arms.rs:+19:1: +19:2
- StorageDead(_7); // scope 0 at $DIR/funky_arms.rs:+19:1: +19:2
- return; // scope 0 at $DIR/funky_arms.rs:+19:2: +19:2
- }
- }
-
diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..298a60848
--- /dev/null
+++ b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff
@@ -0,0 +1,111 @@
+- // MIR for `float_to_exponential_common` before ConstProp
++ // MIR for `float_to_exponential_common` after ConstProp
+
+ fn float_to_exponential_common(_1: &mut Formatter<'_>, _2: &T, _3: bool) -> Result<(), std::fmt::Error> {
+ debug fmt => _1;
+ debug num => _2;
+ debug upper => _3;
+ let mut _0: std::result::Result<(), std::fmt::Error>;
+ let _4: bool;
+ let mut _6: std::option::Option<usize>;
+ let mut _7: isize;
+ let mut _9: &mut std::fmt::Formatter<'_>;
+ let mut _10: &T;
+ let mut _11: core::num::flt2dec::Sign;
+ let mut _12: u32;
+ let mut _13: u32;
+ let mut _14: usize;
+ let mut _15: bool;
+ let mut _16: &mut std::fmt::Formatter<'_>;
+ let mut _17: &T;
+ let mut _18: core::num::flt2dec::Sign;
+ let mut _19: bool;
+ scope 1 {
+ debug force_sign => _4;
+ let _5: core::num::flt2dec::Sign;
+ scope 2 {
+ debug sign => _5;
+ scope 3 {
+ debug precision => _8;
+ let _8: usize;
+ scope 5 (inlined Formatter::<'_>::precision) {
+ debug self => _1;
+ }
+ }
+ }
+ }
+ scope 4 (inlined Formatter::<'_>::sign_plus) {
+ debug self => _1;
+ let mut _20: u32;
+ let mut _21: u32;
+ }
+
+ bb0: {
+ StorageLive(_4);
+ StorageLive(_20);
+ StorageLive(_21);
+ _21 = ((*_1).0: u32);
+ _20 = BitAnd(move _21, const 1_u32);
+ StorageDead(_21);
+ _4 = Ne(move _20, const 0_u32);
+ StorageDead(_20);
+ StorageLive(_5);
+ switchInt(_4) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+- _5 = MinusPlus;
++ _5 = const MinusPlus;
+ goto -> bb3;
+ }
+
+ bb2: {
+- _5 = Minus;
++ _5 = const Minus;
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageLive(_6);
+ _6 = ((*_1).4: std::option::Option<usize>);
+ _7 = discriminant(_6);
+ switchInt(move _7) -> [1: bb4, otherwise: bb6];
+ }
+
+ bb4: {
+ _8 = ((_6 as Some).0: usize);
+ StorageLive(_11);
+ _11 = _5;
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = _8 as u32 (IntToInt);
+ _12 = Add(move _13, const 1_u32);
+ StorageDead(_13);
+ _0 = float_to_exponential_common_exact::<T>(_1, _2, move _11, move _12, _3) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_12);
+ StorageDead(_11);
+ goto -> bb8;
+ }
+
+ bb6: {
+ StorageLive(_18);
+ _18 = _5;
+ _0 = float_to_exponential_common_shortest::<T>(_1, _2, move _18, _3) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ StorageDead(_18);
+ goto -> bb8;
+ }
+
+ bb8: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_6);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff
new file mode 100644
index 000000000..037f4f7cf
--- /dev/null
+++ b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff
@@ -0,0 +1,111 @@
+- // MIR for `float_to_exponential_common` before ConstProp
++ // MIR for `float_to_exponential_common` after ConstProp
+
+ fn float_to_exponential_common(_1: &mut Formatter<'_>, _2: &T, _3: bool) -> Result<(), std::fmt::Error> {
+ debug fmt => _1;
+ debug num => _2;
+ debug upper => _3;
+ let mut _0: std::result::Result<(), std::fmt::Error>;
+ let _4: bool;
+ let mut _6: std::option::Option<usize>;
+ let mut _7: isize;
+ let mut _9: &mut std::fmt::Formatter<'_>;
+ let mut _10: &T;
+ let mut _11: core::num::flt2dec::Sign;
+ let mut _12: u32;
+ let mut _13: u32;
+ let mut _14: usize;
+ let mut _15: bool;
+ let mut _16: &mut std::fmt::Formatter<'_>;
+ let mut _17: &T;
+ let mut _18: core::num::flt2dec::Sign;
+ let mut _19: bool;
+ scope 1 {
+ debug force_sign => _4;
+ let _5: core::num::flt2dec::Sign;
+ scope 2 {
+ debug sign => _5;
+ scope 3 {
+ debug precision => _8;
+ let _8: usize;
+ scope 5 (inlined Formatter::<'_>::precision) {
+ debug self => _1;
+ }
+ }
+ }
+ }
+ scope 4 (inlined Formatter::<'_>::sign_plus) {
+ debug self => _1;
+ let mut _20: u32;
+ let mut _21: u32;
+ }
+
+ bb0: {
+ StorageLive(_4);
+ StorageLive(_20);
+ StorageLive(_21);
+ _21 = ((*_1).0: u32);
+ _20 = BitAnd(move _21, const 1_u32);
+ StorageDead(_21);
+ _4 = Ne(move _20, const 0_u32);
+ StorageDead(_20);
+ StorageLive(_5);
+ switchInt(_4) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+- _5 = MinusPlus;
++ _5 = const MinusPlus;
+ goto -> bb3;
+ }
+
+ bb2: {
+- _5 = Minus;
++ _5 = const Minus;
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageLive(_6);
+ _6 = ((*_1).4: std::option::Option<usize>);
+ _7 = discriminant(_6);
+ switchInt(move _7) -> [1: bb4, otherwise: bb6];
+ }
+
+ bb4: {
+ _8 = ((_6 as Some).0: usize);
+ StorageLive(_11);
+ _11 = _5;
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = _8 as u32 (IntToInt);
+ _12 = Add(move _13, const 1_u32);
+ StorageDead(_13);
+ _0 = float_to_exponential_common_exact::<T>(_1, _2, move _11, move _12, _3) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_12);
+ StorageDead(_11);
+ goto -> bb8;
+ }
+
+ bb6: {
+ StorageLive(_18);
+ _18 = _5;
+ _0 = float_to_exponential_common_shortest::<T>(_1, _2, move _18, _3) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ StorageDead(_18);
+ goto -> bb8;
+ }
+
+ bb8: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_6);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/funky_arms.rs b/tests/mir-opt/funky_arms.rs
index c4f75b5df..14aad0399 100644
--- a/tests/mir-opt/funky_arms.rs
+++ b/tests/mir-opt/funky_arms.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: --crate-type lib -Cdebug-assertions=no
#![feature(flt2dec)]
@@ -9,7 +10,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.mir b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir
deleted file mode 100644
index afe518642..000000000
--- a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir
+++ /dev/null
@@ -1,91 +0,0 @@
-// MIR for `main::{closure#0}` 0 generator_drop
-/* generator_layout = GeneratorLayout {
- field_tys: {
- _0: GeneratorSavedTy {
- ty: std::string::String,
- source_info: SourceInfo {
- span: $DIR/generator_drop_cleanup.rs:11:13: 11:15 (#0),
- scope: scope[0],
- },
- ignore_for_traits: false,
- },
- },
- variant_fields: {
- Unresumed(0): [],
- Returned (1): [],
- Panicked (2): [],
- Suspend0 (3): [_0],
- },
- storage_conflicts: BitMatrix(1x1) {
- (_0, _0),
- },
-} */
-
-fn main::{closure#0}(_1: *mut [generator@$DIR/generator_drop_cleanup.rs:10:15: 10:17]) -> () {
- let mut _0: (); // return place in scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
- let mut _2: (); // in scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
- let _3: std::string::String; // in scope 0 at $DIR/generator_drop_cleanup.rs:+1:13: +1:15
- let _4: (); // in scope 0 at $DIR/generator_drop_cleanup.rs:+2:9: +2:14
- let mut _5: (); // in scope 0 at $DIR/generator_drop_cleanup.rs:+2:9: +2:14
- let mut _6: (); // in scope 0 at $DIR/generator_drop_cleanup.rs:+0:18: +0:18
- let mut _7: (); // in scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
- let mut _8: u32; // in scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
- scope 1 {
- debug _s => (((*_1) as variant#3).0: std::string::String); // in scope 1 at $DIR/generator_drop_cleanup.rs:+1:13: +1:15
- }
-
- bb0: {
- _8 = discriminant((*_1)); // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
- switchInt(move _8) -> [0: bb7, 3: bb10, otherwise: bb11]; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
- }
-
- bb1: {
- StorageDead(_5); // scope 1 at $DIR/generator_drop_cleanup.rs:+2:13: +2:14
- StorageDead(_4); // scope 1 at $DIR/generator_drop_cleanup.rs:+2:14: +2:15
- drop((((*_1) as variant#3).0: std::string::String)) -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/generator_drop_cleanup.rs:+3:5: +3:6
- }
-
- bb2: {
- nop; // scope 0 at $DIR/generator_drop_cleanup.rs:+3:5: +3:6
- goto -> bb8; // scope 0 at $DIR/generator_drop_cleanup.rs:+3:5: +3:6
- }
-
- bb3: {
- return; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
- }
-
- bb4 (cleanup): {
- resume; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
- }
-
- bb5 (cleanup): {
- nop; // scope 0 at $DIR/generator_drop_cleanup.rs:+3:5: +3:6
- goto -> bb4; // scope 0 at $DIR/generator_drop_cleanup.rs:+3:5: +3:6
- }
-
- bb6: {
- return; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
- }
-
- bb7: {
- goto -> bb9; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
- }
-
- bb8: {
- goto -> bb3; // scope 0 at $DIR/generator_drop_cleanup.rs:+3:5: +3:6
- }
-
- bb9: {
- goto -> bb6; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
- }
-
- bb10: {
- StorageLive(_4); // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
- StorageLive(_5); // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
- goto -> bb1; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
- }
-
- bb11: {
- return; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6
- }
-}
diff --git a/tests/mir-opt/generator_drop_cleanup.rs b/tests/mir-opt/generator_drop_cleanup.rs
deleted file mode 100644
index 82c1292cb..000000000
--- a/tests/mir-opt/generator_drop_cleanup.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-#![feature(generators, generator_trait)]
-
-// ignore-wasm32-bare compiled with panic=abort by default
-
-// Regression test for #58892, generator drop shims should not have blocks
-// spuriously marked as cleanup
-
-// EMIT_MIR generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir
-fn main() {
- let gen = || {
- let _s = String::new();
- yield;
- };
-}
diff --git a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir
deleted file mode 100644
index 32b472ebe..000000000
--- a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir
+++ /dev/null
@@ -1,124 +0,0 @@
-// MIR for `main::{closure#0}` before StateTransform
-
-fn main::{closure#0}(_1: [generator@$DIR/generator_storage_dead_unwind.rs:22:16: 22:18], _2: ()) -> ()
-yields ()
- {
- let mut _0: (); // return place in scope 0 at $DIR/generator_storage_dead_unwind.rs:+0:19: +0:19
- let _3: Foo; // in scope 0 at $DIR/generator_storage_dead_unwind.rs:+1:13: +1:14
- let _5: (); // in scope 0 at $DIR/generator_storage_dead_unwind.rs:+3:9: +3:14
- let mut _6: (); // in scope 0 at $DIR/generator_storage_dead_unwind.rs:+3:9: +3:14
- let _7: (); // in scope 0 at $DIR/generator_storage_dead_unwind.rs:+4:9: +4:16
- let mut _8: Foo; // in scope 0 at $DIR/generator_storage_dead_unwind.rs:+4:14: +4:15
- let _9: (); // in scope 0 at $DIR/generator_storage_dead_unwind.rs:+5:9: +5:16
- let mut _10: Bar; // in scope 0 at $DIR/generator_storage_dead_unwind.rs:+5:14: +5:15
- scope 1 {
- debug a => _3; // in scope 1 at $DIR/generator_storage_dead_unwind.rs:+1:13: +1:14
- let _4: Bar; // in scope 1 at $DIR/generator_storage_dead_unwind.rs:+2:13: +2:14
- scope 2 {
- debug b => _4; // in scope 2 at $DIR/generator_storage_dead_unwind.rs:+2:13: +2:14
- }
- }
-
- bb0: {
- StorageLive(_3); // scope 0 at $DIR/generator_storage_dead_unwind.rs:+1:13: +1:14
- _3 = Foo(const 5_i32); // scope 0 at $DIR/generator_storage_dead_unwind.rs:+1:17: +1:23
- StorageLive(_4); // scope 1 at $DIR/generator_storage_dead_unwind.rs:+2:13: +2:14
- _4 = Bar(const 6_i32); // scope 1 at $DIR/generator_storage_dead_unwind.rs:+2:17: +2:23
- StorageLive(_5); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:9: +3:14
- StorageLive(_6); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:9: +3:14
- _6 = (); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:9: +3:14
- _5 = yield(move _6) -> [resume: bb1, drop: bb6]; // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:9: +3:14
- }
-
- bb1: {
- StorageDead(_6); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:13: +3:14
- StorageDead(_5); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:14: +3:15
- StorageLive(_7); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+4:9: +4:16
- StorageLive(_8); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+4:14: +4:15
- _8 = move _3; // scope 2 at $DIR/generator_storage_dead_unwind.rs:+4:14: +4:15
- _7 = take::<Foo>(move _8) -> [return: bb2, unwind: bb10]; // scope 2 at $DIR/generator_storage_dead_unwind.rs:+4:9: +4:16
- // mir::Constant
- // + span: $DIR/generator_storage_dead_unwind.rs:26:9: 26:13
- // + literal: Const { ty: fn(Foo) {take::<Foo>}, val: Value(<ZST>) }
- }
-
- bb2: {
- StorageDead(_8); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+4:15: +4:16
- StorageDead(_7); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+4:16: +4:17
- StorageLive(_9); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+5:9: +5:16
- StorageLive(_10); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+5:14: +5:15
- _10 = move _4; // scope 2 at $DIR/generator_storage_dead_unwind.rs:+5:14: +5:15
- _9 = take::<Bar>(move _10) -> [return: bb3, unwind: bb9]; // scope 2 at $DIR/generator_storage_dead_unwind.rs:+5:9: +5:16
- // mir::Constant
- // + span: $DIR/generator_storage_dead_unwind.rs:27:9: 27:13
- // + literal: Const { ty: fn(Bar) {take::<Bar>}, val: Value(<ZST>) }
- }
-
- bb3: {
- StorageDead(_10); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+5:15: +5:16
- StorageDead(_9); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+5:16: +5:17
- _0 = const (); // scope 0 at $DIR/generator_storage_dead_unwind.rs:+0:19: +6:6
- StorageDead(_4); // scope 1 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6
- goto -> bb4; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6
- }
-
- bb4: {
- StorageDead(_3); // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6
- drop(_1) -> [return: bb5, unwind: bb14]; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6
- }
-
- bb5: {
- return; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:6: +6:6
- }
-
- bb6: {
- StorageDead(_6); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:13: +3:14
- StorageDead(_5); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+3:14: +3:15
- StorageDead(_4); // scope 1 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6
- drop(_3) -> [return: bb7, unwind: bb15]; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6
- }
-
- bb7: {
- StorageDead(_3); // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6
- drop(_1) -> [return: bb8, unwind: bb14]; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6
- }
-
- bb8: {
- generator_drop; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+0:16: +6:6
- }
-
- bb9 (cleanup): {
- StorageDead(_10); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+5:15: +5:16
- StorageDead(_9); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+5:16: +5:17
- goto -> bb12; // scope 2 at no-location
- }
-
- bb10 (cleanup): {
- goto -> bb11; // scope 2 at $DIR/generator_storage_dead_unwind.rs:+4:15: +4:16
- }
-
- bb11 (cleanup): {
- StorageDead(_8); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+4:15: +4:16
- StorageDead(_7); // scope 2 at $DIR/generator_storage_dead_unwind.rs:+4:16: +4:17
- goto -> bb12; // scope 2 at no-location
- }
-
- bb12 (cleanup): {
- StorageDead(_4); // scope 1 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6
- goto -> bb13; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6
- }
-
- bb13 (cleanup): {
- StorageDead(_3); // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6
- drop(_1) -> [return: bb14, unwind terminate]; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6
- }
-
- bb14 (cleanup): {
- resume; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+0:16: +6:6
- }
-
- bb15 (cleanup): {
- StorageDead(_3); // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6
- drop(_1) -> [return: bb14, unwind terminate]; // scope 0 at $DIR/generator_storage_dead_unwind.rs:+6:5: +6:6
- }
-}
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
deleted file mode 100644
index dc9bb533f..000000000
--- a/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir
+++ /dev/null
@@ -1,89 +0,0 @@
-// MIR for `main::{closure#0}` 0 generator_resume
-/* generator_layout = GeneratorLayout {
- field_tys: {
- _0: GeneratorSavedTy {
- ty: HasDrop,
- source_info: SourceInfo {
- span: $DIR/generator_tiny.rs:20:13: 20:15 (#0),
- scope: scope[0],
- },
- ignore_for_traits: false,
- },
- },
- variant_fields: {
- Unresumed(0): [],
- Returned (1): [],
- Panicked (2): [],
- Suspend0 (3): [_0],
- },
- storage_conflicts: BitMatrix(1x1) {
- (_0, _0),
- },
-} */
-
-fn main::{closure#0}(_1: Pin<&mut [generator@$DIR/generator_tiny.rs:19:16: 19:24]>, _2: u8) -> GeneratorState<(), ()> {
- debug _x => _10; // in scope 0 at $DIR/generator_tiny.rs:+0:17: +0:19
- let mut _0: std::ops::GeneratorState<(), ()>; // return place in scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6
- let _3: HasDrop; // in scope 0 at $DIR/generator_tiny.rs:+1:13: +1:15
- let mut _4: !; // in scope 0 at $DIR/generator_tiny.rs:+2:9: +5:10
- let mut _5: (); // in scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6
- let _6: u8; // in scope 0 at $DIR/generator_tiny.rs:+3:13: +3:18
- let mut _7: (); // in scope 0 at $DIR/generator_tiny.rs:+3:13: +3:18
- let _8: (); // in scope 0 at $DIR/generator_tiny.rs:+4:13: +4:21
- let mut _9: (); // in scope 0 at $DIR/generator_tiny.rs:+0:25: +0:25
- let _10: u8; // in scope 0 at $DIR/generator_tiny.rs:+0:17: +0:19
- let mut _11: u32; // in scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6
- scope 1 {
- debug _d => (((*(_1.0: &mut [generator@$DIR/generator_tiny.rs:19:16: 19:24])) as variant#3).0: HasDrop); // in scope 1 at $DIR/generator_tiny.rs:+1:13: +1:15
- }
-
- bb0: {
- _11 = discriminant((*(_1.0: &mut [generator@$DIR/generator_tiny.rs:19:16: 19:24]))); // scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6
- switchInt(move _11) -> [0: bb1, 3: bb5, otherwise: bb6]; // scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6
- }
-
- bb1: {
- _10 = move _2; // scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6
- nop; // scope 0 at $DIR/generator_tiny.rs:+1:13: +1:15
- (((*(_1.0: &mut [generator@$DIR/generator_tiny.rs:19:16: 19:24])) as variant#3).0: HasDrop) = HasDrop; // scope 0 at $DIR/generator_tiny.rs:+1:18: +1:25
- StorageLive(_4); // scope 1 at $DIR/generator_tiny.rs:+2:9: +5:10
- goto -> bb2; // scope 1 at $DIR/generator_tiny.rs:+2:9: +5:10
- }
-
- bb2: {
- StorageLive(_6); // scope 1 at $DIR/generator_tiny.rs:+3:13: +3:18
- StorageLive(_7); // scope 1 at $DIR/generator_tiny.rs:+3:13: +3:18
- _7 = (); // scope 1 at $DIR/generator_tiny.rs:+3:13: +3:18
- _0 = GeneratorState::<(), ()>::Yielded(move _7); // scope 1 at $DIR/generator_tiny.rs:+3:13: +3:18
- discriminant((*(_1.0: &mut [generator@$DIR/generator_tiny.rs:19:16: 19:24]))) = 3; // scope 1 at $DIR/generator_tiny.rs:+3:13: +3:18
- return; // scope 1 at $DIR/generator_tiny.rs:+3:13: +3:18
- }
-
- bb3: {
- StorageDead(_7); // scope 1 at $DIR/generator_tiny.rs:+3:17: +3:18
- StorageDead(_6); // scope 1 at $DIR/generator_tiny.rs:+3:18: +3:19
- StorageLive(_8); // scope 1 at $DIR/generator_tiny.rs:+4:13: +4:21
- _8 = callee() -> [return: bb4, unwind unreachable]; // scope 1 at $DIR/generator_tiny.rs:+4:13: +4:21
- // mir::Constant
- // + span: $DIR/generator_tiny.rs:23:13: 23:19
- // + literal: Const { ty: fn() {callee}, val: Value(<ZST>) }
- }
-
- bb4: {
- StorageDead(_8); // scope 1 at $DIR/generator_tiny.rs:+4:21: +4:22
- _5 = const (); // scope 1 at $DIR/generator_tiny.rs:+2:14: +5:10
- goto -> bb2; // scope 1 at $DIR/generator_tiny.rs:+2:9: +5:10
- }
-
- bb5: {
- StorageLive(_4); // scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6
- StorageLive(_6); // scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6
- StorageLive(_7); // scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6
- _6 = move _2; // scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6
- goto -> bb3; // scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6
- }
-
- bb6: {
- unreachable; // scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6
- }
-}
diff --git a/tests/mir-opt/graphviz.rs b/tests/mir-opt/graphviz.rs
index 6906b86c2..61b5a2fb3 100644
--- a/tests/mir-opt/graphviz.rs
+++ b/tests/mir-opt/graphviz.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test graphviz output
// compile-flags: -Z dump-mir-graphviz
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..d524ad242
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff
@@ -0,0 +1,349 @@
+- // 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);
++ _3 = Add(_1, const 0_u64);
+ StorageDead(_4);
+ _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);
++ _6 = Sub(_1, const 0_u64);
+ StorageDead(_7);
+ _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);
++ _9 = Mul(_1, const 0_u64);
+ StorageDead(_10);
+ _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);
++ _12 = Mul(_1, const 1_u64);
+ StorageDead(_13);
+ _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];
++ _17 = const true;
++ assert(!const true, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind unreachable];
+ }
+
+ bb5: {
+- _15 = Div(move _16, const 0_u64);
++ _15 = Div(_1, const 0_u64);
+ StorageDead(_16);
+ _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];
++ _21 = const false;
++ assert(!const false, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind unreachable];
+ }
+
+ bb7: {
+- _19 = Div(move _20, const 1_u64);
++ _19 = Div(_1, const 1_u64);
+ StorageDead(_20);
+ _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);
++ _23 = Div(const 0_u64, _1);
+ StorageDead(_24);
+ _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];
++ _29 = _25;
++ assert(!_25, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind unreachable];
+ }
+
+ bb11: {
+- _27 = Div(const 1_u64, move _28);
++ _27 = Div(const 1_u64, _1);
+ StorageDead(_28);
+ _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];
++ _33 = const true;
++ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind unreachable];
+ }
+
+ bb13: {
+- _31 = Rem(move _32, const 0_u64);
++ _31 = Rem(_1, const 0_u64);
+ StorageDead(_32);
+ _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];
++ _37 = const false;
++ assert(!const false, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind unreachable];
+ }
+
+ bb15: {
+- _35 = Rem(move _36, const 1_u64);
++ _35 = Rem(_1, const 1_u64);
+ StorageDead(_36);
+ _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];
++ _41 = _25;
++ 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);
++ _39 = Rem(const 0_u64, _1);
+ StorageDead(_40);
+ _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];
++ _45 = _25;
++ 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);
++ _43 = Rem(const 1_u64, _1);
+ StorageDead(_44);
+ _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);
++ _47 = BitAnd(_1, const 0_u64);
+ StorageDead(_48);
+ _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);
++ _50 = BitOr(_1, const 0_u64);
+ StorageDead(_51);
+ _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);
++ _53 = BitXor(_1, const 0_u64);
+ StorageDead(_54);
+ _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);
++ _56 = Shr(_1, const 0_i32);
+ StorageDead(_57);
+ _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);
++ _59 = Shl(_1, const 0_i32);
+ StorageDead(_60);
+ _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..9d6935393
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff
@@ -0,0 +1,349 @@
+- // 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);
++ _3 = Add(_1, const 0_u64);
+ StorageDead(_4);
+ _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);
++ _6 = Sub(_1, const 0_u64);
+ StorageDead(_7);
+ _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);
++ _9 = Mul(_1, const 0_u64);
+ StorageDead(_10);
+ _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);
++ _12 = Mul(_1, const 1_u64);
+ StorageDead(_13);
+ _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];
++ _17 = const true;
++ assert(!const true, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind continue];
+ }
+
+ bb5: {
+- _15 = Div(move _16, const 0_u64);
++ _15 = Div(_1, const 0_u64);
+ StorageDead(_16);
+ _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];
++ _21 = const false;
++ assert(!const false, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind continue];
+ }
+
+ bb7: {
+- _19 = Div(move _20, const 1_u64);
++ _19 = Div(_1, const 1_u64);
+ StorageDead(_20);
+ _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);
++ _23 = Div(const 0_u64, _1);
+ StorageDead(_24);
+ _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];
++ _29 = _25;
++ assert(!_25, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind continue];
+ }
+
+ bb11: {
+- _27 = Div(const 1_u64, move _28);
++ _27 = Div(const 1_u64, _1);
+ StorageDead(_28);
+ _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];
++ _33 = const true;
++ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind continue];
+ }
+
+ bb13: {
+- _31 = Rem(move _32, const 0_u64);
++ _31 = Rem(_1, const 0_u64);
+ StorageDead(_32);
+ _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];
++ _37 = const false;
++ assert(!const false, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind continue];
+ }
+
+ bb15: {
+- _35 = Rem(move _36, const 1_u64);
++ _35 = Rem(_1, const 1_u64);
+ StorageDead(_36);
+ _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];
++ _41 = _25;
++ 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);
++ _39 = Rem(const 0_u64, _1);
+ StorageDead(_40);
+ _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];
++ _45 = _25;
++ 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);
++ _43 = Rem(const 1_u64, _1);
+ StorageDead(_44);
+ _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);
++ _47 = BitAnd(_1, const 0_u64);
+ StorageDead(_48);
+ _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);
++ _50 = BitOr(_1, const 0_u64);
+ StorageDead(_51);
+ _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);
++ _53 = BitXor(_1, const 0_u64);
+ StorageDead(_54);
+ _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);
++ _56 = Shr(_1, const 0_i32);
+ StorageDead(_57);
+ _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);
++ _59 = Shl(_1, const 0_i32);
+ StorageDead(_60);
+ _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..6633df3ae
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff
@@ -0,0 +1,105 @@
+- // 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);
+
+ 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);
+ _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..d100a77fe
--- /dev/null
+++ b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff
@@ -0,0 +1,105 @@
+- // 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);
+
+ 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);
+ _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..b332100ea
--- /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);
++ _3 = Add(_1, const 0f64);
+ StorageDead(_4);
+ _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);
++ _6 = Sub(_1, const 0f64);
+ StorageDead(_7);
+ _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);
++ _9 = Mul(_1, const 0f64);
+ StorageDead(_10);
+ _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);
++ _12 = Div(_1, const 0f64);
+ StorageDead(_13);
+ _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);
++ _15 = Div(const 0f64, _1);
+ StorageDead(_16);
+ _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);
++ _18 = Rem(_1, const 0f64);
+ StorageDead(_19);
+ _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);
++ _21 = Rem(const 0f64, _1);
+ StorageDead(_22);
+ _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);
++ _24 = Eq(_1, _1);
+ StorageDead(_26);
+ StorageDead(_25);
+ _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);
++ _28 = Ne(_1, _1);
+ StorageDead(_30);
+ StorageDead(_29);
+ _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..28664cb0a
--- /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);
++ _3 = Add(_1, const 0f64);
+ StorageDead(_4);
+ _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);
++ _6 = Sub(_1, const 0f64);
+ StorageDead(_7);
+ _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);
++ _9 = Mul(_1, const 0f64);
+ StorageDead(_10);
+ _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);
++ _12 = Div(_1, const 0f64);
+ StorageDead(_13);
+ _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);
++ _15 = Div(const 0f64, _1);
+ StorageDead(_16);
+ _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);
++ _18 = Rem(_1, const 0f64);
+ StorageDead(_19);
+ _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);
++ _21 = Rem(const 0f64, _1);
+ StorageDead(_22);
+ _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);
++ _24 = Eq(_1, _1);
+ StorageDead(_26);
+ StorageDead(_25);
+ _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);
++ _28 = Ne(_1, _1);
+ StorageDead(_30);
+ StorageDead(_29);
+ _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..d43198c99
--- /dev/null
+++ b/tests/mir-opt/gvn.cast.GVN.panic-abort.diff
@@ -0,0 +1,564 @@
+- // 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);
++ nop;
+ _1 = const 1_i64;
+- StorageLive(_2);
++ nop;
+ _2 = const 1_u64;
+- StorageLive(_3);
++ nop;
+ _3 = const 1f64;
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = _1;
+- _5 = move _6 as u8 (IntToInt);
++ _6 = const 1_i64;
++ _5 = const 1_u8;
+ StorageDead(_6);
+- _4 = opaque::<u8>(move _5) -> [return: bb1, unwind unreachable];
++ _4 = opaque::<u8>(const 1_u8) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+- _9 = _1;
+- _8 = move _9 as u16 (IntToInt);
++ _9 = const 1_i64;
++ _8 = const 1_u16;
+ StorageDead(_9);
+- _7 = opaque::<u16>(move _8) -> [return: bb2, unwind unreachable];
++ _7 = opaque::<u16>(const 1_u16) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+- _12 = _1;
+- _11 = move _12 as u32 (IntToInt);
++ _12 = const 1_i64;
++ _11 = const 1_u32;
+ StorageDead(_12);
+- _10 = opaque::<u32>(move _11) -> [return: bb3, unwind unreachable];
++ _10 = opaque::<u32>(const 1_u32) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_13);
+ StorageLive(_14);
+ StorageLive(_15);
+- _15 = _1;
+- _14 = move _15 as u64 (IntToInt);
++ _15 = const 1_i64;
++ _14 = const 1_u64;
+ StorageDead(_15);
+- _13 = opaque::<u64>(move _14) -> [return: bb4, unwind unreachable];
++ _13 = opaque::<u64>(const 1_u64) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageLive(_16);
+ StorageLive(_17);
+ StorageLive(_18);
+- _18 = _1;
+- _17 = move _18 as i8 (IntToInt);
++ _18 = const 1_i64;
++ _17 = const 1_i8;
+ StorageDead(_18);
+- _16 = opaque::<i8>(move _17) -> [return: bb5, unwind unreachable];
++ _16 = opaque::<i8>(const 1_i8) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_19);
+ StorageLive(_20);
+ StorageLive(_21);
+- _21 = _1;
+- _20 = move _21 as i16 (IntToInt);
++ _21 = const 1_i64;
++ _20 = const 1_i16;
+ StorageDead(_21);
+- _19 = opaque::<i16>(move _20) -> [return: bb6, unwind unreachable];
++ _19 = opaque::<i16>(const 1_i16) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_20);
+ StorageDead(_19);
+ StorageLive(_22);
+ StorageLive(_23);
+ StorageLive(_24);
+- _24 = _1;
+- _23 = move _24 as i32 (IntToInt);
++ _24 = const 1_i64;
++ _23 = const 1_i32;
+ StorageDead(_24);
+- _22 = opaque::<i32>(move _23) -> [return: bb7, unwind unreachable];
++ _22 = opaque::<i32>(const 1_i32) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_25);
+ StorageLive(_26);
+- _26 = _1;
+- _25 = opaque::<i64>(move _26) -> [return: bb8, unwind unreachable];
++ _26 = const 1_i64;
++ _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);
++ _29 = const 1_i64;
++ _28 = const 1f32;
+ StorageDead(_29);
+- _27 = opaque::<f32>(move _28) -> [return: bb9, unwind unreachable];
++ _27 = opaque::<f32>(const 1f32) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageLive(_30);
+ StorageLive(_31);
+ StorageLive(_32);
+- _32 = _1;
+- _31 = move _32 as f64 (IntToFloat);
++ _32 = const 1_i64;
++ _31 = const 1f64;
+ StorageDead(_32);
+- _30 = opaque::<f64>(move _31) -> [return: bb10, unwind unreachable];
++ _30 = opaque::<f64>(const 1f64) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_33);
+ StorageLive(_34);
+ StorageLive(_35);
+- _35 = _2;
+- _34 = move _35 as u8 (IntToInt);
++ _35 = const 1_u64;
++ _34 = const 1_u8;
+ StorageDead(_35);
+- _33 = opaque::<u8>(move _34) -> [return: bb11, unwind unreachable];
++ _33 = opaque::<u8>(const 1_u8) -> [return: bb11, unwind unreachable];
+ }
+
+ bb11: {
+ StorageDead(_34);
+ StorageDead(_33);
+ StorageLive(_36);
+ StorageLive(_37);
+ StorageLive(_38);
+- _38 = _2;
+- _37 = move _38 as u16 (IntToInt);
++ _38 = const 1_u64;
++ _37 = const 1_u16;
+ StorageDead(_38);
+- _36 = opaque::<u16>(move _37) -> [return: bb12, unwind unreachable];
++ _36 = opaque::<u16>(const 1_u16) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+ StorageDead(_37);
+ StorageDead(_36);
+ StorageLive(_39);
+ StorageLive(_40);
+ StorageLive(_41);
+- _41 = _2;
+- _40 = move _41 as u32 (IntToInt);
++ _41 = const 1_u64;
++ _40 = const 1_u32;
+ StorageDead(_41);
+- _39 = opaque::<u32>(move _40) -> [return: bb13, unwind unreachable];
++ _39 = opaque::<u32>(const 1_u32) -> [return: bb13, unwind unreachable];
+ }
+
+ bb13: {
+ StorageDead(_40);
+ StorageDead(_39);
+ StorageLive(_42);
+ StorageLive(_43);
+- _43 = _2;
+- _42 = opaque::<u64>(move _43) -> [return: bb14, unwind unreachable];
++ _43 = const 1_u64;
++ _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);
++ _46 = const 1_u64;
++ _45 = const 1_i8;
+ StorageDead(_46);
+- _44 = opaque::<i8>(move _45) -> [return: bb15, unwind unreachable];
++ _44 = opaque::<i8>(const 1_i8) -> [return: bb15, unwind unreachable];
+ }
+
+ bb15: {
+ StorageDead(_45);
+ StorageDead(_44);
+ StorageLive(_47);
+ StorageLive(_48);
+ StorageLive(_49);
+- _49 = _2;
+- _48 = move _49 as i16 (IntToInt);
++ _49 = const 1_u64;
++ _48 = const 1_i16;
+ StorageDead(_49);
+- _47 = opaque::<i16>(move _48) -> [return: bb16, unwind unreachable];
++ _47 = opaque::<i16>(const 1_i16) -> [return: bb16, unwind unreachable];
+ }
+
+ bb16: {
+ StorageDead(_48);
+ StorageDead(_47);
+ StorageLive(_50);
+ StorageLive(_51);
+ StorageLive(_52);
+- _52 = _2;
+- _51 = move _52 as i32 (IntToInt);
++ _52 = const 1_u64;
++ _51 = const 1_i32;
+ StorageDead(_52);
+- _50 = opaque::<i32>(move _51) -> [return: bb17, unwind unreachable];
++ _50 = opaque::<i32>(const 1_i32) -> [return: bb17, unwind unreachable];
+ }
+
+ bb17: {
+ StorageDead(_51);
+ StorageDead(_50);
+ StorageLive(_53);
+ StorageLive(_54);
+ StorageLive(_55);
+- _55 = _2;
+- _54 = move _55 as i64 (IntToInt);
++ _55 = const 1_u64;
++ _54 = const 1_i64;
+ StorageDead(_55);
+- _53 = opaque::<i64>(move _54) -> [return: bb18, unwind unreachable];
++ _53 = opaque::<i64>(const 1_i64) -> [return: bb18, unwind unreachable];
+ }
+
+ bb18: {
+ StorageDead(_54);
+ StorageDead(_53);
+ StorageLive(_56);
+ StorageLive(_57);
+ StorageLive(_58);
+- _58 = _2;
+- _57 = move _58 as f32 (IntToFloat);
++ _58 = const 1_u64;
++ _57 = const 1f32;
+ StorageDead(_58);
+- _56 = opaque::<f32>(move _57) -> [return: bb19, unwind unreachable];
++ _56 = opaque::<f32>(const 1f32) -> [return: bb19, unwind unreachable];
+ }
+
+ bb19: {
+ StorageDead(_57);
+ StorageDead(_56);
+ StorageLive(_59);
+ StorageLive(_60);
+ StorageLive(_61);
+- _61 = _2;
+- _60 = move _61 as f64 (IntToFloat);
++ _61 = const 1_u64;
++ _60 = const 1f64;
+ StorageDead(_61);
+- _59 = opaque::<f64>(move _60) -> [return: bb20, unwind unreachable];
++ _59 = opaque::<f64>(const 1f64) -> [return: bb20, unwind unreachable];
+ }
+
+ bb20: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_62);
+ StorageLive(_63);
+ StorageLive(_64);
+- _64 = _3;
+- _63 = move _64 as u8 (FloatToInt);
++ _64 = const 1f64;
++ _63 = const 1_u8;
+ StorageDead(_64);
+- _62 = opaque::<u8>(move _63) -> [return: bb21, unwind unreachable];
++ _62 = opaque::<u8>(const 1_u8) -> [return: bb21, unwind unreachable];
+ }
+
+ bb21: {
+ StorageDead(_63);
+ StorageDead(_62);
+ StorageLive(_65);
+ StorageLive(_66);
+ StorageLive(_67);
+- _67 = _3;
+- _66 = move _67 as u16 (FloatToInt);
++ _67 = const 1f64;
++ _66 = const 1_u16;
+ StorageDead(_67);
+- _65 = opaque::<u16>(move _66) -> [return: bb22, unwind unreachable];
++ _65 = opaque::<u16>(const 1_u16) -> [return: bb22, unwind unreachable];
+ }
+
+ bb22: {
+ StorageDead(_66);
+ StorageDead(_65);
+ StorageLive(_68);
+ StorageLive(_69);
+ StorageLive(_70);
+- _70 = _3;
+- _69 = move _70 as u32 (FloatToInt);
++ _70 = const 1f64;
++ _69 = const 1_u32;
+ StorageDead(_70);
+- _68 = opaque::<u32>(move _69) -> [return: bb23, unwind unreachable];
++ _68 = opaque::<u32>(const 1_u32) -> [return: bb23, unwind unreachable];
+ }
+
+ bb23: {
+ StorageDead(_69);
+ StorageDead(_68);
+ StorageLive(_71);
+ StorageLive(_72);
+ StorageLive(_73);
+- _73 = _3;
+- _72 = move _73 as u64 (FloatToInt);
++ _73 = const 1f64;
++ _72 = const 1_u64;
+ StorageDead(_73);
+- _71 = opaque::<u64>(move _72) -> [return: bb24, unwind unreachable];
++ _71 = opaque::<u64>(const 1_u64) -> [return: bb24, unwind unreachable];
+ }
+
+ bb24: {
+ StorageDead(_72);
+ StorageDead(_71);
+ StorageLive(_74);
+ StorageLive(_75);
+ StorageLive(_76);
+- _76 = _3;
+- _75 = move _76 as i8 (FloatToInt);
++ _76 = const 1f64;
++ _75 = const 1_i8;
+ StorageDead(_76);
+- _74 = opaque::<i8>(move _75) -> [return: bb25, unwind unreachable];
++ _74 = opaque::<i8>(const 1_i8) -> [return: bb25, unwind unreachable];
+ }
+
+ bb25: {
+ StorageDead(_75);
+ StorageDead(_74);
+ StorageLive(_77);
+ StorageLive(_78);
+ StorageLive(_79);
+- _79 = _3;
+- _78 = move _79 as i16 (FloatToInt);
++ _79 = const 1f64;
++ _78 = const 1_i16;
+ StorageDead(_79);
+- _77 = opaque::<i16>(move _78) -> [return: bb26, unwind unreachable];
++ _77 = opaque::<i16>(const 1_i16) -> [return: bb26, unwind unreachable];
+ }
+
+ bb26: {
+ StorageDead(_78);
+ StorageDead(_77);
+ StorageLive(_80);
+ StorageLive(_81);
+ StorageLive(_82);
+- _82 = _3;
+- _81 = move _82 as i32 (FloatToInt);
++ _82 = const 1f64;
++ _81 = const 1_i32;
+ StorageDead(_82);
+- _80 = opaque::<i32>(move _81) -> [return: bb27, unwind unreachable];
++ _80 = opaque::<i32>(const 1_i32) -> [return: bb27, unwind unreachable];
+ }
+
+ bb27: {
+ StorageDead(_81);
+ StorageDead(_80);
+ StorageLive(_83);
+ StorageLive(_84);
+ StorageLive(_85);
+- _85 = _3;
+- _84 = move _85 as i64 (FloatToInt);
++ _85 = const 1f64;
++ _84 = const 1_i64;
+ StorageDead(_85);
+- _83 = opaque::<i64>(move _84) -> [return: bb28, unwind unreachable];
++ _83 = opaque::<i64>(const 1_i64) -> [return: bb28, unwind unreachable];
+ }
+
+ bb28: {
+ StorageDead(_84);
+ StorageDead(_83);
+ StorageLive(_86);
+ StorageLive(_87);
+ StorageLive(_88);
+- _88 = _3;
+- _87 = move _88 as f32 (FloatToFloat);
++ _88 = const 1f64;
++ _87 = const 1f32;
+ StorageDead(_88);
+- _86 = opaque::<f32>(move _87) -> [return: bb29, unwind unreachable];
++ _86 = opaque::<f32>(const 1f32) -> [return: bb29, unwind unreachable];
+ }
+
+ bb29: {
+ StorageDead(_87);
+ StorageDead(_86);
+ StorageLive(_89);
+ StorageLive(_90);
+- _90 = _3;
+- _89 = opaque::<f64>(move _90) -> [return: bb30, unwind unreachable];
++ _90 = const 1f64;
++ _89 = opaque::<f64>(const 1f64) -> [return: bb30, unwind unreachable];
+ }
+
+ bb30: {
+ StorageDead(_90);
+ StorageDead(_89);
+ _0 = const ();
+- StorageDead(_3);
+- StorageDead(_2);
+- StorageDead(_1);
++ nop;
++ nop;
++ nop;
+ 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..08b97e13a
--- /dev/null
+++ b/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff
@@ -0,0 +1,564 @@
+- // 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);
++ nop;
+ _1 = const 1_i64;
+- StorageLive(_2);
++ nop;
+ _2 = const 1_u64;
+- StorageLive(_3);
++ nop;
+ _3 = const 1f64;
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = _1;
+- _5 = move _6 as u8 (IntToInt);
++ _6 = const 1_i64;
++ _5 = const 1_u8;
+ StorageDead(_6);
+- _4 = opaque::<u8>(move _5) -> [return: bb1, unwind continue];
++ _4 = opaque::<u8>(const 1_u8) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+- _9 = _1;
+- _8 = move _9 as u16 (IntToInt);
++ _9 = const 1_i64;
++ _8 = const 1_u16;
+ StorageDead(_9);
+- _7 = opaque::<u16>(move _8) -> [return: bb2, unwind continue];
++ _7 = opaque::<u16>(const 1_u16) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+- _12 = _1;
+- _11 = move _12 as u32 (IntToInt);
++ _12 = const 1_i64;
++ _11 = const 1_u32;
+ StorageDead(_12);
+- _10 = opaque::<u32>(move _11) -> [return: bb3, unwind continue];
++ _10 = opaque::<u32>(const 1_u32) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_13);
+ StorageLive(_14);
+ StorageLive(_15);
+- _15 = _1;
+- _14 = move _15 as u64 (IntToInt);
++ _15 = const 1_i64;
++ _14 = const 1_u64;
+ StorageDead(_15);
+- _13 = opaque::<u64>(move _14) -> [return: bb4, unwind continue];
++ _13 = opaque::<u64>(const 1_u64) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageLive(_16);
+ StorageLive(_17);
+ StorageLive(_18);
+- _18 = _1;
+- _17 = move _18 as i8 (IntToInt);
++ _18 = const 1_i64;
++ _17 = const 1_i8;
+ StorageDead(_18);
+- _16 = opaque::<i8>(move _17) -> [return: bb5, unwind continue];
++ _16 = opaque::<i8>(const 1_i8) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_19);
+ StorageLive(_20);
+ StorageLive(_21);
+- _21 = _1;
+- _20 = move _21 as i16 (IntToInt);
++ _21 = const 1_i64;
++ _20 = const 1_i16;
+ StorageDead(_21);
+- _19 = opaque::<i16>(move _20) -> [return: bb6, unwind continue];
++ _19 = opaque::<i16>(const 1_i16) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_20);
+ StorageDead(_19);
+ StorageLive(_22);
+ StorageLive(_23);
+ StorageLive(_24);
+- _24 = _1;
+- _23 = move _24 as i32 (IntToInt);
++ _24 = const 1_i64;
++ _23 = const 1_i32;
+ StorageDead(_24);
+- _22 = opaque::<i32>(move _23) -> [return: bb7, unwind continue];
++ _22 = opaque::<i32>(const 1_i32) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_25);
+ StorageLive(_26);
+- _26 = _1;
+- _25 = opaque::<i64>(move _26) -> [return: bb8, unwind continue];
++ _26 = const 1_i64;
++ _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);
++ _29 = const 1_i64;
++ _28 = const 1f32;
+ StorageDead(_29);
+- _27 = opaque::<f32>(move _28) -> [return: bb9, unwind continue];
++ _27 = opaque::<f32>(const 1f32) -> [return: bb9, unwind continue];
+ }
+
+ bb9: {
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageLive(_30);
+ StorageLive(_31);
+ StorageLive(_32);
+- _32 = _1;
+- _31 = move _32 as f64 (IntToFloat);
++ _32 = const 1_i64;
++ _31 = const 1f64;
+ StorageDead(_32);
+- _30 = opaque::<f64>(move _31) -> [return: bb10, unwind continue];
++ _30 = opaque::<f64>(const 1f64) -> [return: bb10, unwind continue];
+ }
+
+ bb10: {
+ StorageDead(_31);
+ StorageDead(_30);
+ StorageLive(_33);
+ StorageLive(_34);
+ StorageLive(_35);
+- _35 = _2;
+- _34 = move _35 as u8 (IntToInt);
++ _35 = const 1_u64;
++ _34 = const 1_u8;
+ StorageDead(_35);
+- _33 = opaque::<u8>(move _34) -> [return: bb11, unwind continue];
++ _33 = opaque::<u8>(const 1_u8) -> [return: bb11, unwind continue];
+ }
+
+ bb11: {
+ StorageDead(_34);
+ StorageDead(_33);
+ StorageLive(_36);
+ StorageLive(_37);
+ StorageLive(_38);
+- _38 = _2;
+- _37 = move _38 as u16 (IntToInt);
++ _38 = const 1_u64;
++ _37 = const 1_u16;
+ StorageDead(_38);
+- _36 = opaque::<u16>(move _37) -> [return: bb12, unwind continue];
++ _36 = opaque::<u16>(const 1_u16) -> [return: bb12, unwind continue];
+ }
+
+ bb12: {
+ StorageDead(_37);
+ StorageDead(_36);
+ StorageLive(_39);
+ StorageLive(_40);
+ StorageLive(_41);
+- _41 = _2;
+- _40 = move _41 as u32 (IntToInt);
++ _41 = const 1_u64;
++ _40 = const 1_u32;
+ StorageDead(_41);
+- _39 = opaque::<u32>(move _40) -> [return: bb13, unwind continue];
++ _39 = opaque::<u32>(const 1_u32) -> [return: bb13, unwind continue];
+ }
+
+ bb13: {
+ StorageDead(_40);
+ StorageDead(_39);
+ StorageLive(_42);
+ StorageLive(_43);
+- _43 = _2;
+- _42 = opaque::<u64>(move _43) -> [return: bb14, unwind continue];
++ _43 = const 1_u64;
++ _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);
++ _46 = const 1_u64;
++ _45 = const 1_i8;
+ StorageDead(_46);
+- _44 = opaque::<i8>(move _45) -> [return: bb15, unwind continue];
++ _44 = opaque::<i8>(const 1_i8) -> [return: bb15, unwind continue];
+ }
+
+ bb15: {
+ StorageDead(_45);
+ StorageDead(_44);
+ StorageLive(_47);
+ StorageLive(_48);
+ StorageLive(_49);
+- _49 = _2;
+- _48 = move _49 as i16 (IntToInt);
++ _49 = const 1_u64;
++ _48 = const 1_i16;
+ StorageDead(_49);
+- _47 = opaque::<i16>(move _48) -> [return: bb16, unwind continue];
++ _47 = opaque::<i16>(const 1_i16) -> [return: bb16, unwind continue];
+ }
+
+ bb16: {
+ StorageDead(_48);
+ StorageDead(_47);
+ StorageLive(_50);
+ StorageLive(_51);
+ StorageLive(_52);
+- _52 = _2;
+- _51 = move _52 as i32 (IntToInt);
++ _52 = const 1_u64;
++ _51 = const 1_i32;
+ StorageDead(_52);
+- _50 = opaque::<i32>(move _51) -> [return: bb17, unwind continue];
++ _50 = opaque::<i32>(const 1_i32) -> [return: bb17, unwind continue];
+ }
+
+ bb17: {
+ StorageDead(_51);
+ StorageDead(_50);
+ StorageLive(_53);
+ StorageLive(_54);
+ StorageLive(_55);
+- _55 = _2;
+- _54 = move _55 as i64 (IntToInt);
++ _55 = const 1_u64;
++ _54 = const 1_i64;
+ StorageDead(_55);
+- _53 = opaque::<i64>(move _54) -> [return: bb18, unwind continue];
++ _53 = opaque::<i64>(const 1_i64) -> [return: bb18, unwind continue];
+ }
+
+ bb18: {
+ StorageDead(_54);
+ StorageDead(_53);
+ StorageLive(_56);
+ StorageLive(_57);
+ StorageLive(_58);
+- _58 = _2;
+- _57 = move _58 as f32 (IntToFloat);
++ _58 = const 1_u64;
++ _57 = const 1f32;
+ StorageDead(_58);
+- _56 = opaque::<f32>(move _57) -> [return: bb19, unwind continue];
++ _56 = opaque::<f32>(const 1f32) -> [return: bb19, unwind continue];
+ }
+
+ bb19: {
+ StorageDead(_57);
+ StorageDead(_56);
+ StorageLive(_59);
+ StorageLive(_60);
+ StorageLive(_61);
+- _61 = _2;
+- _60 = move _61 as f64 (IntToFloat);
++ _61 = const 1_u64;
++ _60 = const 1f64;
+ StorageDead(_61);
+- _59 = opaque::<f64>(move _60) -> [return: bb20, unwind continue];
++ _59 = opaque::<f64>(const 1f64) -> [return: bb20, unwind continue];
+ }
+
+ bb20: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_62);
+ StorageLive(_63);
+ StorageLive(_64);
+- _64 = _3;
+- _63 = move _64 as u8 (FloatToInt);
++ _64 = const 1f64;
++ _63 = const 1_u8;
+ StorageDead(_64);
+- _62 = opaque::<u8>(move _63) -> [return: bb21, unwind continue];
++ _62 = opaque::<u8>(const 1_u8) -> [return: bb21, unwind continue];
+ }
+
+ bb21: {
+ StorageDead(_63);
+ StorageDead(_62);
+ StorageLive(_65);
+ StorageLive(_66);
+ StorageLive(_67);
+- _67 = _3;
+- _66 = move _67 as u16 (FloatToInt);
++ _67 = const 1f64;
++ _66 = const 1_u16;
+ StorageDead(_67);
+- _65 = opaque::<u16>(move _66) -> [return: bb22, unwind continue];
++ _65 = opaque::<u16>(const 1_u16) -> [return: bb22, unwind continue];
+ }
+
+ bb22: {
+ StorageDead(_66);
+ StorageDead(_65);
+ StorageLive(_68);
+ StorageLive(_69);
+ StorageLive(_70);
+- _70 = _3;
+- _69 = move _70 as u32 (FloatToInt);
++ _70 = const 1f64;
++ _69 = const 1_u32;
+ StorageDead(_70);
+- _68 = opaque::<u32>(move _69) -> [return: bb23, unwind continue];
++ _68 = opaque::<u32>(const 1_u32) -> [return: bb23, unwind continue];
+ }
+
+ bb23: {
+ StorageDead(_69);
+ StorageDead(_68);
+ StorageLive(_71);
+ StorageLive(_72);
+ StorageLive(_73);
+- _73 = _3;
+- _72 = move _73 as u64 (FloatToInt);
++ _73 = const 1f64;
++ _72 = const 1_u64;
+ StorageDead(_73);
+- _71 = opaque::<u64>(move _72) -> [return: bb24, unwind continue];
++ _71 = opaque::<u64>(const 1_u64) -> [return: bb24, unwind continue];
+ }
+
+ bb24: {
+ StorageDead(_72);
+ StorageDead(_71);
+ StorageLive(_74);
+ StorageLive(_75);
+ StorageLive(_76);
+- _76 = _3;
+- _75 = move _76 as i8 (FloatToInt);
++ _76 = const 1f64;
++ _75 = const 1_i8;
+ StorageDead(_76);
+- _74 = opaque::<i8>(move _75) -> [return: bb25, unwind continue];
++ _74 = opaque::<i8>(const 1_i8) -> [return: bb25, unwind continue];
+ }
+
+ bb25: {
+ StorageDead(_75);
+ StorageDead(_74);
+ StorageLive(_77);
+ StorageLive(_78);
+ StorageLive(_79);
+- _79 = _3;
+- _78 = move _79 as i16 (FloatToInt);
++ _79 = const 1f64;
++ _78 = const 1_i16;
+ StorageDead(_79);
+- _77 = opaque::<i16>(move _78) -> [return: bb26, unwind continue];
++ _77 = opaque::<i16>(const 1_i16) -> [return: bb26, unwind continue];
+ }
+
+ bb26: {
+ StorageDead(_78);
+ StorageDead(_77);
+ StorageLive(_80);
+ StorageLive(_81);
+ StorageLive(_82);
+- _82 = _3;
+- _81 = move _82 as i32 (FloatToInt);
++ _82 = const 1f64;
++ _81 = const 1_i32;
+ StorageDead(_82);
+- _80 = opaque::<i32>(move _81) -> [return: bb27, unwind continue];
++ _80 = opaque::<i32>(const 1_i32) -> [return: bb27, unwind continue];
+ }
+
+ bb27: {
+ StorageDead(_81);
+ StorageDead(_80);
+ StorageLive(_83);
+ StorageLive(_84);
+ StorageLive(_85);
+- _85 = _3;
+- _84 = move _85 as i64 (FloatToInt);
++ _85 = const 1f64;
++ _84 = const 1_i64;
+ StorageDead(_85);
+- _83 = opaque::<i64>(move _84) -> [return: bb28, unwind continue];
++ _83 = opaque::<i64>(const 1_i64) -> [return: bb28, unwind continue];
+ }
+
+ bb28: {
+ StorageDead(_84);
+ StorageDead(_83);
+ StorageLive(_86);
+ StorageLive(_87);
+ StorageLive(_88);
+- _88 = _3;
+- _87 = move _88 as f32 (FloatToFloat);
++ _88 = const 1f64;
++ _87 = const 1f32;
+ StorageDead(_88);
+- _86 = opaque::<f32>(move _87) -> [return: bb29, unwind continue];
++ _86 = opaque::<f32>(const 1f32) -> [return: bb29, unwind continue];
+ }
+
+ bb29: {
+ StorageDead(_87);
+ StorageDead(_86);
+ StorageLive(_89);
+ StorageLive(_90);
+- _90 = _3;
+- _89 = opaque::<f64>(move _90) -> [return: bb30, unwind continue];
++ _90 = const 1f64;
++ _89 = opaque::<f64>(const 1f64) -> [return: bb30, unwind continue];
+ }
+
+ bb30: {
+ StorageDead(_90);
+ StorageDead(_89);
+ _0 = const ();
+- StorageDead(_3);
+- StorageDead(_2);
+- StorageDead(_1);
++ nop;
++ nop;
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.comparison.GVN.panic-abort.diff b/tests/mir-opt/gvn.comparison.GVN.panic-abort.diff
new file mode 100644
index 000000000..ee3b9da21
--- /dev/null
+++ b/tests/mir-opt/gvn.comparison.GVN.panic-abort.diff
@@ -0,0 +1,94 @@
+- // MIR for `comparison` before GVN
++ // MIR for `comparison` after GVN
+
+ fn comparison(_1: u64, _2: u64) -> () {
+ debug x => _1;
+ debug y => _2;
+ let mut _0: ();
+ let _3: ();
+ let mut _4: bool;
+ let mut _5: u64;
+ let mut _6: u64;
+ let _7: ();
+ let mut _8: bool;
+ let mut _9: u64;
+ let mut _10: u64;
+ let _11: ();
+ let mut _12: bool;
+ let mut _13: u64;
+ let mut _14: u64;
+ let _15: ();
+ let mut _16: bool;
+ let mut _17: u64;
+ let mut _18: u64;
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ StorageLive(_6);
+ _6 = _1;
+- _4 = Eq(move _5, move _6);
++ _4 = Eq(_1, _1);
+ StorageDead(_6);
+ StorageDead(_5);
+ _3 = opaque::<bool>(move _4) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = _1;
+ StorageLive(_10);
+ _10 = _1;
+- _8 = Ne(move _9, move _10);
++ _8 = Ne(_1, _1);
+ StorageDead(_10);
+ StorageDead(_9);
+ _7 = opaque::<bool>(move _8) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_11);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = _1;
+ StorageLive(_14);
+ _14 = _2;
+- _12 = Eq(move _13, move _14);
++ _12 = Eq(_1, _2);
+ StorageDead(_14);
+ StorageDead(_13);
+ _11 = opaque::<bool>(move _12) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_15);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = _1;
+ StorageLive(_18);
+ _18 = _2;
+- _16 = Ne(move _17, move _18);
++ _16 = Ne(_1, _2);
+ StorageDead(_18);
+ StorageDead(_17);
+ _15 = opaque::<bool>(move _16) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_16);
+ StorageDead(_15);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.comparison.GVN.panic-unwind.diff b/tests/mir-opt/gvn.comparison.GVN.panic-unwind.diff
new file mode 100644
index 000000000..a1408fe34
--- /dev/null
+++ b/tests/mir-opt/gvn.comparison.GVN.panic-unwind.diff
@@ -0,0 +1,94 @@
+- // MIR for `comparison` before GVN
++ // MIR for `comparison` after GVN
+
+ fn comparison(_1: u64, _2: u64) -> () {
+ debug x => _1;
+ debug y => _2;
+ let mut _0: ();
+ let _3: ();
+ let mut _4: bool;
+ let mut _5: u64;
+ let mut _6: u64;
+ let _7: ();
+ let mut _8: bool;
+ let mut _9: u64;
+ let mut _10: u64;
+ let _11: ();
+ let mut _12: bool;
+ let mut _13: u64;
+ let mut _14: u64;
+ let _15: ();
+ let mut _16: bool;
+ let mut _17: u64;
+ let mut _18: u64;
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ StorageLive(_6);
+ _6 = _1;
+- _4 = Eq(move _5, move _6);
++ _4 = Eq(_1, _1);
+ StorageDead(_6);
+ StorageDead(_5);
+ _3 = opaque::<bool>(move _4) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = _1;
+ StorageLive(_10);
+ _10 = _1;
+- _8 = Ne(move _9, move _10);
++ _8 = Ne(_1, _1);
+ StorageDead(_10);
+ StorageDead(_9);
+ _7 = opaque::<bool>(move _8) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_11);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = _1;
+ StorageLive(_14);
+ _14 = _2;
+- _12 = Eq(move _13, move _14);
++ _12 = Eq(_1, _2);
+ StorageDead(_14);
+ StorageDead(_13);
+ _11 = opaque::<bool>(move _12) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_15);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = _1;
+ StorageLive(_18);
+ _18 = _2;
+- _16 = Ne(move _17, move _18);
++ _16 = Ne(_1, _2);
+ StorageDead(_18);
+ StorageDead(_17);
+ _15 = opaque::<bool>(move _16) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_16);
+ StorageDead(_15);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff
new file mode 100644
index 000000000..4b1e33791
--- /dev/null
+++ b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff
@@ -0,0 +1,104 @@
+- // MIR for `constant_index_overflow` before GVN
++ // MIR for `constant_index_overflow` after GVN
+
+ fn constant_index_overflow(_1: &[T]) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: usize;
+ let mut _4: bool;
+ let mut _5: usize;
+ let mut _6: usize;
+ let mut _7: &[T];
+ let _8: usize;
+ let mut _9: usize;
+ let mut _10: bool;
+ let _11: usize;
+ let mut _12: usize;
+ let mut _13: bool;
+ let mut _14: T;
+ scope 1 {
+ debug a => _2;
+ let _3: T;
+ scope 2 {
+ debug b => _3;
+ }
+ }
+
+ bb0: {
+- StorageLive(_2);
+- _2 = const _ as usize (IntToInt);
++ nop;
++ _2 = const usize::MAX;
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+- _5 = _2;
++ _5 = const usize::MAX;
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &(*_1);
+ _6 = core::slice::<impl [T]>::len(move _7) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_7);
+- _4 = Lt(move _5, move _6);
++ _4 = Lt(const usize::MAX, move _6);
+ switchInt(move _4) -> [0: bb4, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_8);
+- _8 = _2;
++ _8 = const usize::MAX;
+ _9 = Len((*_1));
+- _10 = Lt(_8, _9);
+- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind unreachable];
++ _10 = Lt(const usize::MAX, _9);
++ assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, const usize::MAX) -> [success: bb3, unwind unreachable];
+ }
+
+ bb3: {
+- _3 = (*_1)[_8];
++ _3 = (*_1)[_2];
+ StorageDead(_8);
+ goto -> bb6;
+ }
+
+ bb4: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_11);
+ _11 = const 0_usize;
+ _12 = Len((*_1));
+- _13 = Lt(_11, _12);
+- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb5, unwind unreachable];
++ _13 = Lt(const 0_usize, _12);
++ assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, const 0_usize) -> [success: bb5, unwind unreachable];
+ }
+
+ bb5: {
+- _3 = (*_1)[_11];
++ _3 = (*_1)[0 of 1];
+ StorageDead(_11);
+ goto -> bb6;
+ }
+
+ bb6: {
+ StorageDead(_4);
+ StorageLive(_14);
+ _14 = _3;
+ _0 = opaque::<T>(move _14) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ StorageDead(_14);
+ StorageDead(_3);
+- StorageDead(_2);
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff
new file mode 100644
index 000000000..8abcd7e93
--- /dev/null
+++ b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff
@@ -0,0 +1,104 @@
+- // MIR for `constant_index_overflow` before GVN
++ // MIR for `constant_index_overflow` after GVN
+
+ fn constant_index_overflow(_1: &[T]) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: usize;
+ let mut _4: bool;
+ let mut _5: usize;
+ let mut _6: usize;
+ let mut _7: &[T];
+ let _8: usize;
+ let mut _9: usize;
+ let mut _10: bool;
+ let _11: usize;
+ let mut _12: usize;
+ let mut _13: bool;
+ let mut _14: T;
+ scope 1 {
+ debug a => _2;
+ let _3: T;
+ scope 2 {
+ debug b => _3;
+ }
+ }
+
+ bb0: {
+- StorageLive(_2);
+- _2 = const _ as usize (IntToInt);
++ nop;
++ _2 = const usize::MAX;
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+- _5 = _2;
++ _5 = const usize::MAX;
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &(*_1);
+ _6 = core::slice::<impl [T]>::len(move _7) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_7);
+- _4 = Lt(move _5, move _6);
++ _4 = Lt(const usize::MAX, move _6);
+ switchInt(move _4) -> [0: bb4, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_8);
+- _8 = _2;
++ _8 = const usize::MAX;
+ _9 = Len((*_1));
+- _10 = Lt(_8, _9);
+- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind continue];
++ _10 = Lt(const usize::MAX, _9);
++ assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, const usize::MAX) -> [success: bb3, unwind continue];
+ }
+
+ bb3: {
+- _3 = (*_1)[_8];
++ _3 = (*_1)[_2];
+ StorageDead(_8);
+ goto -> bb6;
+ }
+
+ bb4: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_11);
+ _11 = const 0_usize;
+ _12 = Len((*_1));
+- _13 = Lt(_11, _12);
+- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb5, unwind continue];
++ _13 = Lt(const 0_usize, _12);
++ assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, const 0_usize) -> [success: bb5, unwind continue];
+ }
+
+ bb5: {
+- _3 = (*_1)[_11];
++ _3 = (*_1)[0 of 1];
+ StorageDead(_11);
+ goto -> bb6;
+ }
+
+ bb6: {
+ StorageDead(_4);
+ StorageLive(_14);
+ _14 = _3;
+ _0 = opaque::<T>(move _14) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ StorageDead(_14);
+ StorageDead(_3);
+- StorageDead(_2);
++ nop;
+ 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..a587b1e6b
--- /dev/null
+++ b/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff
@@ -0,0 +1,203 @@
+- // 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);
++ nop;
+ _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);
++ nop;
+ _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);
++ nop;
+ _18 = &(*_1);
+ StorageLive(_19);
+- StorageLive(_20);
++ nop;
+ _20 = (*_18);
+- _19 = opaque::<u32>(move _20) -> [return: bb7, unwind unreachable];
++ _19 = opaque::<u32>(_20) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+- StorageDead(_20);
++ nop;
+ StorageDead(_19);
+ StorageLive(_21);
+ StorageLive(_22);
+- _22 = (*_18);
+- _21 = opaque::<u32>(move _22) -> [return: bb8, unwind unreachable];
++ _22 = _20;
++ _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);
++ nop;
+ _30 = ((*_3).0: u32);
+- _29 = opaque::<u32>(move _30) -> [return: bb12, unwind unreachable];
++ _29 = opaque::<u32>(_30) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+- StorageDead(_30);
++ nop;
+ StorageDead(_29);
+ StorageLive(_31);
+ StorageLive(_32);
+- _32 = ((*_3).0: u32);
+- _31 = opaque::<u32>(move _32) -> [return: bb13, unwind unreachable];
++ _32 = _30;
++ _31 = opaque::<u32>(_30) -> [return: bb13, unwind unreachable];
+ }
+
+ bb13: {
+ StorageDead(_32);
+ StorageDead(_31);
+ _0 = const ();
+- StorageDead(_18);
+- StorageDead(_13);
+- StorageDead(_8);
++ nop;
++ nop;
++ nop;
+ 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..6fdda5e99
--- /dev/null
+++ b/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff
@@ -0,0 +1,203 @@
+- // 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);
++ nop;
+ _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);
++ nop;
+ _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);
++ nop;
+ _18 = &(*_1);
+ StorageLive(_19);
+- StorageLive(_20);
++ nop;
+ _20 = (*_18);
+- _19 = opaque::<u32>(move _20) -> [return: bb7, unwind continue];
++ _19 = opaque::<u32>(_20) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+- StorageDead(_20);
++ nop;
+ StorageDead(_19);
+ StorageLive(_21);
+ StorageLive(_22);
+- _22 = (*_18);
+- _21 = opaque::<u32>(move _22) -> [return: bb8, unwind continue];
++ _22 = _20;
++ _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);
++ nop;
+ _30 = ((*_3).0: u32);
+- _29 = opaque::<u32>(move _30) -> [return: bb12, unwind continue];
++ _29 = opaque::<u32>(_30) -> [return: bb12, unwind continue];
+ }
+
+ bb12: {
+- StorageDead(_30);
++ nop;
+ StorageDead(_29);
+ StorageLive(_31);
+ StorageLive(_32);
+- _32 = ((*_3).0: u32);
+- _31 = opaque::<u32>(move _32) -> [return: bb13, unwind continue];
++ _32 = _30;
++ _31 = opaque::<u32>(_30) -> [return: bb13, unwind continue];
+ }
+
+ bb13: {
+ StorageDead(_32);
+ StorageDead(_31);
+ _0 = const ();
+- StorageDead(_18);
+- StorageDead(_13);
+- StorageDead(_8);
++ nop;
++ nop;
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff
new file mode 100644
index 000000000..7ae1fae68
--- /dev/null
+++ b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff
@@ -0,0 +1,38 @@
+- // MIR for `duplicate_slice` before GVN
++ // MIR for `duplicate_slice` after GVN
+
+ fn duplicate_slice() -> (bool, bool) {
+ let mut _0: (bool, bool);
+ let mut _1: u128;
+ let mut _2: u128;
+ let mut _3: u128;
+ let mut _4: u128;
+ let mut _5: &str;
+ let mut _6: &str;
+ let mut _7: (&str,);
+ let mut _8: &str;
+ let mut _9: bool;
+ let mut _10: bool;
+
+ bb0: {
+ _7 = (const "a",);
+ _1 = (_7.0: &str) as u128 (Transmute);
+ _5 = identity::<&str>((_7.0: &str)) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _3 = _5 as u128 (Transmute);
+ _8 = const "a";
+ _2 = _8 as u128 (Transmute);
+ _6 = identity::<&str>(_8) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ _4 = _6 as u128 (Transmute);
+ _9 = Eq(_1, _2);
+ _10 = Eq(_3, _4);
+ _0 = (_9, _10);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff
new file mode 100644
index 000000000..8c96edaa2
--- /dev/null
+++ b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff
@@ -0,0 +1,38 @@
+- // MIR for `duplicate_slice` before GVN
++ // MIR for `duplicate_slice` after GVN
+
+ fn duplicate_slice() -> (bool, bool) {
+ let mut _0: (bool, bool);
+ let mut _1: u128;
+ let mut _2: u128;
+ let mut _3: u128;
+ let mut _4: u128;
+ let mut _5: &str;
+ let mut _6: &str;
+ let mut _7: (&str,);
+ let mut _8: &str;
+ let mut _9: bool;
+ let mut _10: bool;
+
+ bb0: {
+ _7 = (const "a",);
+ _1 = (_7.0: &str) as u128 (Transmute);
+ _5 = identity::<&str>((_7.0: &str)) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ _3 = _5 as u128 (Transmute);
+ _8 = const "a";
+ _2 = _8 as u128 (Transmute);
+ _6 = identity::<&str>(_8) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ _4 = _6 as u128 (Transmute);
+ _9 = Eq(_1, _2);
+ _10 = Eq(_3, _4);
+ _0 = (_9, _10);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff b/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff
new file mode 100644
index 000000000..d8248d22d
--- /dev/null
+++ b/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff
@@ -0,0 +1,118 @@
+- // MIR for `fn_pointers` before GVN
++ // MIR for `fn_pointers` after GVN
+
+ fn fn_pointers() -> () {
+ let mut _0: ();
+ let _1: fn(u8) -> u8;
+ let _2: ();
+ let mut _3: fn(u8) -> u8;
+ let _5: ();
+ let mut _6: fn(u8) -> u8;
+ let mut _9: {closure@$DIR/gvn.rs:591:19: 591:21};
+ let _10: ();
+ let mut _11: fn();
+ let mut _13: {closure@$DIR/gvn.rs:591:19: 591:21};
+ let _14: ();
+ let mut _15: fn();
+ scope 1 {
+ debug f => _1;
+ let _4: fn(u8) -> u8;
+ scope 2 {
+ debug g => _4;
+ let _7: {closure@$DIR/gvn.rs:591:19: 591:21};
+ scope 3 {
+ debug closure => _7;
+ let _8: fn();
+ scope 4 {
+ debug cf => _8;
+ let _12: fn();
+ scope 5 {
+ debug cg => _12;
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
++ nop;
+ _1 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer));
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = opaque::<fn(u8) -> u8>(move _3) -> [return: bb1, unwind unreachable];
++ _2 = opaque::<fn(u8) -> u8>(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+- StorageLive(_4);
++ nop;
+ _4 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer));
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = _4;
+- _5 = opaque::<fn(u8) -> u8>(move _6) -> [return: bb2, unwind unreachable];
++ _5 = opaque::<fn(u8) -> u8>(_4) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+- StorageLive(_7);
+- _7 = {closure@$DIR/gvn.rs:591:19: 591:21};
+- StorageLive(_8);
++ nop;
++ _7 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
++ nop;
+ StorageLive(_9);
+- _9 = _7;
+- _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Normal)));
++ _9 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
++ _8 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21} as fn() (PointerCoercion(ClosureFnPointer(Normal)));
+ StorageDead(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = _8;
+- _10 = opaque::<fn()>(move _11) -> [return: bb3, unwind unreachable];
++ _10 = opaque::<fn()>(_8) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+- StorageLive(_12);
++ nop;
+ StorageLive(_13);
+- _13 = _7;
+- _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Normal)));
++ _13 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
++ _12 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21} as fn() (PointerCoercion(ClosureFnPointer(Normal)));
+ StorageDead(_13);
+ StorageLive(_14);
+ StorageLive(_15);
+ _15 = _12;
+- _14 = opaque::<fn()>(move _15) -> [return: bb4, unwind unreachable];
++ _14 = opaque::<fn()>(_12) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_15);
+ StorageDead(_14);
+ _0 = const ();
+- StorageDead(_12);
+- StorageDead(_8);
+- StorageDead(_7);
+- StorageDead(_4);
+- StorageDead(_1);
++ nop;
++ nop;
++ nop;
++ nop;
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff b/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff
new file mode 100644
index 000000000..e38a3d852
--- /dev/null
+++ b/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff
@@ -0,0 +1,118 @@
+- // MIR for `fn_pointers` before GVN
++ // MIR for `fn_pointers` after GVN
+
+ fn fn_pointers() -> () {
+ let mut _0: ();
+ let _1: fn(u8) -> u8;
+ let _2: ();
+ let mut _3: fn(u8) -> u8;
+ let _5: ();
+ let mut _6: fn(u8) -> u8;
+ let mut _9: {closure@$DIR/gvn.rs:591:19: 591:21};
+ let _10: ();
+ let mut _11: fn();
+ let mut _13: {closure@$DIR/gvn.rs:591:19: 591:21};
+ let _14: ();
+ let mut _15: fn();
+ scope 1 {
+ debug f => _1;
+ let _4: fn(u8) -> u8;
+ scope 2 {
+ debug g => _4;
+ let _7: {closure@$DIR/gvn.rs:591:19: 591:21};
+ scope 3 {
+ debug closure => _7;
+ let _8: fn();
+ scope 4 {
+ debug cf => _8;
+ let _12: fn();
+ scope 5 {
+ debug cg => _12;
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
++ nop;
+ _1 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer));
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = opaque::<fn(u8) -> u8>(move _3) -> [return: bb1, unwind continue];
++ _2 = opaque::<fn(u8) -> u8>(_1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+- StorageLive(_4);
++ nop;
+ _4 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer));
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = _4;
+- _5 = opaque::<fn(u8) -> u8>(move _6) -> [return: bb2, unwind continue];
++ _5 = opaque::<fn(u8) -> u8>(_4) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+- StorageLive(_7);
+- _7 = {closure@$DIR/gvn.rs:591:19: 591:21};
+- StorageLive(_8);
++ nop;
++ _7 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
++ nop;
+ StorageLive(_9);
+- _9 = _7;
+- _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Normal)));
++ _9 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
++ _8 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21} as fn() (PointerCoercion(ClosureFnPointer(Normal)));
+ StorageDead(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = _8;
+- _10 = opaque::<fn()>(move _11) -> [return: bb3, unwind continue];
++ _10 = opaque::<fn()>(_8) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+- StorageLive(_12);
++ nop;
+ StorageLive(_13);
+- _13 = _7;
+- _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Normal)));
++ _13 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
++ _12 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21} as fn() (PointerCoercion(ClosureFnPointer(Normal)));
+ StorageDead(_13);
+ StorageLive(_14);
+ StorageLive(_15);
+ _15 = _12;
+- _14 = opaque::<fn()>(move _15) -> [return: bb4, unwind continue];
++ _14 = opaque::<fn()>(_12) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_15);
+ StorageDead(_14);
+ _0 = const ();
+- StorageDead(_12);
+- StorageDead(_8);
+- StorageDead(_7);
+- StorageDead(_4);
+- StorageDead(_1);
++ nop;
++ nop;
++ nop;
++ nop;
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.indirect_static.GVN.panic-abort.diff b/tests/mir-opt/gvn.indirect_static.GVN.panic-abort.diff
new file mode 100644
index 000000000..f853942bb
--- /dev/null
+++ b/tests/mir-opt/gvn.indirect_static.GVN.panic-abort.diff
@@ -0,0 +1,19 @@
+- // MIR for `indirect_static` before GVN
++ // MIR for `indirect_static` after GVN
+
+ fn indirect_static() -> () {
+ let mut _0: ();
+ let mut _1: &std::option::Option<u8>;
+ let mut _2: u8;
+
+ bb0: {
+ _1 = const {ALLOC0: &Option<u8>};
+ _2 = (((*_1) as variant#1).0: u8);
+ return;
+ }
+ }
+
+ ALLOC0 (static: A, size: 2, align: 1) {
+ 00 __ │ .░
+ }
+
diff --git a/tests/mir-opt/gvn.indirect_static.GVN.panic-unwind.diff b/tests/mir-opt/gvn.indirect_static.GVN.panic-unwind.diff
new file mode 100644
index 000000000..f853942bb
--- /dev/null
+++ b/tests/mir-opt/gvn.indirect_static.GVN.panic-unwind.diff
@@ -0,0 +1,19 @@
+- // MIR for `indirect_static` before GVN
++ // MIR for `indirect_static` after GVN
+
+ fn indirect_static() -> () {
+ let mut _0: ();
+ let mut _1: &std::option::Option<u8>;
+ let mut _2: u8;
+
+ bb0: {
+ _1 = const {ALLOC0: &Option<u8>};
+ _2 = (((*_1) as variant#1).0: u8);
+ return;
+ }
+ }
+
+ ALLOC0 (static: A, size: 2, align: 1) {
+ 00 __ │ .░
+ }
+
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..29ca1ba59
--- /dev/null
+++ b/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff
@@ -0,0 +1,208 @@
+- // 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);
++ nop;
+ StorageLive(_8);
+ _8 = _2;
+ StorageLive(_9);
+ _9 = _3;
+- _7 = Add(move _8, move _9);
++ _7 = Add(_2, _3);
+ StorageDead(_9);
+ StorageDead(_8);
+- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind unreachable];
++ _6 = opaque::<u8>(_7) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- StorageDead(_7);
++ nop;
+ StorageDead(_6);
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = _2;
+ StorageLive(_13);
+ _13 = _3;
+- _11 = Add(move _12, move _13);
++ _11 = _7;
+ 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);
++ nop;
+ StorageLive(_16);
+ _16 = _2;
+ StorageLive(_17);
+ _17 = _3;
+- _15 = Add(move _16, move _17);
++ _15 = Add(_2, _3);
+ StorageDead(_17);
+ StorageDead(_16);
+- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind unreachable];
++ _14 = opaque::<u8>(_15) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+- StorageDead(_15);
++ nop;
+ StorageDead(_14);
+ StorageLive(_18);
+ StorageLive(_19);
+ StorageLive(_20);
+ _20 = _2;
+ StorageLive(_21);
+ _21 = _3;
+- _19 = Add(move _20, move _21);
++ _19 = _15;
+ 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);
++ nop;
+ StorageLive(_24);
+ _24 = _2;
+ StorageLive(_25);
+ _25 = _3;
+- _23 = Add(move _24, move _25);
++ _23 = Add(_2, _3);
+ StorageDead(_25);
+ StorageDead(_24);
+- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind unreachable];
++ _22 = opaque::<u8>(_23) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+- StorageDead(_23);
++ nop;
+ 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);
++ _28 = _23;
+ 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);
++ _32 = _23;
+ 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..5394dc8be
--- /dev/null
+++ b/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff
@@ -0,0 +1,208 @@
+- // 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);
++ nop;
+ StorageLive(_8);
+ _8 = _2;
+ StorageLive(_9);
+ _9 = _3;
+- _7 = Add(move _8, move _9);
++ _7 = Add(_2, _3);
+ StorageDead(_9);
+ StorageDead(_8);
+- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind continue];
++ _6 = opaque::<u8>(_7) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+- StorageDead(_7);
++ nop;
+ StorageDead(_6);
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = _2;
+ StorageLive(_13);
+ _13 = _3;
+- _11 = Add(move _12, move _13);
++ _11 = _7;
+ 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);
++ nop;
+ StorageLive(_16);
+ _16 = _2;
+ StorageLive(_17);
+ _17 = _3;
+- _15 = Add(move _16, move _17);
++ _15 = Add(_2, _3);
+ StorageDead(_17);
+ StorageDead(_16);
+- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind continue];
++ _14 = opaque::<u8>(_15) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+- StorageDead(_15);
++ nop;
+ StorageDead(_14);
+ StorageLive(_18);
+ StorageLive(_19);
+ StorageLive(_20);
+ _20 = _2;
+ StorageLive(_21);
+ _21 = _3;
+- _19 = Add(move _20, move _21);
++ _19 = _15;
+ 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);
++ nop;
+ StorageLive(_24);
+ _24 = _2;
+ StorageLive(_25);
+ _25 = _3;
+- _23 = Add(move _24, move _25);
++ _23 = Add(_2, _3);
+ StorageDead(_25);
+ StorageDead(_24);
+- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind continue];
++ _22 = opaque::<u8>(_23) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+- StorageDead(_23);
++ nop;
+ 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);
++ _28 = _23;
+ 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);
++ _32 = _23;
+ 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..7799c6114
--- /dev/null
+++ b/tests/mir-opt/gvn.references.GVN.panic-abort.diff
@@ -0,0 +1,180 @@
+- // 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;
+ let _18: &mut impl Sized;
+ let mut _20: S<&mut impl Sized>;
+ let mut _21: &mut impl Sized;
+ let _22: ();
+ let mut _23: &impl Sized;
+ let _24: ();
+ let mut _25: &mut impl Sized;
+ let _26: ();
+ let mut _27: *const impl Sized;
+ let _28: ();
+ let mut _29: *mut impl Sized;
+ scope 1 {
+ debug r => _18;
+ let _19: &mut impl Sized;
+ scope 2 {
+ debug s => _19;
+ }
+ }
+
+ 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);
+- StorageLive(_18);
++ nop;
+ _18 = &mut _1;
+ StorageLive(_19);
+ StorageLive(_20);
+ StorageLive(_21);
+- _21 = move _18;
+- _20 = S::<&mut impl Sized>(move _21);
++ _21 = _18;
++ _20 = S::<&mut impl Sized>(_18);
+ StorageDead(_21);
+- _19 = move (_20.0: &mut impl Sized);
++ _19 = _18;
+ StorageDead(_20);
+ StorageLive(_22);
+ StorageLive(_23);
+- _23 = &(*_19);
++ _23 = &(*_18);
+ _22 = opaque::<&impl Sized>(move _23) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_24);
+ StorageLive(_25);
+- _25 = &mut (*_19);
++ _25 = &mut (*_18);
+ _24 = opaque::<&mut impl Sized>(move _25) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageLive(_26);
+ StorageLive(_27);
+- _27 = &raw const (*_19);
++ _27 = &raw const (*_18);
+ _26 = opaque::<*const impl Sized>(move _27) -> [return: bb11, unwind unreachable];
+ }
+
+ bb11: {
+ StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_28);
+ StorageLive(_29);
+- _29 = &raw mut (*_19);
++ _29 = &raw mut (*_18);
+ _28 = opaque::<*mut impl Sized>(move _29) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+ StorageDead(_29);
+ StorageDead(_28);
+ _0 = const ();
+ StorageDead(_19);
+- StorageDead(_18);
++ nop;
+ drop(_1) -> [return: bb13, unwind unreachable];
+ }
+
+ bb13: {
+ 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..880e7913f
--- /dev/null
+++ b/tests/mir-opt/gvn.references.GVN.panic-unwind.diff
@@ -0,0 +1,188 @@
+- // 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;
+ let _18: &mut impl Sized;
+ let mut _20: S<&mut impl Sized>;
+ let mut _21: &mut impl Sized;
+ let _22: ();
+ let mut _23: &impl Sized;
+ let _24: ();
+ let mut _25: &mut impl Sized;
+ let _26: ();
+ let mut _27: *const impl Sized;
+ let _28: ();
+ let mut _29: *mut impl Sized;
+ scope 1 {
+ debug r => _18;
+ let _19: &mut impl Sized;
+ scope 2 {
+ debug s => _19;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &_1;
+ _2 = opaque::<&impl Sized>(move _3) -> [return: bb1, unwind: bb14];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = &_1;
+ _4 = opaque::<&impl Sized>(move _5) -> [return: bb2, unwind: bb14];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &mut _1;
+ _6 = opaque::<&mut impl Sized>(move _7) -> [return: bb3, unwind: bb14];
+ }
+
+ bb3: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = &mut _1;
+ _8 = opaque::<&mut impl Sized>(move _9) -> [return: bb4, unwind: bb14];
+ }
+
+ bb4: {
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = &raw const _1;
+ _10 = opaque::<*const impl Sized>(move _11) -> [return: bb5, unwind: bb14];
+ }
+
+ bb5: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = &raw const _1;
+ _12 = opaque::<*const impl Sized>(move _13) -> [return: bb6, unwind: bb14];
+ }
+
+ bb6: {
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageLive(_14);
+ StorageLive(_15);
+ _15 = &raw mut _1;
+ _14 = opaque::<*mut impl Sized>(move _15) -> [return: bb7, unwind: bb14];
+ }
+
+ bb7: {
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = &raw mut _1;
+ _16 = opaque::<*mut impl Sized>(move _17) -> [return: bb8, unwind: bb14];
+ }
+
+ bb8: {
+ StorageDead(_17);
+ StorageDead(_16);
+- StorageLive(_18);
++ nop;
+ _18 = &mut _1;
+ StorageLive(_19);
+ StorageLive(_20);
+ StorageLive(_21);
+- _21 = move _18;
+- _20 = S::<&mut impl Sized>(move _21);
++ _21 = _18;
++ _20 = S::<&mut impl Sized>(_18);
+ StorageDead(_21);
+- _19 = move (_20.0: &mut impl Sized);
++ _19 = _18;
+ StorageDead(_20);
+ StorageLive(_22);
+ StorageLive(_23);
+- _23 = &(*_19);
++ _23 = &(*_18);
+ _22 = opaque::<&impl Sized>(move _23) -> [return: bb9, unwind: bb14];
+ }
+
+ bb9: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_24);
+ StorageLive(_25);
+- _25 = &mut (*_19);
++ _25 = &mut (*_18);
+ _24 = opaque::<&mut impl Sized>(move _25) -> [return: bb10, unwind: bb14];
+ }
+
+ bb10: {
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageLive(_26);
+ StorageLive(_27);
+- _27 = &raw const (*_19);
++ _27 = &raw const (*_18);
+ _26 = opaque::<*const impl Sized>(move _27) -> [return: bb11, unwind: bb14];
+ }
+
+ bb11: {
+ StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_28);
+ StorageLive(_29);
+- _29 = &raw mut (*_19);
++ _29 = &raw mut (*_18);
+ _28 = opaque::<*mut impl Sized>(move _29) -> [return: bb12, unwind: bb14];
+ }
+
+ bb12: {
+ StorageDead(_29);
+ StorageDead(_28);
+ _0 = const ();
+ StorageDead(_19);
+- StorageDead(_18);
++ nop;
+ drop(_1) -> [return: bb13, unwind: bb15];
+ }
+
+ bb13: {
+ return;
+ }
+
+ bb14 (cleanup): {
+ drop(_1) -> [return: bb15, unwind terminate(cleanup)];
+ }
+
+ bb15 (cleanup): {
+ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff b/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff
new file mode 100644
index 000000000..37915f857
--- /dev/null
+++ b/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff
@@ -0,0 +1,79 @@
+- // MIR for `repeat` before GVN
++ // MIR for `repeat` after GVN
+
+ fn repeat() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _3: i32;
+ let mut _4: i32;
+ let mut _5: i32;
+ let mut _6: i32;
+ let mut _7: i32;
+ let mut _8: i32;
+ let mut _9: i32;
+ let mut _10: i32;
+ let mut _11: i32;
+ let mut _12: i32;
+ scope 1 {
+ debug val => _1;
+ let _2: [i32; 10];
+ scope 2 {
+ debug array => _2;
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
++ nop;
+ _1 = const 5_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = _1;
++ _3 = const 5_i32;
+ StorageLive(_4);
+- _4 = _1;
++ _4 = const 5_i32;
+ StorageLive(_5);
+- _5 = _1;
++ _5 = const 5_i32;
+ StorageLive(_6);
+- _6 = _1;
++ _6 = const 5_i32;
+ StorageLive(_7);
+- _7 = _1;
++ _7 = const 5_i32;
+ StorageLive(_8);
+- _8 = _1;
++ _8 = const 5_i32;
+ StorageLive(_9);
+- _9 = _1;
++ _9 = const 5_i32;
+ StorageLive(_10);
+- _10 = _1;
++ _10 = const 5_i32;
+ StorageLive(_11);
+- _11 = _1;
++ _11 = const 5_i32;
+ StorageLive(_12);
+- _12 = _1;
+- _2 = [move _3, move _4, move _5, move _6, move _7, move _8, move _9, move _10, move _11, move _12];
++ _12 = const 5_i32;
++ _2 = [const 5_i32; 10];
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_2);
+- StorageDead(_1);
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff b/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff
new file mode 100644
index 000000000..37915f857
--- /dev/null
+++ b/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff
@@ -0,0 +1,79 @@
+- // MIR for `repeat` before GVN
++ // MIR for `repeat` after GVN
+
+ fn repeat() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _3: i32;
+ let mut _4: i32;
+ let mut _5: i32;
+ let mut _6: i32;
+ let mut _7: i32;
+ let mut _8: i32;
+ let mut _9: i32;
+ let mut _10: i32;
+ let mut _11: i32;
+ let mut _12: i32;
+ scope 1 {
+ debug val => _1;
+ let _2: [i32; 10];
+ scope 2 {
+ debug array => _2;
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
++ nop;
+ _1 = const 5_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = _1;
++ _3 = const 5_i32;
+ StorageLive(_4);
+- _4 = _1;
++ _4 = const 5_i32;
+ StorageLive(_5);
+- _5 = _1;
++ _5 = const 5_i32;
+ StorageLive(_6);
+- _6 = _1;
++ _6 = const 5_i32;
+ StorageLive(_7);
+- _7 = _1;
++ _7 = const 5_i32;
+ StorageLive(_8);
+- _8 = _1;
++ _8 = const 5_i32;
+ StorageLive(_9);
+- _9 = _1;
++ _9 = const 5_i32;
+ StorageLive(_10);
+- _10 = _1;
++ _10 = const 5_i32;
+ StorageLive(_11);
+- _11 = _1;
++ _11 = const 5_i32;
+ StorageLive(_12);
+- _12 = _1;
+- _2 = [move _3, move _4, move _5, move _6, move _7, move _8, move _9, move _10, move _11, move _12];
++ _12 = const 5_i32;
++ _2 = [const 5_i32; 10];
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_2);
+- StorageDead(_1);
++ nop;
+ return;
+ }
+ }
+
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..d937902e8
--- /dev/null
+++ b/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff
@@ -0,0 +1,81 @@
+- // 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];
++ _3 = [_1; N];
+ StorageDead(_4);
+ 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];
++ _6 = _1;
++ _5 = opaque::<T>(_1) -> [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];
++ _13 = _8;
++ _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];
++ _11 = _1;
++ _10 = opaque::<T>(_1) -> [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..dd4d24b12
--- /dev/null
+++ b/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff
@@ -0,0 +1,81 @@
+- // 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];
++ _3 = [_1; N];
+ StorageDead(_4);
+ 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];
++ _6 = _1;
++ _5 = opaque::<T>(_1) -> [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];
++ _13 = _8;
++ _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];
++ _11 = _1;
++ _10 = opaque::<T>(_1) -> [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..db131f7f9
--- /dev/null
+++ b/tests/mir-opt/gvn.rs
@@ -0,0 +1,673 @@
+// unit-test: GVN
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// only-64bit
+
+#![feature(raw_ref_op)]
+#![feature(rustc_attrs)]
+#![feature(custom_mir)]
+#![feature(core_intrinsics)]
+#![allow(unconditional_panic)]
+
+use std::intrinsics::mir::*;
+use std::mem::transmute;
+
+struct S<T>(T);
+
+fn subexpression_elimination(x: u64, y: u64, mut z: u64) {
+ // CHECK-LABEL: fn subexpression_elimination(
+
+ // CHECK: [[add:_.*]] = Add(_1, _2);
+ // CHECK: opaque::<u64>([[add]])
+ opaque(x + y);
+ // CHECK: [[mul:_.*]] = Mul(_1, _2);
+ // CHECK: opaque::<u64>([[mul]])
+ opaque(x * y);
+ // CHECK: [[sub:_.*]] = Sub(_1, _2);
+ // CHECK: opaque::<u64>([[sub]])
+ opaque(x - y);
+ // CHECK: [[div:_.*]] = Div(_1, _2);
+ // CHECK: opaque::<u64>([[div]])
+ opaque(x / y);
+ // CHECK: [[rem:_.*]] = Rem(_1, _2);
+ // CHECK: opaque::<u64>([[rem]])
+ opaque(x % y);
+ // CHECK: [[and:_.*]] = BitAnd(_1, _2);
+ // CHECK: opaque::<u64>([[and]])
+ opaque(x & y);
+ // CHECK: [[or:_.*]] = BitOr(_1, _2);
+ // CHECK: opaque::<u64>([[or]])
+ opaque(x | y);
+ // CHECK: [[xor:_.*]] = BitXor(_1, _2);
+ // CHECK: opaque::<u64>([[xor]])
+ opaque(x ^ y);
+ // CHECK: [[shl:_.*]] = Shl(_1, _2);
+ // CHECK: opaque::<u64>([[shl]])
+ opaque(x << y);
+ // CHECK: [[shr:_.*]] = Shr(_1, _2);
+ // CHECK: opaque::<u64>([[shr]])
+ opaque(x >> y);
+ // CHECK: [[int:_.*]] = _1 as u32 (IntToInt);
+ // CHECK: opaque::<u32>([[int]])
+ opaque(x as u32);
+ // CHECK: [[float:_.*]] = _1 as f32 (IntToFloat);
+ // CHECK: opaque::<f32>([[float]])
+ opaque(x as f32);
+ // CHECK: [[wrap:_.*]] = S::<u64>(_1);
+ // CHECK: opaque::<S<u64>>([[wrap]])
+ opaque(S(x));
+ // CHECK: opaque::<u64>(_1)
+ opaque(S(x).0);
+
+ // Those are duplicates to substitute somehow.
+ // CHECK: opaque::<u64>([[add]])
+ opaque(x + y);
+ // CHECK: opaque::<u64>([[mul]])
+ opaque(x * y);
+ // CHECK: opaque::<u64>([[sub]])
+ opaque(x - y);
+ // CHECK: opaque::<u64>([[div]])
+ opaque(x / y);
+ // CHECK: opaque::<u64>([[rem]])
+ opaque(x % y);
+ // CHECK: opaque::<u64>([[and]])
+ opaque(x & y);
+ // CHECK: opaque::<u64>([[or]])
+ opaque(x | y);
+ // CHECK: opaque::<u64>([[xor]])
+ opaque(x ^ y);
+ // CHECK: opaque::<u64>([[shl]])
+ opaque(x << y);
+ // CHECK: opaque::<u64>([[shr]])
+ opaque(x >> y);
+ // CHECK: opaque::<u32>([[int]])
+ opaque(x as u32);
+ // CHECK: opaque::<f32>([[float]])
+ opaque(x as f32);
+ // CHECK: opaque::<S<u64>>([[wrap]])
+ opaque(S(x));
+ // CHECK: opaque::<u64>(_1)
+ opaque(S(x).0);
+
+ // We can substitute through a complex expression.
+ // CHECK: [[compound:_.*]] = Sub([[mul]], _2);
+ // CHECK: opaque::<u64>([[compound]])
+ // CHECK: opaque::<u64>([[compound]])
+ opaque((x * y) - y);
+ opaque((x * y) - y);
+
+ // We can substitute through an immutable reference too.
+ // CHECK: [[ref:_.*]] = &_3;
+ // CHECK: [[deref:_.*]] = (*[[ref]]);
+ // CHECK: [[addref:_.*]] = Add([[deref]], _1);
+ // CHECK: opaque::<u64>([[addref]])
+ // CHECK: opaque::<u64>([[addref]])
+ let a = &z;
+ opaque(*a + x);
+ opaque(*a + x);
+
+ // But not through a mutable reference or a pointer.
+ // CHECK: [[mut:_.*]] = &mut _3;
+ // CHECK: [[addmut:_.*]] = Add(
+ // CHECK: opaque::<u64>(move [[addmut]])
+ // CHECK: [[addmut2:_.*]] = Add(
+ // CHECK: opaque::<u64>(move [[addmut2]])
+ let b = &mut z;
+ opaque(*b + x);
+ opaque(*b + x);
+ unsafe {
+ // CHECK: [[raw:_.*]] = &raw const _3;
+ // CHECK: [[addraw:_.*]] = Add(
+ // CHECK: opaque::<u64>(move [[addraw]])
+ // CHECK: [[addraw2:_.*]] = Add(
+ // CHECK: opaque::<u64>(move [[addraw2]])
+ let c = &raw const z;
+ opaque(*c + x);
+ opaque(*c + x);
+ // CHECK: [[ptr:_.*]] = &raw mut _3;
+ // CHECK: [[addptr:_.*]] = Add(
+ // CHECK: opaque::<u64>(move [[addptr]])
+ // CHECK: [[addptr2:_.*]] = Add(
+ // CHECK: opaque::<u64>(move [[addptr2]])
+ 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`!
+ // CHECK: [[ref2:_.*]] = &_3;
+ // CHECK: [[deref2:_.*]] = (*[[ref2]]);
+ // CHECK: [[addref2:_.*]] = Add([[deref2]], _1);
+ // CHECK: opaque::<u64>([[addref2]])
+ // CHECK: opaque::<u64>([[addref2]])
+ let e = &z;
+ opaque(*e + x);
+ opaque(*e + x);
+}
+
+fn wrap_unwrap<T: Copy>(x: T) -> T {
+ // CHECK-LABEL: fn wrap_unwrap(
+ // CHECK: [[some:_.*]] = Option::<T>::Some(_1);
+ // CHECK: switchInt(const 1_isize)
+ // CHECK: _0 = _1;
+ match Some(x) {
+ Some(y) => y,
+ None => panic!(),
+ }
+}
+
+fn repeated_index<T: Copy, const N: usize>(x: T, idx: usize) {
+ // CHECK-LABEL: fn repeated_index(
+ // CHECK: [[a:_.*]] = [_1; N];
+ let a = [x; N];
+ // CHECK: opaque::<T>(_1)
+ opaque(a[0]);
+ // CHECK: opaque::<T>(_1)
+ opaque(a[idx]);
+}
+
+/// Verify symbolic integer arithmetic simplifications.
+fn arithmetic(x: u64) {
+ // CHECK-LABEL: fn arithmetic(
+ // CHECK: [[add:_.*]] = Add(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[add]])
+ opaque(x + 0);
+ // CHECK: [[sub:_.*]] = Sub(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[sub]])
+ opaque(x - 0);
+ // CHECK: [[mul0:_.*]] = Mul(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[mul0]])
+ opaque(x * 0);
+ // CHECK: [[mul1:_.*]] = Mul(_1, const 1_u64);
+ // CHECK: opaque::<u64>(move [[mul1]])
+ opaque(x * 1);
+ // CHECK: [[div0:_.*]] = Div(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[div0]])
+ opaque(x / 0);
+ // CHECK: [[div1:_.*]] = Div(_1, const 1_u64);
+ // CHECK: opaque::<u64>(move [[div1]])
+ opaque(x / 1);
+ // CHECK: [[zdiv:_.*]] = Div(const 0_u64, _1);
+ // CHECK: opaque::<u64>(move [[zdiv]])
+ opaque(0 / x);
+ // CHECK: [[odiv:_.*]] = Div(const 1_u64, _1);
+ // CHECK: opaque::<u64>(move [[odiv]])
+ opaque(1 / x);
+ // CHECK: [[rem0:_.*]] = Rem(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[rem0]])
+ opaque(x % 0);
+ // CHECK: [[rem1:_.*]] = Rem(_1, const 1_u64);
+ // CHECK: opaque::<u64>(move [[rem1]])
+ opaque(x % 1);
+ // CHECK: [[zrem:_.*]] = Rem(const 0_u64, _1);
+ // CHECK: opaque::<u64>(move [[zrem]])
+ opaque(0 % x);
+ // CHECK: [[orem:_.*]] = Rem(const 1_u64, _1);
+ // CHECK: opaque::<u64>(move [[orem]])
+ opaque(1 % x);
+ // CHECK: [[and:_.*]] = BitAnd(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[and]])
+ opaque(x & 0);
+ // CHECK: [[or:_.*]] = BitOr(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[or]])
+ opaque(x | 0);
+ // CHECK: [[xor:_.*]] = BitXor(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[xor]])
+ opaque(x ^ 0);
+ // CHECK: [[shr:_.*]] = Shr(_1, const 0_i32);
+ // CHECK: opaque::<u64>(move [[shr]])
+ opaque(x >> 0);
+ // CHECK: [[shl:_.*]] = Shl(_1, const 0_i32);
+ // CHECK: opaque::<u64>(move [[shl]])
+ opaque(x << 0);
+}
+
+fn comparison(x: u64, y: u64) {
+ // CHECK-LABEL: fn comparison(
+ // CHECK: [[eqxx:_.*]] = Eq(_1, _1);
+ // CHECK: opaque::<bool>(move [[eqxx]])
+ opaque(x == x);
+ // CHECK: [[nexx:_.*]] = Ne(_1, _1);
+ // CHECK: opaque::<bool>(move [[nexx]])
+ opaque(x != x);
+ // CHECK: [[eqxy:_.*]] = Eq(_1, _2);
+ // CHECK: opaque::<bool>(move [[eqxy]])
+ opaque(x == y);
+ // CHECK: [[nexy:_.*]] = Ne(_1, _2);
+ // CHECK: opaque::<bool>(move [[nexy]])
+ opaque(x != y);
+}
+
+/// Verify symbolic integer arithmetic simplifications on checked ops.
+#[rustc_inherit_overflow_checks]
+fn arithmetic_checked(x: u64) {
+ // CHECK-LABEL: fn arithmetic_checked(
+ // CHECK: [[cadd:_.*]] = CheckedAdd(_1, const 0_u64);
+ // CHECK: [[add:_.*]] = move ([[cadd]].0: u64);
+ // CHECK: opaque::<u64>(move [[add]])
+ opaque(x + 0);
+ // CHECK: [[csub:_.*]] = CheckedSub(_1, const 0_u64);
+ // CHECK: [[sub:_.*]] = move ([[csub]].0: u64);
+ // CHECK: opaque::<u64>(move [[sub]])
+ opaque(x - 0);
+ // CHECK: [[cmul0:_.*]] = CheckedMul(_1, const 0_u64);
+ // CHECK: [[mul0:_.*]] = move ([[cmul0]].0: u64);
+ // CHECK: opaque::<u64>(move [[mul0]])
+ opaque(x * 0);
+ // CHECK: [[cmul1:_.*]] = CheckedMul(_1, const 1_u64);
+ // CHECK: [[mul1:_.*]] = move ([[cmul1]].0: u64);
+ // CHECK: opaque::<u64>(move [[mul1]])
+ opaque(x * 1);
+}
+
+/// Verify that we do not apply arithmetic simplifications on floats.
+fn arithmetic_float(x: f64) {
+ // CHECK-LABEL: fn arithmetic_float(
+ // CHECK: [[add:_.*]] = Add(_1, const 0f64);
+ // CHECK: opaque::<f64>(move [[add]])
+ opaque(x + 0.);
+ // CHECK: [[sub:_.*]] = Sub(_1, const 0f64);
+ // CHECK: opaque::<f64>(move [[sub]])
+ opaque(x - 0.);
+ // CHECK: [[mul:_.*]] = Mul(_1, const 0f64);
+ // CHECK: opaque::<f64>(move [[mul]])
+ opaque(x * 0.);
+ // CHECK: [[div0:_.*]] = Div(_1, const 0f64);
+ // CHECK: opaque::<f64>(move [[div0]])
+ opaque(x / 0.);
+ // CHECK: [[zdiv:_.*]] = Div(const 0f64, _1);
+ // CHECK: opaque::<f64>(move [[zdiv]])
+ opaque(0. / x);
+ // CHECK: [[rem0:_.*]] = Rem(_1, const 0f64);
+ // CHECK: opaque::<f64>(move [[rem0]])
+ opaque(x % 0.);
+ // CHECK: [[zrem:_.*]] = Rem(const 0f64, _1);
+ // CHECK: opaque::<f64>(move [[zrem]])
+ opaque(0. % x);
+ // Those are not simplifiable to `true`/`false`, thanks to NaNs.
+ // CHECK: [[eq:_.*]] = Eq(_1, _1);
+ // CHECK: opaque::<bool>(move [[eq]])
+ opaque(x == x);
+ // CHECK: [[ne:_.*]] = Ne(_1, _1);
+ // CHECK: opaque::<bool>(move [[ne]])
+ opaque(x != x);
+}
+
+fn cast() {
+ // CHECK-LABEL: fn cast(
+ let i = 1_i64;
+ let u = 1_u64;
+ let f = 1_f64;
+ // CHECK: opaque::<u8>(const 1_u8)
+ opaque(i as u8);
+ // CHECK: opaque::<u16>(const 1_u16)
+ opaque(i as u16);
+ // CHECK: opaque::<u32>(const 1_u32)
+ opaque(i as u32);
+ // CHECK: opaque::<u64>(const 1_u64)
+ opaque(i as u64);
+ // CHECK: opaque::<i8>(const 1_i8)
+ opaque(i as i8);
+ // CHECK: opaque::<i16>(const 1_i16)
+ opaque(i as i16);
+ // CHECK: opaque::<i32>(const 1_i32)
+ opaque(i as i32);
+ // CHECK: opaque::<i64>(const 1_i64)
+ opaque(i as i64);
+ // CHECK: opaque::<f32>(const 1f32)
+ opaque(i as f32);
+ // CHECK: opaque::<f64>(const 1f64)
+ opaque(i as f64);
+ // CHECK: opaque::<u8>(const 1_u8)
+ opaque(u as u8);
+ // CHECK: opaque::<u16>(const 1_u16)
+ opaque(u as u16);
+ // CHECK: opaque::<u32>(const 1_u32)
+ opaque(u as u32);
+ // CHECK: opaque::<u64>(const 1_u64)
+ opaque(u as u64);
+ // CHECK: opaque::<i8>(const 1_i8)
+ opaque(u as i8);
+ // CHECK: opaque::<i16>(const 1_i16)
+ opaque(u as i16);
+ // CHECK: opaque::<i32>(const 1_i32)
+ opaque(u as i32);
+ // CHECK: opaque::<i64>(const 1_i64)
+ opaque(u as i64);
+ // CHECK: opaque::<f32>(const 1f32)
+ opaque(u as f32);
+ // CHECK: opaque::<f64>(const 1f64)
+ opaque(u as f64);
+ // CHECK: opaque::<u8>(const 1_u8)
+ opaque(f as u8);
+ // CHECK: opaque::<u16>(const 1_u16)
+ opaque(f as u16);
+ // CHECK: opaque::<u32>(const 1_u32)
+ opaque(f as u32);
+ // CHECK: opaque::<u64>(const 1_u64)
+ opaque(f as u64);
+ // CHECK: opaque::<i8>(const 1_i8)
+ opaque(f as i8);
+ // CHECK: opaque::<i16>(const 1_i16)
+ opaque(f as i16);
+ // CHECK: opaque::<i32>(const 1_i32)
+ opaque(f as i32);
+ // CHECK: opaque::<i64>(const 1_i64)
+ opaque(f as i64);
+ // CHECK: opaque::<f32>(const 1f32)
+ opaque(f as f32);
+ // CHECK: opaque::<f64>(const 1f64)
+ opaque(f as f64);
+}
+
+fn multiple_branches(t: bool, x: u8, y: u8) {
+ // CHECK-LABEL: fn multiple_branches(
+ // CHECK: switchInt(_1) -> [0: [[bbf:bb.*]], otherwise: [[bbt:bb.*]]];
+ if t {
+ // CHECK: [[bbt]]: {
+ // CHECK: [[a:_.*]] = Add(_2, _3);
+ // CHECK: opaque::<u8>([[a]])
+ // CHECK: opaque::<u8>([[a]])
+ // CHECK: goto -> [[bbc:bb.*]];
+ opaque(x + y);
+ opaque(x + y);
+ } else {
+ // CHECK: [[bbf]]: {
+ // CHECK: [[b:_.*]] = Add(_2, _3);
+ // CHECK: opaque::<u8>([[b]])
+ // CHECK: opaque::<u8>([[b]])
+ // CHECK: goto -> [[bbc:bb.*]];
+ opaque(x + y);
+ opaque(x + y);
+ }
+ // Neither `a` nor `b` dominate `c`, so we cannot reuse any of them.
+ // CHECK: [[bbc]]: {
+ // CHECK: [[c:_.*]] = Add(_2, _3);
+ // CHECK: opaque::<u8>([[c]])
+ opaque(x + y);
+
+ // `c` dominates both calls, so we can reuse it.
+ if t {
+ // CHECK: opaque::<u8>([[c]])
+ opaque(x + y);
+ } else {
+ // CHECK: opaque::<u8>([[c]])
+ opaque(x + y);
+ }
+}
+
+/// Verify that we do not reuse a `&raw? mut?` rvalue.
+fn references(mut x: impl Sized) {
+ // CHECK-LABEL: fn references(
+ // CHECK: [[ref1:_.*]] = &_1;
+ // CHECK: opaque::<&impl Sized>(move [[ref1]])
+ opaque(&x);
+ // CHECK: [[ref2:_.*]] = &_1;
+ // CHECK: opaque::<&impl Sized>(move [[ref2]])
+ opaque(&x);
+ // CHECK: [[ref3:_.*]] = &mut _1;
+ // CHECK: opaque::<&mut impl Sized>(move [[ref3]])
+ opaque(&mut x);
+ // CHECK: [[ref4:_.*]] = &mut _1;
+ // CHECK: opaque::<&mut impl Sized>(move [[ref4]])
+ opaque(&mut x);
+ // CHECK: [[ref5:_.*]] = &raw const _1;
+ // CHECK: opaque::<*const impl Sized>(move [[ref5]])
+ opaque(&raw const x);
+ // CHECK: [[ref6:_.*]] = &raw const _1;
+ // CHECK: opaque::<*const impl Sized>(move [[ref6]])
+ opaque(&raw const x);
+ // CHECK: [[ref7:_.*]] = &raw mut _1;
+ // CHECK: opaque::<*mut impl Sized>(move [[ref7]])
+ opaque(&raw mut x);
+ // CHECK: [[ref8:_.*]] = &raw mut _1;
+ // CHECK: opaque::<*mut impl Sized>(move [[ref8]])
+ opaque(&raw mut x);
+
+ let r = &mut x;
+ let s = S(r).0; // Obfuscate `r`. Following lines should still reborrow `r`.
+ // CHECK: [[ref9:_.*]] = &mut _1;
+ // CHECK: [[ref10:_.*]] = &(*[[ref9]]);
+ // CHECK: opaque::<&impl Sized>(move [[ref10]])
+ opaque(&*s);
+ // CHECK: [[ref11:_.*]] = &mut (*[[ref9]]);
+ // CHECK: opaque::<&mut impl Sized>(move [[ref11]])
+ opaque(&mut *s);
+ // CHECK: [[ref12:_.*]] = &raw const (*[[ref9]]);
+ // CHECK: opaque::<*const impl Sized>(move [[ref12]])
+ opaque(&raw const *s);
+ // CHECK: [[ref12:_.*]] = &raw mut (*[[ref9]]);
+ // CHECK: opaque::<*mut impl Sized>(move [[ref12]])
+ opaque(&raw mut *s);
+}
+
+fn dereferences(t: &mut u32, u: &impl Copy, s: &S<u32>) {
+ // CHECK-LABEL: fn dereferences(
+
+ // Do not reuse dereferences of `&mut`.
+ // CHECK: [[st1:_.*]] = (*_1);
+ // CHECK: opaque::<u32>(move [[st1]])
+ // CHECK: [[st2:_.*]] = (*_1);
+ // CHECK: opaque::<u32>(move [[st2]])
+ opaque(*t);
+ opaque(*t);
+
+ // Do not reuse dereferences of `*const`.
+ // CHECK: [[raw:_.*]] = &raw const (*_1);
+ // CHECK: [[st3:_.*]] = (*[[raw]]);
+ // CHECK: opaque::<u32>(move [[st3]])
+ // CHECK: [[st4:_.*]] = (*[[raw]]);
+ // CHECK: opaque::<u32>(move [[st4]])
+ let z = &raw const *t;
+ unsafe { opaque(*z) };
+ unsafe { opaque(*z) };
+
+ // Do not reuse dereferences of `*mut`.
+ // CHECK: [[ptr:_.*]] = &raw mut (*_1);
+ // CHECK: [[st5:_.*]] = (*[[ptr]]);
+ // CHECK: opaque::<u32>(move [[st5]])
+ // CHECK: [[st6:_.*]] = (*[[ptr]]);
+ // CHECK: opaque::<u32>(move [[st6]])
+ let z = &raw mut *t;
+ unsafe { opaque(*z) };
+ unsafe { opaque(*z) };
+
+ // We can reuse dereferences of `&Freeze`.
+ // CHECK: [[ref:_.*]] = &(*_1);
+ // CHECK: [[st7:_.*]] = (*[[ref]]);
+ // CHECK: opaque::<u32>([[st7]])
+ // CHECK: opaque::<u32>([[st7]])
+ let z = &*t;
+ opaque(*z);
+ opaque(*z);
+ // But not in reborrows.
+ // CHECK: [[reborrow:_.*]] = &(*[[ref]]);
+ // CHECK: opaque::<&u32>(move [[reborrow]])
+ opaque(&*z);
+
+ // `*u` is not Freeze, so we cannot reuse.
+ // CHECK: [[st8:_.*]] = (*_2);
+ // CHECK: opaque::<impl Copy>(move [[st8]])
+ // CHECK: [[st9:_.*]] = (*_2);
+ // CHECK: opaque::<impl Copy>(move [[st9]])
+ opaque(*u);
+ opaque(*u);
+
+ // `*s` is not Copy, by `(*s).0` is, so we can reuse.
+ // CHECK: [[st10:_.*]] = ((*_3).0: u32);
+ // CHECK: opaque::<u32>([[st10]])
+ // CHECK: opaque::<u32>([[st10]])
+ opaque(s.0);
+ opaque(s.0);
+}
+
+fn slices() {
+ // CHECK-LABEL: fn slices(
+ // CHECK: {{_.*}} = const "
+ // CHECK-NOT: {{_.*}} = const "
+ 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 { transmute::<&str, &[u8]>(s) };
+ opaque(u);
+ assert_eq!(s.as_ptr(), u.as_ptr());
+}
+
+#[custom_mir(dialect = "analysis")]
+fn duplicate_slice() -> (bool, bool) {
+ // CHECK-LABEL: fn duplicate_slice(
+ mir!(
+ let au: u128;
+ let bu: u128;
+ let cu: u128;
+ let du: u128;
+ let c: &str;
+ let d: &str;
+ {
+ // CHECK: [[a:_.*]] = (const "a",);
+ // CHECK: [[au:_.*]] = ([[a]].0: &str) as u128 (Transmute);
+ let a = ("a",);
+ Call(au = transmute::<_, u128>(a.0), bb1, UnwindContinue())
+ }
+ bb1 = {
+ // CHECK: [[c:_.*]] = identity::<&str>(([[a]].0: &str))
+ Call(c = identity(a.0), bb2, UnwindContinue())
+ }
+ bb2 = {
+ // CHECK: [[cu:_.*]] = [[c]] as u128 (Transmute);
+ Call(cu = transmute::<_, u128>(c), bb3, UnwindContinue())
+ }
+ bb3 = {
+ // This slice is different from `a.0`. Hence `bu` is not `au`.
+ // CHECK: [[b:_.*]] = const "a";
+ // CHECK: [[bu:_.*]] = [[b]] as u128 (Transmute);
+ let b = "a";
+ Call(bu = transmute::<_, u128>(b), bb4, UnwindContinue())
+ }
+ bb4 = {
+ // This returns a copy of `b`, which is not `a`.
+ // CHECK: [[d:_.*]] = identity::<&str>([[b]])
+ Call(d = identity(b), bb5, UnwindContinue())
+ }
+ bb5 = {
+ // CHECK: [[du:_.*]] = [[d]] as u128 (Transmute);
+ Call(du = transmute::<_, u128>(d), bb6, UnwindContinue())
+ }
+ bb6 = {
+ // `direct` must not fold to `true`, as `indirect` will not.
+ // CHECK: = Eq([[au]], [[bu]]);
+ // CHECK: = Eq([[cu]], [[du]]);
+ let direct = au == bu;
+ let indirect = cu == du;
+ RET = (direct, indirect);
+ Return()
+ }
+ )
+}
+
+fn repeat() {
+ // CHECK-LABEL: fn repeat(
+ // CHECK: = [const 5_i32; 10];
+ let val = 5;
+ let array = [val, val, val, val, val, val, val, val, val, val];
+}
+
+/// Verify that we do not merge fn pointers created by casts.
+fn fn_pointers() {
+ // CHECK-LABEL: fn fn_pointers(
+ // CHECK: [[f:_.*]] = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer
+ // CHECK: opaque::<fn(u8) -> u8>([[f]])
+ let f = identity as fn(u8) -> u8;
+ opaque(f);
+ // CHECK: [[g:_.*]] = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer
+ // CHECK: opaque::<fn(u8) -> u8>([[g]])
+ let g = identity as fn(u8) -> u8;
+ opaque(g);
+
+ // CHECK: [[cf:_.*]] = const {{.*}} as fn() (PointerCoercion(ClosureFnPointer
+ // CHECK: opaque::<fn()>([[cf]])
+ let closure = || {};
+ let cf = closure as fn();
+ opaque(cf);
+ // CHECK: [[cg:_.*]] = const {{.*}} as fn() (PointerCoercion(ClosureFnPointer
+ // CHECK: opaque::<fn()>([[cg]])
+ let cg = closure as fn();
+ opaque(cg);
+}
+
+/// Verify that we do not create a `ConstValue::Indirect` backed by a static's AllocId.
+#[custom_mir(dialect = "analysis")]
+fn indirect_static() {
+ static A: Option<u8> = None;
+
+ mir!({
+ let ptr = Static(A);
+ let out = Field::<u8>(Variant(*ptr, 1), 0);
+ Return()
+ })
+}
+
+/// Verify that having constant index `u64::MAX` does not yield to an overflow in rustc.
+fn constant_index_overflow<T: Copy>(x: &[T]) {
+ // CHECK-LABEL: fn constant_index_overflow(
+ // CHECK: debug a => [[a:_.*]];
+ // CHECK: debug b => [[b:_.*]];
+ // CHECK: [[a]] = const usize::MAX;
+ // CHECK-NOT: = (*_1)[{{.*}} of 0];
+ // CHECK: [[b]] = (*_1)[[[a]]];
+ // CHECK-NOT: = (*_1)[{{.*}} of 0];
+ // CHECK: [[b]] = (*_1)[0 of 1];
+ // CHECK-NOT: = (*_1)[{{.*}} of 0];
+ let a = u64::MAX as usize;
+ let b = if a < x.len() { x[a] } else { x[0] };
+ opaque(b)
+}
+
+fn main() {
+ subexpression_elimination(2, 4, 5);
+ wrap_unwrap(5);
+ repeated_index::<u32, 7>(5, 3);
+ arithmetic(5);
+ comparison(5, 6);
+ arithmetic_checked(5);
+ arithmetic_float(5.);
+ cast();
+ multiple_branches(true, 5, 9);
+ references(5);
+ dereferences(&mut 5, &6, &S(7));
+ slices();
+ let (direct, indirect) = duplicate_slice();
+ assert_eq!(direct, indirect);
+ repeat();
+ fn_pointers();
+ indirect_static();
+ constant_index_overflow(&[5, 3]);
+}
+
+#[inline(never)]
+fn opaque(_: impl Sized) {}
+
+#[inline(never)]
+fn identity<T>(x: T) -> T {
+ x
+}
+
+// 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.comparison.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
+// EMIT_MIR gvn.duplicate_slice.GVN.diff
+// EMIT_MIR gvn.repeat.GVN.diff
+// EMIT_MIR gvn.fn_pointers.GVN.diff
+// EMIT_MIR gvn.indirect_static.GVN.diff
+// EMIT_MIR gvn.constant_index_overflow.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..ec4499803
--- /dev/null
+++ b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff
@@ -0,0 +1,313 @@
+- // 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);
++ nop;
+ _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];
++ _6 = _1;
++ _5 = opaque::<&str>(_1) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_7);
+ StorageLive(_8);
+- StorageLive(_9);
++ nop;
+ 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);
++ nop;
+ StorageLive(_13);
+ StorageLive(_14);
+- _14 = &(*_4);
++ _14 = &(*_1);
+ _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);
++ _8 = (_9, _12);
++ nop;
++ nop;
+ StorageLive(_15);
+- _15 = (_8.0: &*const u8);
++ _15 = _9;
+ StorageLive(_16);
+- _16 = (_8.1: &*const u8);
++ _16 = _12;
+ StorageLive(_17);
+ StorageLive(_18);
+- _18 = (*_15);
++ _18 = (*_9);
+ StorageLive(_19);
+- _19 = (*_16);
++ _19 = (*_12);
+ _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);
++ nop;
+ 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;
++ nop;
++ _21 = const core::panicking::AssertKind::Eq;
+ StorageLive(_22);
+ StorageLive(_23);
+- _23 = move _21;
++ _23 = const core::panicking::AssertKind::Eq;
+ StorageLive(_24);
+- StorageLive(_25);
+- _25 = &(*_15);
++ nop;
++ _25 = &(*_9);
+ _24 = &(*_25);
+ StorageLive(_26);
+- StorageLive(_27);
+- _27 = &(*_16);
++ nop;
++ _27 = &(*_12);
+ _26 = &(*_27);
+ StorageLive(_28);
+ _28 = Option::<Arguments<'_>>::None;
+- _22 = assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind unreachable;
++ _22 = assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _24, move _26, move _28) -> unwind unreachable;
+ }
+
+ bb7: {
+ StorageDead(_32);
+ StorageDead(_31);
+ StorageLive(_33);
+ StorageLive(_34);
+- StorageLive(_35);
++ nop;
+ 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);
++ nop;
+ 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);
++ _34 = (_35, _38);
++ nop;
++ nop;
+ StorageLive(_41);
+- _41 = (_34.0: &*const u8);
++ _41 = _35;
+ StorageLive(_42);
+- _42 = (_34.1: &*const u8);
++ _42 = _38;
+ StorageLive(_43);
+ StorageLive(_44);
+- _44 = (*_41);
++ _44 = (*_35);
+ StorageLive(_45);
+- _45 = (*_42);
++ _45 = (*_38);
+ _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);
++ nop;
+ StorageDead(_4);
+- StorageDead(_1);
++ nop;
+ return;
+ }
+
+ bb11: {
+ StorageDead(_45);
+ StorageDead(_44);
+- StorageLive(_47);
+- _47 = core::panicking::AssertKind::Eq;
++ nop;
++ _47 = const core::panicking::AssertKind::Eq;
+ StorageLive(_48);
+ StorageLive(_49);
+- _49 = move _47;
++ _49 = const core::panicking::AssertKind::Eq;
+ StorageLive(_50);
+- StorageLive(_51);
+- _51 = &(*_41);
++ nop;
++ _51 = &(*_35);
+ _50 = &(*_51);
+ StorageLive(_52);
+- StorageLive(_53);
+- _53 = &(*_42);
++ nop;
++ _53 = &(*_38);
+ _52 = &(*_53);
+ StorageLive(_54);
+ _54 = Option::<Arguments<'_>>::None;
+- _48 = assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind unreachable;
++ _48 = assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, 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..56a78ca86
--- /dev/null
+++ b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff
@@ -0,0 +1,313 @@
+- // 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);
++ nop;
+ _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];
++ _6 = _1;
++ _5 = opaque::<&str>(_1) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageLive(_7);
+ StorageLive(_8);
+- StorageLive(_9);
++ nop;
+ 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);
++ nop;
+ StorageLive(_13);
+ StorageLive(_14);
+- _14 = &(*_4);
++ _14 = &(*_1);
+ _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);
++ _8 = (_9, _12);
++ nop;
++ nop;
+ StorageLive(_15);
+- _15 = (_8.0: &*const u8);
++ _15 = _9;
+ StorageLive(_16);
+- _16 = (_8.1: &*const u8);
++ _16 = _12;
+ StorageLive(_17);
+ StorageLive(_18);
+- _18 = (*_15);
++ _18 = (*_9);
+ StorageLive(_19);
+- _19 = (*_16);
++ _19 = (*_12);
+ _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);
++ nop;
+ 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;
++ nop;
++ _21 = const core::panicking::AssertKind::Eq;
+ StorageLive(_22);
+ StorageLive(_23);
+- _23 = move _21;
++ _23 = const core::panicking::AssertKind::Eq;
+ StorageLive(_24);
+- StorageLive(_25);
+- _25 = &(*_15);
++ nop;
++ _25 = &(*_9);
+ _24 = &(*_25);
+ StorageLive(_26);
+- StorageLive(_27);
+- _27 = &(*_16);
++ nop;
++ _27 = &(*_12);
+ _26 = &(*_27);
+ StorageLive(_28);
+ _28 = Option::<Arguments<'_>>::None;
+- _22 = assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind continue;
++ _22 = assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _24, move _26, move _28) -> unwind continue;
+ }
+
+ bb7: {
+ StorageDead(_32);
+ StorageDead(_31);
+ StorageLive(_33);
+ StorageLive(_34);
+- StorageLive(_35);
++ nop;
+ 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);
++ nop;
+ 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);
++ _34 = (_35, _38);
++ nop;
++ nop;
+ StorageLive(_41);
+- _41 = (_34.0: &*const u8);
++ _41 = _35;
+ StorageLive(_42);
+- _42 = (_34.1: &*const u8);
++ _42 = _38;
+ StorageLive(_43);
+ StorageLive(_44);
+- _44 = (*_41);
++ _44 = (*_35);
+ StorageLive(_45);
+- _45 = (*_42);
++ _45 = (*_38);
+ _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);
++ nop;
+ StorageDead(_4);
+- StorageDead(_1);
++ nop;
+ return;
+ }
+
+ bb11: {
+ StorageDead(_45);
+ StorageDead(_44);
+- StorageLive(_47);
+- _47 = core::panicking::AssertKind::Eq;
++ nop;
++ _47 = const core::panicking::AssertKind::Eq;
+ StorageLive(_48);
+ StorageLive(_49);
+- _49 = move _47;
++ _49 = const core::panicking::AssertKind::Eq;
+ StorageLive(_50);
+- StorageLive(_51);
+- _51 = &(*_41);
++ nop;
++ _51 = &(*_35);
+ _50 = &(*_51);
+ StorageLive(_52);
+- StorageLive(_53);
+- _53 = &(*_42);
++ nop;
++ _53 = &(*_38);
+ _52 = &(*_53);
+ StorageLive(_54);
+ _54 = Option::<Arguments<'_>>::None;
+- _48 = assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind continue;
++ _48 = assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, 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..0a747d3ae
--- /dev/null
+++ b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff
@@ -0,0 +1,966 @@
+- // 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 _63: ();
+ let mut _64: u64;
+ let mut _65: u64;
+ let mut _66: u64;
+ let _67: ();
+ 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: bool;
+ let _76: ();
+ let mut _77: u64;
+ let mut _78: u64;
+ let mut _79: u64;
+ let mut _80: bool;
+ let _81: ();
+ let mut _82: u64;
+ let mut _83: u64;
+ let mut _84: u64;
+ let _85: ();
+ let mut _86: u64;
+ let mut _87: u64;
+ let mut _88: u64;
+ let _89: ();
+ let mut _90: u64;
+ let mut _91: u64;
+ let mut _92: u64;
+ let _93: ();
+ 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 _101: ();
+ let mut _102: u32;
+ let mut _103: u64;
+ let _104: ();
+ let mut _105: f32;
+ let mut _106: u64;
+ let _107: ();
+ let mut _108: S<u64>;
+ let mut _109: u64;
+ let _110: ();
+ let mut _111: u64;
+ let mut _112: S<u64>;
+ let mut _113: u64;
+ let _114: ();
+ let mut _115: u64;
+ let mut _116: u64;
+ let mut _117: u64;
+ let mut _118: u64;
+ let mut _119: u64;
+ let _120: ();
+ let mut _121: u64;
+ let mut _122: u64;
+ let mut _123: u64;
+ let mut _124: u64;
+ let mut _125: u64;
+ let _126: &u64;
+ let _127: ();
+ let mut _128: u64;
+ let mut _129: u64;
+ let mut _130: u64;
+ let _131: ();
+ let mut _132: u64;
+ let mut _133: u64;
+ let mut _134: u64;
+ let _136: ();
+ let mut _137: u64;
+ let mut _138: u64;
+ let mut _139: u64;
+ let _140: ();
+ let mut _141: u64;
+ let mut _142: u64;
+ let mut _143: u64;
+ let _144: ();
+ let _146: ();
+ let mut _147: u64;
+ let mut _148: u64;
+ let mut _149: u64;
+ let _150: ();
+ let mut _151: u64;
+ let mut _152: u64;
+ let mut _153: u64;
+ let _155: ();
+ let mut _156: u64;
+ let mut _157: u64;
+ let mut _158: u64;
+ let _159: ();
+ let mut _160: u64;
+ let mut _161: u64;
+ let mut _162: u64;
+ let _164: ();
+ let mut _165: u64;
+ let mut _166: u64;
+ let mut _167: u64;
+ let _168: ();
+ let mut _169: u64;
+ let mut _170: u64;
+ let mut _171: u64;
+ scope 1 {
+ debug a => _126;
+ let _135: &mut u64;
+ scope 2 {
+ debug b => _135;
+ let _163: &u64;
+ scope 3 {
+ let _145: *const u64;
+ scope 4 {
+ debug c => _145;
+ let _154: *mut u64;
+ scope 5 {
+ debug d => _154;
+ }
+ }
+ }
+ scope 6 {
+ debug e => _163;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+- StorageLive(_5);
++ nop;
+ StorageLive(_6);
+ _6 = _1;
+ StorageLive(_7);
+ _7 = _2;
+- _5 = Add(move _6, move _7);
++ _5 = Add(_1, _2);
+ StorageDead(_7);
+ StorageDead(_6);
+- _4 = opaque::<u64>(move _5) -> [return: bb1, unwind unreachable];
++ _4 = opaque::<u64>(_5) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- StorageDead(_5);
++ nop;
+ StorageDead(_4);
+ StorageLive(_8);
+- StorageLive(_9);
++ nop;
+ StorageLive(_10);
+ _10 = _1;
+ StorageLive(_11);
+ _11 = _2;
+- _9 = Mul(move _10, move _11);
++ _9 = Mul(_1, _2);
+ StorageDead(_11);
+ StorageDead(_10);
+- _8 = opaque::<u64>(move _9) -> [return: bb2, unwind unreachable];
++ _8 = opaque::<u64>(_9) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- StorageDead(_9);
++ nop;
+ StorageDead(_8);
+ StorageLive(_12);
+- StorageLive(_13);
++ nop;
+ StorageLive(_14);
+ _14 = _1;
+ StorageLive(_15);
+ _15 = _2;
+- _13 = Sub(move _14, move _15);
++ _13 = Sub(_1, _2);
+ StorageDead(_15);
+ StorageDead(_14);
+- _12 = opaque::<u64>(move _13) -> [return: bb3, unwind unreachable];
++ _12 = opaque::<u64>(_13) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+- StorageDead(_13);
++ nop;
+ StorageDead(_12);
+ StorageLive(_16);
+- StorageLive(_17);
++ nop;
+ 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);
++ _17 = Div(_1, _2);
+ StorageDead(_19);
+ StorageDead(_18);
+- _16 = opaque::<u64>(move _17) -> [return: bb5, unwind unreachable];
++ _16 = opaque::<u64>(_17) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+- StorageDead(_17);
++ nop;
+ StorageDead(_16);
+ StorageLive(_21);
+- StorageLive(_22);
++ nop;
+ 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];
++ _25 = _20;
++ 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);
++ _22 = Rem(_1, _2);
+ StorageDead(_24);
+ StorageDead(_23);
+- _21 = opaque::<u64>(move _22) -> [return: bb7, unwind unreachable];
++ _21 = opaque::<u64>(_22) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+- StorageDead(_22);
++ nop;
+ StorageDead(_21);
+ StorageLive(_26);
+- StorageLive(_27);
++ nop;
+ StorageLive(_28);
+ _28 = _1;
+ StorageLive(_29);
+ _29 = _2;
+- _27 = BitAnd(move _28, move _29);
++ _27 = BitAnd(_1, _2);
+ StorageDead(_29);
+ StorageDead(_28);
+- _26 = opaque::<u64>(move _27) -> [return: bb8, unwind unreachable];
++ _26 = opaque::<u64>(_27) -> [return: bb8, unwind unreachable];
+ }
+
+ bb8: {
+- StorageDead(_27);
++ nop;
+ StorageDead(_26);
+ StorageLive(_30);
+- StorageLive(_31);
++ nop;
+ StorageLive(_32);
+ _32 = _1;
+ StorageLive(_33);
+ _33 = _2;
+- _31 = BitOr(move _32, move _33);
++ _31 = BitOr(_1, _2);
+ StorageDead(_33);
+ StorageDead(_32);
+- _30 = opaque::<u64>(move _31) -> [return: bb9, unwind unreachable];
++ _30 = opaque::<u64>(_31) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+- StorageDead(_31);
++ nop;
+ StorageDead(_30);
+ StorageLive(_34);
+- StorageLive(_35);
++ nop;
+ StorageLive(_36);
+ _36 = _1;
+ StorageLive(_37);
+ _37 = _2;
+- _35 = BitXor(move _36, move _37);
++ _35 = BitXor(_1, _2);
+ StorageDead(_37);
+ StorageDead(_36);
+- _34 = opaque::<u64>(move _35) -> [return: bb10, unwind unreachable];
++ _34 = opaque::<u64>(_35) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+- StorageDead(_35);
++ nop;
+ StorageDead(_34);
+ StorageLive(_38);
+- StorageLive(_39);
++ nop;
+ StorageLive(_40);
+ _40 = _1;
+ StorageLive(_41);
+ _41 = _2;
+- _39 = Shl(move _40, move _41);
++ _39 = Shl(_1, _2);
+ StorageDead(_41);
+ StorageDead(_40);
+- _38 = opaque::<u64>(move _39) -> [return: bb11, unwind unreachable];
++ _38 = opaque::<u64>(_39) -> [return: bb11, unwind unreachable];
+ }
+
+ bb11: {
+- StorageDead(_39);
++ nop;
+ StorageDead(_38);
+ StorageLive(_42);
+- StorageLive(_43);
++ nop;
+ StorageLive(_44);
+ _44 = _1;
+ StorageLive(_45);
+ _45 = _2;
+- _43 = Shr(move _44, move _45);
++ _43 = Shr(_1, _2);
+ StorageDead(_45);
+ StorageDead(_44);
+- _42 = opaque::<u64>(move _43) -> [return: bb12, unwind unreachable];
++ _42 = opaque::<u64>(_43) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+- StorageDead(_43);
++ nop;
+ StorageDead(_42);
+ StorageLive(_46);
+- StorageLive(_47);
++ nop;
+ StorageLive(_48);
+ _48 = _1;
+- _47 = move _48 as u32 (IntToInt);
++ _47 = _1 as u32 (IntToInt);
+ StorageDead(_48);
+- _46 = opaque::<u32>(move _47) -> [return: bb13, unwind unreachable];
++ _46 = opaque::<u32>(_47) -> [return: bb13, unwind unreachable];
+ }
+
+ bb13: {
+- StorageDead(_47);
++ nop;
+ StorageDead(_46);
+ StorageLive(_49);
+- StorageLive(_50);
++ nop;
+ StorageLive(_51);
+ _51 = _1;
+- _50 = move _51 as f32 (IntToFloat);
++ _50 = _1 as f32 (IntToFloat);
+ StorageDead(_51);
+- _49 = opaque::<f32>(move _50) -> [return: bb14, unwind unreachable];
++ _49 = opaque::<f32>(_50) -> [return: bb14, unwind unreachable];
+ }
+
+ bb14: {
+- StorageDead(_50);
++ nop;
+ StorageDead(_49);
+ StorageLive(_52);
+- StorageLive(_53);
++ nop;
+ StorageLive(_54);
+ _54 = _1;
+- _53 = S::<u64>(move _54);
++ _53 = S::<u64>(_1);
+ StorageDead(_54);
+- _52 = opaque::<S<u64>>(move _53) -> [return: bb15, unwind unreachable];
++ _52 = opaque::<S<u64>>(_53) -> [return: bb15, unwind unreachable];
+ }
+
+ bb15: {
+- StorageDead(_53);
++ nop;
+ StorageDead(_52);
+ StorageLive(_55);
+ StorageLive(_56);
+ StorageLive(_57);
+ StorageLive(_58);
+ _58 = _1;
+- _57 = S::<u64>(move _58);
++ _57 = _53;
+ StorageDead(_58);
+- _56 = (_57.0: u64);
+- _55 = opaque::<u64>(move _56) -> [return: bb16, unwind unreachable];
++ _56 = _1;
++ _55 = opaque::<u64>(_1) -> [return: bb16, unwind unreachable];
+ }
+
+ bb16: {
+ StorageDead(_56);
+ StorageDead(_57);
+ StorageDead(_55);
+ StorageLive(_59);
+ StorageLive(_60);
+ StorageLive(_61);
+ _61 = _1;
+ StorageLive(_62);
+ _62 = _2;
+- _60 = Add(move _61, move _62);
++ _60 = _5;
+ StorageDead(_62);
+ StorageDead(_61);
+- _59 = opaque::<u64>(move _60) -> [return: bb17, unwind unreachable];
++ _59 = opaque::<u64>(_5) -> [return: bb17, unwind unreachable];
+ }
+
+ bb17: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_63);
+ StorageLive(_64);
+ StorageLive(_65);
+ _65 = _1;
+ StorageLive(_66);
+ _66 = _2;
+- _64 = Mul(move _65, move _66);
++ _64 = _9;
+ StorageDead(_66);
+ StorageDead(_65);
+- _63 = opaque::<u64>(move _64) -> [return: bb18, unwind unreachable];
++ _63 = opaque::<u64>(_9) -> [return: bb18, unwind unreachable];
+ }
+
+ bb18: {
+ StorageDead(_64);
+ StorageDead(_63);
+ StorageLive(_67);
+ StorageLive(_68);
+ StorageLive(_69);
+ _69 = _1;
+ StorageLive(_70);
+ _70 = _2;
+- _68 = Sub(move _69, move _70);
++ _68 = _13;
+ StorageDead(_70);
+ StorageDead(_69);
+- _67 = opaque::<u64>(move _68) -> [return: bb19, unwind unreachable];
++ _67 = opaque::<u64>(_13) -> [return: bb19, unwind unreachable];
+ }
+
+ bb19: {
+ StorageDead(_68);
+ StorageDead(_67);
+ StorageLive(_71);
+ StorageLive(_72);
+ StorageLive(_73);
+ _73 = _1;
+ StorageLive(_74);
+ _74 = _2;
+- _75 = Eq(_74, const 0_u64);
+- assert(!move _75, "attempt to divide `{}` by zero", _73) -> [success: bb20, unwind unreachable];
++ _75 = _20;
++ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb20, unwind unreachable];
+ }
+
+ bb20: {
+- _72 = Div(move _73, move _74);
++ _72 = _17;
+ StorageDead(_74);
+ StorageDead(_73);
+- _71 = opaque::<u64>(move _72) -> [return: bb21, unwind unreachable];
++ _71 = opaque::<u64>(_17) -> [return: bb21, unwind unreachable];
+ }
+
+ bb21: {
+ StorageDead(_72);
+ StorageDead(_71);
+ StorageLive(_76);
+ StorageLive(_77);
+ StorageLive(_78);
+ _78 = _1;
+ StorageLive(_79);
+ _79 = _2;
+- _80 = Eq(_79, const 0_u64);
+- assert(!move _80, "attempt to calculate the remainder of `{}` with a divisor of zero", _78) -> [success: bb22, unwind unreachable];
++ _80 = _20;
++ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb22, unwind unreachable];
+ }
+
+ bb22: {
+- _77 = Rem(move _78, move _79);
++ _77 = _22;
+ StorageDead(_79);
+ StorageDead(_78);
+- _76 = opaque::<u64>(move _77) -> [return: bb23, unwind unreachable];
++ _76 = opaque::<u64>(_22) -> [return: bb23, unwind unreachable];
+ }
+
+ bb23: {
+ StorageDead(_77);
+ StorageDead(_76);
+ StorageLive(_81);
+ StorageLive(_82);
+ StorageLive(_83);
+ _83 = _1;
+ StorageLive(_84);
+ _84 = _2;
+- _82 = BitAnd(move _83, move _84);
++ _82 = _27;
+ StorageDead(_84);
+ StorageDead(_83);
+- _81 = opaque::<u64>(move _82) -> [return: bb24, unwind unreachable];
++ _81 = opaque::<u64>(_27) -> [return: bb24, unwind unreachable];
+ }
+
+ bb24: {
+ StorageDead(_82);
+ StorageDead(_81);
+ StorageLive(_85);
+ StorageLive(_86);
+ StorageLive(_87);
+ _87 = _1;
+ StorageLive(_88);
+ _88 = _2;
+- _86 = BitOr(move _87, move _88);
++ _86 = _31;
+ StorageDead(_88);
+ StorageDead(_87);
+- _85 = opaque::<u64>(move _86) -> [return: bb25, unwind unreachable];
++ _85 = opaque::<u64>(_31) -> [return: bb25, unwind unreachable];
+ }
+
+ bb25: {
+ StorageDead(_86);
+ StorageDead(_85);
+ StorageLive(_89);
+ StorageLive(_90);
+ StorageLive(_91);
+ _91 = _1;
+ StorageLive(_92);
+ _92 = _2;
+- _90 = BitXor(move _91, move _92);
++ _90 = _35;
+ StorageDead(_92);
+ StorageDead(_91);
+- _89 = opaque::<u64>(move _90) -> [return: bb26, unwind unreachable];
++ _89 = opaque::<u64>(_35) -> [return: bb26, unwind unreachable];
+ }
+
+ bb26: {
+ StorageDead(_90);
+ StorageDead(_89);
+ StorageLive(_93);
+ StorageLive(_94);
+ StorageLive(_95);
+ _95 = _1;
+ StorageLive(_96);
+ _96 = _2;
+- _94 = Shl(move _95, move _96);
++ _94 = _39;
+ StorageDead(_96);
+ StorageDead(_95);
+- _93 = opaque::<u64>(move _94) -> [return: bb27, unwind unreachable];
++ _93 = opaque::<u64>(_39) -> [return: bb27, unwind unreachable];
+ }
+
+ bb27: {
+ StorageDead(_94);
+ StorageDead(_93);
+ StorageLive(_97);
+ StorageLive(_98);
+ StorageLive(_99);
+ _99 = _1;
+ StorageLive(_100);
+ _100 = _2;
+- _98 = Shr(move _99, move _100);
++ _98 = _43;
+ StorageDead(_100);
+ StorageDead(_99);
+- _97 = opaque::<u64>(move _98) -> [return: bb28, unwind unreachable];
++ _97 = opaque::<u64>(_43) -> [return: bb28, unwind unreachable];
+ }
+
+ bb28: {
+ StorageDead(_98);
+ StorageDead(_97);
+ StorageLive(_101);
+ StorageLive(_102);
+ StorageLive(_103);
+ _103 = _1;
+- _102 = move _103 as u32 (IntToInt);
++ _102 = _47;
+ StorageDead(_103);
+- _101 = opaque::<u32>(move _102) -> [return: bb29, unwind unreachable];
++ _101 = opaque::<u32>(_47) -> [return: bb29, unwind unreachable];
+ }
+
+ bb29: {
+ StorageDead(_102);
+ StorageDead(_101);
+ StorageLive(_104);
+ StorageLive(_105);
+ StorageLive(_106);
+ _106 = _1;
+- _105 = move _106 as f32 (IntToFloat);
++ _105 = _50;
+ StorageDead(_106);
+- _104 = opaque::<f32>(move _105) -> [return: bb30, unwind unreachable];
++ _104 = opaque::<f32>(_50) -> [return: bb30, unwind unreachable];
+ }
+
+ bb30: {
+ StorageDead(_105);
+ StorageDead(_104);
+ StorageLive(_107);
+ StorageLive(_108);
+ StorageLive(_109);
+ _109 = _1;
+- _108 = S::<u64>(move _109);
++ _108 = _53;
+ StorageDead(_109);
+- _107 = opaque::<S<u64>>(move _108) -> [return: bb31, unwind unreachable];
++ _107 = opaque::<S<u64>>(_53) -> [return: bb31, unwind unreachable];
+ }
+
+ bb31: {
+ StorageDead(_108);
+ StorageDead(_107);
+ StorageLive(_110);
+ StorageLive(_111);
+ StorageLive(_112);
+ StorageLive(_113);
+ _113 = _1;
+- _112 = S::<u64>(move _113);
++ _112 = _53;
+ StorageDead(_113);
+- _111 = (_112.0: u64);
+- _110 = opaque::<u64>(move _111) -> [return: bb32, unwind unreachable];
++ _111 = _1;
++ _110 = opaque::<u64>(_1) -> [return: bb32, unwind unreachable];
+ }
+
+ bb32: {
+ StorageDead(_111);
+ StorageDead(_112);
+ StorageDead(_110);
+ StorageLive(_114);
+- StorageLive(_115);
++ nop;
+ StorageLive(_116);
+ StorageLive(_117);
+ _117 = _1;
+ StorageLive(_118);
+ _118 = _2;
+- _116 = Mul(move _117, move _118);
++ _116 = _9;
+ StorageDead(_118);
+ StorageDead(_117);
+ StorageLive(_119);
+ _119 = _2;
+- _115 = Sub(move _116, move _119);
++ _115 = Sub(_9, _2);
+ StorageDead(_119);
+ StorageDead(_116);
+- _114 = opaque::<u64>(move _115) -> [return: bb33, unwind unreachable];
++ _114 = opaque::<u64>(_115) -> [return: bb33, unwind unreachable];
+ }
+
+ bb33: {
+- StorageDead(_115);
++ nop;
+ StorageDead(_114);
+ StorageLive(_120);
+ StorageLive(_121);
+ StorageLive(_122);
+ StorageLive(_123);
+ _123 = _1;
+ StorageLive(_124);
+ _124 = _2;
+- _122 = Mul(move _123, move _124);
++ _122 = _9;
+ StorageDead(_124);
+ StorageDead(_123);
+ StorageLive(_125);
+ _125 = _2;
+- _121 = Sub(move _122, move _125);
++ _121 = _115;
+ StorageDead(_125);
+ StorageDead(_122);
+- _120 = opaque::<u64>(move _121) -> [return: bb34, unwind unreachable];
++ _120 = opaque::<u64>(_115) -> [return: bb34, unwind unreachable];
+ }
+
+ bb34: {
+ StorageDead(_121);
+ StorageDead(_120);
+- StorageLive(_126);
++ nop;
+ _126 = &_3;
+ StorageLive(_127);
+- StorageLive(_128);
+- StorageLive(_129);
++ nop;
++ nop;
+ _129 = (*_126);
+ StorageLive(_130);
+ _130 = _1;
+- _128 = Add(move _129, move _130);
++ _128 = Add(_129, _1);
+ StorageDead(_130);
+- StorageDead(_129);
+- _127 = opaque::<u64>(move _128) -> [return: bb35, unwind unreachable];
++ nop;
++ _127 = opaque::<u64>(_128) -> [return: bb35, unwind unreachable];
+ }
+
+ bb35: {
+- StorageDead(_128);
++ nop;
+ StorageDead(_127);
+ StorageLive(_131);
+ StorageLive(_132);
+ StorageLive(_133);
+- _133 = (*_126);
++ _133 = _129;
+ StorageLive(_134);
+ _134 = _1;
+- _132 = Add(move _133, move _134);
++ _132 = _128;
+ StorageDead(_134);
+ StorageDead(_133);
+- _131 = opaque::<u64>(move _132) -> [return: bb36, unwind unreachable];
++ _131 = opaque::<u64>(_128) -> [return: bb36, unwind unreachable];
+ }
+
+ bb36: {
+ StorageDead(_132);
+ StorageDead(_131);
+- StorageLive(_135);
++ nop;
+ _135 = &mut _3;
+ StorageLive(_136);
+ StorageLive(_137);
+ StorageLive(_138);
+ _138 = (*_135);
+ StorageLive(_139);
+ _139 = _1;
+- _137 = Add(move _138, move _139);
++ _137 = Add(move _138, _1);
+ StorageDead(_139);
+ StorageDead(_138);
+ _136 = opaque::<u64>(move _137) -> [return: bb37, unwind unreachable];
+ }
+
+ bb37: {
+ StorageDead(_137);
+ StorageDead(_136);
+ StorageLive(_140);
+ StorageLive(_141);
+ StorageLive(_142);
+ _142 = (*_135);
+ StorageLive(_143);
+ _143 = _1;
+- _141 = Add(move _142, move _143);
++ _141 = Add(move _142, _1);
+ StorageDead(_143);
+ StorageDead(_142);
+ _140 = opaque::<u64>(move _141) -> [return: bb38, unwind unreachable];
+ }
+
+ bb38: {
+ StorageDead(_141);
+ StorageDead(_140);
+ StorageLive(_144);
+- StorageLive(_145);
++ nop;
+ _145 = &raw const _3;
+ StorageLive(_146);
+ StorageLive(_147);
+ StorageLive(_148);
+ _148 = (*_145);
+ StorageLive(_149);
+ _149 = _1;
+- _147 = Add(move _148, move _149);
++ _147 = Add(move _148, _1);
+ StorageDead(_149);
+ StorageDead(_148);
+ _146 = opaque::<u64>(move _147) -> [return: bb39, unwind unreachable];
+ }
+
+ bb39: {
+ StorageDead(_147);
+ StorageDead(_146);
+ StorageLive(_150);
+ StorageLive(_151);
+ StorageLive(_152);
+ _152 = (*_145);
+ StorageLive(_153);
+ _153 = _1;
+- _151 = Add(move _152, move _153);
++ _151 = Add(move _152, _1);
+ StorageDead(_153);
+ StorageDead(_152);
+ _150 = opaque::<u64>(move _151) -> [return: bb40, unwind unreachable];
+ }
+
+ bb40: {
+ StorageDead(_151);
+ StorageDead(_150);
+- StorageLive(_154);
++ nop;
+ _154 = &raw mut _3;
+ StorageLive(_155);
+ StorageLive(_156);
+ StorageLive(_157);
+ _157 = (*_154);
+ StorageLive(_158);
+ _158 = _1;
+- _156 = Add(move _157, move _158);
++ _156 = Add(move _157, _1);
+ StorageDead(_158);
+ StorageDead(_157);
+ _155 = opaque::<u64>(move _156) -> [return: bb41, unwind unreachable];
+ }
+
+ bb41: {
+ StorageDead(_156);
+ StorageDead(_155);
+ StorageLive(_159);
+ StorageLive(_160);
+ StorageLive(_161);
+ _161 = (*_154);
+ StorageLive(_162);
+ _162 = _1;
+- _160 = Add(move _161, move _162);
++ _160 = Add(move _161, _1);
+ StorageDead(_162);
+ StorageDead(_161);
+ _159 = opaque::<u64>(move _160) -> [return: bb42, unwind unreachable];
+ }
+
+ bb42: {
+ StorageDead(_160);
+ StorageDead(_159);
+ _144 = const ();
+- StorageDead(_154);
+- StorageDead(_145);
++ nop;
++ nop;
+ StorageDead(_144);
+- StorageLive(_163);
++ nop;
+ _163 = &_3;
+ StorageLive(_164);
+- StorageLive(_165);
+- StorageLive(_166);
++ nop;
++ nop;
+ _166 = (*_163);
+ StorageLive(_167);
+ _167 = _1;
+- _165 = Add(move _166, move _167);
++ _165 = Add(_166, _1);
+ StorageDead(_167);
+- StorageDead(_166);
+- _164 = opaque::<u64>(move _165) -> [return: bb43, unwind unreachable];
++ nop;
++ _164 = opaque::<u64>(_165) -> [return: bb43, unwind unreachable];
+ }
+
+ bb43: {
+- StorageDead(_165);
++ nop;
+ StorageDead(_164);
+ StorageLive(_168);
+ StorageLive(_169);
+ StorageLive(_170);
+- _170 = (*_163);
++ _170 = _166;
+ StorageLive(_171);
+ _171 = _1;
+- _169 = Add(move _170, move _171);
++ _169 = _165;
+ StorageDead(_171);
+ StorageDead(_170);
+- _168 = opaque::<u64>(move _169) -> [return: bb44, unwind unreachable];
++ _168 = opaque::<u64>(_165) -> [return: bb44, unwind unreachable];
+ }
+
+ bb44: {
+ StorageDead(_169);
+ StorageDead(_168);
+ _0 = const ();
+- StorageDead(_163);
+- StorageDead(_135);
+- StorageDead(_126);
++ nop;
++ nop;
++ nop;
+ 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..119a4d9bb
--- /dev/null
+++ b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff
@@ -0,0 +1,966 @@
+- // 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 _63: ();
+ let mut _64: u64;
+ let mut _65: u64;
+ let mut _66: u64;
+ let _67: ();
+ 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: bool;
+ let _76: ();
+ let mut _77: u64;
+ let mut _78: u64;
+ let mut _79: u64;
+ let mut _80: bool;
+ let _81: ();
+ let mut _82: u64;
+ let mut _83: u64;
+ let mut _84: u64;
+ let _85: ();
+ let mut _86: u64;
+ let mut _87: u64;
+ let mut _88: u64;
+ let _89: ();
+ let mut _90: u64;
+ let mut _91: u64;
+ let mut _92: u64;
+ let _93: ();
+ 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 _101: ();
+ let mut _102: u32;
+ let mut _103: u64;
+ let _104: ();
+ let mut _105: f32;
+ let mut _106: u64;
+ let _107: ();
+ let mut _108: S<u64>;
+ let mut _109: u64;
+ let _110: ();
+ let mut _111: u64;
+ let mut _112: S<u64>;
+ let mut _113: u64;
+ let _114: ();
+ let mut _115: u64;
+ let mut _116: u64;
+ let mut _117: u64;
+ let mut _118: u64;
+ let mut _119: u64;
+ let _120: ();
+ let mut _121: u64;
+ let mut _122: u64;
+ let mut _123: u64;
+ let mut _124: u64;
+ let mut _125: u64;
+ let _126: &u64;
+ let _127: ();
+ let mut _128: u64;
+ let mut _129: u64;
+ let mut _130: u64;
+ let _131: ();
+ let mut _132: u64;
+ let mut _133: u64;
+ let mut _134: u64;
+ let _136: ();
+ let mut _137: u64;
+ let mut _138: u64;
+ let mut _139: u64;
+ let _140: ();
+ let mut _141: u64;
+ let mut _142: u64;
+ let mut _143: u64;
+ let _144: ();
+ let _146: ();
+ let mut _147: u64;
+ let mut _148: u64;
+ let mut _149: u64;
+ let _150: ();
+ let mut _151: u64;
+ let mut _152: u64;
+ let mut _153: u64;
+ let _155: ();
+ let mut _156: u64;
+ let mut _157: u64;
+ let mut _158: u64;
+ let _159: ();
+ let mut _160: u64;
+ let mut _161: u64;
+ let mut _162: u64;
+ let _164: ();
+ let mut _165: u64;
+ let mut _166: u64;
+ let mut _167: u64;
+ let _168: ();
+ let mut _169: u64;
+ let mut _170: u64;
+ let mut _171: u64;
+ scope 1 {
+ debug a => _126;
+ let _135: &mut u64;
+ scope 2 {
+ debug b => _135;
+ let _163: &u64;
+ scope 3 {
+ let _145: *const u64;
+ scope 4 {
+ debug c => _145;
+ let _154: *mut u64;
+ scope 5 {
+ debug d => _154;
+ }
+ }
+ }
+ scope 6 {
+ debug e => _163;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+- StorageLive(_5);
++ nop;
+ StorageLive(_6);
+ _6 = _1;
+ StorageLive(_7);
+ _7 = _2;
+- _5 = Add(move _6, move _7);
++ _5 = Add(_1, _2);
+ StorageDead(_7);
+ StorageDead(_6);
+- _4 = opaque::<u64>(move _5) -> [return: bb1, unwind continue];
++ _4 = opaque::<u64>(_5) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- StorageDead(_5);
++ nop;
+ StorageDead(_4);
+ StorageLive(_8);
+- StorageLive(_9);
++ nop;
+ StorageLive(_10);
+ _10 = _1;
+ StorageLive(_11);
+ _11 = _2;
+- _9 = Mul(move _10, move _11);
++ _9 = Mul(_1, _2);
+ StorageDead(_11);
+ StorageDead(_10);
+- _8 = opaque::<u64>(move _9) -> [return: bb2, unwind continue];
++ _8 = opaque::<u64>(_9) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+- StorageDead(_9);
++ nop;
+ StorageDead(_8);
+ StorageLive(_12);
+- StorageLive(_13);
++ nop;
+ StorageLive(_14);
+ _14 = _1;
+ StorageLive(_15);
+ _15 = _2;
+- _13 = Sub(move _14, move _15);
++ _13 = Sub(_1, _2);
+ StorageDead(_15);
+ StorageDead(_14);
+- _12 = opaque::<u64>(move _13) -> [return: bb3, unwind continue];
++ _12 = opaque::<u64>(_13) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+- StorageDead(_13);
++ nop;
+ StorageDead(_12);
+ StorageLive(_16);
+- StorageLive(_17);
++ nop;
+ 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);
++ _17 = Div(_1, _2);
+ StorageDead(_19);
+ StorageDead(_18);
+- _16 = opaque::<u64>(move _17) -> [return: bb5, unwind continue];
++ _16 = opaque::<u64>(_17) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+- StorageDead(_17);
++ nop;
+ StorageDead(_16);
+ StorageLive(_21);
+- StorageLive(_22);
++ nop;
+ 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];
++ _25 = _20;
++ 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);
++ _22 = Rem(_1, _2);
+ StorageDead(_24);
+ StorageDead(_23);
+- _21 = opaque::<u64>(move _22) -> [return: bb7, unwind continue];
++ _21 = opaque::<u64>(_22) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+- StorageDead(_22);
++ nop;
+ StorageDead(_21);
+ StorageLive(_26);
+- StorageLive(_27);
++ nop;
+ StorageLive(_28);
+ _28 = _1;
+ StorageLive(_29);
+ _29 = _2;
+- _27 = BitAnd(move _28, move _29);
++ _27 = BitAnd(_1, _2);
+ StorageDead(_29);
+ StorageDead(_28);
+- _26 = opaque::<u64>(move _27) -> [return: bb8, unwind continue];
++ _26 = opaque::<u64>(_27) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+- StorageDead(_27);
++ nop;
+ StorageDead(_26);
+ StorageLive(_30);
+- StorageLive(_31);
++ nop;
+ StorageLive(_32);
+ _32 = _1;
+ StorageLive(_33);
+ _33 = _2;
+- _31 = BitOr(move _32, move _33);
++ _31 = BitOr(_1, _2);
+ StorageDead(_33);
+ StorageDead(_32);
+- _30 = opaque::<u64>(move _31) -> [return: bb9, unwind continue];
++ _30 = opaque::<u64>(_31) -> [return: bb9, unwind continue];
+ }
+
+ bb9: {
+- StorageDead(_31);
++ nop;
+ StorageDead(_30);
+ StorageLive(_34);
+- StorageLive(_35);
++ nop;
+ StorageLive(_36);
+ _36 = _1;
+ StorageLive(_37);
+ _37 = _2;
+- _35 = BitXor(move _36, move _37);
++ _35 = BitXor(_1, _2);
+ StorageDead(_37);
+ StorageDead(_36);
+- _34 = opaque::<u64>(move _35) -> [return: bb10, unwind continue];
++ _34 = opaque::<u64>(_35) -> [return: bb10, unwind continue];
+ }
+
+ bb10: {
+- StorageDead(_35);
++ nop;
+ StorageDead(_34);
+ StorageLive(_38);
+- StorageLive(_39);
++ nop;
+ StorageLive(_40);
+ _40 = _1;
+ StorageLive(_41);
+ _41 = _2;
+- _39 = Shl(move _40, move _41);
++ _39 = Shl(_1, _2);
+ StorageDead(_41);
+ StorageDead(_40);
+- _38 = opaque::<u64>(move _39) -> [return: bb11, unwind continue];
++ _38 = opaque::<u64>(_39) -> [return: bb11, unwind continue];
+ }
+
+ bb11: {
+- StorageDead(_39);
++ nop;
+ StorageDead(_38);
+ StorageLive(_42);
+- StorageLive(_43);
++ nop;
+ StorageLive(_44);
+ _44 = _1;
+ StorageLive(_45);
+ _45 = _2;
+- _43 = Shr(move _44, move _45);
++ _43 = Shr(_1, _2);
+ StorageDead(_45);
+ StorageDead(_44);
+- _42 = opaque::<u64>(move _43) -> [return: bb12, unwind continue];
++ _42 = opaque::<u64>(_43) -> [return: bb12, unwind continue];
+ }
+
+ bb12: {
+- StorageDead(_43);
++ nop;
+ StorageDead(_42);
+ StorageLive(_46);
+- StorageLive(_47);
++ nop;
+ StorageLive(_48);
+ _48 = _1;
+- _47 = move _48 as u32 (IntToInt);
++ _47 = _1 as u32 (IntToInt);
+ StorageDead(_48);
+- _46 = opaque::<u32>(move _47) -> [return: bb13, unwind continue];
++ _46 = opaque::<u32>(_47) -> [return: bb13, unwind continue];
+ }
+
+ bb13: {
+- StorageDead(_47);
++ nop;
+ StorageDead(_46);
+ StorageLive(_49);
+- StorageLive(_50);
++ nop;
+ StorageLive(_51);
+ _51 = _1;
+- _50 = move _51 as f32 (IntToFloat);
++ _50 = _1 as f32 (IntToFloat);
+ StorageDead(_51);
+- _49 = opaque::<f32>(move _50) -> [return: bb14, unwind continue];
++ _49 = opaque::<f32>(_50) -> [return: bb14, unwind continue];
+ }
+
+ bb14: {
+- StorageDead(_50);
++ nop;
+ StorageDead(_49);
+ StorageLive(_52);
+- StorageLive(_53);
++ nop;
+ StorageLive(_54);
+ _54 = _1;
+- _53 = S::<u64>(move _54);
++ _53 = S::<u64>(_1);
+ StorageDead(_54);
+- _52 = opaque::<S<u64>>(move _53) -> [return: bb15, unwind continue];
++ _52 = opaque::<S<u64>>(_53) -> [return: bb15, unwind continue];
+ }
+
+ bb15: {
+- StorageDead(_53);
++ nop;
+ StorageDead(_52);
+ StorageLive(_55);
+ StorageLive(_56);
+ StorageLive(_57);
+ StorageLive(_58);
+ _58 = _1;
+- _57 = S::<u64>(move _58);
++ _57 = _53;
+ StorageDead(_58);
+- _56 = (_57.0: u64);
+- _55 = opaque::<u64>(move _56) -> [return: bb16, unwind continue];
++ _56 = _1;
++ _55 = opaque::<u64>(_1) -> [return: bb16, unwind continue];
+ }
+
+ bb16: {
+ StorageDead(_56);
+ StorageDead(_57);
+ StorageDead(_55);
+ StorageLive(_59);
+ StorageLive(_60);
+ StorageLive(_61);
+ _61 = _1;
+ StorageLive(_62);
+ _62 = _2;
+- _60 = Add(move _61, move _62);
++ _60 = _5;
+ StorageDead(_62);
+ StorageDead(_61);
+- _59 = opaque::<u64>(move _60) -> [return: bb17, unwind continue];
++ _59 = opaque::<u64>(_5) -> [return: bb17, unwind continue];
+ }
+
+ bb17: {
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageLive(_63);
+ StorageLive(_64);
+ StorageLive(_65);
+ _65 = _1;
+ StorageLive(_66);
+ _66 = _2;
+- _64 = Mul(move _65, move _66);
++ _64 = _9;
+ StorageDead(_66);
+ StorageDead(_65);
+- _63 = opaque::<u64>(move _64) -> [return: bb18, unwind continue];
++ _63 = opaque::<u64>(_9) -> [return: bb18, unwind continue];
+ }
+
+ bb18: {
+ StorageDead(_64);
+ StorageDead(_63);
+ StorageLive(_67);
+ StorageLive(_68);
+ StorageLive(_69);
+ _69 = _1;
+ StorageLive(_70);
+ _70 = _2;
+- _68 = Sub(move _69, move _70);
++ _68 = _13;
+ StorageDead(_70);
+ StorageDead(_69);
+- _67 = opaque::<u64>(move _68) -> [return: bb19, unwind continue];
++ _67 = opaque::<u64>(_13) -> [return: bb19, unwind continue];
+ }
+
+ bb19: {
+ StorageDead(_68);
+ StorageDead(_67);
+ StorageLive(_71);
+ StorageLive(_72);
+ StorageLive(_73);
+ _73 = _1;
+ StorageLive(_74);
+ _74 = _2;
+- _75 = Eq(_74, const 0_u64);
+- assert(!move _75, "attempt to divide `{}` by zero", _73) -> [success: bb20, unwind continue];
++ _75 = _20;
++ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb20, unwind continue];
+ }
+
+ bb20: {
+- _72 = Div(move _73, move _74);
++ _72 = _17;
+ StorageDead(_74);
+ StorageDead(_73);
+- _71 = opaque::<u64>(move _72) -> [return: bb21, unwind continue];
++ _71 = opaque::<u64>(_17) -> [return: bb21, unwind continue];
+ }
+
+ bb21: {
+ StorageDead(_72);
+ StorageDead(_71);
+ StorageLive(_76);
+ StorageLive(_77);
+ StorageLive(_78);
+ _78 = _1;
+ StorageLive(_79);
+ _79 = _2;
+- _80 = Eq(_79, const 0_u64);
+- assert(!move _80, "attempt to calculate the remainder of `{}` with a divisor of zero", _78) -> [success: bb22, unwind continue];
++ _80 = _20;
++ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb22, unwind continue];
+ }
+
+ bb22: {
+- _77 = Rem(move _78, move _79);
++ _77 = _22;
+ StorageDead(_79);
+ StorageDead(_78);
+- _76 = opaque::<u64>(move _77) -> [return: bb23, unwind continue];
++ _76 = opaque::<u64>(_22) -> [return: bb23, unwind continue];
+ }
+
+ bb23: {
+ StorageDead(_77);
+ StorageDead(_76);
+ StorageLive(_81);
+ StorageLive(_82);
+ StorageLive(_83);
+ _83 = _1;
+ StorageLive(_84);
+ _84 = _2;
+- _82 = BitAnd(move _83, move _84);
++ _82 = _27;
+ StorageDead(_84);
+ StorageDead(_83);
+- _81 = opaque::<u64>(move _82) -> [return: bb24, unwind continue];
++ _81 = opaque::<u64>(_27) -> [return: bb24, unwind continue];
+ }
+
+ bb24: {
+ StorageDead(_82);
+ StorageDead(_81);
+ StorageLive(_85);
+ StorageLive(_86);
+ StorageLive(_87);
+ _87 = _1;
+ StorageLive(_88);
+ _88 = _2;
+- _86 = BitOr(move _87, move _88);
++ _86 = _31;
+ StorageDead(_88);
+ StorageDead(_87);
+- _85 = opaque::<u64>(move _86) -> [return: bb25, unwind continue];
++ _85 = opaque::<u64>(_31) -> [return: bb25, unwind continue];
+ }
+
+ bb25: {
+ StorageDead(_86);
+ StorageDead(_85);
+ StorageLive(_89);
+ StorageLive(_90);
+ StorageLive(_91);
+ _91 = _1;
+ StorageLive(_92);
+ _92 = _2;
+- _90 = BitXor(move _91, move _92);
++ _90 = _35;
+ StorageDead(_92);
+ StorageDead(_91);
+- _89 = opaque::<u64>(move _90) -> [return: bb26, unwind continue];
++ _89 = opaque::<u64>(_35) -> [return: bb26, unwind continue];
+ }
+
+ bb26: {
+ StorageDead(_90);
+ StorageDead(_89);
+ StorageLive(_93);
+ StorageLive(_94);
+ StorageLive(_95);
+ _95 = _1;
+ StorageLive(_96);
+ _96 = _2;
+- _94 = Shl(move _95, move _96);
++ _94 = _39;
+ StorageDead(_96);
+ StorageDead(_95);
+- _93 = opaque::<u64>(move _94) -> [return: bb27, unwind continue];
++ _93 = opaque::<u64>(_39) -> [return: bb27, unwind continue];
+ }
+
+ bb27: {
+ StorageDead(_94);
+ StorageDead(_93);
+ StorageLive(_97);
+ StorageLive(_98);
+ StorageLive(_99);
+ _99 = _1;
+ StorageLive(_100);
+ _100 = _2;
+- _98 = Shr(move _99, move _100);
++ _98 = _43;
+ StorageDead(_100);
+ StorageDead(_99);
+- _97 = opaque::<u64>(move _98) -> [return: bb28, unwind continue];
++ _97 = opaque::<u64>(_43) -> [return: bb28, unwind continue];
+ }
+
+ bb28: {
+ StorageDead(_98);
+ StorageDead(_97);
+ StorageLive(_101);
+ StorageLive(_102);
+ StorageLive(_103);
+ _103 = _1;
+- _102 = move _103 as u32 (IntToInt);
++ _102 = _47;
+ StorageDead(_103);
+- _101 = opaque::<u32>(move _102) -> [return: bb29, unwind continue];
++ _101 = opaque::<u32>(_47) -> [return: bb29, unwind continue];
+ }
+
+ bb29: {
+ StorageDead(_102);
+ StorageDead(_101);
+ StorageLive(_104);
+ StorageLive(_105);
+ StorageLive(_106);
+ _106 = _1;
+- _105 = move _106 as f32 (IntToFloat);
++ _105 = _50;
+ StorageDead(_106);
+- _104 = opaque::<f32>(move _105) -> [return: bb30, unwind continue];
++ _104 = opaque::<f32>(_50) -> [return: bb30, unwind continue];
+ }
+
+ bb30: {
+ StorageDead(_105);
+ StorageDead(_104);
+ StorageLive(_107);
+ StorageLive(_108);
+ StorageLive(_109);
+ _109 = _1;
+- _108 = S::<u64>(move _109);
++ _108 = _53;
+ StorageDead(_109);
+- _107 = opaque::<S<u64>>(move _108) -> [return: bb31, unwind continue];
++ _107 = opaque::<S<u64>>(_53) -> [return: bb31, unwind continue];
+ }
+
+ bb31: {
+ StorageDead(_108);
+ StorageDead(_107);
+ StorageLive(_110);
+ StorageLive(_111);
+ StorageLive(_112);
+ StorageLive(_113);
+ _113 = _1;
+- _112 = S::<u64>(move _113);
++ _112 = _53;
+ StorageDead(_113);
+- _111 = (_112.0: u64);
+- _110 = opaque::<u64>(move _111) -> [return: bb32, unwind continue];
++ _111 = _1;
++ _110 = opaque::<u64>(_1) -> [return: bb32, unwind continue];
+ }
+
+ bb32: {
+ StorageDead(_111);
+ StorageDead(_112);
+ StorageDead(_110);
+ StorageLive(_114);
+- StorageLive(_115);
++ nop;
+ StorageLive(_116);
+ StorageLive(_117);
+ _117 = _1;
+ StorageLive(_118);
+ _118 = _2;
+- _116 = Mul(move _117, move _118);
++ _116 = _9;
+ StorageDead(_118);
+ StorageDead(_117);
+ StorageLive(_119);
+ _119 = _2;
+- _115 = Sub(move _116, move _119);
++ _115 = Sub(_9, _2);
+ StorageDead(_119);
+ StorageDead(_116);
+- _114 = opaque::<u64>(move _115) -> [return: bb33, unwind continue];
++ _114 = opaque::<u64>(_115) -> [return: bb33, unwind continue];
+ }
+
+ bb33: {
+- StorageDead(_115);
++ nop;
+ StorageDead(_114);
+ StorageLive(_120);
+ StorageLive(_121);
+ StorageLive(_122);
+ StorageLive(_123);
+ _123 = _1;
+ StorageLive(_124);
+ _124 = _2;
+- _122 = Mul(move _123, move _124);
++ _122 = _9;
+ StorageDead(_124);
+ StorageDead(_123);
+ StorageLive(_125);
+ _125 = _2;
+- _121 = Sub(move _122, move _125);
++ _121 = _115;
+ StorageDead(_125);
+ StorageDead(_122);
+- _120 = opaque::<u64>(move _121) -> [return: bb34, unwind continue];
++ _120 = opaque::<u64>(_115) -> [return: bb34, unwind continue];
+ }
+
+ bb34: {
+ StorageDead(_121);
+ StorageDead(_120);
+- StorageLive(_126);
++ nop;
+ _126 = &_3;
+ StorageLive(_127);
+- StorageLive(_128);
+- StorageLive(_129);
++ nop;
++ nop;
+ _129 = (*_126);
+ StorageLive(_130);
+ _130 = _1;
+- _128 = Add(move _129, move _130);
++ _128 = Add(_129, _1);
+ StorageDead(_130);
+- StorageDead(_129);
+- _127 = opaque::<u64>(move _128) -> [return: bb35, unwind continue];
++ nop;
++ _127 = opaque::<u64>(_128) -> [return: bb35, unwind continue];
+ }
+
+ bb35: {
+- StorageDead(_128);
++ nop;
+ StorageDead(_127);
+ StorageLive(_131);
+ StorageLive(_132);
+ StorageLive(_133);
+- _133 = (*_126);
++ _133 = _129;
+ StorageLive(_134);
+ _134 = _1;
+- _132 = Add(move _133, move _134);
++ _132 = _128;
+ StorageDead(_134);
+ StorageDead(_133);
+- _131 = opaque::<u64>(move _132) -> [return: bb36, unwind continue];
++ _131 = opaque::<u64>(_128) -> [return: bb36, unwind continue];
+ }
+
+ bb36: {
+ StorageDead(_132);
+ StorageDead(_131);
+- StorageLive(_135);
++ nop;
+ _135 = &mut _3;
+ StorageLive(_136);
+ StorageLive(_137);
+ StorageLive(_138);
+ _138 = (*_135);
+ StorageLive(_139);
+ _139 = _1;
+- _137 = Add(move _138, move _139);
++ _137 = Add(move _138, _1);
+ StorageDead(_139);
+ StorageDead(_138);
+ _136 = opaque::<u64>(move _137) -> [return: bb37, unwind continue];
+ }
+
+ bb37: {
+ StorageDead(_137);
+ StorageDead(_136);
+ StorageLive(_140);
+ StorageLive(_141);
+ StorageLive(_142);
+ _142 = (*_135);
+ StorageLive(_143);
+ _143 = _1;
+- _141 = Add(move _142, move _143);
++ _141 = Add(move _142, _1);
+ StorageDead(_143);
+ StorageDead(_142);
+ _140 = opaque::<u64>(move _141) -> [return: bb38, unwind continue];
+ }
+
+ bb38: {
+ StorageDead(_141);
+ StorageDead(_140);
+ StorageLive(_144);
+- StorageLive(_145);
++ nop;
+ _145 = &raw const _3;
+ StorageLive(_146);
+ StorageLive(_147);
+ StorageLive(_148);
+ _148 = (*_145);
+ StorageLive(_149);
+ _149 = _1;
+- _147 = Add(move _148, move _149);
++ _147 = Add(move _148, _1);
+ StorageDead(_149);
+ StorageDead(_148);
+ _146 = opaque::<u64>(move _147) -> [return: bb39, unwind continue];
+ }
+
+ bb39: {
+ StorageDead(_147);
+ StorageDead(_146);
+ StorageLive(_150);
+ StorageLive(_151);
+ StorageLive(_152);
+ _152 = (*_145);
+ StorageLive(_153);
+ _153 = _1;
+- _151 = Add(move _152, move _153);
++ _151 = Add(move _152, _1);
+ StorageDead(_153);
+ StorageDead(_152);
+ _150 = opaque::<u64>(move _151) -> [return: bb40, unwind continue];
+ }
+
+ bb40: {
+ StorageDead(_151);
+ StorageDead(_150);
+- StorageLive(_154);
++ nop;
+ _154 = &raw mut _3;
+ StorageLive(_155);
+ StorageLive(_156);
+ StorageLive(_157);
+ _157 = (*_154);
+ StorageLive(_158);
+ _158 = _1;
+- _156 = Add(move _157, move _158);
++ _156 = Add(move _157, _1);
+ StorageDead(_158);
+ StorageDead(_157);
+ _155 = opaque::<u64>(move _156) -> [return: bb41, unwind continue];
+ }
+
+ bb41: {
+ StorageDead(_156);
+ StorageDead(_155);
+ StorageLive(_159);
+ StorageLive(_160);
+ StorageLive(_161);
+ _161 = (*_154);
+ StorageLive(_162);
+ _162 = _1;
+- _160 = Add(move _161, move _162);
++ _160 = Add(move _161, _1);
+ StorageDead(_162);
+ StorageDead(_161);
+ _159 = opaque::<u64>(move _160) -> [return: bb42, unwind continue];
+ }
+
+ bb42: {
+ StorageDead(_160);
+ StorageDead(_159);
+ _144 = const ();
+- StorageDead(_154);
+- StorageDead(_145);
++ nop;
++ nop;
+ StorageDead(_144);
+- StorageLive(_163);
++ nop;
+ _163 = &_3;
+ StorageLive(_164);
+- StorageLive(_165);
+- StorageLive(_166);
++ nop;
++ nop;
+ _166 = (*_163);
+ StorageLive(_167);
+ _167 = _1;
+- _165 = Add(move _166, move _167);
++ _165 = Add(_166, _1);
+ StorageDead(_167);
+- StorageDead(_166);
+- _164 = opaque::<u64>(move _165) -> [return: bb43, unwind continue];
++ nop;
++ _164 = opaque::<u64>(_165) -> [return: bb43, unwind continue];
+ }
+
+ bb43: {
+- StorageDead(_165);
++ nop;
+ StorageDead(_164);
+ StorageLive(_168);
+ StorageLive(_169);
+ StorageLive(_170);
+- _170 = (*_163);
++ _170 = _166;
+ StorageLive(_171);
+ _171 = _1;
+- _169 = Add(move _170, move _171);
++ _169 = _165;
+ StorageDead(_171);
+ StorageDead(_170);
+- _168 = opaque::<u64>(move _169) -> [return: bb44, unwind continue];
++ _168 = opaque::<u64>(_165) -> [return: bb44, unwind continue];
+ }
+
+ bb44: {
+ StorageDead(_169);
+ StorageDead(_168);
+ _0 = const ();
+- StorageDead(_163);
+- StorageDead(_135);
+- StorageDead(_126);
++ nop;
++ nop;
++ nop;
+ 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..62710ba8f
--- /dev/null
+++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff
@@ -0,0 +1,49 @@
+- // 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);
++ _2 = Option::<T>::Some(_1);
+ StorageDead(_3);
+- _4 = discriminant(_2);
+- switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
++ _4 = const 1_isize;
++ switchInt(const 1_isize) -> [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;
++ _5 = _1;
++ _0 = _1;
+ 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..ad46a065b
--- /dev/null
+++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff
@@ -0,0 +1,49 @@
+- // 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);
++ _2 = Option::<T>::Some(_1);
+ StorageDead(_3);
+- _4 = discriminant(_2);
+- switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
++ _4 = const 1_isize;
++ switchInt(const 1_isize) -> [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;
++ _5 = _1;
++ _0 = _1;
+ StorageDead(_5);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff
index de4235c9e..083515aeb 100644
--- a/tests/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff
@@ -2,29 +2,29 @@
+ // MIR for `dont_opt_bool` after SimplifyComparisonIntegral
fn dont_opt_bool(_1: bool) -> u32 {
- debug x => _1; // in scope 0 at $DIR/if_condition_int.rs:+0:18: +0:19
- let mut _0: u32; // return place in scope 0 at $DIR/if_condition_int.rs:+0:30: +0:33
- let mut _2: bool; // in scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
- _2 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
+ StorageLive(_2);
+ _2 = _1;
+ switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
- _0 = const 0_u32; // scope 0 at $DIR/if_condition_int.rs:+1:12: +1:13
- goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:26
+ _0 = const 0_u32;
+ goto -> bb3;
}
bb2: {
- _0 = const 1_u32; // scope 0 at $DIR/if_condition_int.rs:+1:23: +1:24
- goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:26
+ _0 = const 1_u32;
+ goto -> bb3;
}
bb3: {
- StorageDead(_2); // scope 0 at $DIR/if_condition_int.rs:+1:25: +1:26
- return; // scope 0 at $DIR/if_condition_int.rs:+2:2: +2:2
+ 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 754c6579a..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
@@ -2,33 +2,34 @@
+ // MIR for `dont_opt_floats` after SimplifyComparisonIntegral
fn dont_opt_floats(_1: f32) -> i32 {
- debug a => _1; // in scope 0 at $DIR/if_condition_int.rs:+0:20: +0:21
- let mut _0: i32; // return place in scope 0 at $DIR/if_condition_int.rs:+0:31: +0:34
- let mut _2: bool; // in scope 0 at $DIR/if_condition_int.rs:+1:8: +1:18
- let mut _3: f32; // in scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
+ debug a => _1;
+ let mut _0: i32;
+ let mut _2: bool;
+ let mut _3: f32;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:18
- StorageLive(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
- _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
- _2 = Eq(move _3, const -42f32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:18
- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:17: +1:18
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:18
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _2 = Eq(move _3, const -42f32);
+ switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
- _0 = const 0_i32; // scope 0 at $DIR/if_condition_int.rs:+1:21: +1:22
- goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:35
+ StorageDead(_3);
+ _0 = const 0_i32;
+ goto -> bb3;
}
bb2: {
- _0 = const 1_i32; // scope 0 at $DIR/if_condition_int.rs:+1:32: +1:33
- goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:35
+ StorageDead(_3);
+ _0 = const 1_i32;
+ goto -> bb3;
}
bb3: {
- StorageDead(_2); // scope 0 at $DIR/if_condition_int.rs:+1:34: +1:35
- return; // scope 0 at $DIR/if_condition_int.rs:+2:2: +2:2
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/if_condition_int.dont_remove_comparison.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.dont_remove_comparison.SimplifyComparisonIntegral.diff
index ff23839e2..218d7fd59 100644
--- a/tests/mir-opt/if_condition_int.dont_remove_comparison.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.dont_remove_comparison.SimplifyComparisonIntegral.diff
@@ -2,57 +2,57 @@
+ // MIR for `dont_remove_comparison` after SimplifyComparisonIntegral
fn dont_remove_comparison(_1: i8) -> i32 {
- debug a => _1; // in scope 0 at $DIR/if_condition_int.rs:+0:27: +0:28
- let mut _0: i32; // return place in scope 0 at $DIR/if_condition_int.rs:+0:37: +0:40
- let _2: bool; // in scope 0 at $DIR/if_condition_int.rs:+1:9: +1:10
- let mut _3: i8; // in scope 0 at $DIR/if_condition_int.rs:+1:13: +1:14
- let mut _4: i32; // in scope 0 at $DIR/if_condition_int.rs:+3:23: +3:31
- let mut _5: bool; // in scope 0 at $DIR/if_condition_int.rs:+3:23: +3:24
- let mut _6: i32; // in scope 0 at $DIR/if_condition_int.rs:+4:23: +4:31
- let mut _7: bool; // in scope 0 at $DIR/if_condition_int.rs:+4:23: +4:24
+ debug a => _1;
+ let mut _0: i32;
+ let _2: bool;
+ let mut _3: i8;
+ let mut _4: i32;
+ let mut _5: bool;
+ let mut _6: i32;
+ let mut _7: bool;
scope 1 {
- debug b => _2; // in scope 1 at $DIR/if_condition_int.rs:+1:9: +1:10
+ debug b => _2;
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/if_condition_int.rs:+1:9: +1:10
- StorageLive(_3); // scope 0 at $DIR/if_condition_int.rs:+1:13: +1:14
- _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:13: +1:14
-- _2 = Eq(move _3, const 17_i8); // scope 0 at $DIR/if_condition_int.rs:+1:13: +1:20
-- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:19: +1:20
-- switchInt(_2) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/if_condition_int.rs:+2:5: +2:12
-+ _2 = Eq(_3, const 17_i8); // scope 0 at $DIR/if_condition_int.rs:+1:13: +1:20
-+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:19: +1:20
-+ switchInt(move _3) -> [17: bb1, otherwise: bb2]; // scope 1 at $DIR/if_condition_int.rs:+2:5: +2:12
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Eq(move _3, const 17_i8);
+- StorageDead(_3);
+- switchInt(_2) -> [0: bb2, otherwise: bb1];
++ _2 = Eq(_3, const 17_i8);
++ nop;
++ switchInt(move _3) -> [17: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3); // scope 1 at $DIR/if_condition_int.rs:+2:5: +2:12
- StorageLive(_6); // scope 1 at $DIR/if_condition_int.rs:+4:23: +4:31
- StorageLive(_7); // scope 1 at $DIR/if_condition_int.rs:+4:23: +4:24
- _7 = _2; // scope 1 at $DIR/if_condition_int.rs:+4:23: +4:24
- _6 = move _7 as i32 (IntToInt); // scope 1 at $DIR/if_condition_int.rs:+4:23: +4:31
- StorageDead(_7); // scope 1 at $DIR/if_condition_int.rs:+4:30: +4:31
- _0 = Add(const 100_i32, move _6); // scope 1 at $DIR/if_condition_int.rs:+4:17: +4:31
- StorageDead(_6); // scope 1 at $DIR/if_condition_int.rs:+4:30: +4:31
- goto -> bb3; // scope 1 at $DIR/if_condition_int.rs:+4:30: +4:31
++ StorageDead(_3);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = _2;
+ _6 = move _7 as i32 (IntToInt);
+ StorageDead(_7);
+ _0 = Add(const 100_i32, move _6);
+ StorageDead(_6);
+ goto -> bb3;
}
bb2: {
-+ StorageDead(_3); // scope 1 at $DIR/if_condition_int.rs:+2:5: +2:12
- StorageLive(_4); // scope 1 at $DIR/if_condition_int.rs:+3:23: +3:31
- StorageLive(_5); // scope 1 at $DIR/if_condition_int.rs:+3:23: +3:24
- _5 = _2; // scope 1 at $DIR/if_condition_int.rs:+3:23: +3:24
- _4 = move _5 as i32 (IntToInt); // scope 1 at $DIR/if_condition_int.rs:+3:23: +3:31
- StorageDead(_5); // scope 1 at $DIR/if_condition_int.rs:+3:30: +3:31
- _0 = Add(const 10_i32, move _4); // scope 1 at $DIR/if_condition_int.rs:+3:18: +3:31
- StorageDead(_4); // scope 1 at $DIR/if_condition_int.rs:+3:30: +3:31
- goto -> bb3; // scope 1 at $DIR/if_condition_int.rs:+3:30: +3:31
++ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _2;
+ _4 = move _5 as i32 (IntToInt);
+ StorageDead(_5);
+ _0 = Add(const 10_i32, move _4);
+ StorageDead(_4);
+ goto -> bb3;
}
bb3: {
- StorageDead(_2); // scope 0 at $DIR/if_condition_int.rs:+6:1: +6:2
- return; // scope 0 at $DIR/if_condition_int.rs:+6:2: +6:2
+ StorageDead(_2);
+ return;
}
}
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 5964d76a4..fedbd6cdd 100644
--- a/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff
@@ -2,38 +2,36 @@
+ // MIR for `opt_char` after SimplifyComparisonIntegral
fn opt_char(_1: char) -> u32 {
- debug x => _1; // in scope 0 at $DIR/if_condition_int.rs:+0:13: +0:14
- let mut _0: u32; // return place in scope 0 at $DIR/if_condition_int.rs:+0:25: +0:28
- let mut _2: bool; // in scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
- let mut _3: char; // in scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: char;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
- StorageLive(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
- _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
-- _2 = Eq(move _3, const 'x'); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
-- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16
-- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
-+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
-+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16
-+ switchInt(move _3) -> [120: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Eq(move _3, const 'x');
+- switchInt(move _2) -> [0: bb2, otherwise: bb1];
++ nop;
++ switchInt(move _3) -> [120: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
- _0 = const 0_u32; // scope 0 at $DIR/if_condition_int.rs:+1:19: +1:20
- goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:33
+ StorageDead(_3);
+ _0 = const 0_u32;
+ goto -> bb3;
}
bb2: {
-+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
- _0 = const 1_u32; // scope 0 at $DIR/if_condition_int.rs:+1:30: +1:31
- goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:33
+ StorageDead(_3);
+ _0 = const 1_u32;
+ goto -> bb3;
}
bb3: {
- StorageDead(_2); // scope 0 at $DIR/if_condition_int.rs:+1:32: +1:33
- return; // scope 0 at $DIR/if_condition_int.rs:+2:2: +2:2
+ StorageDead(_2);
+ return;
}
}
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 98918cc74..9c38d8fe0 100644
--- a/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff
@@ -2,38 +2,36 @@
+ // MIR for `opt_i8` after SimplifyComparisonIntegral
fn opt_i8(_1: i8) -> u32 {
- debug x => _1; // in scope 0 at $DIR/if_condition_int.rs:+0:11: +0:12
- let mut _0: u32; // return place in scope 0 at $DIR/if_condition_int.rs:+0:21: +0:24
- let mut _2: bool; // in scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
- let mut _3: i8; // in scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: i8;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
- StorageLive(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
- _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
-- _2 = Eq(move _3, const 42_i8); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
-- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15
-- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
-+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
-+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15
-+ switchInt(move _3) -> [42: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Eq(move _3, const 42_i8);
+- switchInt(move _2) -> [0: bb2, otherwise: bb1];
++ nop;
++ switchInt(move _3) -> [42: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
- _0 = const 0_u32; // scope 0 at $DIR/if_condition_int.rs:+1:18: +1:19
- goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:32
+ StorageDead(_3);
+ _0 = const 0_u32;
+ goto -> bb3;
}
bb2: {
-+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
- _0 = const 1_u32; // scope 0 at $DIR/if_condition_int.rs:+1:29: +1:30
- goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:32
+ StorageDead(_3);
+ _0 = const 1_u32;
+ goto -> bb3;
}
bb3: {
- StorageDead(_2); // scope 0 at $DIR/if_condition_int.rs:+1:31: +1:32
- return; // scope 0 at $DIR/if_condition_int.rs:+2:2: +2:2
+ StorageDead(_2);
+ return;
}
}
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 db38140b8..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
@@ -2,64 +2,60 @@
+ // MIR for `opt_multiple_ifs` after SimplifyComparisonIntegral
fn opt_multiple_ifs(_1: u32) -> u32 {
- debug x => _1; // in scope 0 at $DIR/if_condition_int.rs:+0:21: +0:22
- let mut _0: u32; // return place in scope 0 at $DIR/if_condition_int.rs:+0:32: +0:35
- let mut _2: bool; // in scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
- let mut _3: u32; // in scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
- let mut _4: bool; // in scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22
- let mut _5: u32; // in scope 0 at $DIR/if_condition_int.rs:+3:15: +3:16
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: u32;
+ let mut _4: bool;
+ let mut _5: u32;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
- StorageLive(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
- _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
-- _2 = Eq(move _3, const 42_u32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
-- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15
-- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
-+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
-+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15
-+ switchInt(move _3) -> [42: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Eq(move _3, const 42_u32);
+- switchInt(move _2) -> [0: bb2, otherwise: bb1];
++ nop;
++ switchInt(move _3) -> [42: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
- _0 = const 0_u32; // scope 0 at $DIR/if_condition_int.rs:+2:9: +2:10
- goto -> bb6; // scope 0 at $DIR/if_condition_int.rs:+1:5: +7:6
+ StorageDead(_3);
+ _0 = const 0_u32;
+ goto -> bb6;
}
bb2: {
-+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
- StorageLive(_4); // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22
- StorageLive(_5); // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:16
- _5 = _1; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:16
-- _4 = Ne(move _5, const 21_u32); // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22
-- StorageDead(_5); // scope 0 at $DIR/if_condition_int.rs:+3:21: +3:22
-- switchInt(move _4) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22
-+ nop; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22
-+ nop; // scope 0 at $DIR/if_condition_int.rs:+3:21: +3:22
-+ switchInt(move _5) -> [21: bb4, otherwise: bb3]; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22
+ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+- _4 = Ne(move _5, const 21_u32);
+- switchInt(move _4) -> [0: bb4, otherwise: bb3];
++ nop;
++ switchInt(move _5) -> [21: bb4, otherwise: bb3];
}
bb3: {
-+ StorageDead(_5); // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22
- _0 = const 1_u32; // scope 0 at $DIR/if_condition_int.rs:+4:9: +4:10
- goto -> bb5; // scope 0 at $DIR/if_condition_int.rs:+3:12: +7:6
+ StorageDead(_5);
+ _0 = const 1_u32;
+ goto -> bb5;
}
bb4: {
-+ StorageDead(_5); // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22
- _0 = const 2_u32; // scope 0 at $DIR/if_condition_int.rs:+6:9: +6:10
- goto -> bb5; // scope 0 at $DIR/if_condition_int.rs:+3:12: +7:6
+ StorageDead(_5);
+ _0 = const 2_u32;
+ goto -> bb5;
}
bb5: {
- StorageDead(_4); // scope 0 at $DIR/if_condition_int.rs:+7:5: +7:6
- goto -> bb6; // scope 0 at $DIR/if_condition_int.rs:+1:5: +7:6
+ StorageDead(_4);
+ goto -> bb6;
}
bb6: {
- StorageDead(_2); // scope 0 at $DIR/if_condition_int.rs:+7:5: +7:6
- return; // scope 0 at $DIR/if_condition_int.rs:+8:2: +8:2
+ StorageDead(_2);
+ return;
}
}
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 1a1ac4caa..876ed61e9 100644
--- a/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff
@@ -2,38 +2,36 @@
+ // MIR for `opt_negative` after SimplifyComparisonIntegral
fn opt_negative(_1: i32) -> u32 {
- debug x => _1; // in scope 0 at $DIR/if_condition_int.rs:+0:17: +0:18
- let mut _0: u32; // return place in scope 0 at $DIR/if_condition_int.rs:+0:28: +0:31
- let mut _2: bool; // in scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
- let mut _3: i32; // in scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: i32;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
- StorageLive(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
- _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
-- _2 = Eq(move _3, const -42_i32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
-- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16
-- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
-+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
-+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16
-+ switchInt(move _3) -> [4294967254: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Eq(move _3, const -42_i32);
+- switchInt(move _2) -> [0: bb2, otherwise: bb1];
++ nop;
++ switchInt(move _3) -> [4294967254: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
- _0 = const 0_u32; // scope 0 at $DIR/if_condition_int.rs:+1:19: +1:20
- goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:33
+ StorageDead(_3);
+ _0 = const 0_u32;
+ goto -> bb3;
}
bb2: {
-+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16
- _0 = const 1_u32; // scope 0 at $DIR/if_condition_int.rs:+1:30: +1:31
- goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:33
+ StorageDead(_3);
+ _0 = const 1_u32;
+ goto -> bb3;
}
bb3: {
- StorageDead(_2); // scope 0 at $DIR/if_condition_int.rs:+1:32: +1:33
- return; // scope 0 at $DIR/if_condition_int.rs:+2:2: +2:2
+ StorageDead(_2);
+ return;
}
}
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 fc3f50227..ed3eb47dd 100644
--- a/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff
@@ -2,38 +2,36 @@
+ // MIR for `opt_u32` after SimplifyComparisonIntegral
fn opt_u32(_1: u32) -> u32 {
- debug x => _1; // in scope 0 at $DIR/if_condition_int.rs:+0:12: +0:13
- let mut _0: u32; // return place in scope 0 at $DIR/if_condition_int.rs:+0:23: +0:26
- let mut _2: bool; // in scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
- let mut _3: u32; // in scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: u32;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
- StorageLive(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
- _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9
-- _2 = Eq(move _3, const 42_u32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
-- StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15
-- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
-+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
-+ nop; // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15
-+ switchInt(move _3) -> [42: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Eq(move _3, const 42_u32);
+- switchInt(move _2) -> [0: bb2, otherwise: bb1];
++ nop;
++ switchInt(move _3) -> [42: bb1, otherwise: bb2];
}
bb1: {
-+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
- _0 = const 0_u32; // scope 0 at $DIR/if_condition_int.rs:+1:18: +1:19
- goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:32
+ StorageDead(_3);
+ _0 = const 0_u32;
+ goto -> bb3;
}
bb2: {
-+ StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15
- _0 = const 1_u32; // scope 0 at $DIR/if_condition_int.rs:+1:29: +1:30
- goto -> bb3; // scope 0 at $DIR/if_condition_int.rs:+1:5: +1:32
+ StorageDead(_3);
+ _0 = const 1_u32;
+ goto -> bb3;
}
bb3: {
- StorageDead(_2); // scope 0 at $DIR/if_condition_int.rs:+1:31: +1:32
- return; // scope 0 at $DIR/if_condition_int.rs:+2:2: +2:2
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/if_condition_int.rs b/tests/mir-opt/if_condition_int.rs
index 398311e6b..a3dd74d9a 100644
--- a/tests/mir-opt/if_condition_int.rs
+++ b/tests/mir-opt/if_condition_int.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: SimplifyComparisonIntegral
// EMIT_MIR if_condition_int.opt_u32.SimplifyComparisonIntegral.diff
// EMIT_MIR if_condition_int.opt_negative.SimplifyComparisonIntegral.diff
diff --git a/tests/mir-opt/inline/asm_unwind.main.Inline.diff b/tests/mir-opt/inline/asm_unwind.main.Inline.diff
deleted file mode 100644
index ba1bfec05..000000000
--- a/tests/mir-opt/inline/asm_unwind.main.Inline.diff
+++ /dev/null
@@ -1,45 +0,0 @@
-- // MIR for `main` before Inline
-+ // MIR for `main` after Inline
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/asm_unwind.rs:+0:15: +0:15
- let _1: (); // in scope 0 at $DIR/asm_unwind.rs:+1:5: +1:10
-+ scope 1 (inlined foo) { // at $DIR/asm_unwind.rs:21:5: 21:10
-+ let _2: D; // in scope 1 at $DIR/asm_unwind.rs:15:9: 15:11
-+ scope 2 {
-+ debug _d => const D; // in scope 2 at $DIR/asm_unwind.rs:15:9: 15:11
-+ scope 3 {
-+ }
-+ }
-+ }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/asm_unwind.rs:+1:5: +1:10
-- _1 = foo() -> bb1; // scope 0 at $DIR/asm_unwind.rs:+1:5: +1:10
-- // mir::Constant
-- // + span: $DIR/asm_unwind.rs:21:5: 21:8
-- // + literal: Const { ty: fn() {foo}, val: Value(<ZST>) }
-+ StorageLive(_2); // scope 0 at $DIR/asm_unwind.rs:+1:5: +1:10
-+ asm!("", options(MAY_UNWIND)) -> [return: bb2, unwind: bb3]; // scope 3 at $DIR/asm_unwind.rs:16:14: 16:54
- }
-
- bb1: {
-+ StorageDead(_2); // scope 0 at $DIR/asm_unwind.rs:+1:5: +1:10
- StorageDead(_1); // scope 0 at $DIR/asm_unwind.rs:+1:10: +1:11
- _0 = const (); // scope 0 at $DIR/asm_unwind.rs:+0:15: +2:2
- return; // scope 0 at $DIR/asm_unwind.rs:+2:2: +2:2
-+ }
-+
-+ bb2: {
-+ drop(_2) -> bb1; // scope 1 at $DIR/asm_unwind.rs:17:1: 17:2
-+ }
-+
-+ bb3 (cleanup): {
-+ drop(_2) -> [return: bb4, unwind terminate]; // scope 1 at $DIR/asm_unwind.rs:17:1: 17:2
-+ }
-+
-+ bb4 (cleanup): {
-+ resume; // scope 1 at $DIR/asm_unwind.rs:14:1: 17:2
- }
- }
-
diff --git a/tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff
new file mode 100644
index 000000000..aa9429c46
--- /dev/null
+++ b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-abort.diff
@@ -0,0 +1,34 @@
+- // MIR for `main` before Inline
++ // MIR for `main` after Inline
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
++ scope 1 (inlined foo) {
++ let _2: D;
++ scope 2 {
++ debug _d => const D;
++ scope 3 {
++ }
++ }
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = foo() -> [return: bb1, unwind unreachable];
++ StorageLive(_2);
++ asm!("", options(MAY_UNWIND)) -> [return: bb2, unwind terminate(abi)];
+ }
+
+ bb1: {
++ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
++ }
++
++ bb2: {
++ drop(_2) -> [return: bb1, unwind unreachable];
+ }
+ }
+
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
new file mode 100644
index 000000000..ea9c360aa
--- /dev/null
+++ b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff
@@ -0,0 +1,42 @@
+- // MIR for `main` before Inline
++ // MIR for `main` after Inline
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
++ scope 1 (inlined foo) {
++ let _2: D;
++ scope 2 {
++ debug _d => const D;
++ scope 3 {
++ }
++ }
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = foo() -> [return: bb1, unwind continue];
++ StorageLive(_2);
++ asm!("", options(MAY_UNWIND)) -> [return: bb2, unwind: bb3];
+ }
+
+ bb1: {
++ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
++ }
++
++ bb2: {
++ drop(_2) -> [return: bb1, unwind continue];
++ }
++
++ bb3 (cleanup): {
++ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
++ }
++
++ bb4 (cleanup): {
++ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/asm_unwind.rs b/tests/mir-opt/inline/asm_unwind.rs
index c03feb433..0ae20e522 100644
--- a/tests/mir-opt/inline/asm_unwind.rs
+++ b/tests/mir-opt/inline/asm_unwind.rs
@@ -1,7 +1,9 @@
// Tests inlining of `may_unwind` inline assembly.
//
-// ignore-wasm32-bare compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// needs-asm-support
+// needs-unwind
+// compile-flags: -Zinline-mir-hint-threshold=1000
#![feature(asm_unwind)]
struct D;
@@ -10,7 +12,7 @@ impl Drop for D {
fn drop(&mut self) {}
}
-#[inline(always)]
+#[inline]
fn foo() {
let _d = D;
unsafe { std::arch::asm!("", options(may_unwind)) };
@@ -18,5 +20,9 @@ fn foo() {
// EMIT_MIR asm_unwind.main.Inline.diff
pub fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: (inlined foo)
+ // CHECK: asm!("", options(MAY_UNWIND)) -> [return: {{bb.*}}, unwind: [[unwind:bb.*]]];
+ // CHECK: [[unwind]] (cleanup)
foo();
}
diff --git a/tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.diff b/tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.diff
deleted file mode 100644
index 8b0300678..000000000
--- a/tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.diff
+++ /dev/null
@@ -1,33 +0,0 @@
-- // MIR for `foo` before Inline
-+ // MIR for `foo` after Inline
-
- fn foo() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/caller_with_trivial_bound.rs:+1:1: +1:1
- let mut _1: <IntFactory as Factory<T>>::Item; // in scope 0 at $DIR/caller_with_trivial_bound.rs:+4:9: +4:14
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/caller_with_trivial_bound.rs:+4:9: +4:14
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/caller_with_trivial_bound.rs:+4:9: +4:14
- _1 = bar::<T>() -> bb1; // scope 0 at $DIR/caller_with_trivial_bound.rs:+4:51: +4:61
- // mir::Constant
- // + span: $DIR/caller_with_trivial_bound.rs:20:51: 20:59
- // + literal: Const { ty: fn() -> <IntFactory as Factory<T>>::Item {bar::<T>}, val: Value(<ZST>) }
- }
-
- bb1: {
- _0 = const (); // scope 0 at $DIR/caller_with_trivial_bound.rs:+3:1: +5:2
- drop(_1) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/caller_with_trivial_bound.rs:+5:1: +5:2
- }
-
- bb2: {
- StorageDead(_1); // scope 0 at $DIR/caller_with_trivial_bound.rs:+5:1: +5:2
- return; // scope 0 at $DIR/caller_with_trivial_bound.rs:+5:2: +5:2
- }
-
- bb3 (cleanup): {
- resume; // scope 0 at $DIR/caller_with_trivial_bound.rs:+0:1: +5:2
- }
- }
-
diff --git a/tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.panic-unwind.diff b/tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.panic-unwind.diff
new file mode 100644
index 000000000..d4427b2a8
--- /dev/null
+++ b/tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.panic-unwind.diff
@@ -0,0 +1,30 @@
+- // MIR for `foo` before Inline
++ // MIR for `foo` after Inline
+
+ fn foo() -> () {
+ let mut _0: ();
+ let mut _1: <IntFactory as Factory<T>>::Item;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = bar::<T>() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ _0 = const ();
+ drop(_1) -> [return: bb2, unwind: bb3];
+ }
+
+ bb2: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb3 (cleanup): {
+ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/caller_with_trivial_bound.rs b/tests/mir-opt/inline/caller_with_trivial_bound.rs
index 8545db894..40f7f4bba 100644
--- a/tests/mir-opt/inline/caller_with_trivial_bound.rs
+++ b/tests/mir-opt/inline/caller_with_trivial_bound.rs
@@ -1,4 +1,4 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// needs-unwind
#![crate_type = "lib"]
@@ -15,8 +15,13 @@ impl<T> Factory<T> for IntFactory {
// EMIT_MIR caller_with_trivial_bound.foo.Inline.diff
pub fn foo<T>()
where
+ // Because of this trivial bound, the inliner fails to normalize
+ // `<IntFactory as Factory<T>>::Item`.
+ // Verify that we do not inline anything, which would cause validation ICEs.
IntFactory: Factory<T>,
{
+ // CHECK-LABEL: fn foo(
+ // CHECK-NOT: (inlined bar::<T>)
let mut x: <IntFactory as Factory<T>>::Item = bar::<T>();
}
diff --git a/tests/mir-opt/inline/cycle.f.Inline.diff b/tests/mir-opt/inline/cycle.f.Inline.diff
deleted file mode 100644
index 8da597577..000000000
--- a/tests/mir-opt/inline/cycle.f.Inline.diff
+++ /dev/null
@@ -1,43 +0,0 @@
-- // MIR for `f` before Inline
-+ // MIR for `f` after Inline
-
- fn f(_1: impl Fn()) -> () {
- debug g => _1; // in scope 0 at $DIR/cycle.rs:+0:6: +0:7
- let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:20: +0:20
- let _2: (); // in scope 0 at $DIR/cycle.rs:+1:5: +1:8
- let mut _3: &impl Fn(); // in scope 0 at $DIR/cycle.rs:+1:5: +1:6
- let mut _4: (); // in scope 0 at $DIR/cycle.rs:+1:5: +1:8
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/cycle.rs:+1:5: +1:8
- StorageLive(_3); // scope 0 at $DIR/cycle.rs:+1:5: +1:6
- _3 = &_1; // scope 0 at $DIR/cycle.rs:+1:5: +1:6
- StorageLive(_4); // scope 0 at $DIR/cycle.rs:+1:5: +1:8
- _4 = (); // scope 0 at $DIR/cycle.rs:+1:5: +1:8
- _2 = <impl Fn() as Fn<()>>::call(move _3, move _4) -> [return: bb1, unwind: bb3]; // scope 0 at $DIR/cycle.rs:+1:5: +1:8
- // mir::Constant
- // + span: $DIR/cycle.rs:6:5: 6:6
- // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(), ()) -> <impl Fn() as FnOnce<()>>::Output {<impl Fn() as Fn<()>>::call}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_4); // scope 0 at $DIR/cycle.rs:+1:7: +1:8
- StorageDead(_3); // scope 0 at $DIR/cycle.rs:+1:7: +1:8
- StorageDead(_2); // scope 0 at $DIR/cycle.rs:+1:8: +1:9
- _0 = const (); // scope 0 at $DIR/cycle.rs:+0:20: +2:2
- drop(_1) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/cycle.rs:+2:1: +2:2
- }
-
- bb2: {
- return; // scope 0 at $DIR/cycle.rs:+2:2: +2:2
- }
-
- bb3 (cleanup): {
- drop(_1) -> [return: bb4, unwind terminate]; // scope 0 at $DIR/cycle.rs:+2:1: +2:2
- }
-
- bb4 (cleanup): {
- resume; // scope 0 at $DIR/cycle.rs:+0:1: +2:2
- }
- }
-
diff --git a/tests/mir-opt/inline/cycle.f.Inline.panic-abort.diff b/tests/mir-opt/inline/cycle.f.Inline.panic-abort.diff
new file mode 100644
index 000000000..861b2fc9f
--- /dev/null
+++ b/tests/mir-opt/inline/cycle.f.Inline.panic-abort.diff
@@ -0,0 +1,32 @@
+- // MIR for `f` before Inline
++ // MIR for `f` after Inline
+
+ fn f(_1: impl Fn()) -> () {
+ debug g => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: &impl Fn();
+ let mut _4: ();
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &_1;
+ StorageLive(_4);
+ _4 = ();
+ _2 = <impl Fn() as Fn<()>>::call(move _3, move _4) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff b/tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff
new file mode 100644
index 000000000..b7fea4f2e
--- /dev/null
+++ b/tests/mir-opt/inline/cycle.f.Inline.panic-unwind.diff
@@ -0,0 +1,40 @@
+- // MIR for `f` before Inline
++ // MIR for `f` after Inline
+
+ fn f(_1: impl Fn()) -> () {
+ debug g => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: &impl Fn();
+ let mut _4: ();
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &_1;
+ StorageLive(_4);
+ _4 = ();
+ _2 = <impl Fn() as Fn<()>>::call(move _3, move _4) -> [return: bb1, unwind: bb3];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb2, unwind: bb4];
+ }
+
+ bb2: {
+ return;
+ }
+
+ bb3 (cleanup): {
+ drop(_1) -> [return: bb4, unwind terminate(cleanup)];
+ }
+
+ bb4 (cleanup): {
+ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/cycle.g.Inline.diff b/tests/mir-opt/inline/cycle.g.Inline.diff
deleted file mode 100644
index 1e6e30f9e..000000000
--- a/tests/mir-opt/inline/cycle.g.Inline.diff
+++ /dev/null
@@ -1,58 +0,0 @@
-- // MIR for `g` before Inline
-+ // MIR for `g` after Inline
-
- fn g() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:8: +0:8
- let _1: (); // in scope 0 at $DIR/cycle.rs:+1:5: +1:12
-+ let mut _2: fn() {main}; // in scope 0 at $DIR/cycle.rs:+1:5: +1:12
-+ let mut _5: (); // in scope 0 at $DIR/cycle.rs:6:5: 6:8
-+ scope 1 (inlined f::<fn() {main}>) { // at $DIR/cycle.rs:12:5: 12:12
-+ debug g => _2; // in scope 1 at $DIR/cycle.rs:5:6: 5:7
-+ let _3: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8
-+ let mut _4: &fn() {main}; // in scope 1 at $DIR/cycle.rs:6:5: 6:6
-+ scope 2 (inlined <fn() {main} as Fn<()>>::call - shim(fn() {main})) { // at $DIR/cycle.rs:6:5: 6:8
-+ }
-+ }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/cycle.rs:+1:5: +1:12
-- _1 = f::<fn() {main}>(main) -> bb1; // scope 0 at $DIR/cycle.rs:+1:5: +1:12
-+ StorageLive(_2); // scope 0 at $DIR/cycle.rs:+1:5: +1:12
-+ _2 = main; // scope 0 at $DIR/cycle.rs:+1:5: +1:12
- // mir::Constant
-- // + span: $DIR/cycle.rs:12:5: 12:6
-- // + literal: Const { ty: fn(fn() {main}) {f::<fn() {main}>}, val: Value(<ZST>) }
-- // mir::Constant
- // + span: $DIR/cycle.rs:12:7: 12:11
- // + literal: Const { ty: fn() {main}, val: Value(<ZST>) }
-+ StorageLive(_3); // scope 0 at $DIR/cycle.rs:+1:5: +1:12
-+ StorageLive(_4); // scope 1 at $DIR/cycle.rs:6:5: 6:6
-+ _4 = &_2; // scope 1 at $DIR/cycle.rs:6:5: 6:6
-+ StorageLive(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8
-+ _5 = const (); // scope 1 at $DIR/cycle.rs:6:5: 6:8
-+ _3 = move (*_4)() -> [return: bb4, unwind: bb2]; // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL
- }
-
- bb1: {
-+ StorageDead(_3); // scope 0 at $DIR/cycle.rs:+1:5: +1:12
-+ StorageDead(_2); // scope 0 at $DIR/cycle.rs:+1:5: +1:12
- StorageDead(_1); // scope 0 at $DIR/cycle.rs:+1:12: +1:13
- _0 = const (); // scope 0 at $DIR/cycle.rs:+0:8: +2:2
- return; // scope 0 at $DIR/cycle.rs:+2:2: +2:2
-+ }
-+
-+ bb2 (cleanup): {
-+ drop(_2) -> [return: bb3, unwind terminate]; // scope 1 at $DIR/cycle.rs:7:1: 7:2
-+ }
-+
-+ bb3 (cleanup): {
-+ resume; // scope 1 at $DIR/cycle.rs:5:1: 7:2
-+ }
-+
-+ bb4: {
-+ StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8
-+ StorageDead(_4); // scope 1 at $DIR/cycle.rs:6:7: 6:8
-+ drop(_2) -> bb1; // scope 1 at $DIR/cycle.rs:7:1: 7:2
- }
- }
-
diff --git a/tests/mir-opt/inline/cycle.g.Inline.panic-abort.diff b/tests/mir-opt/inline/cycle.g.Inline.panic-abort.diff
new file mode 100644
index 000000000..8f2baf4a3
--- /dev/null
+++ b/tests/mir-opt/inline/cycle.g.Inline.panic-abort.diff
@@ -0,0 +1,38 @@
+- // MIR for `g` before Inline
++ // MIR for `g` after Inline
+
+ fn g() -> () {
+ let mut _0: ();
+ let _1: ();
++ let mut _2: fn() {main};
++ scope 1 (inlined f::<fn() {main}>) {
++ debug g => _2;
++ let mut _3: &fn() {main};
++ let _4: ();
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = f::<fn() {main}>(main) -> [return: bb1, unwind unreachable];
++ StorageLive(_2);
++ _2 = main;
++ StorageLive(_4);
++ StorageLive(_3);
++ _3 = &_2;
++ _4 = <fn() {main} as Fn<()>>::call(move _3, const ()) -> [return: bb2, unwind unreachable];
+ }
+
+ bb1: {
++ StorageDead(_4);
++ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
++ }
++
++ bb2: {
++ StorageDead(_3);
++ drop(_2) -> [return: bb1, unwind unreachable];
+ }
+ }
+
diff --git a/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff b/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff
new file mode 100644
index 000000000..1fd1014ba
--- /dev/null
+++ b/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff
@@ -0,0 +1,46 @@
+- // MIR for `g` before Inline
++ // MIR for `g` after Inline
+
+ fn g() -> () {
+ let mut _0: ();
+ let _1: ();
++ let mut _2: fn() {main};
++ scope 1 (inlined f::<fn() {main}>) {
++ debug g => _2;
++ let mut _3: &fn() {main};
++ let _4: ();
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = f::<fn() {main}>(main) -> [return: bb1, unwind continue];
++ StorageLive(_2);
++ _2 = main;
++ StorageLive(_4);
++ StorageLive(_3);
++ _3 = &_2;
++ _4 = <fn() {main} as Fn<()>>::call(move _3, const ()) -> [return: bb2, unwind: bb3];
+ }
+
+ bb1: {
++ StorageDead(_4);
++ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
++ }
++
++ bb2: {
++ StorageDead(_3);
++ drop(_2) -> [return: bb1, unwind continue];
++ }
++
++ bb3 (cleanup): {
++ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
++ }
++
++ bb4 (cleanup): {
++ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/cycle.main.Inline.diff b/tests/mir-opt/inline/cycle.main.Inline.diff
deleted file mode 100644
index 315634945..000000000
--- a/tests/mir-opt/inline/cycle.main.Inline.diff
+++ /dev/null
@@ -1,58 +0,0 @@
-- // MIR for `main` before Inline
-+ // MIR for `main` after Inline
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:+0:11: +0:11
- let _1: (); // in scope 0 at $DIR/cycle.rs:+1:5: +1:9
-+ let mut _2: fn() {g}; // in scope 0 at $DIR/cycle.rs:+1:5: +1:9
-+ let mut _5: (); // in scope 0 at $DIR/cycle.rs:6:5: 6:8
-+ scope 1 (inlined f::<fn() {g}>) { // at $DIR/cycle.rs:17:5: 17:9
-+ debug g => _2; // in scope 1 at $DIR/cycle.rs:5:6: 5:7
-+ let _3: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8
-+ let mut _4: &fn() {g}; // in scope 1 at $DIR/cycle.rs:6:5: 6:6
-+ scope 2 (inlined <fn() {g} as Fn<()>>::call - shim(fn() {g})) { // at $DIR/cycle.rs:6:5: 6:8
-+ }
-+ }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/cycle.rs:+1:5: +1:9
-- _1 = f::<fn() {g}>(g) -> bb1; // scope 0 at $DIR/cycle.rs:+1:5: +1:9
-+ StorageLive(_2); // scope 0 at $DIR/cycle.rs:+1:5: +1:9
-+ _2 = g; // scope 0 at $DIR/cycle.rs:+1:5: +1:9
- // mir::Constant
-- // + span: $DIR/cycle.rs:17:5: 17:6
-- // + literal: Const { ty: fn(fn() {g}) {f::<fn() {g}>}, val: Value(<ZST>) }
-- // mir::Constant
- // + span: $DIR/cycle.rs:17:7: 17:8
- // + literal: Const { ty: fn() {g}, val: Value(<ZST>) }
-+ StorageLive(_3); // scope 0 at $DIR/cycle.rs:+1:5: +1:9
-+ StorageLive(_4); // scope 1 at $DIR/cycle.rs:6:5: 6:6
-+ _4 = &_2; // scope 1 at $DIR/cycle.rs:6:5: 6:6
-+ StorageLive(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8
-+ _5 = const (); // scope 1 at $DIR/cycle.rs:6:5: 6:8
-+ _3 = move (*_4)() -> [return: bb4, unwind: bb2]; // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL
- }
-
- bb1: {
-+ StorageDead(_3); // scope 0 at $DIR/cycle.rs:+1:5: +1:9
-+ StorageDead(_2); // scope 0 at $DIR/cycle.rs:+1:5: +1:9
- StorageDead(_1); // scope 0 at $DIR/cycle.rs:+1:9: +1:10
- _0 = const (); // scope 0 at $DIR/cycle.rs:+0:11: +2:2
- return; // scope 0 at $DIR/cycle.rs:+2:2: +2:2
-+ }
-+
-+ bb2 (cleanup): {
-+ drop(_2) -> [return: bb3, unwind terminate]; // scope 1 at $DIR/cycle.rs:7:1: 7:2
-+ }
-+
-+ bb3 (cleanup): {
-+ resume; // scope 1 at $DIR/cycle.rs:5:1: 7:2
-+ }
-+
-+ bb4: {
-+ StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8
-+ StorageDead(_4); // scope 1 at $DIR/cycle.rs:6:7: 6:8
-+ drop(_2) -> bb1; // scope 1 at $DIR/cycle.rs:7:1: 7:2
- }
- }
-
diff --git a/tests/mir-opt/inline/cycle.main.Inline.panic-abort.diff b/tests/mir-opt/inline/cycle.main.Inline.panic-abort.diff
new file mode 100644
index 000000000..fd1f698c6
--- /dev/null
+++ b/tests/mir-opt/inline/cycle.main.Inline.panic-abort.diff
@@ -0,0 +1,38 @@
+- // MIR for `main` before Inline
++ // MIR for `main` after Inline
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
++ let mut _2: fn() {g};
++ scope 1 (inlined f::<fn() {g}>) {
++ debug g => _2;
++ let mut _3: &fn() {g};
++ let _4: ();
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = f::<fn() {g}>(g) -> [return: bb1, unwind unreachable];
++ StorageLive(_2);
++ _2 = g;
++ StorageLive(_4);
++ StorageLive(_3);
++ _3 = &_2;
++ _4 = <fn() {g} as Fn<()>>::call(move _3, const ()) -> [return: bb2, unwind unreachable];
+ }
+
+ bb1: {
++ StorageDead(_4);
++ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
++ }
++
++ bb2: {
++ StorageDead(_3);
++ drop(_2) -> [return: bb1, unwind unreachable];
+ }
+ }
+
diff --git a/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff
new file mode 100644
index 000000000..e8299db47
--- /dev/null
+++ b/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff
@@ -0,0 +1,46 @@
+- // MIR for `main` before Inline
++ // MIR for `main` after Inline
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
++ let mut _2: fn() {g};
++ scope 1 (inlined f::<fn() {g}>) {
++ debug g => _2;
++ let mut _3: &fn() {g};
++ let _4: ();
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = f::<fn() {g}>(g) -> [return: bb1, unwind continue];
++ StorageLive(_2);
++ _2 = g;
++ StorageLive(_4);
++ StorageLive(_3);
++ _3 = &_2;
++ _4 = <fn() {g} as Fn<()>>::call(move _3, const ()) -> [return: bb2, unwind: bb3];
+ }
+
+ bb1: {
++ StorageDead(_4);
++ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
++ }
++
++ bb2: {
++ StorageDead(_3);
++ drop(_2) -> [return: bb1, unwind continue];
++ }
++
++ bb3 (cleanup): {
++ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
++ }
++
++ bb4 (cleanup): {
++ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/cycle.rs b/tests/mir-opt/inline/cycle.rs
index 9e8950d8a..350724235 100644
--- a/tests/mir-opt/inline/cycle.rs
+++ b/tests/mir-opt/inline/cycle.rs
@@ -1,18 +1,29 @@
-// ignore-wasm32-bare compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// compile-flags: -Zinline-mir-hint-threshold=1000
// EMIT_MIR cycle.f.Inline.diff
#[inline(always)]
fn f(g: impl Fn()) {
+ // CHECK-LABEL: fn f(
+ // CHECK-NOT: inlined
g();
}
// EMIT_MIR cycle.g.Inline.diff
#[inline(always)]
fn g() {
+ // CHECK-LABEL: fn g(
+ // CHECK-NOT: inlined
+ // CHECK: (inlined f::<fn() {main}>)
+ // CHECK-NOT: inlined
f(main);
}
// EMIT_MIR cycle.main.Inline.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK-NOT: inlined
+ // CHECK: (inlined f::<fn() {g}>)
+ // CHECK-NOT: inlined
f(g);
}
diff --git a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-abort.diff b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-abort.diff
new file mode 100644
index 000000000..757617e59
--- /dev/null
+++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-abort.diff
@@ -0,0 +1,29 @@
+- // MIR for `call` before Inline
++ // MIR for `call` after Inline
+
+ fn call(_1: Box<dyn FnMut<I, Output = ()>>, _2: I) -> () {
+ debug mock => _1;
+ debug input => _2;
+ let mut _0: ();
+ let mut _3: &mut std::boxed::Box<dyn std::ops::FnMut<I, Output = ()>>;
+ let mut _4: I;
+
+ bb0: {
+ StorageLive(_3);
+ _3 = &mut _1;
+ StorageLive(_4);
+ _4 = move _2;
+ _0 = <Box<dyn FnMut<I, Output = ()>> as FnMut<I>>::call_mut(move _3, move _4) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ drop(_1) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ return;
+ }
+ }
+
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
new file mode 100644
index 000000000..b82961c28
--- /dev/null
+++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff
@@ -0,0 +1,37 @@
+- // MIR for `call` before Inline
++ // MIR for `call` after Inline
+
+ fn call(_1: Box<dyn FnMut<I, Output = ()>>, _2: I) -> () {
+ debug mock => _1;
+ debug input => _2;
+ let mut _0: ();
+ let mut _3: &mut std::boxed::Box<dyn std::ops::FnMut<I, Output = ()>>;
+ let mut _4: I;
+
+ bb0: {
+ StorageLive(_3);
+ _3 = &mut _1;
+ StorageLive(_4);
+ _4 = move _2;
+ _0 = <Box<dyn FnMut<I, Output = ()>> as FnMut<I>>::call_mut(move _3, move _4) -> [return: bb1, unwind: bb3];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ drop(_1) -> [return: bb2, unwind: bb4];
+ }
+
+ bb2: {
+ return;
+ }
+
+ bb3 (cleanup): {
+ drop(_1) -> [return: bb4, unwind terminate(cleanup)];
+ }
+
+ bb4 (cleanup): {
+ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs
new file mode 100644
index 000000000..ce5e1855a
--- /dev/null
+++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs
@@ -0,0 +1,13 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// compile-flags: -Zmir-enable-passes=+Inline --crate-type=lib
+
+#![feature(fn_traits, tuple_trait, unboxed_closures)]
+
+use std::marker::Tuple;
+
+// EMIT_MIR dont_ice_on_generic_rust_call.call.Inline.diff
+pub fn call<I: Tuple>(mut mock: Box<dyn FnMut<I, Output = ()>>, input: I) {
+ // CHECK-LABEL: fn call(
+ // CHECK-NOT: inlined
+ mock.call_mut(input)
+}
diff --git a/tests/mir-opt/inline/dyn_trait.get_query.Inline.diff b/tests/mir-opt/inline/dyn_trait.get_query.Inline.diff
deleted file mode 100644
index 75d9bd54d..000000000
--- a/tests/mir-opt/inline/dyn_trait.get_query.Inline.diff
+++ /dev/null
@@ -1,54 +0,0 @@
-- // MIR for `get_query` before Inline
-+ // MIR for `get_query` after Inline
-
- fn get_query(_1: &T) -> () {
- debug t => _1; // in scope 0 at $DIR/dyn_trait.rs:+0:31: +0:32
- let mut _0: (); // return place in scope 0 at $DIR/dyn_trait.rs:+0:38: +0:38
- let _2: &<Q as Query>::C; // in scope 0 at $DIR/dyn_trait.rs:+1:9: +1:10
- let mut _3: &T; // in scope 0 at $DIR/dyn_trait.rs:+1:22: +1:23
- let mut _4: &<Q as Query>::C; // in scope 0 at $DIR/dyn_trait.rs:+2:23: +2:24
- scope 1 {
- debug c => _2; // in scope 1 at $DIR/dyn_trait.rs:+1:9: +1:10
-+ scope 2 (inlined try_execute_query::<<Q as Query>::C>) { // at $DIR/dyn_trait.rs:35:5: 35:25
-+ debug c => _4; // in scope 2 at $DIR/dyn_trait.rs:27:36: 27:37
-+ let mut _5: &dyn Cache<V = <Q as Query>::V>; // in scope 2 at $DIR/dyn_trait.rs:28:14: 28:15
-+ scope 3 (inlined mk_cycle::<<Q as Query>::V>) { // at $DIR/dyn_trait.rs:28:5: 28:16
-+ debug c => _5; // in scope 3 at $DIR/dyn_trait.rs:21:27: 21:28
-+ }
-+ }
- }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/dyn_trait.rs:+1:9: +1:10
- StorageLive(_3); // scope 0 at $DIR/dyn_trait.rs:+1:22: +1:23
- _3 = &(*_1); // scope 0 at $DIR/dyn_trait.rs:+1:22: +1:23
- _2 = <Q as Query>::cache::<T>(move _3) -> bb1; // scope 0 at $DIR/dyn_trait.rs:+1:13: +1:24
- // mir::Constant
- // + span: $DIR/dyn_trait.rs:34:13: 34:21
- // + user_ty: UserType(0)
- // + literal: Const { ty: for<'a> fn(&'a T) -> &'a <Q as Query>::C {<Q as Query>::cache::<T>}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_3); // scope 0 at $DIR/dyn_trait.rs:+1:23: +1:24
- StorageLive(_4); // scope 1 at $DIR/dyn_trait.rs:+2:23: +2:24
- _4 = &(*_2); // scope 1 at $DIR/dyn_trait.rs:+2:23: +2:24
-- _0 = try_execute_query::<<Q as Query>::C>(move _4) -> bb2; // scope 1 at $DIR/dyn_trait.rs:+2:5: +2:25
-+ StorageLive(_5); // scope 2 at $DIR/dyn_trait.rs:28:14: 28:15
-+ _5 = _4 as &dyn Cache<V = <Q as Query>::V> (Pointer(Unsize)); // scope 2 at $DIR/dyn_trait.rs:28:14: 28:15
-+ _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(_5) -> bb2; // scope 3 at $DIR/dyn_trait.rs:22:5: 22:22
- // mir::Constant
-- // + span: $DIR/dyn_trait.rs:35:5: 35:22
-- // + literal: Const { ty: for<'a> fn(&'a <Q as Query>::C) {try_execute_query::<<Q as Query>::C>}, val: Value(<ZST>) }
-+ // + span: $DIR/dyn_trait.rs:22:7: 22:20
-+ // + literal: Const { ty: for<'a> fn(&'a dyn Cache<V = <Q as Query>::V>) {<dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache}, val: Value(<ZST>) }
- }
-
- bb2: {
-+ StorageDead(_5); // scope 2 at $DIR/dyn_trait.rs:28:15: 28:16
- StorageDead(_4); // scope 1 at $DIR/dyn_trait.rs:+2:24: +2:25
- StorageDead(_2); // scope 0 at $DIR/dyn_trait.rs:+3:1: +3:2
- return; // scope 0 at $DIR/dyn_trait.rs:+3:2: +3:2
- }
- }
-
diff --git a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff
new file mode 100644
index 000000000..9d5042caa
--- /dev/null
+++ b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff
@@ -0,0 +1,45 @@
+- // MIR for `get_query` before Inline
++ // MIR for `get_query` after Inline
+
+ fn get_query(_1: &T) -> () {
+ debug t => _1;
+ let mut _0: ();
+ let _2: &<Q as Query>::C;
+ let mut _3: &T;
+ let mut _4: &<Q as Query>::C;
+ scope 1 {
+ debug c => _2;
++ scope 2 (inlined try_execute_query::<<Q as Query>::C>) {
++ debug c => _4;
++ let mut _5: &dyn Cache<V = <Q as Query>::V>;
++ scope 3 (inlined mk_cycle::<<Q as Query>::V>) {
++ debug c => _5;
++ }
++ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &(*_1);
+ _2 = <Q as Query>::cache::<T>(move _3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageLive(_4);
+ _4 = &(*_2);
+- _0 = try_execute_query::<<Q as Query>::C>(move _4) -> [return: bb2, unwind unreachable];
++ StorageLive(_5);
++ _5 = _4 as &dyn Cache<V = <Q as Query>::V> (PointerCoercion(Unsize));
++ _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(move _5) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
++ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff
new file mode 100644
index 000000000..9bd3855c5
--- /dev/null
+++ b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff
@@ -0,0 +1,45 @@
+- // MIR for `get_query` before Inline
++ // MIR for `get_query` after Inline
+
+ fn get_query(_1: &T) -> () {
+ debug t => _1;
+ let mut _0: ();
+ let _2: &<Q as Query>::C;
+ let mut _3: &T;
+ let mut _4: &<Q as Query>::C;
+ scope 1 {
+ debug c => _2;
++ scope 2 (inlined try_execute_query::<<Q as Query>::C>) {
++ debug c => _4;
++ let mut _5: &dyn Cache<V = <Q as Query>::V>;
++ scope 3 (inlined mk_cycle::<<Q as Query>::V>) {
++ debug c => _5;
++ }
++ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &(*_1);
+ _2 = <Q as Query>::cache::<T>(move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageLive(_4);
+ _4 = &(*_2);
+- _0 = try_execute_query::<<Q as Query>::C>(move _4) -> [return: bb2, unwind continue];
++ StorageLive(_5);
++ _5 = _4 as &dyn Cache<V = <Q as Query>::V> (PointerCoercion(Unsize));
++ _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(move _5) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
++ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.diff b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.diff
deleted file mode 100644
index 925c95988..000000000
--- a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.diff
+++ /dev/null
@@ -1,23 +0,0 @@
-- // MIR for `mk_cycle` before Inline
-+ // MIR for `mk_cycle` after Inline
-
- fn mk_cycle(_1: &dyn Cache<V = V>) -> () {
- debug c => _1; // in scope 0 at $DIR/dyn_trait.rs:+0:27: +0:28
- let mut _0: (); // return place in scope 0 at $DIR/dyn_trait.rs:+0:49: +0:49
- let mut _2: &dyn Cache<V = V>; // in scope 0 at $DIR/dyn_trait.rs:+1:5: +1:22
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/dyn_trait.rs:+1:5: +1:22
- _2 = &(*_1); // scope 0 at $DIR/dyn_trait.rs:+1:5: +1:22
- _0 = <dyn Cache<V = V> as Cache>::store_nocache(move _2) -> bb1; // scope 0 at $DIR/dyn_trait.rs:+1:5: +1:22
- // mir::Constant
- // + span: $DIR/dyn_trait.rs:22:7: 22:20
- // + literal: Const { ty: for<'a> fn(&'a dyn Cache<V = V>) {<dyn Cache<V = V> as Cache>::store_nocache}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/dyn_trait.rs:+1:21: +1:22
- return; // scope 0 at $DIR/dyn_trait.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff
new file mode 100644
index 000000000..d7801b7a0
--- /dev/null
+++ b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff
@@ -0,0 +1,20 @@
+- // MIR for `mk_cycle` before Inline
++ // MIR for `mk_cycle` after Inline
+
+ fn mk_cycle(_1: &dyn Cache<V = V>) -> () {
+ debug c => _1;
+ let mut _0: ();
+ let mut _2: &dyn Cache<V = V>;
+
+ bb0: {
+ StorageLive(_2);
+ _2 = &(*_1);
+ _0 = <dyn Cache<V = V> as Cache>::store_nocache(move _2) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff
new file mode 100644
index 000000000..7b1cf895a
--- /dev/null
+++ b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff
@@ -0,0 +1,20 @@
+- // MIR for `mk_cycle` before Inline
++ // MIR for `mk_cycle` after Inline
+
+ fn mk_cycle(_1: &dyn Cache<V = V>) -> () {
+ debug c => _1;
+ let mut _0: ();
+ let mut _2: &dyn Cache<V = V>;
+
+ bb0: {
+ StorageLive(_2);
+ _2 = &(*_1);
+ _0 = <dyn Cache<V = V> as Cache>::store_nocache(move _2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/dyn_trait.rs b/tests/mir-opt/inline/dyn_trait.rs
index 2af81f825..ecf220a85 100644
--- a/tests/mir-opt/inline/dyn_trait.rs
+++ b/tests/mir-opt/inline/dyn_trait.rs
@@ -1,4 +1,4 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![crate_type = "lib"]
use std::fmt::Debug;
@@ -19,18 +19,26 @@ pub trait Query {
// EMIT_MIR dyn_trait.mk_cycle.Inline.diff
#[inline(always)]
pub fn mk_cycle<V: Debug>(c: &dyn Cache<V = V>) {
+ // CHECK-LABEL: fn mk_cycle(
+ // CHECK-NOT: inlined
c.store_nocache()
}
// EMIT_MIR dyn_trait.try_execute_query.Inline.diff
#[inline(always)]
pub fn try_execute_query<C: Cache>(c: &C) {
+ // CHECK-LABEL: fn try_execute_query(
+ // CHECK: (inlined mk_cycle::<<C as Cache>::V>)
mk_cycle(c)
}
// EMIT_MIR dyn_trait.get_query.Inline.diff
#[inline(always)]
pub fn get_query<Q: Query, T>(t: &T) {
+ // CHECK-LABEL: fn get_query(
+ // CHECK-NOT: inlined
let c = Q::cache(t);
+ // CHECK: (inlined try_execute_query::<<Q as Query>::C>)
+ // CHECK: (inlined mk_cycle::<<Q as Query>::V>)
try_execute_query(c)
}
diff --git a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.diff b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.diff
deleted file mode 100644
index f4e5272ab..000000000
--- a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.diff
+++ /dev/null
@@ -1,33 +0,0 @@
-- // MIR for `try_execute_query` before Inline
-+ // MIR for `try_execute_query` after Inline
-
- fn try_execute_query(_1: &C) -> () {
- debug c => _1; // in scope 0 at $DIR/dyn_trait.rs:+0:36: +0:37
- let mut _0: (); // return place in scope 0 at $DIR/dyn_trait.rs:+0:43: +0:43
- let mut _2: &dyn Cache<V = <C as Cache>::V>; // in scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15
- let mut _3: &C; // in scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15
-+ scope 1 (inlined mk_cycle::<<C as Cache>::V>) { // at $DIR/dyn_trait.rs:28:5: 28:16
-+ debug c => _2; // in scope 1 at $DIR/dyn_trait.rs:21:27: 21:28
-+ }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15
- StorageLive(_3); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15
- _3 = &(*_1); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15
- _2 = move _3 as &dyn Cache<V = <C as Cache>::V> (Pointer(Unsize)); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15
- StorageDead(_3); // scope 0 at $DIR/dyn_trait.rs:+1:14: +1:15
-- _0 = mk_cycle::<<C as Cache>::V>(move _2) -> bb1; // scope 0 at $DIR/dyn_trait.rs:+1:5: +1:16
-+ _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(_2) -> bb1; // scope 1 at $DIR/dyn_trait.rs:22:5: 22:22
- // mir::Constant
-- // + span: $DIR/dyn_trait.rs:28:5: 28:13
-- // + literal: Const { ty: for<'a> fn(&'a (dyn Cache<V = <C as Cache>::V> + 'a)) {mk_cycle::<<C as Cache>::V>}, val: Value(<ZST>) }
-+ // + span: $DIR/dyn_trait.rs:22:7: 22:20
-+ // + literal: Const { ty: for<'a> fn(&'a dyn Cache<V = <C as Cache>::V>) {<dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/dyn_trait.rs:+1:15: +1:16
- return; // scope 0 at $DIR/dyn_trait.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff
new file mode 100644
index 000000000..96e16d023
--- /dev/null
+++ b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff
@@ -0,0 +1,28 @@
+- // MIR for `try_execute_query` before Inline
++ // MIR for `try_execute_query` after Inline
+
+ fn try_execute_query(_1: &C) -> () {
+ debug c => _1;
+ let mut _0: ();
+ let mut _2: &dyn Cache<V = <C as Cache>::V>;
+ let mut _3: &C;
++ scope 1 (inlined mk_cycle::<<C as Cache>::V>) {
++ debug c => _2;
++ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &(*_1);
+ _2 = move _3 as &dyn Cache<V = <C as Cache>::V> (PointerCoercion(Unsize));
+ StorageDead(_3);
+- _0 = mk_cycle::<<C as Cache>::V>(move _2) -> [return: bb1, unwind unreachable];
++ _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(move _2) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff
new file mode 100644
index 000000000..06d65abcb
--- /dev/null
+++ b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff
@@ -0,0 +1,28 @@
+- // MIR for `try_execute_query` before Inline
++ // MIR for `try_execute_query` after Inline
+
+ fn try_execute_query(_1: &C) -> () {
+ debug c => _1;
+ let mut _0: ();
+ let mut _2: &dyn Cache<V = <C as Cache>::V>;
+ let mut _3: &C;
++ scope 1 (inlined mk_cycle::<<C as Cache>::V>) {
++ debug c => _2;
++ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &(*_1);
+ _2 = move _3 as &dyn Cache<V = <C as Cache>::V> (PointerCoercion(Unsize));
+ StorageDead(_3);
+- _0 = mk_cycle::<<C as Cache>::V>(move _2) -> [return: bb1, unwind continue];
++ _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(move _2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/exponential_runtime.main.Inline.diff b/tests/mir-opt/inline/exponential_runtime.main.Inline.diff
deleted file mode 100644
index 30af8661d..000000000
--- a/tests/mir-opt/inline/exponential_runtime.main.Inline.diff
+++ /dev/null
@@ -1,75 +0,0 @@
-- // MIR for `main` before Inline
-+ // MIR for `main` after Inline
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/exponential_runtime.rs:+0:11: +0:11
- let _1: (); // in scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22
-+ scope 1 (inlined <() as G>::call) { // at $DIR/exponential_runtime.rs:87:5: 87:22
-+ let _2: (); // in scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25
-+ let _3: (); // in scope 1 at $DIR/exponential_runtime.rs:75:9: 75:25
-+ let _4: (); // in scope 1 at $DIR/exponential_runtime.rs:76:9: 76:25
-+ scope 2 (inlined <() as F>::call) { // at $DIR/exponential_runtime.rs:74:9: 74:25
-+ let _5: (); // in scope 2 at $DIR/exponential_runtime.rs:62:9: 62:25
-+ let _6: (); // in scope 2 at $DIR/exponential_runtime.rs:63:9: 63:25
-+ let _7: (); // in scope 2 at $DIR/exponential_runtime.rs:64:9: 64:25
-+ }
-+ }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22
-- _1 = <() as G>::call() -> bb1; // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22
-+ StorageLive(_2); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22
-+ StorageLive(_3); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22
-+ StorageLive(_4); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22
-+ StorageLive(_5); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25
-+ StorageLive(_6); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25
-+ StorageLive(_7); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25
-+ _5 = <() as E>::call() -> bb4; // scope 2 at $DIR/exponential_runtime.rs:62:9: 62:25
- // mir::Constant
-- // + span: $DIR/exponential_runtime.rs:87:5: 87:20
-- // + literal: Const { ty: fn() {<() as G>::call}, val: Value(<ZST>) }
-+ // + span: $DIR/exponential_runtime.rs:62:9: 62:23
-+ // + literal: Const { ty: fn() {<() as E>::call}, val: Value(<ZST>) }
- }
-
- bb1: {
-+ StorageDead(_4); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22
-+ StorageDead(_3); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22
-+ StorageDead(_2); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22
- StorageDead(_1); // scope 0 at $DIR/exponential_runtime.rs:+1:22: +1:23
- _0 = const (); // scope 0 at $DIR/exponential_runtime.rs:+0:11: +2:2
- return; // scope 0 at $DIR/exponential_runtime.rs:+2:2: +2:2
-+ }
-+
-+ bb2: {
-+ StorageDead(_7); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25
-+ StorageDead(_6); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25
-+ StorageDead(_5); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25
-+ _3 = <() as F>::call() -> bb3; // scope 1 at $DIR/exponential_runtime.rs:75:9: 75:25
-+ // mir::Constant
-+ // + span: $DIR/exponential_runtime.rs:75:9: 75:23
-+ // + literal: Const { ty: fn() {<() as F>::call}, val: Value(<ZST>) }
-+ }
-+
-+ bb3: {
-+ _4 = <() as F>::call() -> bb1; // scope 1 at $DIR/exponential_runtime.rs:76:9: 76:25
-+ // mir::Constant
-+ // + span: $DIR/exponential_runtime.rs:76:9: 76:23
-+ // + literal: Const { ty: fn() {<() as F>::call}, val: Value(<ZST>) }
-+ }
-+
-+ bb4: {
-+ _6 = <() as E>::call() -> bb5; // scope 2 at $DIR/exponential_runtime.rs:63:9: 63:25
-+ // mir::Constant
-+ // + span: $DIR/exponential_runtime.rs:63:9: 63:23
-+ // + literal: Const { ty: fn() {<() as E>::call}, val: Value(<ZST>) }
-+ }
-+
-+ bb5: {
-+ _7 = <() as E>::call() -> bb2; // scope 2 at $DIR/exponential_runtime.rs:64:9: 64:25
-+ // mir::Constant
-+ // + span: $DIR/exponential_runtime.rs:64:9: 64:23
-+ // + literal: Const { ty: fn() {<() as E>::call}, val: Value(<ZST>) }
- }
- }
-
diff --git a/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-abort.diff b/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-abort.diff
new file mode 100644
index 000000000..3ffe2ee0c
--- /dev/null
+++ b/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-abort.diff
@@ -0,0 +1,134 @@
+- // MIR for `main` before Inline
++ // MIR for `main` after Inline
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
++ scope 1 (inlined <() as G>::call) {
++ let _2: ();
++ let _3: ();
++ let _4: ();
++ scope 2 (inlined <() as F>::call) {
++ let _5: ();
++ let _6: ();
++ let _7: ();
++ scope 3 (inlined <() as E>::call) {
++ let _8: ();
++ let _9: ();
++ let _10: ();
++ scope 4 (inlined <() as D>::call) {
++ let _11: ();
++ let _12: ();
++ let _13: ();
++ scope 5 (inlined <() as C>::call) {
++ let _14: ();
++ let _15: ();
++ let _16: ();
++ scope 6 (inlined <() as B>::call) {
++ let _17: ();
++ let _18: ();
++ let _19: ();
++ }
++ }
++ }
++ }
++ }
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = <() as G>::call() -> [return: bb1, unwind unreachable];
++ StorageLive(_2);
++ StorageLive(_3);
++ StorageLive(_4);
++ StorageLive(_5);
++ StorageLive(_6);
++ StorageLive(_7);
++ StorageLive(_8);
++ StorageLive(_9);
++ StorageLive(_10);
++ StorageLive(_11);
++ StorageLive(_12);
++ StorageLive(_13);
++ StorageLive(_14);
++ StorageLive(_15);
++ StorageLive(_16);
++ StorageLive(_17);
++ StorageLive(_18);
++ StorageLive(_19);
++ _17 = <() as A>::call() -> [return: bb12, unwind unreachable];
+ }
+
+ bb1: {
++ StorageDead(_4);
++ StorageDead(_3);
++ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
++ }
++
++ bb2: {
++ _4 = <() as F>::call() -> [return: bb1, unwind unreachable];
++ }
++
++ bb3: {
++ StorageDead(_7);
++ StorageDead(_6);
++ StorageDead(_5);
++ _3 = <() as F>::call() -> [return: bb2, unwind unreachable];
++ }
++
++ bb4: {
++ _7 = <() as E>::call() -> [return: bb3, unwind unreachable];
++ }
++
++ bb5: {
++ StorageDead(_10);
++ StorageDead(_9);
++ StorageDead(_8);
++ _6 = <() as E>::call() -> [return: bb4, unwind unreachable];
++ }
++
++ bb6: {
++ _10 = <() as D>::call() -> [return: bb5, unwind unreachable];
++ }
++
++ bb7: {
++ StorageDead(_13);
++ StorageDead(_12);
++ StorageDead(_11);
++ _9 = <() as D>::call() -> [return: bb6, unwind unreachable];
++ }
++
++ bb8: {
++ _13 = <() as C>::call() -> [return: bb7, unwind unreachable];
++ }
++
++ bb9: {
++ StorageDead(_16);
++ StorageDead(_15);
++ StorageDead(_14);
++ _12 = <() as C>::call() -> [return: bb8, unwind unreachable];
++ }
++
++ bb10: {
++ _16 = <() as B>::call() -> [return: bb9, unwind unreachable];
++ }
++
++ bb11: {
++ StorageDead(_19);
++ StorageDead(_18);
++ StorageDead(_17);
++ _15 = <() as B>::call() -> [return: bb10, unwind unreachable];
++ }
++
++ bb12: {
++ _18 = <() as A>::call() -> [return: bb13, unwind unreachable];
++ }
++
++ bb13: {
++ _19 = <() as A>::call() -> [return: bb11, unwind unreachable];
+ }
+ }
+
diff --git a/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-unwind.diff
new file mode 100644
index 000000000..3f334779e
--- /dev/null
+++ b/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-unwind.diff
@@ -0,0 +1,134 @@
+- // MIR for `main` before Inline
++ // MIR for `main` after Inline
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
++ scope 1 (inlined <() as G>::call) {
++ let _2: ();
++ let _3: ();
++ let _4: ();
++ scope 2 (inlined <() as F>::call) {
++ let _5: ();
++ let _6: ();
++ let _7: ();
++ scope 3 (inlined <() as E>::call) {
++ let _8: ();
++ let _9: ();
++ let _10: ();
++ scope 4 (inlined <() as D>::call) {
++ let _11: ();
++ let _12: ();
++ let _13: ();
++ scope 5 (inlined <() as C>::call) {
++ let _14: ();
++ let _15: ();
++ let _16: ();
++ scope 6 (inlined <() as B>::call) {
++ let _17: ();
++ let _18: ();
++ let _19: ();
++ }
++ }
++ }
++ }
++ }
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = <() as G>::call() -> [return: bb1, unwind continue];
++ StorageLive(_2);
++ StorageLive(_3);
++ StorageLive(_4);
++ StorageLive(_5);
++ StorageLive(_6);
++ StorageLive(_7);
++ StorageLive(_8);
++ StorageLive(_9);
++ StorageLive(_10);
++ StorageLive(_11);
++ StorageLive(_12);
++ StorageLive(_13);
++ StorageLive(_14);
++ StorageLive(_15);
++ StorageLive(_16);
++ StorageLive(_17);
++ StorageLive(_18);
++ StorageLive(_19);
++ _17 = <() as A>::call() -> [return: bb12, unwind continue];
+ }
+
+ bb1: {
++ StorageDead(_4);
++ StorageDead(_3);
++ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
++ }
++
++ bb2: {
++ _4 = <() as F>::call() -> [return: bb1, unwind continue];
++ }
++
++ bb3: {
++ StorageDead(_7);
++ StorageDead(_6);
++ StorageDead(_5);
++ _3 = <() as F>::call() -> [return: bb2, unwind continue];
++ }
++
++ bb4: {
++ _7 = <() as E>::call() -> [return: bb3, unwind continue];
++ }
++
++ bb5: {
++ StorageDead(_10);
++ StorageDead(_9);
++ StorageDead(_8);
++ _6 = <() as E>::call() -> [return: bb4, unwind continue];
++ }
++
++ bb6: {
++ _10 = <() as D>::call() -> [return: bb5, unwind continue];
++ }
++
++ bb7: {
++ StorageDead(_13);
++ StorageDead(_12);
++ StorageDead(_11);
++ _9 = <() as D>::call() -> [return: bb6, unwind continue];
++ }
++
++ bb8: {
++ _13 = <() as C>::call() -> [return: bb7, unwind continue];
++ }
++
++ bb9: {
++ StorageDead(_16);
++ StorageDead(_15);
++ StorageDead(_14);
++ _12 = <() as C>::call() -> [return: bb8, unwind continue];
++ }
++
++ bb10: {
++ _16 = <() as B>::call() -> [return: bb9, unwind continue];
++ }
++
++ bb11: {
++ StorageDead(_19);
++ StorageDead(_18);
++ StorageDead(_17);
++ _15 = <() as B>::call() -> [return: bb10, unwind continue];
++ }
++
++ bb12: {
++ _18 = <() as A>::call() -> [return: bb13, unwind continue];
++ }
++
++ bb13: {
++ _19 = <() as A>::call() -> [return: bb11, unwind continue];
+ }
+ }
+
diff --git a/tests/mir-opt/inline/exponential_runtime.rs b/tests/mir-opt/inline/exponential_runtime.rs
index 39985528f..1199ce4e5 100644
--- a/tests/mir-opt/inline/exponential_runtime.rs
+++ b/tests/mir-opt/inline/exponential_runtime.rs
@@ -1,4 +1,4 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Checks that code with exponential runtime does not have exponential behavior in inlining.
trait A {
@@ -84,5 +84,14 @@ impl A for () {
// EMIT_MIR exponential_runtime.main.Inline.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK-NOT: inlined
+ // CHECK: (inlined <() as G>::call)
+ // CHECK: (inlined <() as F>::call)
+ // CHECK: (inlined <() as E>::call)
+ // CHECK: (inlined <() as D>::call)
+ // CHECK: (inlined <() as C>::call)
+ // CHECK: (inlined <() as B>::call)
+ // CHECK-NOT: inlined
<() as G>::call();
}
diff --git a/tests/mir-opt/inline/indirect_destination.rs b/tests/mir-opt/inline/indirect_destination.rs
new file mode 100644
index 000000000..2842e2336
--- /dev/null
+++ b/tests/mir-opt/inline/indirect_destination.rs
@@ -0,0 +1,42 @@
+// Test for inlining with an indirect destination place.
+//
+// unit-test: Inline
+// edition: 2021
+// needs-unwind
+#![crate_type = "lib"]
+#![feature(custom_mir, core_intrinsics)]
+use core::intrinsics::mir::*;
+
+#[custom_mir(dialect = "runtime", phase = "initial")]
+// CHECK-LABEL: fn f(
+// CHECK: bb1: {
+// CHECK-NEXT: StorageLive([[A:.*]]);
+// CHECK-NEXT: [[A]] = &mut (*_1);
+// CHECK-NEXT: StorageLive([[B:.*]]);
+// CHECK-NEXT: [[B]] = const 42_u8;
+// CHECK-NEXT: (*[[A]]) = move [[B]];
+// CHECK-NEXT: StorageDead([[B]]);
+// CHECK-NEXT: StorageDead([[A]]);
+// CHECK-NEXT: goto -> bb1;
+// CHECK-NEXT: }
+pub fn f(a: *mut u8) {
+ mir! {
+ {
+ Goto(bb1)
+ }
+ bb1 = {
+ Call(*a = g(), bb1, UnwindUnreachable())
+ }
+ }
+}
+
+#[custom_mir(dialect = "runtime", phase = "initial")]
+#[inline(always)]
+fn g() -> u8 {
+ mir! {
+ {
+ RET = 42;
+ Return()
+ }
+ }
+}
diff --git a/tests/mir-opt/inline/inline_any_operand.bar.Inline.after.mir b/tests/mir-opt/inline/inline_any_operand.bar.Inline.after.mir
index 20f737cc2..2d0b71e0a 100644
--- a/tests/mir-opt/inline/inline_any_operand.bar.Inline.after.mir
+++ b/tests/mir-opt/inline/inline_any_operand.bar.Inline.after.mir
@@ -1,36 +1,33 @@
// MIR for `bar` after Inline
fn bar() -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/inline_any_operand.rs:+0:13: +0:17
- let _1: fn(i32, i32) -> bool {foo}; // in scope 0 at $DIR/inline_any_operand.rs:+1:9: +1:10
- let mut _2: fn(i32, i32) -> bool {foo}; // in scope 0 at $DIR/inline_any_operand.rs:+2:5: +2:6
- let mut _3: i32; // in scope 0 at $DIR/inline_any_operand.rs:+2:5: +2:13
- let mut _4: i32; // in scope 0 at $DIR/inline_any_operand.rs:+2:5: +2:13
+ let mut _0: bool;
+ let _1: fn(i32, i32) -> bool {foo};
+ let mut _2: fn(i32, i32) -> bool {foo};
+ let mut _3: i32;
+ let mut _4: i32;
scope 1 {
- debug f => _1; // in scope 1 at $DIR/inline_any_operand.rs:+1:9: +1:10
- scope 2 (inlined foo) { // at $DIR/inline_any_operand.rs:12:5: 12:13
- debug x => _3; // in scope 2 at $DIR/inline_any_operand.rs:16:8: 16:9
- debug y => _4; // in scope 2 at $DIR/inline_any_operand.rs:16:16: 16:17
+ debug f => _1;
+ scope 2 (inlined foo) {
+ debug x => _3;
+ debug y => _4;
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_any_operand.rs:+1:9: +1:10
- _1 = foo; // scope 0 at $DIR/inline_any_operand.rs:+1:13: +1:16
- // mir::Constant
- // + span: $DIR/inline_any_operand.rs:11:13: 11:16
- // + literal: Const { ty: fn(i32, i32) -> bool {foo}, val: Value(<ZST>) }
- StorageLive(_2); // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:6
- _2 = _1; // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:6
- StorageLive(_3); // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13
- _3 = const 1_i32; // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13
- StorageLive(_4); // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13
- _4 = const -1_i32; // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13
- _0 = Eq(_3, _4); // scope 2 at $DIR/inline_any_operand.rs:17:5: 17:11
- StorageDead(_4); // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13
- StorageDead(_3); // scope 1 at $DIR/inline_any_operand.rs:+2:5: +2:13
- StorageDead(_2); // scope 1 at $DIR/inline_any_operand.rs:+2:12: +2:13
- StorageDead(_1); // scope 0 at $DIR/inline_any_operand.rs:+3:1: +3:2
- return; // scope 0 at $DIR/inline_any_operand.rs:+3:2: +3:2
+ StorageLive(_1);
+ _1 = foo;
+ StorageLive(_2);
+ _2 = _1;
+ StorageLive(_3);
+ _3 = const 1_i32;
+ StorageLive(_4);
+ _4 = const -1_i32;
+ _0 = Eq(_3, _4);
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/inline/inline_any_operand.rs b/tests/mir-opt/inline/inline_any_operand.rs
index fb0de020f..659b7c3a0 100644
--- a/tests/mir-opt/inline/inline_any_operand.rs
+++ b/tests/mir-opt/inline/inline_any_operand.rs
@@ -8,6 +8,8 @@ fn main() {
// EMIT_MIR inline_any_operand.bar.Inline.after.mir
fn bar() -> bool {
+ // CHECK-LABEL: fn bar(
+ // CHECK: (inlined foo)
let f = foo;
f(1, -1)
}
diff --git a/tests/mir-opt/inline/inline_async.rs b/tests/mir-opt/inline/inline_async.rs
index 5c838159b..1de87e1e4 100644
--- a/tests/mir-opt/inline/inline_async.rs
+++ b/tests/mir-opt/inline/inline_async.rs
@@ -1,4 +1,5 @@
-// Checks that inliner doesn't introduce cycles when optimizing generators.
+// skip-filecheck
+// Checks that inliner doesn't introduce cycles when optimizing coroutines.
// The outcome of optimization is not verfied, just the absence of the cycle.
// Regression test for #76181.
//
diff --git a/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-abort.diff
new file mode 100644
index 000000000..4fa04b05e
--- /dev/null
+++ b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-abort.diff
@@ -0,0 +1,32 @@
+- // MIR for `call` before Inline
++ // MIR for `call` after Inline
+
+ fn call(_1: Box<dyn Fn(i32)>) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: &std::boxed::Box<dyn std::ops::Fn(i32)>;
+ let mut _4: (i32,);
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &_1;
+ StorageLive(_4);
+ _4 = (const 1_i32,);
+ _2 = <Box<dyn Fn(i32)> as Fn<(i32,)>>::call(move _3, move _4) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ return;
+ }
+ }
+
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
new file mode 100644
index 000000000..47fd0ed07
--- /dev/null
+++ b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff
@@ -0,0 +1,40 @@
+- // MIR for `call` before Inline
++ // MIR for `call` after Inline
+
+ fn call(_1: Box<dyn Fn(i32)>) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: &std::boxed::Box<dyn std::ops::Fn(i32)>;
+ let mut _4: (i32,);
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &_1;
+ StorageLive(_4);
+ _4 = (const 1_i32,);
+ _2 = <Box<dyn Fn(i32)> as Fn<(i32,)>>::call(move _3, move _4) -> [return: bb1, unwind: bb3];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb2, unwind: bb4];
+ }
+
+ bb2: {
+ return;
+ }
+
+ bb3 (cleanup): {
+ drop(_1) -> [return: bb4, unwind terminate(cleanup)];
+ }
+
+ bb4 (cleanup): {
+ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_box_fn.rs b/tests/mir-opt/inline/inline_box_fn.rs
new file mode 100644
index 000000000..d2da23939
--- /dev/null
+++ b/tests/mir-opt/inline/inline_box_fn.rs
@@ -0,0 +1,10 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// unit-test: Inline
+// compile-flags: --crate-type=lib
+
+// EMIT_MIR inline_box_fn.call.Inline.diff
+fn call(x: Box<dyn Fn(i32)>) {
+ // CHECK-LABEL: fn call(
+ // CHECK-NOT: inlined
+ x(1);
+}
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 1d2f99cbe..8a60f4b1b 100644
--- a/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir
+++ b/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir
@@ -1,55 +1,47 @@
// MIR for `foo` after Inline
fn foo(_1: T, _2: i32) -> i32 {
- debug _t => _1; // in scope 0 at $DIR/inline_closure.rs:+0:17: +0:19
- debug q => _2; // in scope 0 at $DIR/inline_closure.rs:+0:24: +0:25
- let mut _0: i32; // return place in scope 0 at $DIR/inline_closure.rs:+0:35: +0:38
- let _3: [closure@foo<T>::{closure#0}]; // in scope 0 at $DIR/inline_closure.rs:+1:9: +1:10
- let mut _4: &[closure@foo<T>::{closure#0}]; // in scope 0 at $DIR/inline_closure.rs:+2:5: +2:6
- let mut _5: (i32, i32); // in scope 0 at $DIR/inline_closure.rs:+2:5: +2:12
- let mut _6: i32; // in scope 0 at $DIR/inline_closure.rs:+2:7: +2:8
- let mut _7: i32; // in scope 0 at $DIR/inline_closure.rs:+2:10: +2:11
- let mut _8: i32; // in scope 0 at $DIR/inline_closure.rs:+2:5: +2:12
- let mut _9: i32; // in scope 0 at $DIR/inline_closure.rs:+2:5: +2:12
+ 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 mut _5: (i32, i32);
+ let mut _6: i32;
+ let mut _7: i32;
+ let mut _8: i32;
+ let mut _9: i32;
scope 1 {
- debug x => _3; // in scope 1 at $DIR/inline_closure.rs:+1:9: +1:10
- scope 2 (inlined foo::<T>::{closure#0}) { // at $DIR/inline_closure.rs:12:5: 12:12
- debug _t => _8; // in scope 2 at $DIR/inline_closure.rs:+1:14: +1:16
- debug _q => _9; // in scope 2 at $DIR/inline_closure.rs:+1:18: +1:20
+ debug x => _3;
+ scope 2 (inlined foo::<T>::{closure#0}) {
+ debug _t => _8;
+ debug _q => _9;
}
}
bb0: {
- StorageLive(_3); // scope 0 at $DIR/inline_closure.rs:+1:9: +1:10
- _3 = [closure@foo::<T>::{closure#0}]; // scope 0 at $DIR/inline_closure.rs:+1:13: +1:24
- // closure
- // + def_id: DefId(0:6 ~ inline_closure[8f32]::foo::{closure#0})
- // + substs: [
- // T,
- // i8,
- // extern "rust-call" fn((i32, i32)) -> i32,
- // (),
- // ]
- StorageLive(_4); // scope 1 at $DIR/inline_closure.rs:+2:5: +2:6
- _4 = &_3; // scope 1 at $DIR/inline_closure.rs:+2:5: +2:6
- StorageLive(_5); // scope 1 at $DIR/inline_closure.rs:+2:5: +2:12
- StorageLive(_6); // scope 1 at $DIR/inline_closure.rs:+2:7: +2:8
- _6 = _2; // scope 1 at $DIR/inline_closure.rs:+2:7: +2:8
- StorageLive(_7); // scope 1 at $DIR/inline_closure.rs:+2:10: +2:11
- _7 = _2; // scope 1 at $DIR/inline_closure.rs:+2:10: +2:11
- _5 = (move _6, move _7); // scope 1 at $DIR/inline_closure.rs:+2:5: +2:12
- StorageLive(_8); // scope 1 at $DIR/inline_closure.rs:+2:5: +2:12
- _8 = move (_5.0: i32); // scope 1 at $DIR/inline_closure.rs:+2:5: +2:12
- StorageLive(_9); // scope 1 at $DIR/inline_closure.rs:+2:5: +2:12
- _9 = move (_5.1: i32); // scope 1 at $DIR/inline_closure.rs:+2:5: +2:12
- _0 = _8; // scope 2 at $DIR/inline_closure.rs:+1:22: +1:24
- StorageDead(_9); // scope 1 at $DIR/inline_closure.rs:+2:5: +2:12
- StorageDead(_8); // scope 1 at $DIR/inline_closure.rs:+2:5: +2:12
- StorageDead(_7); // scope 1 at $DIR/inline_closure.rs:+2:11: +2:12
- StorageDead(_6); // scope 1 at $DIR/inline_closure.rs:+2:11: +2:12
- StorageDead(_5); // scope 1 at $DIR/inline_closure.rs:+2:11: +2:12
- StorageDead(_4); // scope 1 at $DIR/inline_closure.rs:+2:11: +2:12
- StorageDead(_3); // scope 0 at $DIR/inline_closure.rs:+3:1: +3:2
- return; // scope 0 at $DIR/inline_closure.rs:+3:2: +3:2
+ StorageLive(_3);
+ _3 = {closure@foo::<T>::{closure#0}};
+ StorageLive(_4);
+ _4 = &_3;
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = _2;
+ StorageLive(_7);
+ _7 = _2;
+ _5 = (move _6, move _7);
+ StorageLive(_8);
+ _8 = move (_5.0: i32);
+ StorageLive(_9);
+ _9 = move (_5.1: i32);
+ _0 = _8;
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
}
}
diff --git a/tests/mir-opt/inline/inline_closure.rs b/tests/mir-opt/inline/inline_closure.rs
index 715fd0138..65f55d49a 100644
--- a/tests/mir-opt/inline/inline_closure.rs
+++ b/tests/mir-opt/inline/inline_closure.rs
@@ -9,5 +9,8 @@ fn main() {
// EMIT_MIR inline_closure.foo.Inline.after.mir
fn foo<T: Copy>(_t: T, q: i32) -> i32 {
let x = |_t, _q| _t;
+
+ // CHECK-LABEL: fn foo(
+ // CHECK: (inlined foo::<T>::{closure#0})
x(q, q)
}
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 80274bb7e..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
@@ -1,58 +1,50 @@
// MIR for `foo` after Inline
fn foo(_1: T, _2: &i32) -> i32 {
- debug _t => _1; // in scope 0 at $DIR/inline_closure_borrows_arg.rs:+0:17: +0:19
- debug q => _2; // in scope 0 at $DIR/inline_closure_borrows_arg.rs:+0:24: +0:25
- let mut _0: i32; // return place in scope 0 at $DIR/inline_closure_borrows_arg.rs:+0:36: +0:39
- let _3: [closure@foo<T>::{closure#0}]; // in scope 0 at $DIR/inline_closure_borrows_arg.rs:+1:9: +1:10
- let mut _4: &[closure@foo<T>::{closure#0}]; // in scope 0 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:6
- let mut _5: (&i32, &i32); // in scope 0 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
- let mut _6: &i32; // in scope 0 at $DIR/inline_closure_borrows_arg.rs:+5:7: +5:8
- let mut _7: &i32; // in scope 0 at $DIR/inline_closure_borrows_arg.rs:+5:10: +5:11
- let mut _8: &i32; // in scope 0 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
- let mut _9: &i32; // in scope 0 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
+ 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 mut _5: (&i32, &i32);
+ let mut _6: &i32;
+ let mut _7: &i32;
+ let mut _8: &i32;
+ let mut _9: &i32;
scope 1 {
- debug x => _3; // in scope 1 at $DIR/inline_closure_borrows_arg.rs:+1:9: +1:10
- scope 2 (inlined foo::<T>::{closure#0}) { // at $DIR/inline_closure_borrows_arg.rs:16:5: 16:12
- debug r => _8; // in scope 2 at $DIR/inline_closure_borrows_arg.rs:+1:14: +1:15
- debug _s => _9; // in scope 2 at $DIR/inline_closure_borrows_arg.rs:+1:23: +1:25
+ debug x => _3;
+ scope 2 (inlined foo::<T>::{closure#0}) {
+ debug r => _8;
+ debug _s => _9;
scope 3 {
- debug variable => _8; // in scope 3 at $DIR/inline_closure_borrows_arg.rs:+2:13: +2:21
+ debug variable => _8;
}
}
}
bb0: {
- StorageLive(_3); // scope 0 at $DIR/inline_closure_borrows_arg.rs:+1:9: +1:10
- _3 = [closure@foo::<T>::{closure#0}]; // scope 0 at $DIR/inline_closure_borrows_arg.rs:+1:13: +4:6
- // closure
- // + def_id: DefId(0:6 ~ inline_closure_borrows_arg[f89f]::foo::{closure#0})
- // + substs: [
- // T,
- // i8,
- // for<'a, 'b> extern "rust-call" fn((&'a i32, &'b i32)) -> i32,
- // (),
- // ]
- StorageLive(_4); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:6
- _4 = &_3; // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:6
- StorageLive(_5); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
- StorageLive(_6); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:7: +5:8
- _6 = &(*_2); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:7: +5:8
- StorageLive(_7); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:10: +5:11
- _7 = &(*_2); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:10: +5:11
- _5 = (move _6, move _7); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
- StorageLive(_8); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
- _8 = move (_5.0: &i32); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
- StorageLive(_9); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
- _9 = move (_5.1: &i32); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
- _0 = (*_8); // scope 3 at $DIR/inline_closure_borrows_arg.rs:+3:9: +3:18
- StorageDead(_9); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
- StorageDead(_8); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:5: +5:12
- StorageDead(_7); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:11: +5:12
- StorageDead(_6); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:11: +5:12
- StorageDead(_5); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:11: +5:12
- StorageDead(_4); // scope 1 at $DIR/inline_closure_borrows_arg.rs:+5:11: +5:12
- StorageDead(_3); // scope 0 at $DIR/inline_closure_borrows_arg.rs:+6:1: +6:2
- return; // scope 0 at $DIR/inline_closure_borrows_arg.rs:+6:2: +6:2
+ StorageLive(_3);
+ _3 = {closure@foo::<T>::{closure#0}};
+ StorageLive(_4);
+ _4 = &_3;
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = &(*_2);
+ StorageLive(_7);
+ _7 = &(*_2);
+ _5 = (move _6, move _7);
+ StorageLive(_8);
+ _8 = move (_5.0: &i32);
+ StorageLive(_9);
+ _9 = move (_5.1: &i32);
+ _0 = (*_8);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
}
}
diff --git a/tests/mir-opt/inline/inline_closure_borrows_arg.rs b/tests/mir-opt/inline/inline_closure_borrows_arg.rs
index d76bc33f5..1570ab057 100644
--- a/tests/mir-opt/inline/inline_closure_borrows_arg.rs
+++ b/tests/mir-opt/inline/inline_closure_borrows_arg.rs
@@ -13,5 +13,8 @@ fn foo<T: Copy>(_t: T, q: &i32) -> i32 {
let variable = &*r;
*variable
};
+
+ // CHECK-LABEL: fn foo(
+ // CHECK: (inlined foo::<T>::{closure#0})
x(q, q)
}
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 b36711f82..10b81e59b 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
@@ -1,68 +1,64 @@
// MIR for `foo` after Inline
fn foo(_1: T, _2: i32) -> (i32, T) {
- debug t => _1; // in scope 0 at $DIR/inline_closure_captures.rs:+0:17: +0:18
- debug q => _2; // in scope 0 at $DIR/inline_closure_captures.rs:+0:23: +0:24
- let mut _0: (i32, T); // return place in scope 0 at $DIR/inline_closure_captures.rs:+0:34: +0:42
- let _3: [closure@foo<T>::{closure#0}]; // in scope 0 at $DIR/inline_closure_captures.rs:+1:9: +1:10
- let mut _4: &i32; // in scope 0 at $DIR/inline_closure_captures.rs:+1:13: +1:24
- let mut _5: &T; // in scope 0 at $DIR/inline_closure_captures.rs:+1:13: +1:24
- let mut _6: &[closure@foo<T>::{closure#0}]; // in scope 0 at $DIR/inline_closure_captures.rs:+2:5: +2:6
- let mut _7: (i32,); // in scope 0 at $DIR/inline_closure_captures.rs:+2:5: +2:9
- let mut _8: i32; // in scope 0 at $DIR/inline_closure_captures.rs:+2:7: +2:8
- let mut _9: i32; // in scope 0 at $DIR/inline_closure_captures.rs:+2:5: +2:9
+ debug t => _1;
+ debug q => _2;
+ let mut _0: (i32, T);
+ 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 _7: (i32,);
+ let mut _8: i32;
+ let mut _9: i32;
scope 1 {
- debug x => _3; // in scope 1 at $DIR/inline_closure_captures.rs:+1:9: +1:10
- scope 2 (inlined foo::<T>::{closure#0}) { // at $DIR/inline_closure_captures.rs:12:5: 12:9
- debug _q => _9; // in scope 2 at $DIR/inline_closure_captures.rs:+1:14: +1:16
- debug q => (*((*_6).0: &i32)); // in scope 2 at $DIR/inline_closure_captures.rs:+0:23: +0:24
- debug t => (*((*_6).1: &T)); // in scope 2 at $DIR/inline_closure_captures.rs:+0:17: +0:18
- let mut _10: i32; // in scope 2 at $DIR/inline_closure_captures.rs:+1:19: +1:20
- let mut _11: T; // in scope 2 at $DIR/inline_closure_captures.rs:+1:22: +1:23
- let mut _12: &i32; // in scope 2 at $DIR/inline_closure_captures.rs:+1:13: +1:24
- let mut _13: &T; // in scope 2 at $DIR/inline_closure_captures.rs:+1:13: +1:24
+ debug x => _3;
+ scope 2 (inlined foo::<T>::{closure#0}) {
+ debug _q => _9;
+ debug q => (*((*_6).0: &i32));
+ debug t => (*((*_6).1: &T));
+ let mut _10: &i32;
+ let mut _11: i32;
+ let mut _12: &T;
+ let mut _13: T;
}
}
bb0: {
- StorageLive(_3); // scope 0 at $DIR/inline_closure_captures.rs:+1:9: +1:10
- StorageLive(_4); // scope 0 at $DIR/inline_closure_captures.rs:+1:13: +1:24
- _4 = &_2; // scope 0 at $DIR/inline_closure_captures.rs:+1:13: +1:24
- StorageLive(_5); // scope 0 at $DIR/inline_closure_captures.rs:+1:13: +1:24
- _5 = &_1; // scope 0 at $DIR/inline_closure_captures.rs:+1:13: +1:24
- _3 = [closure@foo::<T>::{closure#0}] { q: move _4, t: move _5 }; // scope 0 at $DIR/inline_closure_captures.rs:+1:13: +1:24
- // closure
- // + def_id: DefId(0:6 ~ inline_closure_captures[63a5]::foo::{closure#0})
- // + substs: [
- // T,
- // i8,
- // extern "rust-call" fn((i32,)) -> (i32, T),
- // (&i32, &T),
- // ]
- StorageDead(_5); // scope 0 at $DIR/inline_closure_captures.rs:+1:16: +1:17
- StorageDead(_4); // scope 0 at $DIR/inline_closure_captures.rs:+1:16: +1:17
- StorageLive(_6); // scope 1 at $DIR/inline_closure_captures.rs:+2:5: +2:6
- _6 = &_3; // scope 1 at $DIR/inline_closure_captures.rs:+2:5: +2:6
- StorageLive(_7); // scope 1 at $DIR/inline_closure_captures.rs:+2:5: +2:9
- StorageLive(_8); // scope 1 at $DIR/inline_closure_captures.rs:+2:7: +2:8
- _8 = _2; // scope 1 at $DIR/inline_closure_captures.rs:+2:7: +2:8
- _7 = (move _8,); // scope 1 at $DIR/inline_closure_captures.rs:+2:5: +2:9
- StorageLive(_9); // scope 1 at $DIR/inline_closure_captures.rs:+2:5: +2:9
- _9 = move (_7.0: i32); // scope 1 at $DIR/inline_closure_captures.rs:+2:5: +2:9
- StorageLive(_10); // scope 2 at $DIR/inline_closure_captures.rs:+1:19: +1:20
- _12 = deref_copy ((*_6).0: &i32); // scope 2 at $DIR/inline_closure_captures.rs:+1:19: +1:20
- _10 = (*_12); // scope 2 at $DIR/inline_closure_captures.rs:+1:19: +1:20
- StorageLive(_11); // scope 2 at $DIR/inline_closure_captures.rs:+1:22: +1:23
- _13 = deref_copy ((*_6).1: &T); // scope 2 at $DIR/inline_closure_captures.rs:+1:22: +1:23
- _11 = (*_13); // scope 2 at $DIR/inline_closure_captures.rs:+1:22: +1:23
- _0 = (move _10, move _11); // scope 2 at $DIR/inline_closure_captures.rs:+1:18: +1:24
- StorageDead(_11); // scope 2 at $DIR/inline_closure_captures.rs:+1:23: +1:24
- StorageDead(_10); // scope 2 at $DIR/inline_closure_captures.rs:+1:23: +1:24
- StorageDead(_9); // scope 1 at $DIR/inline_closure_captures.rs:+2:5: +2:9
- StorageDead(_8); // scope 1 at $DIR/inline_closure_captures.rs:+2:8: +2:9
- StorageDead(_7); // scope 1 at $DIR/inline_closure_captures.rs:+2:8: +2:9
- StorageDead(_6); // scope 1 at $DIR/inline_closure_captures.rs:+2:8: +2:9
- StorageDead(_3); // scope 0 at $DIR/inline_closure_captures.rs:+3:1: +3:2
- return; // scope 0 at $DIR/inline_closure_captures.rs:+3:2: +3:2
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &_2;
+ StorageLive(_5);
+ _5 = &_1;
+ _3 = {closure@foo::<T>::{closure#0}} { q: move _4, t: move _5 };
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ _6 = &_3;
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = _2;
+ _7 = (move _8,);
+ StorageLive(_9);
+ _9 = move (_7.0: i32);
+ StorageLive(_10);
+ StorageLive(_12);
+ StorageLive(_11);
+ _10 = ((*_6).0: &i32);
+ _11 = (*_10);
+ StorageLive(_13);
+ _12 = ((*_6).1: &T);
+ _13 = (*_12);
+ _0 = (move _11, move _13);
+ StorageDead(_13);
+ StorageDead(_11);
+ StorageDead(_12);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_3);
+ return;
}
}
diff --git a/tests/mir-opt/inline/inline_closure_captures.rs b/tests/mir-opt/inline/inline_closure_captures.rs
index 52b6817e4..2b08b1068 100644
--- a/tests/mir-opt/inline/inline_closure_captures.rs
+++ b/tests/mir-opt/inline/inline_closure_captures.rs
@@ -9,5 +9,8 @@ fn main() {
// EMIT_MIR inline_closure_captures.foo.Inline.after.mir
fn foo<T: Copy>(t: T, q: i32) -> (i32, T) {
let x = |_q| (q, t);
+
+ // CHECK-LABEL: fn foo(
+ // CHECK: (inlined foo::<T>::{closure#0})
x(q)
}
diff --git a/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.diff b/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.diff
deleted file mode 100644
index e30a5e116..000000000
--- a/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.diff
+++ /dev/null
@@ -1,24 +0,0 @@
-- // MIR for `inlined_no_sanitize` before Inline
-+ // MIR for `inlined_no_sanitize` after Inline
-
- fn inlined_no_sanitize() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:37: +0:37
- let _1: (); // in scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
-+ scope 1 (inlined no_sanitize) { // at $DIR/inline_compatibility.rs:24:5: 24:18
-+ }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
-- _1 = no_sanitize() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
-- // mir::Constant
-- // + span: $DIR/inline_compatibility.rs:24:5: 24:16
-- // + literal: Const { ty: unsafe fn() {no_sanitize}, val: Value(<ZST>) }
-- }
--
-- bb1: {
- StorageDead(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:18: +1:19
- _0 = const (); // scope 0 at $DIR/inline_compatibility.rs:+0:37: +2:2
- return; // scope 0 at $DIR/inline_compatibility.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.diff b/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.diff
deleted file mode 100644
index c2b3c46a3..000000000
--- a/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.diff
+++ /dev/null
@@ -1,24 +0,0 @@
-- // MIR for `inlined_target_feature` before Inline
-+ // MIR for `inlined_target_feature` after Inline
-
- fn inlined_target_feature() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:40: +0:40
- let _1: (); // in scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
-+ scope 1 (inlined target_feature) { // at $DIR/inline_compatibility.rs:13:5: 13:21
-+ }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
-- _1 = target_feature() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
-- // mir::Constant
-- // + span: $DIR/inline_compatibility.rs:13:5: 13:19
-- // + literal: Const { ty: unsafe fn() {target_feature}, val: Value(<ZST>) }
-- }
--
-- bb1: {
- StorageDead(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:21: +1:22
- _0 = const (); // scope 0 at $DIR/inline_compatibility.rs:+0:40: +2:2
- return; // scope 0 at $DIR/inline_compatibility.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.diff
deleted file mode 100644
index 0ca5a5f70..000000000
--- a/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.diff
+++ /dev/null
@@ -1,25 +0,0 @@
-- // MIR for `not_inlined_c_variadic` before Inline
-+ // MIR for `not_inlined_c_variadic` after Inline
-
- fn not_inlined_c_variadic() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:40: +0:40
- let _1: u32; // in scope 0 at $DIR/inline_compatibility.rs:+1:9: +1:10
- scope 1 {
- debug s => _1; // in scope 1 at $DIR/inline_compatibility.rs:+1:9: +1:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:9: +1:10
- _1 = sum(const 4_u32, const 4_u32, const 30_u32, const 200_u32, const 1000_u32) -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:13: +1:52
- // mir::Constant
- // + span: $DIR/inline_compatibility.rs:42:13: 42:16
- // + literal: Const { ty: unsafe extern "C" fn(u32, ...) -> u32 {sum}, val: Value(<ZST>) }
- }
-
- bb1: {
- _0 = const (); // scope 0 at $DIR/inline_compatibility.rs:+0:40: +2:2
- StorageDead(_1); // scope 0 at $DIR/inline_compatibility.rs:+2:1: +2:2
- return; // scope 0 at $DIR/inline_compatibility.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.diff
deleted file mode 100644
index 00d405c77..000000000
--- a/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.diff
+++ /dev/null
@@ -1,22 +0,0 @@
-- // MIR for `not_inlined_no_sanitize` before Inline
-+ // MIR for `not_inlined_no_sanitize` after Inline
-
- fn not_inlined_no_sanitize() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:41: +0:41
- let _1: (); // in scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
- _1 = no_sanitize() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
- // mir::Constant
- // + span: $DIR/inline_compatibility.rs:29:5: 29:16
- // + literal: Const { ty: unsafe fn() {no_sanitize}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:18: +1:19
- _0 = const (); // scope 0 at $DIR/inline_compatibility.rs:+0:41: +2:2
- return; // scope 0 at $DIR/inline_compatibility.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.diff
deleted file mode 100644
index 8b9c86f55..000000000
--- a/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.diff
+++ /dev/null
@@ -1,22 +0,0 @@
-- // MIR for `not_inlined_target_feature` before Inline
-+ // MIR for `not_inlined_target_feature` after Inline
-
- fn not_inlined_target_feature() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:44: +0:44
- let _1: (); // in scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
- _1 = target_feature() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
- // mir::Constant
- // + span: $DIR/inline_compatibility.rs:18:5: 18:19
- // + literal: Const { ty: unsafe fn() {target_feature}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:21: +1:22
- _0 = const (); // scope 0 at $DIR/inline_compatibility.rs:+0:44: +2:2
- return; // scope 0 at $DIR/inline_compatibility.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.rs b/tests/mir-opt/inline/inline_compatibility.rs
index 30aff0a64..3ad880715 100644
--- a/tests/mir-opt/inline/inline_compatibility.rs
+++ b/tests/mir-opt/inline/inline_compatibility.rs
@@ -1,49 +1,71 @@
// Checks that only functions with compatible attributes are inlined.
-//
// only-x86_64
+// compile-flags: -Cpanic=abort
#![crate_type = "lib"]
#![feature(no_sanitize)]
#![feature(target_feature_11)]
#![feature(c_variadic)]
-// EMIT_MIR inline_compatibility.inlined_target_feature.Inline.diff
+#[inline]
+#[target_feature(enable = "sse2")]
+unsafe fn sse2() {}
+
+#[inline]
+fn nop() {}
+
+// CHECK-LABEL: fn f0()
+// CHECK: bb0: {
+// CHECK-NEXT: return;
#[target_feature(enable = "sse2")]
-pub unsafe fn inlined_target_feature() {
- target_feature();
+pub unsafe fn f0() {
+ sse2();
}
-// EMIT_MIR inline_compatibility.not_inlined_target_feature.Inline.diff
-pub unsafe fn not_inlined_target_feature() {
- target_feature();
+// CHECK-LABEL: fn f1()
+// CHECK: bb0: {
+// CHECK-NEXT: sse2()
+pub unsafe fn f1() {
+ sse2();
}
-// EMIT_MIR inline_compatibility.inlined_no_sanitize.Inline.diff
+// CHECK-LABEL: fn f2()
+// CHECK: bb0: {
+// CHECK-NEXT: nop()
+#[target_feature(enable = "avx")]
+pub unsafe fn f2() {
+ nop();
+}
+
+#[inline]
+#[no_sanitize(address)]
+pub unsafe fn no_sanitize() {}
+
+// CHECK-LABEL: fn inlined_no_sanitize()
+// CHECK: bb0: {
+// CHECK-NEXT: return;
#[no_sanitize(address)]
pub unsafe fn inlined_no_sanitize() {
no_sanitize();
}
-// EMIT_MIR inline_compatibility.not_inlined_no_sanitize.Inline.diff
+// CHECK-LABEL: fn not_inlined_no_sanitize()
+// CHECK: bb0: {
+// CHECK-NEXT: no_sanitize()
pub unsafe fn not_inlined_no_sanitize() {
no_sanitize();
}
-#[inline]
-#[target_feature(enable = "sse2")]
-pub unsafe fn target_feature() {}
-
-#[inline]
-#[no_sanitize(address)]
-pub unsafe fn no_sanitize() {}
-
-// EMIT_MIR inline_compatibility.not_inlined_c_variadic.Inline.diff
+// CHECK-LABEL: fn not_inlined_c_variadic()
+// CHECK: bb0: {
+// CHECK-NEXT: StorageLive(_1)
+// CHECK-NEXT: _1 = sum
pub unsafe fn not_inlined_c_variadic() {
- let s = sum(4u32, 4u32, 30u32, 200u32, 1000u32);
+ let _ = sum(4u32, 4u32, 30u32, 200u32, 1000u32);
}
-#[no_mangle]
#[inline(always)]
+#[no_mangle]
unsafe extern "C" fn sum(n: u32, mut vs: ...) -> u32 {
let mut s = 0;
let mut i = 0;
diff --git a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff
new file mode 100644
index 000000000..68c612314
--- /dev/null
+++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff
@@ -0,0 +1,113 @@
+- // MIR for `main` before Inline
++ // MIR for `main` after Inline
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::ops::CoroutineState<i32, bool>;
+ let mut _2: std::pin::Pin<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>;
+ let mut _3: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8};
+ let mut _4: {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8};
++ let mut _5: bool;
+ scope 1 {
+ debug _r => _1;
+ }
++ scope 2 (inlined g) {
++ }
++ scope 3 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new) {
++ debug pointer => _3;
++ scope 4 {
++ scope 5 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new_unchecked) {
++ debug pointer => _3;
++ }
++ }
++ }
++ scope 6 (inlined g::{closure#0}) {
++ debug a => _5;
++ let mut _6: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8};
++ let mut _7: u32;
++ let mut _8: i32;
++ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = g() -> [return: bb1, unwind unreachable];
++ _4 = {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8 (#0)};
++ _3 = &mut _4;
++ _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}> { pointer: move _3 };
++ StorageDead(_3);
++ StorageLive(_5);
++ _5 = const false;
++ StorageLive(_6);
++ StorageLive(_7);
++ _6 = (_2.0: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8});
++ _7 = discriminant((*_6));
++ switchInt(move _7) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9];
+ }
+
+ bb1: {
+- _3 = &mut _4;
+- _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new(move _3) -> [return: bb2, unwind unreachable];
++ StorageDead(_4);
++ _0 = const ();
++ StorageDead(_1);
++ return;
+ }
+
+ bb2: {
+- StorageDead(_3);
+- _1 = <{coroutine@$DIR/inline_coroutine.rs:19:5: 19:8} as Coroutine<bool>>::resume(move _2, const false) -> [return: bb3, unwind unreachable];
++ StorageDead(_7);
++ StorageDead(_6);
++ StorageDead(_5);
++ StorageDead(_2);
++ drop(_4) -> [return: bb1, unwind unreachable];
+ }
+
+ bb3: {
+- StorageDead(_2);
+- drop(_4) -> [return: bb4, unwind unreachable];
++ StorageLive(_8);
++ switchInt(_5) -> [0: bb4, otherwise: bb5];
+ }
+
+ bb4: {
+- StorageDead(_4);
+- _0 = const ();
+- StorageDead(_1);
+- return;
++ _8 = const 13_i32;
++ goto -> bb6;
++ }
++
++ bb5: {
++ _8 = const 7_i32;
++ goto -> bb6;
++ }
++
++ bb6: {
++ _1 = CoroutineState::<i32, bool>::Yielded(move _8);
++ StorageDead(_8);
++ discriminant((*_6)) = 3;
++ goto -> bb2;
++ }
++
++ bb7: {
++ assert(const false, "coroutine resumed after completion") -> [success: bb7, unwind unreachable];
++ }
++
++ bb8: {
++ StorageLive(_8);
++ StorageDead(_8);
++ _1 = CoroutineState::<i32, bool>::Complete(_5);
++ discriminant((*_6)) = 1;
++ goto -> bb2;
++ }
++
++ bb9: {
++ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff
new file mode 100644
index 000000000..1bf14e8c3
--- /dev/null
+++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff
@@ -0,0 +1,127 @@
+- // MIR for `main` before Inline
++ // MIR for `main` after Inline
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::ops::CoroutineState<i32, bool>;
+ let mut _2: std::pin::Pin<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>;
+ let mut _3: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8};
+ let mut _4: {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8};
++ let mut _5: bool;
+ scope 1 {
+ debug _r => _1;
+ }
++ scope 2 (inlined g) {
++ }
++ scope 3 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new) {
++ debug pointer => _3;
++ scope 4 {
++ scope 5 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new_unchecked) {
++ debug pointer => _3;
++ }
++ }
++ }
++ scope 6 (inlined g::{closure#0}) {
++ debug a => _5;
++ let mut _6: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8};
++ let mut _7: u32;
++ let mut _8: i32;
++ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = g() -> [return: bb1, unwind continue];
++ _4 = {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8 (#0)};
++ _3 = &mut _4;
++ _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}> { pointer: move _3 };
++ StorageDead(_3);
++ StorageLive(_5);
++ _5 = const false;
++ StorageLive(_6);
++ StorageLive(_7);
++ _6 = (_2.0: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8});
++ _7 = discriminant((*_6));
++ switchInt(move _7) -> [0: bb5, 1: bb9, 3: bb10, otherwise: bb11];
+ }
+
+ bb1: {
+- _3 = &mut _4;
+- _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new(move _3) -> [return: bb2, unwind: bb5];
++ StorageDead(_4);
++ _0 = const ();
++ StorageDead(_1);
++ return;
+ }
+
+- bb2: {
+- StorageDead(_3);
+- _1 = <{coroutine@$DIR/inline_coroutine.rs:19:5: 19:8} as Coroutine<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb5];
++ bb2 (cleanup): {
++ drop(_4) -> [return: bb3, unwind terminate(cleanup)];
+ }
+
+- bb3: {
+- StorageDead(_2);
+- drop(_4) -> [return: bb4, unwind: bb6];
++ bb3 (cleanup): {
++ resume;
+ }
+
+ bb4: {
+- StorageDead(_4);
+- _0 = const ();
+- StorageDead(_1);
+- return;
++ StorageDead(_7);
++ StorageDead(_6);
++ StorageDead(_5);
++ StorageDead(_2);
++ drop(_4) -> [return: bb1, unwind: bb3];
+ }
+
+- bb5 (cleanup): {
+- drop(_4) -> [return: bb6, unwind terminate(cleanup)];
++ bb5: {
++ StorageLive(_8);
++ switchInt(_5) -> [0: bb6, otherwise: bb7];
+ }
+
+- bb6 (cleanup): {
+- resume;
++ bb6: {
++ _8 = const 13_i32;
++ goto -> bb8;
++ }
++
++ bb7: {
++ _8 = const 7_i32;
++ goto -> bb8;
++ }
++
++ bb8: {
++ _1 = CoroutineState::<i32, bool>::Yielded(move _8);
++ StorageDead(_8);
++ discriminant((*_6)) = 3;
++ goto -> bb4;
++ }
++
++ bb9: {
++ assert(const false, "coroutine resumed after completion") -> [success: bb9, unwind: bb2];
++ }
++
++ bb10: {
++ StorageLive(_8);
++ StorageDead(_8);
++ _1 = CoroutineState::<i32, bool>::Complete(_5);
++ discriminant((*_6)) = 1;
++ goto -> bb4;
++ }
++
++ bb11: {
++ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_coroutine.rs b/tests/mir-opt/inline/inline_coroutine.rs
new file mode 100644
index 000000000..a82586bf2
--- /dev/null
+++ b/tests/mir-opt/inline/inline_coroutine.rs
@@ -0,0 +1,20 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// compile-flags: -Zinline-mir-hint-threshold=1000
+#![feature(coroutines, coroutine_trait)]
+
+use std::ops::Coroutine;
+use std::pin::Pin;
+
+// EMIT_MIR inline_coroutine.main.Inline.diff
+fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: (inlined g)
+ // CHECK: (inlined g::{closure#0})
+ let _r = Pin::new(&mut g()).resume(false);
+}
+
+#[inline]
+pub fn g() -> impl Coroutine<bool> {
+ #[inline]
+ |a| { yield if a { 7 } else { 13 } }
+}
diff --git a/tests/mir-opt/inline/inline_cycle.one.Inline.diff b/tests/mir-opt/inline/inline_cycle.one.Inline.diff
deleted file mode 100644
index f6ba69a1d..000000000
--- a/tests/mir-opt/inline/inline_cycle.one.Inline.diff
+++ /dev/null
@@ -1,30 +0,0 @@
-- // MIR for `one` before Inline
-+ // MIR for `one` after Inline
-
- fn one() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_cycle.rs:+0:10: +0:10
- let _1: (); // in scope 0 at $DIR/inline_cycle.rs:+1:5: +1:24
-+ scope 1 (inlined <C as Call>::call) { // at $DIR/inline_cycle.rs:15:5: 15:24
-+ scope 2 (inlined <A<C> as Call>::call) { // at $DIR/inline_cycle.rs:44:9: 44:23
-+ scope 3 (inlined <B<C> as Call>::call) { // at $DIR/inline_cycle.rs:29:9: 29:31
-+ }
-+ }
-+ }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:24
-- _1 = <C as Call>::call() -> bb1; // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:24
-+ _1 = <C as Call>::call() -> bb1; // scope 3 at $DIR/inline_cycle.rs:37:9: 37:28
- // mir::Constant
-- // + span: $DIR/inline_cycle.rs:15:5: 15:22
-+ // + span: $DIR/inline_cycle.rs:37:9: 37:26
- // + literal: Const { ty: fn() {<C as Call>::call}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_1); // scope 0 at $DIR/inline_cycle.rs:+1:24: +1:25
- _0 = const (); // scope 0 at $DIR/inline_cycle.rs:+0:10: +2:2
- return; // scope 0 at $DIR/inline_cycle.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_cycle.one.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_cycle.one.Inline.panic-abort.diff
new file mode 100644
index 000000000..c8805a446
--- /dev/null
+++ b/tests/mir-opt/inline/inline_cycle.one.Inline.panic-abort.diff
@@ -0,0 +1,25 @@
+- // MIR for `one` before Inline
++ // MIR for `one` after Inline
+
+ fn one() -> () {
+ let mut _0: ();
+ let _1: ();
++ scope 1 (inlined <C as Call>::call) {
++ scope 2 (inlined <A<C> as Call>::call) {
++ scope 3 (inlined <B<C> as Call>::call) {
++ }
++ }
++ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = <C as Call>::call() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_cycle.one.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_cycle.one.Inline.panic-unwind.diff
new file mode 100644
index 000000000..75ac40bea
--- /dev/null
+++ b/tests/mir-opt/inline/inline_cycle.one.Inline.panic-unwind.diff
@@ -0,0 +1,25 @@
+- // MIR for `one` before Inline
++ // MIR for `one` after Inline
+
+ fn one() -> () {
+ let mut _0: ();
+ let _1: ();
++ scope 1 (inlined <C as Call>::call) {
++ scope 2 (inlined <A<C> as Call>::call) {
++ scope 3 (inlined <B<C> as Call>::call) {
++ }
++ }
++ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = <C as Call>::call() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_cycle.rs b/tests/mir-opt/inline/inline_cycle.rs
index 2f81696cf..e3dd08255 100644
--- a/tests/mir-opt/inline/inline_cycle.rs
+++ b/tests/mir-opt/inline/inline_cycle.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that inliner handles various forms of recursion and doesn't fall into
// an infinite inlining cycle. The particular outcome of inlining is not
// crucial otherwise.
diff --git a/tests/mir-opt/inline/inline_cycle.two.Inline.diff b/tests/mir-opt/inline/inline_cycle.two.Inline.diff
deleted file mode 100644
index c8f58111d..000000000
--- a/tests/mir-opt/inline/inline_cycle.two.Inline.diff
+++ /dev/null
@@ -1,42 +0,0 @@
-- // MIR for `two` before Inline
-+ // MIR for `two` after Inline
-
- fn two() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_cycle.rs:+0:10: +0:10
- let _1: (); // in scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12
-+ let mut _2: fn() {f}; // in scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12
-+ let mut _4: (); // in scope 0 at $DIR/inline_cycle.rs:55:5: 55:8
-+ scope 1 (inlined call::<fn() {f}>) { // at $DIR/inline_cycle.rs:50:5: 50:12
-+ debug f => _2; // in scope 1 at $DIR/inline_cycle.rs:54:22: 54:23
-+ let _3: (); // in scope 1 at $DIR/inline_cycle.rs:55:5: 55:8
-+ scope 2 (inlined <fn() {f} as FnOnce<()>>::call_once - shim(fn() {f})) { // at $DIR/inline_cycle.rs:55:5: 55:8
-+ }
-+ }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12
-- _1 = call::<fn() {f}>(f) -> bb1; // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12
-+ StorageLive(_2); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12
-+ _2 = f; // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12
- // mir::Constant
-- // + span: $DIR/inline_cycle.rs:50:5: 50:9
-- // + literal: Const { ty: fn(fn() {f}) {call::<fn() {f}>}, val: Value(<ZST>) }
-- // mir::Constant
- // + span: $DIR/inline_cycle.rs:50:10: 50:11
- // + literal: Const { ty: fn() {f}, val: Value(<ZST>) }
-+ StorageLive(_3); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12
-+ StorageLive(_4); // scope 1 at $DIR/inline_cycle.rs:55:5: 55:8
-+ _4 = const (); // scope 1 at $DIR/inline_cycle.rs:55:5: 55:8
-+ _3 = move _2() -> bb1; // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL
- }
-
- bb1: {
-+ StorageDead(_4); // scope 1 at $DIR/inline_cycle.rs:55:5: 55:8
-+ StorageDead(_3); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12
-+ StorageDead(_2); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12
- StorageDead(_1); // scope 0 at $DIR/inline_cycle.rs:+1:12: +1:13
- _0 = const (); // scope 0 at $DIR/inline_cycle.rs:+0:10: +2:2
- return; // scope 0 at $DIR/inline_cycle.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff
new file mode 100644
index 000000000..8a6eec335
--- /dev/null
+++ b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-abort.diff
@@ -0,0 +1,30 @@
+- // MIR for `two` before Inline
++ // MIR for `two` after Inline
+
+ fn two() -> () {
+ let mut _0: ();
+ let _1: ();
++ let mut _2: fn() {f};
++ scope 1 (inlined call::<fn() {f}>) {
++ debug f => _2;
++ let _3: ();
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = call::<fn() {f}>(f) -> [return: bb1, unwind unreachable];
++ StorageLive(_2);
++ _2 = f;
++ StorageLive(_3);
++ _3 = <fn() {f} as FnOnce<()>>::call_once(move _2, const ()) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
++ StorageDead(_3);
++ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff
new file mode 100644
index 000000000..a24649c1e
--- /dev/null
+++ b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff
@@ -0,0 +1,30 @@
+- // MIR for `two` before Inline
++ // MIR for `two` after Inline
+
+ fn two() -> () {
+ let mut _0: ();
+ let _1: ();
++ let mut _2: fn() {f};
++ scope 1 (inlined call::<fn() {f}>) {
++ debug f => _2;
++ let _3: ();
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = call::<fn() {f}>(f) -> [return: bb1, unwind continue];
++ StorageLive(_2);
++ _2 = f;
++ StorageLive(_3);
++ _3 = <fn() {f} as FnOnce<()>>::call_once(move _2, const ()) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
++ StorageDead(_3);
++ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_cycle_generic.main.Inline.diff b/tests/mir-opt/inline/inline_cycle_generic.main.Inline.diff
deleted file mode 100644
index 9429ca593..000000000
--- a/tests/mir-opt/inline/inline_cycle_generic.main.Inline.diff
+++ /dev/null
@@ -1,29 +0,0 @@
-- // MIR for `main` before Inline
-+ // MIR for `main` after Inline
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_cycle_generic.rs:+0:11: +0:11
- let _1: (); // in scope 0 at $DIR/inline_cycle_generic.rs:+1:5: +1:24
-+ scope 1 (inlined <C as Call>::call) { // at $DIR/inline_cycle_generic.rs:10:5: 10:24
-+ scope 2 (inlined <B<A> as Call>::call) { // at $DIR/inline_cycle_generic.rs:39:9: 39:31
-+ }
-+ }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_cycle_generic.rs:+1:5: +1:24
-- _1 = <C as Call>::call() -> bb1; // scope 0 at $DIR/inline_cycle_generic.rs:+1:5: +1:24
-+ _1 = <A as Call>::call() -> bb1; // scope 2 at $DIR/inline_cycle_generic.rs:32:9: 32:28
- // mir::Constant
-- // + span: $DIR/inline_cycle_generic.rs:10:5: 10:22
-- // + literal: Const { ty: fn() {<C as Call>::call}, val: Value(<ZST>) }
-+ // + span: $DIR/inline_cycle_generic.rs:32:9: 32:26
-+ // + literal: Const { ty: fn() {<A as Call>::call}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_1); // scope 0 at $DIR/inline_cycle_generic.rs:+1:24: +1:25
- _0 = const (); // scope 0 at $DIR/inline_cycle_generic.rs:+0:11: +2:2
- return; // scope 0 at $DIR/inline_cycle_generic.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-abort.diff
new file mode 100644
index 000000000..d437dbf57
--- /dev/null
+++ b/tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-abort.diff
@@ -0,0 +1,26 @@
+- // MIR for `main` before Inline
++ // MIR for `main` after Inline
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
++ scope 1 (inlined <C as Call>::call) {
++ scope 2 (inlined <B<A> as Call>::call) {
++ scope 3 (inlined <A as Call>::call) {
++ }
++ }
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = <C as Call>::call() -> [return: bb1, unwind unreachable];
++ _1 = <B<C> as Call>::call() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-unwind.diff
new file mode 100644
index 000000000..8314526ee
--- /dev/null
+++ b/tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-unwind.diff
@@ -0,0 +1,26 @@
+- // MIR for `main` before Inline
++ // MIR for `main` after Inline
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
++ scope 1 (inlined <C as Call>::call) {
++ scope 2 (inlined <B<A> as Call>::call) {
++ scope 3 (inlined <A as Call>::call) {
++ }
++ }
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = <C as Call>::call() -> [return: bb1, unwind continue];
++ _1 = <B<C> as Call>::call() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_cycle_generic.rs b/tests/mir-opt/inline/inline_cycle_generic.rs
index 84e6e4005..667bf7f92 100644
--- a/tests/mir-opt/inline/inline_cycle_generic.rs
+++ b/tests/mir-opt/inline/inline_cycle_generic.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that inliner handles various forms of recursion and doesn't fall into
// an infinite inlining cycle. The particular outcome of inlining is not
// crucial otherwise.
diff --git a/tests/mir-opt/inline/inline_diverging.f.Inline.diff b/tests/mir-opt/inline/inline_diverging.f.Inline.diff
deleted file mode 100644
index b49191f49..000000000
--- a/tests/mir-opt/inline/inline_diverging.f.Inline.diff
+++ /dev/null
@@ -1,24 +0,0 @@
-- // MIR for `f` before Inline
-+ // MIR for `f` after Inline
-
- fn f() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_diverging.rs:+0:12: +0:12
- let mut _1: !; // in scope 0 at $DIR/inline_diverging.rs:+0:12: +2:2
- let _2: !; // in scope 0 at $DIR/inline_diverging.rs:+1:5: +1:12
-+ scope 1 (inlined sleep) { // at $DIR/inline_diverging.rs:8:5: 8:12
-+ }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:12
-- _2 = sleep(); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:12
-- // mir::Constant
-- // + span: $DIR/inline_diverging.rs:8:5: 8:10
-- // + literal: Const { ty: fn() -> ! {sleep}, val: Value(<ZST>) }
-+ goto -> bb1; // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:12
-+ }
-+
-+ bb1: {
-+ goto -> bb1; // scope 1 at $DIR/inline_diverging.rs:39:5: 39:12
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_diverging.f.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.f.Inline.panic-abort.diff
new file mode 100644
index 000000000..3de72d03c
--- /dev/null
+++ b/tests/mir-opt/inline/inline_diverging.f.Inline.panic-abort.diff
@@ -0,0 +1,21 @@
+- // MIR for `f` before Inline
++ // MIR for `f` after Inline
+
+ fn f() -> () {
+ let mut _0: ();
+ let mut _1: !;
+ let _2: !;
++ scope 1 (inlined sleep) {
++ }
+
+ bb0: {
+ StorageLive(_2);
+- _2 = sleep() -> unwind unreachable;
++ goto -> bb1;
++ }
++
++ bb1: {
++ goto -> bb1;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_diverging.f.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.f.Inline.panic-unwind.diff
new file mode 100644
index 000000000..b79918992
--- /dev/null
+++ b/tests/mir-opt/inline/inline_diverging.f.Inline.panic-unwind.diff
@@ -0,0 +1,21 @@
+- // MIR for `f` before Inline
++ // MIR for `f` after Inline
+
+ fn f() -> () {
+ let mut _0: ();
+ let mut _1: !;
+ let _2: !;
++ scope 1 (inlined sleep) {
++ }
+
+ bb0: {
+ StorageLive(_2);
+- _2 = sleep() -> unwind continue;
++ goto -> bb1;
++ }
++
++ bb1: {
++ goto -> bb1;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.diff
deleted file mode 100644
index 4f22ad437..000000000
--- a/tests/mir-opt/inline/inline_diverging.g.Inline.diff
+++ /dev/null
@@ -1,49 +0,0 @@
-- // MIR for `g` before Inline
-+ // MIR for `g` after Inline
-
- fn g(_1: i32) -> u32 {
- debug i => _1; // in scope 0 at $DIR/inline_diverging.rs:+0:10: +0:11
- let mut _0: u32; // return place in scope 0 at $DIR/inline_diverging.rs:+0:21: +0:24
- let mut _2: bool; // in scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13
- let mut _3: i32; // in scope 0 at $DIR/inline_diverging.rs:+1:8: +1:9
- let mut _4: i32; // in scope 0 at $DIR/inline_diverging.rs:+2:9: +2:10
- let mut _5: !; // in scope 0 at $DIR/inline_diverging.rs:+3:12: +5:6
- let _6: !; // in scope 0 at $DIR/inline_diverging.rs:+4:9: +4:16
-+ scope 1 (inlined panic) { // at $DIR/inline_diverging.rs:16:9: 16:16
-+ let mut _7: !; // in scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL
-+ }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13
- StorageLive(_3); // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:9
- _3 = _1; // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:9
- _2 = Gt(move _3, const 0_i32); // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13
- StorageDead(_3); // scope 0 at $DIR/inline_diverging.rs:+1:12: +1:13
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13
- }
-
- bb1: {
- StorageLive(_4); // scope 0 at $DIR/inline_diverging.rs:+2:9: +2:10
- _4 = _1; // scope 0 at $DIR/inline_diverging.rs:+2:9: +2:10
- _0 = move _4 as u32 (IntToInt); // scope 0 at $DIR/inline_diverging.rs:+2:9: +2:17
- StorageDead(_4); // scope 0 at $DIR/inline_diverging.rs:+2:16: +2:17
- StorageDead(_2); // scope 0 at $DIR/inline_diverging.rs:+5:5: +5:6
- return; // scope 0 at $DIR/inline_diverging.rs:+6:2: +6:2
- }
-
- bb2: {
- StorageLive(_6); // scope 0 at $DIR/inline_diverging.rs:+4:9: +4:16
-- _6 = panic(); // scope 0 at $DIR/inline_diverging.rs:+4:9: +4:16
-+ StorageLive(_7); // scope 0 at $DIR/inline_diverging.rs:+4:9: +4:16
-+ _7 = begin_panic::<&str>(const "explicit panic"); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL
- // mir::Constant
-- // + span: $DIR/inline_diverging.rs:16:9: 16:14
-- // + literal: Const { ty: fn() -> ! {panic}, val: Value(<ZST>) }
-+ // + span: $SRC_DIR/std/src/panic.rs:LL:COL
-+ // + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value(<ZST>) }
-+ // mir::Constant
-+ // + span: $SRC_DIR/std/src/panic.rs:LL:COL
-+ // + literal: Const { ty: &str, val: Value(Slice(..)) }
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff
new file mode 100644
index 000000000..d675695eb
--- /dev/null
+++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff
@@ -0,0 +1,42 @@
+- // MIR for `g` before Inline
++ // MIR for `g` after Inline
+
+ fn g(_1: i32) -> u32 {
+ debug i => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: i32;
+ let mut _4: i32;
+ let mut _5: !;
+ let _6: !;
++ scope 1 (inlined panic) {
++ let mut _7: !;
++ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _2 = Gt(move _3, const 0_i32);
+ switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageLive(_4);
+ _4 = _1;
+ _0 = move _4 as u32 (IntToInt);
+ StorageDead(_4);
+ StorageDead(_2);
+ return;
+ }
+
+ bb2: {
+ StorageDead(_3);
+ StorageLive(_6);
+- _6 = panic() -> unwind unreachable;
++ StorageLive(_7);
++ _7 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable;
+ }
+ }
+
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
new file mode 100644
index 000000000..114261611
--- /dev/null
+++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff
@@ -0,0 +1,42 @@
+- // MIR for `g` before Inline
++ // MIR for `g` after Inline
+
+ fn g(_1: i32) -> u32 {
+ debug i => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: i32;
+ let mut _4: i32;
+ let mut _5: !;
+ let _6: !;
++ scope 1 (inlined panic) {
++ let mut _7: !;
++ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _2 = Gt(move _3, const 0_i32);
+ switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageLive(_4);
+ _4 = _1;
+ _0 = move _4 as u32 (IntToInt);
+ StorageDead(_4);
+ StorageDead(_2);
+ return;
+ }
+
+ bb2: {
+ StorageDead(_3);
+ StorageLive(_6);
+- _6 = panic() -> unwind continue;
++ StorageLive(_7);
++ _7 = begin_panic::<&str>(const "explicit panic") -> unwind continue;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.diff
deleted file mode 100644
index d501b6ca8..000000000
--- a/tests/mir-opt/inline/inline_diverging.h.Inline.diff
+++ /dev/null
@@ -1,83 +0,0 @@
-- // MIR for `h` before Inline
-+ // MIR for `h` after Inline
-
- fn h() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_diverging.rs:+0:12: +0:12
- let _1: (!, !); // in scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22
-+ let mut _2: fn() -> ! {sleep}; // in scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22
-+ let mut _8: (); // in scope 0 at $DIR/inline_diverging.rs:27:13: 27:16
-+ scope 1 (inlined call_twice::<!, fn() -> ! {sleep}>) { // at $DIR/inline_diverging.rs:22:5: 22:22
-+ debug f => _2; // in scope 1 at $DIR/inline_diverging.rs:26:36: 26:37
-+ let _3: !; // in scope 1 at $DIR/inline_diverging.rs:27:9: 27:10
-+ let mut _4: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline_diverging.rs:27:13: 27:14
-+ let mut _5: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline_diverging.rs:28:13: 28:14
-+ let mut _6: !; // in scope 1 at $DIR/inline_diverging.rs:29:6: 29:7
-+ let mut _7: !; // in scope 1 at $DIR/inline_diverging.rs:29:9: 29:10
-+ scope 2 {
-+ debug a => _3; // in scope 2 at $DIR/inline_diverging.rs:27:9: 27:10
-+ scope 3 {
-+ debug b => _7; // in scope 3 at $DIR/inline_diverging.rs:28:9: 28:10
-+ }
-+ }
-+ scope 4 (inlined <fn() -> ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) { // at $DIR/inline_diverging.rs:27:13: 27:16
-+ }
-+ }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22
-- _1 = call_twice::<!, fn() -> ! {sleep}>(sleep); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22
-+ StorageLive(_2); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22
-+ _2 = sleep; // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22
- // mir::Constant
-- // + span: $DIR/inline_diverging.rs:22:5: 22:15
-- // + literal: Const { ty: fn(fn() -> ! {sleep}) -> (!, !) {call_twice::<!, fn() -> ! {sleep}>}, val: Value(<ZST>) }
-- // mir::Constant
- // + span: $DIR/inline_diverging.rs:22:16: 22:21
- // + literal: Const { ty: fn() -> ! {sleep}, val: Value(<ZST>) }
-+ StorageLive(_7); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22
-+ StorageLive(_3); // scope 1 at $DIR/inline_diverging.rs:27:9: 27:10
-+ StorageLive(_4); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14
-+ _4 = &_2; // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14
-+ StorageLive(_8); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:16
-+ _8 = const (); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:16
-+ _3 = move (*_4)() -> [return: bb6, unwind: bb4]; // scope 4 at $SRC_DIR/core/src/ops/function.rs:LL:COL
-+ }
-+
-+ bb1: {
-+ StorageDead(_5); // scope 2 at $DIR/inline_diverging.rs:28:15: 28:16
-+ StorageLive(_6); // scope 3 at $DIR/inline_diverging.rs:29:6: 29:7
-+ _6 = move _3; // scope 3 at $DIR/inline_diverging.rs:29:6: 29:7
-+ _1 = (move _6, move _7); // scope 3 at $DIR/inline_diverging.rs:29:5: 29:11
-+ StorageDead(_6); // scope 3 at $DIR/inline_diverging.rs:29:10: 29:11
-+ StorageDead(_3); // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2
-+ drop(_2) -> bb2; // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2
-+ }
-+
-+ bb2: {
-+ unreachable; // scope 0 at $DIR/inline_diverging.rs:30:2: 30:2
-+ }
-+
-+ bb3 (cleanup): {
-+ drop(_3) -> [return: bb4, unwind terminate]; // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2
-+ }
-+
-+ bb4 (cleanup): {
-+ drop(_2) -> [return: bb5, unwind terminate]; // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2
-+ }
-+
-+ bb5 (cleanup): {
-+ resume; // scope 1 at $DIR/inline_diverging.rs:26:1: 30:2
-+ }
-+
-+ bb6: {
-+ StorageDead(_8); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:16
-+ StorageDead(_4); // scope 1 at $DIR/inline_diverging.rs:27:15: 27:16
-+ StorageLive(_5); // scope 2 at $DIR/inline_diverging.rs:28:13: 28:14
-+ _5 = &_2; // scope 2 at $DIR/inline_diverging.rs:28:13: 28:14
-+ _7 = <fn() -> ! {sleep} as Fn<()>>::call(move _5, const ()) -> [return: bb1, unwind: bb3]; // scope 2 at $DIR/inline_diverging.rs:28:13: 28:16
-+ // mir::Constant
-+ // + span: $DIR/inline_diverging.rs:28:13: 28:14
-+ // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a fn() -> ! {sleep}, ()) -> <fn() -> ! {sleep} as FnOnce<()>>::Output {<fn() -> ! {sleep} as Fn<()>>::call}, val: Value(<ZST>) }
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff
new file mode 100644
index 000000000..da45ebcb4
--- /dev/null
+++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff
@@ -0,0 +1,51 @@
+- // MIR for `h` before Inline
++ // MIR for `h` after Inline
+
+ fn h() -> () {
+ let mut _0: ();
+ let _1: (!, !);
++ let mut _2: fn() -> ! {sleep};
++ scope 1 (inlined call_twice::<!, fn() -> ! {sleep}>) {
++ debug f => _2;
++ let mut _3: &fn() -> ! {sleep};
++ let _4: !;
++ let mut _5: &fn() -> ! {sleep};
++ scope 2 {
++ debug a => _4;
++ let _6: !;
++ scope 3 {
++ debug b => _6;
++ }
++ }
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = call_twice::<!, fn() -> ! {sleep}>(sleep) -> unwind unreachable;
++ StorageLive(_2);
++ _2 = sleep;
++ StorageLive(_4);
++ StorageLive(_6);
++ StorageLive(_3);
++ _3 = &_2;
++ _4 = <fn() -> ! {sleep} as Fn<()>>::call(move _3, const ()) -> [return: bb1, unwind unreachable];
++ }
++
++ bb1: {
++ StorageDead(_3);
++ StorageLive(_5);
++ _5 = &_2;
++ _6 = <fn() -> ! {sleep} as Fn<()>>::call(move _5, const ()) -> [return: bb2, unwind unreachable];
++ }
++
++ bb2: {
++ StorageDead(_5);
++ _1 = (move _4, move _6);
++ drop(_2) -> [return: bb3, unwind unreachable];
++ }
++
++ bb3: {
++ unreachable;
+ }
+ }
+
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
new file mode 100644
index 000000000..d65c65e5f
--- /dev/null
+++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
@@ -0,0 +1,68 @@
+- // MIR for `h` before Inline
++ // MIR for `h` after Inline
+
+ fn h() -> () {
+ let mut _0: ();
+ let _1: (!, !);
++ let mut _2: fn() -> ! {sleep};
++ scope 1 (inlined call_twice::<!, fn() -> ! {sleep}>) {
++ debug f => _2;
++ let mut _3: &fn() -> ! {sleep};
++ let _4: !;
++ let mut _5: &fn() -> ! {sleep};
++ let mut _7: !;
++ scope 2 {
++ debug a => _4;
++ let _6: !;
++ scope 3 {
++ debug b => _6;
++ }
++ }
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = call_twice::<!, fn() -> ! {sleep}>(sleep) -> unwind continue;
++ StorageLive(_2);
++ _2 = sleep;
++ StorageLive(_6);
++ StorageLive(_4);
++ StorageLive(_3);
++ _3 = &_2;
++ _4 = <fn() -> ! {sleep} as Fn<()>>::call(move _3, const ()) -> [return: bb1, unwind: bb5];
++ }
++
++ bb1: {
++ StorageDead(_3);
++ StorageLive(_5);
++ _5 = &_2;
++ _6 = <fn() -> ! {sleep} as Fn<()>>::call(move _5, const ()) -> [return: bb2, unwind: bb4];
++ }
++
++ bb2: {
++ StorageDead(_5);
++ StorageLive(_7);
++ _7 = move _4;
++ _1 = (move _7, move _6);
++ StorageDead(_7);
++ StorageDead(_4);
++ drop(_2) -> [return: bb3, unwind continue];
++ }
++
++ bb3: {
++ unreachable;
++ }
++
++ bb4 (cleanup): {
++ drop(_4) -> [return: bb5, unwind terminate(cleanup)];
++ }
++
++ bb5 (cleanup): {
++ drop(_2) -> [return: bb6, unwind terminate(cleanup)];
++ }
++
++ bb6 (cleanup): {
++ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_diverging.rs b/tests/mir-opt/inline/inline_diverging.rs
index ae6f814c2..25a5b9c5c 100644
--- a/tests/mir-opt/inline/inline_diverging.rs
+++ b/tests/mir-opt/inline/inline_diverging.rs
@@ -1,10 +1,13 @@
// Tests inlining of diverging calls.
//
-// ignore-wasm32-bare compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// compile-flags: -Zinline-mir-hint-threshold=1000
#![crate_type = "lib"]
// EMIT_MIR inline_diverging.f.Inline.diff
pub fn f() {
+ // CHECK-LABEL: fn f(
+ // CHECK: (inlined sleep)
sleep();
}
@@ -13,12 +16,17 @@ pub fn g(i: i32) -> u32 {
if i > 0 {
i as u32
} else {
+ // CHECK-LABEL: fn g(
+ // CHECK: (inlined panic)
panic();
}
}
// EMIT_MIR inline_diverging.h.Inline.diff
pub fn h() {
+ // CHECK-LABEL: fn h(
+ // CHECK: (inlined call_twice::<!, fn() -> ! {sleep}>)
+ // CHECK-NOT: inlined
call_twice(sleep);
}
diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.diff b/tests/mir-opt/inline/inline_generator.main.Inline.diff
deleted file mode 100644
index c3ca2d7d4..000000000
--- a/tests/mir-opt/inline/inline_generator.main.Inline.diff
+++ /dev/null
@@ -1,132 +0,0 @@
-- // MIR for `main` before Inline
-+ // MIR for `main` after Inline
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_generator.rs:+0:11: +0:11
- let _1: std::ops::GeneratorState<i32, bool>; // in scope 0 at $DIR/inline_generator.rs:+1:9: +1:11
- let mut _2: std::pin::Pin<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>; // in scope 0 at $DIR/inline_generator.rs:+1:14: +1:32
- let mut _3: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 0 at $DIR/inline_generator.rs:+1:23: +1:31
- let mut _4: [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 0 at $DIR/inline_generator.rs:+1:28: +1:31
-+ let mut _5: bool; // in scope 0 at $DIR/inline_generator.rs:+1:33: +1:46
- scope 1 {
- debug _r => _1; // in scope 1 at $DIR/inline_generator.rs:+1:9: +1:11
- }
-+ scope 2 (inlined g) { // at $DIR/inline_generator.rs:9:28: 9:31
-+ }
-+ scope 3 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new) { // at $DIR/inline_generator.rs:9:14: 9:32
-+ debug pointer => _3; // in scope 3 at $SRC_DIR/core/src/pin.rs:LL:COL
-+ scope 4 {
-+ scope 5 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new_unchecked) { // at $SRC_DIR/core/src/pin.rs:LL:COL
-+ debug pointer => _3; // in scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
-+ }
-+ }
-+ }
-+ scope 6 (inlined g::{closure#0}) { // at $DIR/inline_generator.rs:9:33: 9:46
-+ debug a => _5; // in scope 6 at $DIR/inline_generator.rs:15:6: 15:7
-+ let mut _6: i32; // in scope 6 at $DIR/inline_generator.rs:15:17: 15:39
-+ let mut _7: u32; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
-+ let mut _8: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
-+ let mut _9: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
-+ let mut _10: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
-+ }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_generator.rs:+1:9: +1:11
- StorageLive(_2); // scope 0 at $DIR/inline_generator.rs:+1:14: +1:32
- StorageLive(_3); // scope 0 at $DIR/inline_generator.rs:+1:23: +1:31
- StorageLive(_4); // scope 0 at $DIR/inline_generator.rs:+1:28: +1:31
-- _4 = g() -> bb1; // scope 0 at $DIR/inline_generator.rs:+1:28: +1:31
-- // mir::Constant
-- // + span: $DIR/inline_generator.rs:9:28: 9:29
-- // + literal: Const { ty: fn() -> impl Generator<bool> {g}, val: Value(<ZST>) }
-- }
--
-- bb1: {
-+ _4 = [generator@$DIR/inline_generator.rs:15:5: 15:8 (#0)]; // scope 2 at $DIR/inline_generator.rs:15:5: 15:41
-+ // generator
-+ // + def_id: DefId(0:7 ~ inline_generator[e37e]::g::{closure#0})
-+ // + substs: [
-+ // bool,
-+ // i32,
-+ // bool,
-+ // {bool, i32},
-+ // (),
-+ // ]
-+ // + movability: Movable
- _3 = &mut _4; // scope 0 at $DIR/inline_generator.rs:+1:23: +1:31
-- _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new(move _3) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/inline_generator.rs:+1:14: +1:32
-- // mir::Constant
-- // + span: $DIR/inline_generator.rs:9:14: 9:22
-- // + user_ty: UserType(0)
-- // + literal: Const { ty: fn(&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]) -> Pin<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]> {Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new}, val: Value(<ZST>) }
-- }
--
-- bb2: {
-+ _2 = Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]> { pointer: move _3 }; // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
- StorageDead(_3); // scope 0 at $DIR/inline_generator.rs:+1:31: +1:32
-- _1 = <[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
-- // mir::Constant
-- // + span: $DIR/inline_generator.rs:9:33: 9:39
-- // + literal: Const { ty: for<'a> fn(Pin<&'a mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>, bool) -> GeneratorState<<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::Yield, <[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::Return> {<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::resume}, val: Value(<ZST>) }
-+ StorageLive(_5); // scope 0 at $DIR/inline_generator.rs:+1:33: +1:46
-+ _5 = const false; // scope 0 at $DIR/inline_generator.rs:+1:33: +1:46
-+ _8 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
-+ _7 = discriminant((*_8)); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
-+ switchInt(move _7) -> [0: bb3, 1: bb8, 3: bb7, otherwise: bb9]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
- }
-
-- bb3: {
-+ bb1: {
-+ StorageDead(_5); // scope 0 at $DIR/inline_generator.rs:+1:33: +1:46
- StorageDead(_2); // scope 0 at $DIR/inline_generator.rs:+1:45: +1:46
- StorageDead(_4); // scope 0 at $DIR/inline_generator.rs:+1:46: +1:47
- _0 = const (); // scope 0 at $DIR/inline_generator.rs:+0:11: +2:2
- StorageDead(_1); // scope 0 at $DIR/inline_generator.rs:+2:1: +2:2
- return; // scope 0 at $DIR/inline_generator.rs:+2:2: +2:2
- }
-
-- bb4 (cleanup): {
-+ bb2 (cleanup): {
- resume; // scope 0 at $DIR/inline_generator.rs:+0:1: +2:2
-+ }
-+
-+ bb3: {
-+ StorageLive(_6); // scope 6 at $DIR/inline_generator.rs:15:17: 15:39
-+ switchInt(_5) -> [0: bb5, otherwise: bb4]; // scope 6 at $DIR/inline_generator.rs:15:20: 15:21
-+ }
-+
-+ bb4: {
-+ _6 = const 7_i32; // scope 6 at $DIR/inline_generator.rs:15:24: 15:25
-+ goto -> bb6; // scope 6 at $DIR/inline_generator.rs:15:17: 15:39
-+ }
-+
-+ bb5: {
-+ _6 = const 13_i32; // scope 6 at $DIR/inline_generator.rs:15:35: 15:37
-+ goto -> bb6; // scope 6 at $DIR/inline_generator.rs:15:17: 15:39
-+ }
-+
-+ bb6: {
-+ _1 = GeneratorState::<i32, bool>::Yielded(move _6); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
-+ _9 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
-+ discriminant((*_9)) = 3; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
-+ goto -> bb1; // scope 0 at $DIR/inline_generator.rs:15:11: 15:39
-+ }
-+
-+ bb7: {
-+ StorageLive(_6); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
-+ StorageDead(_6); // scope 6 at $DIR/inline_generator.rs:15:38: 15:39
-+ _1 = GeneratorState::<i32, bool>::Complete(_5); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
-+ _10 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
-+ discriminant((*_10)) = 1; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
-+ goto -> bb1; // scope 0 at $DIR/inline_generator.rs:15:41: 15:41
-+ }
-+
-+ bb8: {
-+ assert(const false, "generator resumed after completion") -> [success: bb8, unwind: bb2]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
-+ }
-+
-+ bb9: {
-+ unreachable; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_generator.rs b/tests/mir-opt/inline/inline_generator.rs
deleted file mode 100644
index d11b3e548..000000000
--- a/tests/mir-opt/inline/inline_generator.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// ignore-wasm32-bare compiled with panic=abort by default
-#![feature(generators, generator_trait)]
-
-use std::ops::Generator;
-use std::pin::Pin;
-
-// EMIT_MIR inline_generator.main.Inline.diff
-fn main() {
- let _r = Pin::new(&mut g()).resume(false);
-}
-
-#[inline(always)]
-pub fn g() -> impl Generator<bool> {
- #[inline(always)]
- |a| { yield if a { 7 } else { 13 } }
-}
diff --git a/tests/mir-opt/inline/inline_instruction_set.default.Inline.diff b/tests/mir-opt/inline/inline_instruction_set.default.Inline.diff
index a1d2423ae..6f8b730b4 100644
--- a/tests/mir-opt/inline/inline_instruction_set.default.Inline.diff
+++ b/tests/mir-opt/inline/inline_instruction_set.default.Inline.diff
@@ -2,59 +2,47 @@
+ // MIR for `default` after Inline
fn default() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_instruction_set.rs:+0:18: +0:18
- let _1: (); // in scope 0 at $DIR/inline_instruction_set.rs:+1:5: +1:26
- let _2: (); // in scope 0 at $DIR/inline_instruction_set.rs:+2:5: +2:26
- let _3: (); // in scope 0 at $DIR/inline_instruction_set.rs:+3:5: +3:30
- let _4: (); // in scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41
-+ scope 1 (inlined instruction_set_default) { // at $DIR/inline_instruction_set.rs:59:5: 59:30
+ let mut _0: ();
+ let _1: ();
+ let _2: ();
+ let _3: ();
+ let _4: ();
++ scope 1 (inlined instruction_set_default) {
+ }
-+ scope 2 (inlined inline_always_and_using_inline_asm) { // at $DIR/inline_instruction_set.rs:60:5: 60:41
++ scope 2 (inlined inline_always_and_using_inline_asm) {
+ scope 3 {
+ }
+ }
bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_instruction_set.rs:+1:5: +1:26
- _1 = instruction_set_a32() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+1:5: +1:26
- // mir::Constant
- // + span: $DIR/inline_instruction_set.rs:57:5: 57:24
- // + literal: Const { ty: fn() {instruction_set_a32}, val: Value(<ZST>) }
+ StorageLive(_1);
+ _1 = instruction_set_a32() -> [return: bb1, unwind unreachable];
}
bb1: {
- StorageDead(_1); // scope 0 at $DIR/inline_instruction_set.rs:+1:26: +1:27
- StorageLive(_2); // scope 0 at $DIR/inline_instruction_set.rs:+2:5: +2:26
- _2 = instruction_set_t32() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+2:5: +2:26
- // mir::Constant
- // + span: $DIR/inline_instruction_set.rs:58:5: 58:24
- // + literal: Const { ty: fn() {instruction_set_t32}, val: Value(<ZST>) }
+ StorageDead(_1);
+ StorageLive(_2);
+ _2 = instruction_set_t32() -> [return: bb2, unwind unreachable];
}
bb2: {
- StorageDead(_2); // scope 0 at $DIR/inline_instruction_set.rs:+2:26: +2:27
- StorageLive(_3); // scope 0 at $DIR/inline_instruction_set.rs:+3:5: +3:30
-- _3 = instruction_set_default() -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+3:5: +3:30
-- // mir::Constant
-- // + span: $DIR/inline_instruction_set.rs:59:5: 59:28
-- // + literal: Const { ty: fn() {instruction_set_default}, val: Value(<ZST>) }
+ StorageDead(_2);
+ StorageLive(_3);
+- _3 = instruction_set_default() -> [return: bb3, unwind unreachable];
- }
-
- bb3: {
- StorageDead(_3); // scope 0 at $DIR/inline_instruction_set.rs:+3:30: +3:31
- StorageLive(_4); // scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41
-- _4 = inline_always_and_using_inline_asm() -> [return: bb4, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41
-- // mir::Constant
-- // + span: $DIR/inline_instruction_set.rs:60:5: 60:39
-- // + literal: Const { ty: fn() {inline_always_and_using_inline_asm}, val: Value(<ZST>) }
-+ asm!("/* do nothing */", options((empty))) -> [return: bb3, unwind unreachable]; // scope 3 at $DIR/inline_instruction_set.rs:43:14: 43:38
+ StorageDead(_3);
+ StorageLive(_4);
+- _4 = inline_always_and_using_inline_asm() -> [return: bb4, unwind unreachable];
++ asm!("/* do nothing */", options((empty))) -> [return: bb3, unwind unreachable];
}
- bb4: {
+ bb3: {
- StorageDead(_4); // scope 0 at $DIR/inline_instruction_set.rs:+4:41: +4:42
- _0 = const (); // scope 0 at $DIR/inline_instruction_set.rs:+0:18: +5:2
- return; // scope 0 at $DIR/inline_instruction_set.rs:+5:2: +5:2
+ StorageDead(_4);
+ _0 = const ();
+ return;
}
}
diff --git a/tests/mir-opt/inline/inline_instruction_set.rs b/tests/mir-opt/inline/inline_instruction_set.rs
index 5dfb04943..7cb596455 100644
--- a/tests/mir-opt/inline/inline_instruction_set.rs
+++ b/tests/mir-opt/inline/inline_instruction_set.rs
@@ -46,16 +46,26 @@ fn inline_always_and_using_inline_asm() {
// EMIT_MIR inline_instruction_set.t32.Inline.diff
#[instruction_set(arm::t32)]
pub fn t32() {
+ // CHECK-LABEL: fn t32(
+ // CHECK-NOT: (inlined instruction_set_a32)
instruction_set_a32();
+ // CHECK: (inlined instruction_set_t32)
instruction_set_t32();
+ // CHECK: (inlined instruction_set_default)
instruction_set_default();
+ // CHECK-NOT: (inlined inline_always_and_using_inline_asm)
inline_always_and_using_inline_asm();
}
// EMIT_MIR inline_instruction_set.default.Inline.diff
pub fn default() {
+ // CHECK-LABEL: fn default(
+ // CHECK-NOT: (inlined instruction_set_a32)
instruction_set_a32();
+ // CHECK-NOT: (inlined instruction_set_t32)
instruction_set_t32();
+ // CHECK: (inlined instruction_set_default)
instruction_set_default();
+ // CHECK: (inlined inline_always_and_using_inline_asm)
inline_always_and_using_inline_asm();
}
diff --git a/tests/mir-opt/inline/inline_instruction_set.t32.Inline.diff b/tests/mir-opt/inline/inline_instruction_set.t32.Inline.diff
index 36aec4f47..33dc116f6 100644
--- a/tests/mir-opt/inline/inline_instruction_set.t32.Inline.diff
+++ b/tests/mir-opt/inline/inline_instruction_set.t32.Inline.diff
@@ -2,57 +2,45 @@
+ // MIR for `t32` after Inline
fn t32() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_instruction_set.rs:+0:14: +0:14
- let _1: (); // in scope 0 at $DIR/inline_instruction_set.rs:+1:5: +1:26
- let _2: (); // in scope 0 at $DIR/inline_instruction_set.rs:+2:5: +2:26
- let _3: (); // in scope 0 at $DIR/inline_instruction_set.rs:+3:5: +3:30
- let _4: (); // in scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41
-+ scope 1 (inlined instruction_set_t32) { // at $DIR/inline_instruction_set.rs:50:5: 50:26
+ let mut _0: ();
+ let _1: ();
+ let _2: ();
+ let _3: ();
+ let _4: ();
++ scope 1 (inlined instruction_set_t32) {
+ }
-+ scope 2 (inlined instruction_set_default) { // at $DIR/inline_instruction_set.rs:51:5: 51:30
++ scope 2 (inlined instruction_set_default) {
+ }
bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_instruction_set.rs:+1:5: +1:26
- _1 = instruction_set_a32() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+1:5: +1:26
- // mir::Constant
- // + span: $DIR/inline_instruction_set.rs:49:5: 49:24
- // + literal: Const { ty: fn() {instruction_set_a32}, val: Value(<ZST>) }
+ StorageLive(_1);
+ _1 = instruction_set_a32() -> [return: bb1, unwind unreachable];
}
bb1: {
- StorageDead(_1); // scope 0 at $DIR/inline_instruction_set.rs:+1:26: +1:27
- StorageLive(_2); // scope 0 at $DIR/inline_instruction_set.rs:+2:5: +2:26
-- _2 = instruction_set_t32() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+2:5: +2:26
-- // mir::Constant
-- // + span: $DIR/inline_instruction_set.rs:50:5: 50:24
-- // + literal: Const { ty: fn() {instruction_set_t32}, val: Value(<ZST>) }
+ StorageDead(_1);
+ StorageLive(_2);
+- _2 = instruction_set_t32() -> [return: bb2, unwind unreachable];
- }
-
- bb2: {
- StorageDead(_2); // scope 0 at $DIR/inline_instruction_set.rs:+2:26: +2:27
- StorageLive(_3); // scope 0 at $DIR/inline_instruction_set.rs:+3:5: +3:30
-- _3 = instruction_set_default() -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+3:5: +3:30
-- // mir::Constant
-- // + span: $DIR/inline_instruction_set.rs:51:5: 51:28
-- // + literal: Const { ty: fn() {instruction_set_default}, val: Value(<ZST>) }
+ StorageDead(_2);
+ StorageLive(_3);
+- _3 = instruction_set_default() -> [return: bb3, unwind unreachable];
- }
-
- bb3: {
- StorageDead(_3); // scope 0 at $DIR/inline_instruction_set.rs:+3:30: +3:31
- StorageLive(_4); // scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41
-- _4 = inline_always_and_using_inline_asm() -> [return: bb4, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41
-+ _4 = inline_always_and_using_inline_asm() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41
- // mir::Constant
- // + span: $DIR/inline_instruction_set.rs:52:5: 52:39
- // + literal: Const { ty: fn() {inline_always_and_using_inline_asm}, val: Value(<ZST>) }
+ StorageDead(_3);
+ StorageLive(_4);
+- _4 = inline_always_and_using_inline_asm() -> [return: bb4, unwind unreachable];
++ _4 = inline_always_and_using_inline_asm() -> [return: bb2, unwind unreachable];
}
- bb4: {
+ bb2: {
- StorageDead(_4); // scope 0 at $DIR/inline_instruction_set.rs:+4:41: +4:42
- _0 = const (); // scope 0 at $DIR/inline_instruction_set.rs:+0:14: +5:2
- return; // scope 0 at $DIR/inline_instruction_set.rs:+5:2: +5:2
+ StorageDead(_4);
+ _0 = const ();
+ return;
}
}
diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff
deleted file mode 100644
index a5129e0e8..000000000
--- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff
+++ /dev/null
@@ -1,81 +0,0 @@
-- // MIR for `main` before Inline
-+ // MIR for `main` after Inline
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_into_box_place.rs:+0:11: +0:11
- let _1: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline_into_box_place.rs:+1:9: +1:11
- let mut _2: std::vec::Vec<u32>; // in scope 0 at $DIR/inline_into_box_place.rs:+1:38: +1:48
- scope 1 {
- debug _x => _1; // in scope 1 at $DIR/inline_into_box_place.rs:+1:9: +1:11
- }
-+ scope 2 (inlined Vec::<u32>::new) { // at $DIR/inline_into_box_place.rs:8:38: 8:48
-+ let mut _3: alloc::raw_vec::RawVec<u32>; // in scope 2 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
-+ }
-+ scope 3 (inlined Box::<Vec<u32>>::new) { // at $DIR/inline_into_box_place.rs:8:29: 8:49
-+ debug x => _2; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
-+ let mut _4: usize; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
-+ let mut _5: usize; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
-+ let mut _6: *mut u8; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
-+ let mut _7: *const std::vec::Vec<u32>; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
-+ scope 4 {
-+ }
-+ }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_into_box_place.rs:+1:9: +1:11
- StorageLive(_2); // scope 0 at $DIR/inline_into_box_place.rs:+1:38: +1:48
-- _2 = Vec::<u32>::new() -> bb1; // scope 0 at $DIR/inline_into_box_place.rs:+1:38: +1:48
-+ StorageLive(_3); // scope 2 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
-+ _3 = const _; // scope 2 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
- // mir::Constant
-- // + span: $DIR/inline_into_box_place.rs:8:38: 8:46
-- // + user_ty: UserType(2)
-- // + literal: Const { ty: fn() -> Vec<u32> {Vec::<u32>::new}, val: Value(<ZST>) }
-+ // + span: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
-+ // + user_ty: UserType(0)
-+ // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Unevaluated(alloc::raw_vec::RawVec::<T>::NEW, [u32], None) }
-+ _2 = Vec::<u32> { buf: move _3, len: const 0_usize }; // scope 2 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
-+ StorageDead(_3); // scope 2 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
-+ _4 = SizeOf(std::vec::Vec<u32>); // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
-+ _5 = AlignOf(std::vec::Vec<u32>); // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
-+ _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb3, unwind: bb4]; // scope 4 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
-+ // mir::Constant
-+ // + span: $SRC_DIR/alloc/src/boxed.rs:LL:COL
-+ // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
- }
-
- bb1: {
-- _1 = Box::<Vec<u32>>::new(move _2) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/inline_into_box_place.rs:+1:29: +1:49
-- // mir::Constant
-- // + span: $DIR/inline_into_box_place.rs:8:29: 8:37
-- // + user_ty: UserType(1)
-- // + literal: Const { ty: fn(Vec<u32>) -> Box<Vec<u32>> {Box::<Vec<u32>>::new}, val: Value(<ZST>) }
-+ StorageDead(_1); // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2
-+ return; // scope 0 at $DIR/inline_into_box_place.rs:+2:2: +2:2
- }
-
-- bb2: {
-- StorageDead(_2); // scope 0 at $DIR/inline_into_box_place.rs:+1:48: +1:49
-- _0 = const (); // scope 0 at $DIR/inline_into_box_place.rs:+0:11: +2:2
-- drop(_1) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2
-+ bb2 (cleanup): {
-+ resume; // scope 0 at $DIR/inline_into_box_place.rs:+0:1: +2:2
- }
-
- bb3: {
-- StorageDead(_1); // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2
-- return; // scope 0 at $DIR/inline_into_box_place.rs:+2:2: +2:2
-+ _1 = ShallowInitBox(move _6, std::vec::Vec<u32>); // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
-+ _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>); // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
-+ (*_7) = move _2; // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
-+ StorageDead(_2); // scope 0 at $DIR/inline_into_box_place.rs:+1:48: +1:49
-+ _0 = const (); // scope 0 at $DIR/inline_into_box_place.rs:+0:11: +2:2
-+ drop(_1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2
- }
-
- bb4 (cleanup): {
-- resume; // scope 0 at $DIR/inline_into_box_place.rs:+0:1: +2:2
-+ drop(_2) -> [return: bb2, unwind terminate]; // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_into_box_place.rs b/tests/mir-opt/inline/inline_into_box_place.rs
deleted file mode 100644
index 02823e4e1..000000000
--- a/tests/mir-opt/inline/inline_into_box_place.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// ignore-endian-big
-// ignore-wasm32-bare compiled with panic=abort by default
-// ignore-debug MIR alignment checks in std alter the diff, breaking the test
-// compile-flags: -Z mir-opt-level=4
-
-// EMIT_MIR inline_into_box_place.main.Inline.diff
-fn main() {
- let _x: Box<Vec<u32>> = Box::new(Vec::new());
-}
diff --git a/tests/mir-opt/inline/inline_options.main.Inline.after.mir b/tests/mir-opt/inline/inline_options.main.Inline.after.mir
deleted file mode 100644
index a2938ead0..000000000
--- a/tests/mir-opt/inline/inline_options.main.Inline.after.mir
+++ /dev/null
@@ -1,55 +0,0 @@
-// MIR for `main` after Inline
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_options.rs:+0:11: +0:11
- let _1: (); // in scope 0 at $DIR/inline_options.rs:+1:5: +1:18
- let _2: (); // in scope 0 at $DIR/inline_options.rs:+2:5: +2:21
- scope 1 (inlined inlined::<u32>) { // at $DIR/inline_options.rs:11:5: 11:21
- let _3: (); // in scope 1 at $DIR/inline_options.rs:17:23: 17:26
- let _4: (); // in scope 1 at $DIR/inline_options.rs:17:28: 17:31
- let _5: (); // in scope 1 at $DIR/inline_options.rs:17:33: 17:36
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_options.rs:+1:5: +1:18
- _1 = not_inlined() -> bb1; // scope 0 at $DIR/inline_options.rs:+1:5: +1:18
- // mir::Constant
- // + span: $DIR/inline_options.rs:10:5: 10:16
- // + literal: Const { ty: fn() {not_inlined}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_1); // scope 0 at $DIR/inline_options.rs:+1:18: +1:19
- StorageLive(_2); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21
- StorageLive(_3); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21
- StorageLive(_4); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21
- StorageLive(_5); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21
- _3 = g() -> bb3; // scope 1 at $DIR/inline_options.rs:17:23: 17:26
- // mir::Constant
- // + span: $DIR/inline_options.rs:17:23: 17:24
- // + literal: Const { ty: fn() {g}, val: Value(<ZST>) }
- }
-
- bb2: {
- StorageDead(_5); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21
- StorageDead(_4); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21
- StorageDead(_3); // scope 0 at $DIR/inline_options.rs:+2:5: +2:21
- StorageDead(_2); // scope 0 at $DIR/inline_options.rs:+2:21: +2:22
- _0 = const (); // scope 0 at $DIR/inline_options.rs:+0:11: +3:2
- return; // scope 0 at $DIR/inline_options.rs:+3:2: +3:2
- }
-
- bb3: {
- _4 = g() -> bb4; // scope 1 at $DIR/inline_options.rs:17:28: 17:31
- // mir::Constant
- // + span: $DIR/inline_options.rs:17:28: 17:29
- // + literal: Const { ty: fn() {g}, val: Value(<ZST>) }
- }
-
- bb4: {
- _5 = g() -> bb2; // scope 1 at $DIR/inline_options.rs:17:33: 17:36
- // mir::Constant
- // + span: $DIR/inline_options.rs:17:33: 17:34
- // + literal: Const { ty: fn() {g}, val: Value(<ZST>) }
- }
-}
diff --git a/tests/mir-opt/inline/inline_options.main.Inline.after.panic-abort.mir b/tests/mir-opt/inline/inline_options.main.Inline.after.panic-abort.mir
new file mode 100644
index 000000000..3218c4e56
--- /dev/null
+++ b/tests/mir-opt/inline/inline_options.main.Inline.after.panic-abort.mir
@@ -0,0 +1,43 @@
+// MIR for `main` after Inline
+
+fn main() -> () {
+ let mut _0: ();
+ let _1: ();
+ let _2: ();
+ scope 1 (inlined inlined::<u32>) {
+ let _3: ();
+ let _4: ();
+ let _5: ();
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = not_inlined() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _3 = g() -> [return: bb3, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ return;
+ }
+
+ bb3: {
+ _4 = g() -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ _5 = g() -> [return: bb2, unwind unreachable];
+ }
+}
diff --git a/tests/mir-opt/inline/inline_options.main.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_options.main.Inline.after.panic-unwind.mir
new file mode 100644
index 000000000..df0cab513
--- /dev/null
+++ b/tests/mir-opt/inline/inline_options.main.Inline.after.panic-unwind.mir
@@ -0,0 +1,43 @@
+// MIR for `main` after Inline
+
+fn main() -> () {
+ let mut _0: ();
+ let _1: ();
+ let _2: ();
+ scope 1 (inlined inlined::<u32>) {
+ let _3: ();
+ let _4: ();
+ let _5: ();
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = not_inlined() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _3 = g() -> [return: bb3, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ return;
+ }
+
+ bb3: {
+ _4 = g() -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ _5 = g() -> [return: bb2, unwind continue];
+ }
+}
diff --git a/tests/mir-opt/inline/inline_options.rs b/tests/mir-opt/inline/inline_options.rs
index f0a898832..b940c64f0 100644
--- a/tests/mir-opt/inline/inline_options.rs
+++ b/tests/mir-opt/inline/inline_options.rs
@@ -1,4 +1,4 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Checks that inlining threshold can be controlled with
// inline-mir-threshold and inline-hint-threshold options.
//
@@ -7,7 +7,10 @@
// EMIT_MIR inline_options.main.Inline.after.mir
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK-NOT: (inlined not_inlined)
not_inlined();
+ // CHECK: (inlined inlined::<u32>)
inlined::<u32>();
}
diff --git a/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir b/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir
index 60149ff36..8c3f3a458 100644
--- a/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir
+++ b/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir
@@ -1,68 +1,59 @@
// MIR for `bar` after Inline
fn bar() -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/inline_retag.rs:+0:13: +0:17
- let _1: for<'a, 'b> fn(&'a i32, &'b i32) -> bool {foo}; // in scope 0 at $DIR/inline_retag.rs:+1:9: +1:10
- let mut _2: for<'a, 'b> fn(&'a i32, &'b i32) -> bool {foo}; // in scope 0 at $DIR/inline_retag.rs:+2:5: +2:6
- let mut _3: &i32; // in scope 0 at $DIR/inline_retag.rs:+2:7: +2:9
- let _4: &i32; // in scope 0 at $DIR/inline_retag.rs:+2:7: +2:9
- let _5: i32; // in scope 0 at $DIR/inline_retag.rs:+2:8: +2:9
- let mut _6: &i32; // in scope 0 at $DIR/inline_retag.rs:+2:11: +2:14
- let _7: &i32; // in scope 0 at $DIR/inline_retag.rs:+2:11: +2:14
- let _8: i32; // in scope 0 at $DIR/inline_retag.rs:+2:12: +2:14
+ let mut _0: bool;
+ let _1: for<'a, 'b> fn(&'a i32, &'b i32) -> bool {foo};
+ let mut _2: for<'a, 'b> fn(&'a i32, &'b i32) -> bool {foo};
+ let mut _3: &i32;
+ let _4: &i32;
+ let _5: i32;
+ let mut _6: &i32;
+ let _7: &i32;
+ let _8: i32;
scope 1 {
- debug f => _1; // in scope 1 at $DIR/inline_retag.rs:+1:9: +1:10
- let mut _9: &i32; // in scope 1 at $DIR/inline_retag.rs:+2:11: +2:14
- let mut _10: &i32; // in scope 1 at $DIR/inline_retag.rs:+2:7: +2:9
- scope 2 (inlined foo) { // at $DIR/inline_retag.rs:12:5: 12:15
- debug x => _3; // in scope 2 at $DIR/inline_retag.rs:16:8: 16:9
- debug y => _6; // in scope 2 at $DIR/inline_retag.rs:16:17: 16:18
- let mut _11: i32; // in scope 2 at $DIR/inline_retag.rs:17:5: 17:7
- let mut _12: i32; // in scope 2 at $DIR/inline_retag.rs:17:11: 17:13
+ debug f => _1;
+ let mut _9: &i32;
+ let mut _10: &i32;
+ scope 2 (inlined foo) {
+ debug x => _3;
+ debug y => _6;
+ let mut _11: i32;
+ let mut _12: i32;
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_retag.rs:+1:9: +1:10
- _1 = foo; // scope 0 at $DIR/inline_retag.rs:+1:13: +1:16
- // mir::Constant
- // + span: $DIR/inline_retag.rs:11:13: 11:16
- // + literal: Const { ty: for<'a, 'b> fn(&'a i32, &'b i32) -> bool {foo}, val: Value(<ZST>) }
- StorageLive(_2); // scope 1 at $DIR/inline_retag.rs:+2:5: +2:6
- _2 = _1; // scope 1 at $DIR/inline_retag.rs:+2:5: +2:6
- StorageLive(_3); // scope 1 at $DIR/inline_retag.rs:+2:7: +2:9
- StorageLive(_4); // scope 1 at $DIR/inline_retag.rs:+2:7: +2:9
- _10 = const _; // scope 1 at $DIR/inline_retag.rs:+2:7: +2:9
- // mir::Constant
- // + span: $DIR/inline_retag.rs:12:7: 12:9
- // + literal: Const { ty: &i32, val: Unevaluated(bar, [], Some(promoted[1])) }
- Retag(_10); // scope 1 at $DIR/inline_retag.rs:+2:7: +2:9
- _4 = &(*_10); // scope 1 at $DIR/inline_retag.rs:+2:7: +2:9
- _3 = &(*_4); // scope 1 at $DIR/inline_retag.rs:+2:7: +2:9
- StorageLive(_6); // scope 1 at $DIR/inline_retag.rs:+2:11: +2:14
- StorageLive(_7); // scope 1 at $DIR/inline_retag.rs:+2:11: +2:14
- _9 = const _; // scope 1 at $DIR/inline_retag.rs:+2:11: +2:14
- // mir::Constant
- // + span: $DIR/inline_retag.rs:12:11: 12:14
- // + literal: Const { ty: &i32, val: Unevaluated(bar, [], Some(promoted[0])) }
- Retag(_9); // scope 1 at $DIR/inline_retag.rs:+2:11: +2:14
- _7 = &(*_9); // scope 1 at $DIR/inline_retag.rs:+2:11: +2:14
- _6 = &(*_7); // scope 1 at $DIR/inline_retag.rs:+2:11: +2:14
- Retag(_3); // scope 2 at $DIR/inline_retag.rs:16:8: 16:9
- Retag(_6); // scope 2 at $DIR/inline_retag.rs:16:17: 16:18
- StorageLive(_11); // scope 2 at $DIR/inline_retag.rs:17:5: 17:7
- _11 = (*_3); // scope 2 at $DIR/inline_retag.rs:17:5: 17:7
- StorageLive(_12); // scope 2 at $DIR/inline_retag.rs:17:11: 17:13
- _12 = (*_6); // scope 2 at $DIR/inline_retag.rs:17:11: 17:13
- _0 = Eq(move _11, move _12); // scope 2 at $DIR/inline_retag.rs:17:5: 17:13
- StorageDead(_12); // scope 2 at $DIR/inline_retag.rs:17:12: 17:13
- StorageDead(_11); // scope 2 at $DIR/inline_retag.rs:17:12: 17:13
- StorageDead(_6); // scope 1 at $DIR/inline_retag.rs:+2:14: +2:15
- StorageDead(_3); // scope 1 at $DIR/inline_retag.rs:+2:14: +2:15
- StorageDead(_2); // scope 1 at $DIR/inline_retag.rs:+2:14: +2:15
- StorageDead(_1); // scope 0 at $DIR/inline_retag.rs:+3:1: +3:2
- StorageDead(_7); // scope 0 at $DIR/inline_retag.rs:+3:1: +3:2
- StorageDead(_4); // scope 0 at $DIR/inline_retag.rs:+3:1: +3:2
- return; // scope 0 at $DIR/inline_retag.rs:+3:2: +3:2
+ StorageLive(_1);
+ _1 = foo;
+ StorageLive(_2);
+ _2 = _1;
+ StorageLive(_3);
+ StorageLive(_4);
+ _10 = const _;
+ Retag(_10);
+ _4 = &(*_10);
+ _3 = &(*_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _9 = const _;
+ Retag(_9);
+ _7 = &(*_9);
+ _6 = &(*_7);
+ Retag(_3);
+ Retag(_6);
+ StorageLive(_11);
+ _11 = (*_3);
+ StorageLive(_12);
+ _12 = (*_6);
+ _0 = Eq(move _11, move _12);
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_6);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ StorageDead(_7);
+ StorageDead(_4);
+ return;
}
}
diff --git a/tests/mir-opt/inline/inline_retag.rs b/tests/mir-opt/inline/inline_retag.rs
index c6950f269..9fb6f7092 100644
--- a/tests/mir-opt/inline/inline_retag.rs
+++ b/tests/mir-opt/inline/inline_retag.rs
@@ -8,6 +8,17 @@ fn main() {
// EMIT_MIR inline_retag.bar.Inline.after.mir
fn bar() -> bool {
+ // CHECK-LABEL: fn bar(
+ // CHECK: (inlined foo)
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: debug y => [[y:_.*]];
+ // CHECK: bb0: {
+ // CHECK: Retag
+ // CHECK: Retag
+ // CHECK: Retag([[x]]);
+ // CHECK: Retag([[y]]);
+ // CHECK: return;
+ // CHECK-NEXT: }
let f = foo;
f(&1, &-1)
}
diff --git a/tests/mir-opt/inline/inline_shims.clone.Inline.diff b/tests/mir-opt/inline/inline_shims.clone.Inline.diff
deleted file mode 100644
index 09dd35c4c..000000000
--- a/tests/mir-opt/inline/inline_shims.clone.Inline.diff
+++ /dev/null
@@ -1,26 +0,0 @@
-- // MIR for `clone` before Inline
-+ // MIR for `clone` after Inline
-
- fn clone(_1: fn(A, B)) -> fn(A, B) {
- debug f => _1; // in scope 0 at $DIR/inline_shims.rs:+0:20: +0:21
- let mut _0: fn(A, B); // return place in scope 0 at $DIR/inline_shims.rs:+0:36: +0:44
- let mut _2: &fn(A, B); // in scope 0 at $DIR/inline_shims.rs:+1:5: +1:14
-+ scope 1 (inlined <fn(A, B) as Clone>::clone - shim(fn(A, B))) { // at $DIR/inline_shims.rs:6:7: 6:14
-+ }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/inline_shims.rs:+1:5: +1:14
- _2 = &_1; // scope 0 at $DIR/inline_shims.rs:+1:5: +1:14
-- _0 = <fn(A, B) as Clone>::clone(move _2) -> bb1; // scope 0 at $DIR/inline_shims.rs:+1:5: +1:14
-- // mir::Constant
-- // + span: $DIR/inline_shims.rs:6:7: 6:12
-- // + literal: Const { ty: for<'a> fn(&'a fn(A, B)) -> fn(A, B) {<fn(A, B) as Clone>::clone}, val: Value(<ZST>) }
-- }
--
-- bb1: {
-+ _0 = (*_2); // scope 1 at $SRC_DIR/core/src/clone.rs:LL:COL
- StorageDead(_2); // scope 0 at $DIR/inline_shims.rs:+1:13: +1:14
- return; // scope 0 at $DIR/inline_shims.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_shims.clone.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_shims.clone.Inline.panic-abort.diff
new file mode 100644
index 000000000..8117e58fa
--- /dev/null
+++ b/tests/mir-opt/inline/inline_shims.clone.Inline.panic-abort.diff
@@ -0,0 +1,23 @@
+- // MIR for `clone` before Inline
++ // MIR for `clone` after Inline
+
+ fn clone(_1: fn(A, B)) -> fn(A, B) {
+ debug f => _1;
+ let mut _0: fn(A, B);
+ let mut _2: &fn(A, B);
++ scope 1 (inlined <fn(A, B) as Clone>::clone - shim(fn(A, B))) {
++ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = &_1;
+- _0 = <fn(A, B) as Clone>::clone(move _2) -> [return: bb1, unwind unreachable];
+- }
+-
+- bb1: {
++ _0 = (*_2);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_shims.clone.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_shims.clone.Inline.panic-unwind.diff
new file mode 100644
index 000000000..00e92a0f5
--- /dev/null
+++ b/tests/mir-opt/inline/inline_shims.clone.Inline.panic-unwind.diff
@@ -0,0 +1,23 @@
+- // MIR for `clone` before Inline
++ // MIR for `clone` after Inline
+
+ fn clone(_1: fn(A, B)) -> fn(A, B) {
+ debug f => _1;
+ let mut _0: fn(A, B);
+ let mut _2: &fn(A, B);
++ scope 1 (inlined <fn(A, B) as Clone>::clone - shim(fn(A, B))) {
++ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = &_1;
+- _0 = <fn(A, B) as Clone>::clone(move _2) -> [return: bb1, unwind continue];
+- }
+-
+- bb1: {
++ _0 = (*_2);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.diff
deleted file mode 100644
index 36ddb189e..000000000
--- a/tests/mir-opt/inline/inline_shims.drop.Inline.diff
+++ /dev/null
@@ -1,56 +0,0 @@
-- // MIR for `drop` before Inline
-+ // MIR for `drop` after Inline
-
- fn drop(_1: *mut Vec<A>, _2: *mut Option<B>) -> () {
- debug a => _1; // in scope 0 at $DIR/inline_shims.rs:+0:19: +0:20
- debug b => _2; // in scope 0 at $DIR/inline_shims.rs:+0:35: +0:36
- let mut _0: (); // return place in scope 0 at $DIR/inline_shims.rs:+0:54: +0:54
- let _3: (); // in scope 0 at $DIR/inline_shims.rs:+1:14: +1:40
- let mut _4: *mut std::vec::Vec<A>; // in scope 0 at $DIR/inline_shims.rs:+1:38: +1:39
- let mut _5: *mut std::option::Option<B>; // in scope 0 at $DIR/inline_shims.rs:+2:38: +2:39
- scope 1 {
- }
- scope 2 {
-+ scope 3 (inlined std::ptr::drop_in_place::<Option<B>> - shim(Some(Option<B>))) { // at $DIR/inline_shims.rs:12:14: 12:40
-+ let mut _6: isize; // in scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
-+ let mut _7: isize; // in scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
-+ }
- }
-
- bb0: {
- StorageLive(_3); // scope 0 at $DIR/inline_shims.rs:+1:5: +1:42
- StorageLive(_4); // scope 1 at $DIR/inline_shims.rs:+1:38: +1:39
- _4 = _1; // scope 1 at $DIR/inline_shims.rs:+1:38: +1:39
- _3 = std::ptr::drop_in_place::<Vec<A>>(move _4) -> bb1; // scope 1 at $DIR/inline_shims.rs:+1:14: +1:40
- // mir::Constant
- // + span: $DIR/inline_shims.rs:11:14: 11:37
- // + literal: Const { ty: unsafe fn(*mut Vec<A>) {std::ptr::drop_in_place::<Vec<A>>}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_4); // scope 1 at $DIR/inline_shims.rs:+1:39: +1:40
- StorageDead(_3); // scope 0 at $DIR/inline_shims.rs:+1:41: +1:42
- StorageLive(_5); // scope 2 at $DIR/inline_shims.rs:+2:38: +2:39
- _5 = _2; // scope 2 at $DIR/inline_shims.rs:+2:38: +2:39
-- _0 = std::ptr::drop_in_place::<Option<B>>(move _5) -> bb2; // scope 2 at $DIR/inline_shims.rs:+2:14: +2:40
-- // mir::Constant
-- // + span: $DIR/inline_shims.rs:12:14: 12:37
-- // + literal: Const { ty: unsafe fn(*mut Option<B>) {std::ptr::drop_in_place::<Option<B>>}, val: Value(<ZST>) }
-+ StorageLive(_6); // scope 2 at $DIR/inline_shims.rs:+2:14: +2:40
-+ StorageLive(_7); // scope 2 at $DIR/inline_shims.rs:+2:14: +2:40
-+ _6 = discriminant((*_5)); // scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
-+ switchInt(move _6) -> [0: bb2, otherwise: bb3]; // scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- }
-
- bb2: {
-+ StorageDead(_7); // scope 2 at $DIR/inline_shims.rs:+2:14: +2:40
-+ StorageDead(_6); // scope 2 at $DIR/inline_shims.rs:+2:14: +2:40
- StorageDead(_5); // scope 2 at $DIR/inline_shims.rs:+2:39: +2:40
- return; // scope 0 at $DIR/inline_shims.rs:+3:2: +3:2
-+ }
-+
-+ bb3: {
-+ drop((((*_5) as Some).0: B)) -> bb2; // scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff
new file mode 100644
index 000000000..4fcd49994
--- /dev/null
+++ b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff
@@ -0,0 +1,64 @@
+- // MIR for `drop` before Inline
++ // MIR for `drop` after Inline
+
+ fn drop(_1: *mut Vec<A>, _2: *mut Option<B>) -> () {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: ();
+ let _3: ();
+ let mut _4: *mut std::vec::Vec<A>;
+ let mut _5: *mut std::option::Option<B>;
+ scope 1 {
++ scope 3 (inlined std::ptr::drop_in_place::<Vec<A>> - shim(Some(Vec<A>))) {
++ let mut _6: &mut std::vec::Vec<A>;
++ let mut _7: ();
++ }
+ }
+ scope 2 {
++ scope 4 (inlined std::ptr::drop_in_place::<Option<B>> - shim(Some(Option<B>))) {
++ let mut _8: isize;
++ let mut _9: isize;
++ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+- _3 = std::ptr::drop_in_place::<Vec<A>>(move _4) -> [return: bb1, unwind unreachable];
++ StorageLive(_6);
++ StorageLive(_7);
++ _6 = &mut (*_4);
++ _7 = <Vec<A> as Drop>::drop(move _6) -> [return: bb2, unwind unreachable];
+ }
+
+ bb1: {
++ StorageDead(_7);
++ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageLive(_5);
+ _5 = _2;
+- _0 = std::ptr::drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind unreachable];
++ StorageLive(_8);
++ StorageLive(_9);
++ _8 = discriminant((*_5));
++ switchInt(move _8) -> [0: bb3, otherwise: bb4];
+ }
+
+ bb2: {
++ drop(((*_4).0: alloc::raw_vec::RawVec<A>)) -> [return: bb1, unwind unreachable];
++ }
++
++ bb3: {
++ StorageDead(_9);
++ StorageDead(_8);
+ StorageDead(_5);
+ return;
++ }
++
++ bb4: {
++ drop((((*_5) as Some).0: B)) -> [return: bb3, unwind unreachable];
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff
new file mode 100644
index 000000000..4270ae00b
--- /dev/null
+++ b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff
@@ -0,0 +1,50 @@
+- // MIR for `drop` before Inline
++ // MIR for `drop` after Inline
+
+ fn drop(_1: *mut Vec<A>, _2: *mut Option<B>) -> () {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: ();
+ let _3: ();
+ let mut _4: *mut std::vec::Vec<A>;
+ let mut _5: *mut std::option::Option<B>;
+ scope 1 {
+ }
+ scope 2 {
++ scope 3 (inlined std::ptr::drop_in_place::<Option<B>> - shim(Some(Option<B>))) {
++ let mut _6: isize;
++ let mut _7: isize;
++ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ _3 = std::ptr::drop_in_place::<Vec<A>>(move _4) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageLive(_5);
+ _5 = _2;
+- _0 = std::ptr::drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind continue];
++ StorageLive(_6);
++ StorageLive(_7);
++ _6 = discriminant((*_5));
++ switchInt(move _6) -> [0: bb2, otherwise: bb3];
+ }
+
+ bb2: {
++ StorageDead(_7);
++ StorageDead(_6);
+ StorageDead(_5);
+ return;
++ }
++
++ bb3: {
++ drop((((*_5) as Some).0: B)) -> [return: bb2, unwind continue];
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_shims.rs b/tests/mir-opt/inline/inline_shims.rs
index 7c8618f71..a223c2d26 100644
--- a/tests/mir-opt/inline/inline_shims.rs
+++ b/tests/mir-opt/inline/inline_shims.rs
@@ -1,13 +1,17 @@
-// ignore-wasm32-bare compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![crate_type = "lib"]
// EMIT_MIR inline_shims.clone.Inline.diff
pub fn clone<A, B>(f: fn(A, B)) -> fn(A, B) {
+ // CHECK-LABEL: fn clone(
+ // CHECK: (inlined <fn(A, B) as Clone>::clone - shim(fn(A, B)))
f.clone()
}
// EMIT_MIR inline_shims.drop.Inline.diff
pub fn drop<A, B>(a: *mut Vec<A>, b: *mut Option<B>) {
+ // CHECK-LABEL: fn drop(
+ // CHECK: (inlined std::ptr::drop_in_place::<Option<B>> - shim(Some(Option<B>)))
unsafe { std::ptr::drop_in_place(a) }
unsafe { std::ptr::drop_in_place(b) }
}
diff --git a/tests/mir-opt/inline/inline_specialization.main.Inline.diff b/tests/mir-opt/inline/inline_specialization.main.Inline.diff
deleted file mode 100644
index 9dde9994d..000000000
--- a/tests/mir-opt/inline/inline_specialization.main.Inline.diff
+++ /dev/null
@@ -1,28 +0,0 @@
-- // MIR for `main` before Inline
-+ // MIR for `main` after Inline
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/inline_specialization.rs:+0:11: +0:11
- let _1: u32; // in scope 0 at $DIR/inline_specialization.rs:+1:9: +1:10
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/inline_specialization.rs:+1:9: +1:10
- }
-+ scope 2 (inlined <Vec<()> as Foo>::bar) { // at $DIR/inline_specialization.rs:6:13: 6:38
-+ }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/inline_specialization.rs:+1:9: +1:10
-- _1 = <Vec<()> as Foo>::bar() -> bb1; // scope 0 at $DIR/inline_specialization.rs:+1:13: +1:38
-- // mir::Constant
-- // + span: $DIR/inline_specialization.rs:6:13: 6:36
-- // + literal: Const { ty: fn() -> u32 {<Vec<()> as Foo>::bar}, val: Value(<ZST>) }
-- }
--
-- bb1: {
-+ _1 = const 123_u32; // scope 2 at $DIR/inline_specialization.rs:15:31: 15:34
- _0 = const (); // scope 0 at $DIR/inline_specialization.rs:+0:11: +2:2
- StorageDead(_1); // scope 0 at $DIR/inline_specialization.rs:+2:1: +2:2
- return; // scope 0 at $DIR/inline_specialization.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_specialization.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_specialization.main.Inline.panic-abort.diff
new file mode 100644
index 000000000..22afcd2ee
--- /dev/null
+++ b/tests/mir-opt/inline/inline_specialization.main.Inline.panic-abort.diff
@@ -0,0 +1,25 @@
+- // MIR for `main` before Inline
++ // MIR for `main` after Inline
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ scope 1 {
+ debug x => _1;
+ }
++ scope 2 (inlined <Vec<()> as Foo>::bar) {
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = <Vec<()> as Foo>::bar() -> [return: bb1, unwind unreachable];
+- }
+-
+- bb1: {
++ _1 = const 123_u32;
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_specialization.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_specialization.main.Inline.panic-unwind.diff
new file mode 100644
index 000000000..bc841101d
--- /dev/null
+++ b/tests/mir-opt/inline/inline_specialization.main.Inline.panic-unwind.diff
@@ -0,0 +1,25 @@
+- // MIR for `main` before Inline
++ // MIR for `main` after Inline
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: u32;
+ scope 1 {
+ debug x => _1;
+ }
++ scope 2 (inlined <Vec<()> as Foo>::bar) {
++ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = <Vec<()> as Foo>::bar() -> [return: bb1, unwind continue];
+- }
+-
+- bb1: {
++ _1 = const 123_u32;
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/inline_specialization.rs b/tests/mir-opt/inline/inline_specialization.rs
index c24795e05..6453abc00 100644
--- a/tests/mir-opt/inline/inline_specialization.rs
+++ b/tests/mir-opt/inline/inline_specialization.rs
@@ -1,8 +1,10 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![feature(specialization)]
// EMIT_MIR inline_specialization.main.Inline.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: (inlined <Vec<()> as Foo>::bar)
let x = <Vec::<()> as Foo>::bar();
}
diff --git a/tests/mir-opt/inline/inline_trait_method.rs b/tests/mir-opt/inline/inline_trait_method.rs
index 6aa957eb5..b39355637 100644
--- a/tests/mir-opt/inline/inline_trait_method.rs
+++ b/tests/mir-opt/inline/inline_trait_method.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// Verify that we do not inline the default impl in a trait object.
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -Z span_free_formats
fn main() {
@@ -7,6 +8,8 @@ fn main() {
// EMIT_MIR inline_trait_method.test.Inline.after.mir
fn test(x: &dyn X) -> u32 {
+ // CHECK-LABEL: fn test(
+ // CHECK-NOT: inlined
x.y()
}
diff --git a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.mir b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.mir
deleted file mode 100644
index a9020a5bb..000000000
--- a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.mir
+++ /dev/null
@@ -1,21 +0,0 @@
-// MIR for `test` after Inline
-
-fn test(_1: &dyn X) -> u32 {
- debug x => _1; // in scope 0 at $DIR/inline_trait_method.rs:+0:9: +0:10
- let mut _0: u32; // return place in scope 0 at $DIR/inline_trait_method.rs:+0:23: +0:26
- let mut _2: &dyn X; // in scope 0 at $DIR/inline_trait_method.rs:+1:5: +1:10
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/inline_trait_method.rs:+1:5: +1:10
- _2 = &(*_1); // scope 0 at $DIR/inline_trait_method.rs:+1:5: +1:10
- _0 = <dyn X as X>::y(move _2) -> bb1; // scope 0 at $DIR/inline_trait_method.rs:+1:5: +1:10
- // mir::Constant
- // + span: $DIR/inline_trait_method.rs:10:7: 10:8
- // + literal: Const { ty: for<'a> fn(&'a dyn X) -> u32 {<dyn X as X>::y}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/inline_trait_method.rs:+1:9: +1:10
- return; // scope 0 at $DIR/inline_trait_method.rs:+2:2: +2:2
- }
-}
diff --git a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir
new file mode 100644
index 000000000..2441e3f1c
--- /dev/null
+++ b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir
@@ -0,0 +1,18 @@
+// MIR for `test` after Inline
+
+fn test(_1: &dyn X) -> u32 {
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: &dyn X;
+
+ bb0: {
+ StorageLive(_2);
+ _2 = &(*_1);
+ _0 = <dyn X as X>::y(move _2) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+}
diff --git a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir
new file mode 100644
index 000000000..da18a5adc
--- /dev/null
+++ b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir
@@ -0,0 +1,18 @@
+// MIR for `test` after Inline
+
+fn test(_1: &dyn X) -> u32 {
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: &dyn X;
+
+ bb0: {
+ StorageLive(_2);
+ _2 = &(*_1);
+ _0 = <dyn X as X>::y(move _2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+}
diff --git a/tests/mir-opt/inline/inline_trait_method_2.rs b/tests/mir-opt/inline/inline_trait_method_2.rs
index 07a601908..b0b6a7b9b 100644
--- a/tests/mir-opt/inline/inline_trait_method_2.rs
+++ b/tests/mir-opt/inline/inline_trait_method_2.rs
@@ -1,8 +1,11 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -Z span_free_formats -Z mir-opt-level=4
// EMIT_MIR inline_trait_method_2.test2.Inline.after.mir
fn test2(x: &dyn X) -> bool {
+ // CHECK-LABEL: fn test2(
+ // CHECK: (inlined test)
+ // CHECK-NOT: (inlined <dyn X as X>::y)
test(x)
}
diff --git a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.mir b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.mir
deleted file mode 100644
index a4bbecf3b..000000000
--- a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.mir
+++ /dev/null
@@ -1,28 +0,0 @@
-// MIR for `test2` after Inline
-
-fn test2(_1: &dyn X) -> bool {
- debug x => _1; // in scope 0 at $DIR/inline_trait_method_2.rs:+0:10: +0:11
- let mut _0: bool; // return place in scope 0 at $DIR/inline_trait_method_2.rs:+0:24: +0:28
- let mut _2: &dyn X; // in scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11
- let mut _3: &dyn X; // in scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11
- scope 1 (inlined test) { // at $DIR/inline_trait_method_2.rs:6:5: 6:12
- debug x => _2; // in scope 1 at $DIR/inline_trait_method_2.rs:10:9: 10:10
- }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11
- StorageLive(_3); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11
- _3 = &(*_1); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11
- _2 = move _3 as &dyn X (Pointer(Unsize)); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11
- StorageDead(_3); // scope 0 at $DIR/inline_trait_method_2.rs:+1:10: +1:11
- _0 = <dyn X as X>::y(_2) -> bb1; // scope 1 at $DIR/inline_trait_method_2.rs:11:5: 11:10
- // mir::Constant
- // + span: $DIR/inline_trait_method_2.rs:11:7: 11:8
- // + literal: Const { ty: for<'a> fn(&'a dyn X) -> bool {<dyn X as X>::y}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/inline_trait_method_2.rs:+1:11: +1:12
- return; // scope 0 at $DIR/inline_trait_method_2.rs:+2:2: +2:2
- }
-}
diff --git a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir
new file mode 100644
index 000000000..f0d1cfe03
--- /dev/null
+++ b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir
@@ -0,0 +1,25 @@
+// MIR for `test2` after Inline
+
+fn test2(_1: &dyn X) -> bool {
+ debug x => _1;
+ let mut _0: bool;
+ let mut _2: &dyn X;
+ let mut _3: &dyn X;
+ scope 1 (inlined test) {
+ debug x => _2;
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &(*_1);
+ _2 = move _3 as &dyn X (PointerCoercion(Unsize));
+ StorageDead(_3);
+ _0 = <dyn X as X>::y(move _2) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+}
diff --git a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir
new file mode 100644
index 000000000..f37b08143
--- /dev/null
+++ b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir
@@ -0,0 +1,25 @@
+// MIR for `test2` after Inline
+
+fn test2(_1: &dyn X) -> bool {
+ debug x => _1;
+ let mut _0: bool;
+ let mut _2: &dyn X;
+ let mut _3: &dyn X;
+ scope 1 (inlined test) {
+ debug x => _2;
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &(*_1);
+ _2 = move _3 as &dyn X (PointerCoercion(Unsize));
+ StorageDead(_3);
+ _0 = <dyn X as X>::y(move _2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+}
diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.diff
deleted file mode 100644
index 3aebfb69e..000000000
--- a/tests/mir-opt/inline/issue_106141.outer.Inline.diff
+++ /dev/null
@@ -1,55 +0,0 @@
-- // MIR for `outer` before Inline
-+ // MIR for `outer` after Inline
-
- fn outer() -> usize {
- let mut _0: usize; // return place in scope 0 at $DIR/issue_106141.rs:+0:19: +0:24
-+ scope 1 (inlined inner) { // at $DIR/issue_106141.rs:3:5: 3:12
-+ let mut _1: bool; // in scope 1 at $DIR/issue_106141.rs:14:8: 14:21
-+ let mut _2: bool; // in scope 1 at $DIR/issue_106141.rs:14:8: 14:21
-+ let mut _3: &[bool; 1]; // in scope 1 at $DIR/issue_106141.rs:12:18: 12:25
-+ scope 2 {
-+ debug buffer => const _; // in scope 2 at $DIR/issue_106141.rs:12:9: 12:15
-+ scope 3 {
-+ debug index => _0; // in scope 3 at $DIR/issue_106141.rs:13:9: 13:14
-+ }
-+ }
-+ }
-
- bb0: {
-- _0 = inner() -> bb1; // scope 0 at $DIR/issue_106141.rs:+1:5: +1:12
-+ StorageLive(_3); // scope 0 at $DIR/issue_106141.rs:+1:5: +1:12
-+ _3 = const _; // scope 1 at $DIR/issue_106141.rs:12:18: 12:25
- // mir::Constant
-- // + span: $DIR/issue_106141.rs:3:5: 3:10
-- // + literal: Const { ty: fn() -> usize {inner}, val: Value(<ZST>) }
-+ // + span: $DIR/issue_106141.rs:12:18: 12:25
-+ // + literal: Const { ty: &[bool; 1], val: Unevaluated(inner, [], Some(promoted[0])) }
-+ _0 = index() -> bb1; // scope 2 at $DIR/issue_106141.rs:13:17: 13:24
-+ // mir::Constant
-+ // + span: $DIR/issue_106141.rs:13:17: 13:22
-+ // + literal: Const { ty: fn() -> usize {index}, val: Value(<ZST>) }
- }
-
- bb1: {
-+ StorageLive(_1); // scope 3 at $DIR/issue_106141.rs:14:8: 14:21
-+ _2 = Lt(_0, const 1_usize); // scope 3 at $DIR/issue_106141.rs:14:8: 14:21
-+ assert(move _2, "index out of bounds: the length is {} but the index is {}", const 1_usize, _0) -> bb2; // scope 3 at $DIR/issue_106141.rs:14:8: 14:21
-+ }
-+
-+ bb2: {
-+ _1 = (*_3)[_0]; // scope 3 at $DIR/issue_106141.rs:14:8: 14:21
-+ switchInt(move _1) -> [0: bb3, otherwise: bb4]; // scope 3 at $DIR/issue_106141.rs:14:8: 14:21
-+ }
-+
-+ bb3: {
-+ _0 = const 0_usize; // scope 3 at $DIR/issue_106141.rs:17:9: 17:10
-+ goto -> bb4; // scope 3 at $DIR/issue_106141.rs:14:5: 18:6
-+ }
-+
-+ bb4: {
-+ StorageDead(_1); // scope 3 at $DIR/issue_106141.rs:18:5: 18:6
-+ StorageDead(_3); // scope 0 at $DIR/issue_106141.rs:+1:5: +1:12
- return; // scope 0 at $DIR/issue_106141.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff
new file mode 100644
index 000000000..688ab9c56
--- /dev/null
+++ b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff
@@ -0,0 +1,49 @@
+- // MIR for `outer` before Inline
++ // MIR for `outer` after Inline
+
+ fn outer() -> usize {
+ let mut _0: usize;
++ scope 1 (inlined inner) {
++ let mut _1: &[bool; 1];
++ let mut _2: bool;
++ let mut _3: bool;
++ scope 2 {
++ debug buffer => const _;
++ scope 3 {
++ debug index => _0;
++ }
++ }
++ }
+
+ bb0: {
+- _0 = inner() -> [return: bb1, unwind unreachable];
++ StorageLive(_1);
++ StorageLive(_2);
++ _1 = const _;
++ _0 = index() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
++ StorageLive(_3);
++ _2 = Lt(_0, const 1_usize);
++ assert(move _2, "index out of bounds: the length is {} but the index is {}", const 1_usize, _0) -> [success: bb2, unwind unreachable];
++ }
++
++ bb2: {
++ _3 = (*_1)[_0];
++ switchInt(move _3) -> [0: bb3, otherwise: bb4];
++ }
++
++ bb3: {
++ _0 = const 0_usize;
++ goto -> bb4;
++ }
++
++ bb4: {
++ StorageDead(_3);
++ StorageDead(_2);
++ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff
new file mode 100644
index 000000000..e4d2b1a7f
--- /dev/null
+++ b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff
@@ -0,0 +1,49 @@
+- // MIR for `outer` before Inline
++ // MIR for `outer` after Inline
+
+ fn outer() -> usize {
+ let mut _0: usize;
++ scope 1 (inlined inner) {
++ let mut _1: &[bool; 1];
++ let mut _2: bool;
++ let mut _3: bool;
++ scope 2 {
++ debug buffer => const _;
++ scope 3 {
++ debug index => _0;
++ }
++ }
++ }
+
+ bb0: {
+- _0 = inner() -> [return: bb1, unwind continue];
++ StorageLive(_1);
++ StorageLive(_2);
++ _1 = const _;
++ _0 = index() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
++ StorageLive(_3);
++ _2 = Lt(_0, const 1_usize);
++ assert(move _2, "index out of bounds: the length is {} but the index is {}", const 1_usize, _0) -> [success: bb2, unwind continue];
++ }
++
++ bb2: {
++ _3 = (*_1)[_0];
++ switchInt(move _3) -> [0: bb3, otherwise: bb4];
++ }
++
++ bb3: {
++ _0 = const 0_usize;
++ goto -> bb4;
++ }
++
++ bb4: {
++ StorageDead(_3);
++ StorageDead(_2);
++ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/issue_106141.rs b/tests/mir-opt/inline/issue_106141.rs
index b6bd806e6..592b4d9b7 100644
--- a/tests/mir-opt/inline/issue_106141.rs
+++ b/tests/mir-opt/inline/issue_106141.rs
@@ -1,14 +1,21 @@
-// ignore-wasm32 compiled with panic=abort by default
+// Verify that we do not ICE inlining a function which uses _0 as an index.
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
pub fn outer() -> usize {
+ // CHECK-LABEL: fn outer(
+ // CHECK: = {{.*}}[_0];
inner()
}
+#[inline(never)]
fn index() -> usize {
loop {}
}
#[inline]
fn inner() -> usize {
+ // CHECK-LABEL: fn inner(
+ // CHECK: = {{.*}}[_0];
let buffer = &[true];
let index = index();
if buffer[index] {
diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir
index 6441a9668..7cc65efe0 100644
--- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir
+++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir
@@ -1,26 +1,26 @@
// MIR for `a` after Inline
fn a(_1: &mut [T]) -> &mut [T] {
- debug x => _1; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+0:13: +0:14
- let mut _0: &mut [T]; // return place in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+0:29: +0:37
- let mut _2: &mut [T]; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- let mut _3: &mut [T]; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- let mut _4: &mut [T]; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- scope 1 (inlined <[T] as AsMut<[T]>>::as_mut) { // at $DIR/issue_58867_inline_as_ref_as_mut.rs:3:7: 3:15
- debug self => _4; // in scope 1 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
+ debug x => _1;
+ let mut _0: &mut [T];
+ let mut _2: &mut [T];
+ let mut _3: &mut [T];
+ let mut _4: &mut [T];
+ scope 1 (inlined <[T] as AsMut<[T]>>::as_mut) {
+ debug self => _4;
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- StorageLive(_3); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- StorageLive(_4); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- _4 = &mut (*_1); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- _3 = _4; // scope 1 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
- _2 = &mut (*_3); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- StorageDead(_4); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:14: +1:15
- _0 = &mut (*_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- StorageDead(_3); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+2:1: +2:2
- StorageDead(_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+2:1: +2:2
- return; // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+2:2: +2:2
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &mut (*_1);
+ _3 = _4;
+ _2 = &mut (*_3);
+ StorageDead(_4);
+ _0 = &mut (*_2);
+ StorageDead(_3);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
index 21570a88a..62d7e839f 100644
--- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
+++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
@@ -1,30 +1,34 @@
// MIR for `b` after Inline
fn b(_1: &mut Box<T>) -> &mut T {
- debug x => _1; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+0:13: +0:14
- let mut _0: &mut T; // return place in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+0:32: +0:38
- let mut _2: &mut T; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- let mut _3: &mut T; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- let mut _4: &mut std::boxed::Box<T>; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- scope 1 (inlined <Box<T> as AsMut<T>>::as_mut) { // at $DIR/issue_58867_inline_as_ref_as_mut.rs:8:7: 8:15
- debug self => _4; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
- let mut _5: std::boxed::Box<T>; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
- let mut _6: *const T; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
+ debug x => _1;
+ let mut _0: &mut T;
+ let mut _2: &mut T;
+ let mut _3: &mut T;
+ let mut _4: &mut std::boxed::Box<T>;
+ scope 1 (inlined <Box<T> as AsMut<T>>::as_mut) {
+ debug self => _4;
+ let mut _5: std::boxed::Box<T>;
+ let mut _6: *const T;
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- StorageLive(_3); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- StorageLive(_4); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- _4 = &mut (*_1); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- _5 = deref_copy (*_4); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
- _6 = (((_5.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
- _3 = &mut (*_6); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
- _2 = &mut (*_3); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- StorageDead(_4); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:14: +1:15
- _0 = &mut (*_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- StorageDead(_3); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+2:1: +2:2
- StorageDead(_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+2:1: +2:2
- return; // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+2:2: +2:2
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &mut (*_1);
+ StorageLive(_5);
+ StorageLive(_6);
+ _5 = deref_copy (*_4);
+ _6 = (((_5.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T);
+ _3 = &mut (*_6);
+ StorageDead(_6);
+ StorageDead(_5);
+ _2 = &mut (*_3);
+ StorageDead(_4);
+ _0 = &mut (*_2);
+ StorageDead(_3);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir
index af830d249..bad7f31ae 100644
--- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir
+++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir
@@ -1,22 +1,22 @@
// MIR for `c` after Inline
fn c(_1: &[T]) -> &[T] {
- debug x => _1; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+0:13: +0:14
- let mut _0: &[T]; // return place in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+0:25: +0:29
- let _2: &[T]; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- let mut _3: &[T]; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- scope 1 (inlined <[T] as AsRef<[T]>>::as_ref) { // at $DIR/issue_58867_inline_as_ref_as_mut.rs:13:7: 13:15
- debug self => _3; // in scope 1 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
+ debug x => _1;
+ let mut _0: &[T];
+ let _2: &[T];
+ let mut _3: &[T];
+ scope 1 (inlined <[T] as AsRef<[T]>>::as_ref) {
+ debug self => _3;
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- StorageLive(_3); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- _3 = &(*_1); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- _2 = _3; // scope 1 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
- _0 = &(*_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- StorageDead(_3); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:14: +1:15
- StorageDead(_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+2:1: +2:2
- return; // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+2:2: +2:2
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &(*_1);
+ _2 = _3;
+ _0 = &(*_2);
+ StorageDead(_3);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
index 4f9342247..bc0aa06a7 100644
--- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
+++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
@@ -1,26 +1,30 @@
// MIR for `d` after Inline
fn d(_1: &Box<T>) -> &T {
- debug x => _1; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+0:13: +0:14
- let mut _0: &T; // return place in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+0:28: +0:30
- let _2: &T; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- let mut _3: &std::boxed::Box<T>; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- scope 1 (inlined <Box<T> as AsRef<T>>::as_ref) { // at $DIR/issue_58867_inline_as_ref_as_mut.rs:18:7: 18:15
- debug self => _3; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
- let mut _4: std::boxed::Box<T>; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
- let mut _5: *const T; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
+ debug x => _1;
+ let mut _0: &T;
+ let _2: &T;
+ let mut _3: &std::boxed::Box<T>;
+ scope 1 (inlined <Box<T> as AsRef<T>>::as_ref) {
+ debug self => _3;
+ let mut _4: std::boxed::Box<T>;
+ let mut _5: *const T;
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- StorageLive(_3); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- _3 = &(*_1); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- _4 = deref_copy (*_3); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
- _5 = (((_4.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
- _2 = &(*_5); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL
- _0 = &(*_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15
- StorageDead(_3); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:14: +1:15
- StorageDead(_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+2:1: +2:2
- return; // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+2:2: +2:2
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &(*_1);
+ StorageLive(_4);
+ StorageLive(_5);
+ _4 = deref_copy (*_3);
+ _5 = (((_4.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T);
+ _2 = &(*_5);
+ StorageDead(_5);
+ StorageDead(_4);
+ _0 = &(*_2);
+ StorageDead(_3);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.rs b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.rs
index 94f926d39..4517c88d7 100644
--- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.rs
+++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.rs
@@ -1,20 +1,28 @@
// EMIT_MIR issue_58867_inline_as_ref_as_mut.a.Inline.after.mir
pub fn a<T>(x: &mut [T]) -> &mut [T] {
+ // CHECK-LABEL: fn a(
+ // CHECK: (inlined <[T] as AsMut<[T]>>::as_mut)
x.as_mut()
}
// EMIT_MIR issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
pub fn b<T>(x: &mut Box<T>) -> &mut T {
+ // CHECK-LABEL: fn b(
+ // CHECK: (inlined <Box<T> as AsMut<T>>::as_mut)
x.as_mut()
}
// EMIT_MIR issue_58867_inline_as_ref_as_mut.c.Inline.after.mir
pub fn c<T>(x: &[T]) -> &[T] {
+ // CHECK-LABEL: fn c(
+ // CHECK: (inlined <[T] as AsRef<[T]>>::as_ref)
x.as_ref()
}
// EMIT_MIR issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
pub fn d<T>(x: &Box<T>) -> &T {
+ // CHECK-LABEL: fn d(
+ // CHECK: (inlined <Box<T> as AsRef<T>>::as_ref)
x.as_ref()
}
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 1da3c8bb7..ba4f91b28 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
@@ -1,45 +1,38 @@
// MIR for `main` after Inline
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/issue_76997_inline_scopes_parenting.rs:+0:11: +0:11
- let _1: [closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16]; // in scope 0 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:9: +1:10
- let mut _2: &[closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16]; // in scope 0 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:5: +2:6
- let mut _3: ((),); // in scope 0 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:5: +2:10
- let mut _4: (); // in scope 0 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:7: +2:9
- let mut _5: (); // in scope 0 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:5: +2:10
+ let mut _0: ();
+ let _1: {closure@$DIR/issue_76997_inline_scopes_parenting.rs:15:13: 15:16};
+ let mut _2: &{closure@$DIR/issue_76997_inline_scopes_parenting.rs:15:13: 15:16};
+ let mut _3: ((),);
+ let mut _4: ();
+ let mut _5: ();
scope 1 {
- debug f => _1; // in scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:9: +1:10
- scope 2 (inlined main::{closure#0}) { // at $DIR/issue_76997_inline_scopes_parenting.rs:6:5: 6:10
- debug x => const (); // in scope 2 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:14: +1:15
+ debug f => _1;
+ scope 2 (inlined main::{closure#0}) {
+ debug x => const ();
scope 3 {
- debug y => const (); // in scope 3 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:23: +1:24
+ debug y => const ();
}
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:9: +1:10
- _1 = [closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16]; // scope 0 at $DIR/issue_76997_inline_scopes_parenting.rs:+1:13: +1:33
- // closure
- // + def_id: DefId(0:4 ~ issue_76997_inline_scopes_parenting[5cd2]::main::{closure#0})
- // + substs: [
- // i8,
- // extern "rust-call" fn(((),)),
- // (),
- // ]
- StorageLive(_2); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:5: +2:6
- _2 = &_1; // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:5: +2:6
- StorageLive(_3); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:5: +2:10
- StorageLive(_4); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:7: +2:9
- _4 = (); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:7: +2:9
- _3 = (move _4,); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:5: +2:10
- StorageLive(_5); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:5: +2:10
- _5 = move (_3.0: ()); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:5: +2:10
- StorageDead(_5); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:5: +2:10
- StorageDead(_4); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:9: +2:10
- StorageDead(_3); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:9: +2:10
- StorageDead(_2); // scope 1 at $DIR/issue_76997_inline_scopes_parenting.rs:+2:9: +2:10
- StorageDead(_1); // scope 0 at $DIR/issue_76997_inline_scopes_parenting.rs:+3:1: +3:2
- return; // scope 0 at $DIR/issue_76997_inline_scopes_parenting.rs:+3:2: +3:2
+ StorageLive(_1);
+ _1 = {closure@$DIR/issue_76997_inline_scopes_parenting.rs:15:13: 15:16};
+ StorageLive(_2);
+ _2 = &_1;
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = ();
+ _3 = (move _4,);
+ StorageLive(_5);
+ _5 = move (_3.0: ());
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.rs b/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.rs
index 76d806acc..2fb363c19 100644
--- a/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.rs
+++ b/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.rs
@@ -2,6 +2,16 @@
// EMIT_MIR issue_76997_inline_scopes_parenting.main.Inline.after.mir
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: scope 1 {
+ // CHECK-NEXT: debug f
+ // CHECK-NEXT: scope 2 (inlined main::{closure#0}) {
+ // CHECK-NEXT: debug x
+ // CHECK-NEXT: scope 3 {
+ // CHECK-NEXT: debug y
+ // CHECK-NEXT: }
+ // CHECK-NEXT: }
+ // CHECK-NEXT: }
let f = |x| { let y = x; y };
f(())
}
diff --git a/tests/mir-opt/inline/issue_78442.bar.Inline.diff b/tests/mir-opt/inline/issue_78442.bar.Inline.diff
deleted file mode 100644
index dc3fe7555..000000000
--- a/tests/mir-opt/inline/issue_78442.bar.Inline.diff
+++ /dev/null
@@ -1,68 +0,0 @@
-- // MIR for `bar` before Inline
-+ // MIR for `bar` after Inline
-
- fn bar(_1: P) -> () {
- debug _baz => _1; // in scope 0 at $DIR/issue_78442.rs:+2:5: +2:9
- let mut _0: (); // return place in scope 0 at $DIR/issue_78442.rs:+3:3: +3:3
- let _2: (); // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:17
- let mut _3: &fn() {foo}; // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:15
- let _4: fn() {foo}; // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:15
- let mut _5: (); // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:17
-+ scope 1 (inlined <fn() {foo} as Fn<()>>::call - shim(fn() {foo})) { // at $DIR/issue_78442.rs:11:5: 11:17
-+ }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17
- StorageLive(_3); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15
- StorageLive(_4); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15
-- _4 = hide_foo() -> [return: bb1, unwind: bb4]; // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15
-+ _4 = hide_foo() -> [return: bb1, unwind: bb3]; // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15
- // mir::Constant
- // + span: $DIR/issue_78442.rs:11:5: 11:13
- // + literal: Const { ty: fn() -> impl Fn() {hide_foo}, val: Value(<ZST>) }
- }
-
- bb1: {
- _3 = &_4; // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15
- StorageLive(_5); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17
- _5 = (); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17
-- _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17
-- // mir::Constant
-- // + span: $DIR/issue_78442.rs:11:5: 11:15
-- // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a fn() {foo}, ()) -> <fn() {foo} as FnOnce<()>>::Output {<fn() {foo} as Fn<()>>::call}, val: Value(<ZST>) }
-+ _2 = move (*_3)() -> [return: bb5, unwind: bb3]; // scope 1 at $SRC_DIR/core/src/ops/function.rs:LL:COL
- }
-
- bb2: {
-- StorageDead(_5); // scope 0 at $DIR/issue_78442.rs:+4:16: +4:17
-- StorageDead(_3); // scope 0 at $DIR/issue_78442.rs:+4:16: +4:17
-- StorageDead(_4); // scope 0 at $DIR/issue_78442.rs:+4:17: +4:18
-- StorageDead(_2); // scope 0 at $DIR/issue_78442.rs:+4:17: +4:18
-- _0 = const (); // scope 0 at $DIR/issue_78442.rs:+3:3: +5:2
-- drop(_1) -> [return: bb3, unwind: bb5]; // scope 0 at $DIR/issue_78442.rs:+5:1: +5:2
-+ return; // scope 0 at $DIR/issue_78442.rs:+5:2: +5:2
- }
-
-- bb3: {
-- return; // scope 0 at $DIR/issue_78442.rs:+5:2: +5:2
-+ bb3 (cleanup): {
-+ drop(_1) -> [return: bb4, unwind terminate]; // scope 0 at $DIR/issue_78442.rs:+5:1: +5:2
- }
-
- bb4 (cleanup): {
-- drop(_1) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/issue_78442.rs:+5:1: +5:2
-+ resume; // scope 0 at $DIR/issue_78442.rs:+0:1: +5:2
- }
-
-- bb5 (cleanup): {
-- resume; // scope 0 at $DIR/issue_78442.rs:+0:1: +5:2
-+ bb5: {
-+ StorageDead(_5); // scope 0 at $DIR/issue_78442.rs:+4:16: +4:17
-+ StorageDead(_3); // scope 0 at $DIR/issue_78442.rs:+4:16: +4:17
-+ StorageDead(_4); // scope 0 at $DIR/issue_78442.rs:+4:17: +4:18
-+ StorageDead(_2); // scope 0 at $DIR/issue_78442.rs:+4:17: +4:18
-+ _0 = const (); // scope 0 at $DIR/issue_78442.rs:+3:3: +5:2
-+ drop(_1) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/issue_78442.rs:+5:1: +5:2
- }
- }
-
diff --git a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff
new file mode 100644
index 000000000..b9f268df3
--- /dev/null
+++ b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff
@@ -0,0 +1,45 @@
+- // MIR for `bar` before Inline
++ // MIR for `bar` after Inline
+
+ fn bar(_1: P) -> () {
+ debug _baz => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: &fn() {foo};
+ let _4: fn() {foo};
+ let mut _5: ();
++ scope 1 (inlined hide_foo) {
++ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = hide_foo() -> [return: bb1, unwind unreachable];
+- }
+-
+- bb1: {
+ _3 = &_4;
+ StorageLive(_5);
+ _5 = ();
+- _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind unreachable];
++ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb1, unwind unreachable];
+ }
+
+- bb2: {
++ bb1: {
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_4);
+ StorageDead(_2);
+ _0 = const ();
+- drop(_1) -> [return: bb3, unwind unreachable];
++ drop(_1) -> [return: bb2, unwind unreachable];
+ }
+
+- bb3: {
++ bb2: {
+ return;
+ }
+ }
+
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
new file mode 100644
index 000000000..8495164df
--- /dev/null
+++ b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff
@@ -0,0 +1,56 @@
+- // MIR for `bar` before Inline
++ // MIR for `bar` after Inline
+
+ fn bar(_1: P) -> () {
+ debug _baz => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: &fn() {foo};
+ let _4: fn() {foo};
+ let mut _5: ();
++ scope 1 (inlined hide_foo) {
++ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = hide_foo() -> [return: bb1, unwind: bb4];
+- }
+-
+- bb1: {
+ _3 = &_4;
+ StorageLive(_5);
+ _5 = ();
+- _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb4];
++ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb1, unwind: bb3];
+ }
+
+- bb2: {
++ bb1: {
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_4);
+ StorageDead(_2);
+ _0 = const ();
+- drop(_1) -> [return: bb3, unwind: bb5];
++ drop(_1) -> [return: bb2, unwind: bb4];
+ }
+
+- bb3: {
++ bb2: {
+ return;
+ }
+
+- bb4 (cleanup): {
+- drop(_1) -> [return: bb5, unwind terminate(cleanup)];
++ bb3 (cleanup): {
++ drop(_1) -> [return: bb4, unwind terminate(cleanup)];
+ }
+
+- bb5 (cleanup): {
++ bb4 (cleanup): {
+ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/issue_78442.bar.RevealAll.diff b/tests/mir-opt/inline/issue_78442.bar.RevealAll.diff
deleted file mode 100644
index 8f56ef258..000000000
--- a/tests/mir-opt/inline/issue_78442.bar.RevealAll.diff
+++ /dev/null
@@ -1,57 +0,0 @@
-- // MIR for `bar` before RevealAll
-+ // MIR for `bar` after RevealAll
-
- fn bar(_1: P) -> () {
- debug _baz => _1; // in scope 0 at $DIR/issue_78442.rs:+2:5: +2:9
- let mut _0: (); // return place in scope 0 at $DIR/issue_78442.rs:+3:3: +3:3
- let _2: (); // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:17
-- let mut _3: &impl Fn(); // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:15
-- let _4: impl Fn(); // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:15
-+ let mut _3: &fn() {foo}; // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:15
-+ let _4: fn() {foo}; // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:15
- let mut _5: (); // in scope 0 at $DIR/issue_78442.rs:+4:5: +4:17
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17
- StorageLive(_3); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15
- StorageLive(_4); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15
- _4 = hide_foo() -> [return: bb1, unwind: bb4]; // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15
- // mir::Constant
- // + span: $DIR/issue_78442.rs:11:5: 11:13
- // + literal: Const { ty: fn() -> impl Fn() {hide_foo}, val: Value(<ZST>) }
- }
-
- bb1: {
- _3 = &_4; // scope 0 at $DIR/issue_78442.rs:+4:5: +4:15
- StorageLive(_5); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17
- _5 = (); // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17
-- _2 = <impl Fn() as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17
-+ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/issue_78442.rs:+4:5: +4:17
- // mir::Constant
- // + span: $DIR/issue_78442.rs:11:5: 11:15
-- // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(), ()) -> <impl Fn() as FnOnce<()>>::Output {<impl Fn() as Fn<()>>::call}, val: Value(<ZST>) }
-+ // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a fn() {foo}, ()) -> <fn() {foo} as FnOnce<()>>::Output {<fn() {foo} as Fn<()>>::call}, val: Value(<ZST>) }
- }
-
- bb2: {
- StorageDead(_5); // scope 0 at $DIR/issue_78442.rs:+4:16: +4:17
- StorageDead(_3); // scope 0 at $DIR/issue_78442.rs:+4:16: +4:17
- StorageDead(_4); // scope 0 at $DIR/issue_78442.rs:+4:17: +4:18
- StorageDead(_2); // scope 0 at $DIR/issue_78442.rs:+4:17: +4:18
- _0 = const (); // scope 0 at $DIR/issue_78442.rs:+3:3: +5:2
- drop(_1) -> [return: bb3, unwind: bb5]; // scope 0 at $DIR/issue_78442.rs:+5:1: +5:2
- }
-
- bb3: {
- return; // scope 0 at $DIR/issue_78442.rs:+5:2: +5:2
- }
-
- bb4 (cleanup): {
- drop(_1) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/issue_78442.rs:+5:1: +5:2
- }
-
- bb5 (cleanup): {
- resume; // scope 0 at $DIR/issue_78442.rs:+0:1: +5:2
- }
- }
-
diff --git a/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff b/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff
new file mode 100644
index 000000000..b532b133a
--- /dev/null
+++ b/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-abort.diff
@@ -0,0 +1,58 @@
+- // MIR for `bar` before RevealAll
++ // MIR for `bar` after RevealAll
+
+ fn bar(_1: P) -> () {
+ debug _baz => _1;
+ let mut _0: ();
+ let _2: ();
+- let mut _3: &impl Fn();
+- let _4: impl Fn();
++ let mut _3: &fn() {foo};
++ let _4: fn() {foo};
+ let mut _5: ();
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _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: 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: bb4, unwind: bb7];
+ }
+
+ 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
new file mode 100644
index 000000000..bcebcf297
--- /dev/null
+++ b/tests/mir-opt/inline/issue_78442.bar.RevealAll.panic-unwind.diff
@@ -0,0 +1,58 @@
+- // MIR for `bar` before RevealAll
++ // MIR for `bar` after RevealAll
+
+ fn bar(_1: P) -> () {
+ debug _baz => _1;
+ let mut _0: ();
+ let _2: ();
+- let mut _3: &impl Fn();
+- let _4: impl Fn();
++ let mut _3: &fn() {foo};
++ let _4: fn() {foo};
+ let mut _5: ();
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _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: 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: bb4, unwind continue];
+ }
+
+ 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.rs b/tests/mir-opt/inline/issue_78442.rs
index aa8ede2df..f9a523428 100644
--- a/tests/mir-opt/inline/issue_78442.rs
+++ b/tests/mir-opt/inline/issue_78442.rs
@@ -1,5 +1,5 @@
// compile-flags: -Z mir-opt-level=3 -Z inline-mir
-// ignore-wasm32-bare compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![crate_type = "lib"]
// EMIT_MIR issue_78442.bar.RevealAll.diff
@@ -8,6 +8,11 @@ pub fn bar<P>(
// Error won't happen if "bar" is not generic
_baz: P,
) {
+ // CHECK-LABEL: fn bar(
+ // CHECK: let mut {{.*}}: &fn() {foo};
+ // CHECK: let {{.*}}: fn() {foo};
+ // CHECK: (inlined hide_foo)
+ // CHECK-NOT: inlined
hide_foo()();
}
diff --git a/tests/mir-opt/inline/polymorphic_recursion.rs b/tests/mir-opt/inline/polymorphic_recursion.rs
index 7388722b7..f71e382e8 100644
--- a/tests/mir-opt/inline/polymorphic_recursion.rs
+++ b/tests/mir-opt/inline/polymorphic_recursion.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Make sure that the MIR inliner does not loop indefinitely on polymorphic recursion.
// compile-flags: --crate-type lib
diff --git a/tests/mir-opt/inline/unchecked_shifts.rs b/tests/mir-opt/inline/unchecked_shifts.rs
index 17724530d..0de80641c 100644
--- a/tests/mir-opt/inline/unchecked_shifts.rs
+++ b/tests/mir-opt/inline/unchecked_shifts.rs
@@ -1,6 +1,6 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![crate_type = "lib"]
-#![feature(unchecked_math)]
+#![feature(unchecked_shifts)]
// ignore-debug: the debug assertions prevent the inlining we are testing for
// compile-flags: -Zmir-opt-level=2 -Zinline-mir
@@ -8,11 +8,31 @@
// EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff
// EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir
pub unsafe fn unchecked_shl_unsigned_smaller(a: u16, b: u32) -> u16 {
+ // CHECK-LABEL: fn unchecked_shl_unsigned_smaller(
+ // CHECK: (inlined core::num::<impl u16>::unchecked_shl)
a.unchecked_shl(b)
}
// EMIT_MIR unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff
// EMIT_MIR unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir
pub unsafe fn unchecked_shr_signed_smaller(a: i16, b: u32) -> i16 {
+ // CHECK-LABEL: fn unchecked_shr_signed_smaller(
+ // CHECK: (inlined core::num::<impl i16>::unchecked_shr)
+ a.unchecked_shr(b)
+}
+
+// EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.diff
+// EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.mir
+pub unsafe fn unchecked_shl_unsigned_bigger(a: u64, b: u32) -> u64 {
+ // CHECK-LABEL: fn unchecked_shl_unsigned_bigger(
+ // CHECK: (inlined core::num::<impl u64>::unchecked_shl)
+ a.unchecked_shl(b)
+}
+
+// EMIT_MIR unchecked_shifts.unchecked_shr_signed_bigger.Inline.diff
+// EMIT_MIR unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.mir
+pub unsafe fn unchecked_shr_signed_bigger(a: i64, b: u32) -> i64 {
+ // CHECK-LABEL: fn unchecked_shr_signed_bigger(
+ // CHECK: (inlined core::num::<impl i64>::unchecked_shr)
a.unchecked_shr(b)
}
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-abort.diff
new file mode 100644
index 000000000..1ab1d01e5
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-abort.diff
@@ -0,0 +1,36 @@
+- // MIR for `unchecked_shl_unsigned_bigger` before Inline
++ // MIR for `unchecked_shl_unsigned_bigger` after Inline
+
+ fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: u64;
+ let mut _3: u64;
+ let mut _4: u32;
++ scope 1 (inlined core::num::<impl u64>::unchecked_shl) {
++ debug self => _3;
++ debug rhs => _4;
++ let mut _5: u64;
++ scope 2 {
++ }
++ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = _1;
+ StorageLive(_4);
+ _4 = _2;
+- _0 = core::num::<impl u64>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind unreachable];
+- }
+-
+- bb1: {
++ StorageLive(_5);
++ _5 = _4 as u64 (IntToInt);
++ _0 = ShlUnchecked(_3, move _5);
++ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-unwind.diff
new file mode 100644
index 000000000..d71b5c4a6
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-unwind.diff
@@ -0,0 +1,36 @@
+- // MIR for `unchecked_shl_unsigned_bigger` before Inline
++ // MIR for `unchecked_shl_unsigned_bigger` after Inline
+
+ fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: u64;
+ let mut _3: u64;
+ let mut _4: u32;
++ scope 1 (inlined core::num::<impl u64>::unchecked_shl) {
++ debug self => _3;
++ debug rhs => _4;
++ let mut _5: u64;
++ scope 2 {
++ }
++ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = _1;
+ StorageLive(_4);
+ _4 = _2;
+- _0 = core::num::<impl u64>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind continue];
+- }
+-
+- bb1: {
++ StorageLive(_5);
++ _5 = _4 as u64 (IntToInt);
++ _0 = ShlUnchecked(_3, move _5);
++ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..65b832497
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,22 @@
+// MIR for `unchecked_shl_unsigned_bigger` after PreCodegen
+
+fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: u64;
+ scope 1 (inlined core::num::<impl u64>::unchecked_shl) {
+ debug self => _1;
+ debug rhs => _2;
+ let mut _3: u64;
+ scope 2 {
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = _2 as u64 (IntToInt);
+ _0 = ShlUnchecked(_1, move _3);
+ StorageDead(_3);
+ return;
+ }
+}
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 000000000..65b832497
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,22 @@
+// MIR for `unchecked_shl_unsigned_bigger` after PreCodegen
+
+fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: u64;
+ scope 1 (inlined core::num::<impl u64>::unchecked_shl) {
+ debug self => _1;
+ debug rhs => _2;
+ let mut _3: u64;
+ scope 2 {
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = _2 as u64 (IntToInt);
+ _0 = ShlUnchecked(_1, move _3);
+ StorageDead(_3);
+ return;
+ }
+}
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff
deleted file mode 100644
index d76cd0e2b..000000000
--- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff
+++ /dev/null
@@ -1,152 +0,0 @@
-- // MIR for `unchecked_shl_unsigned_smaller` before Inline
-+ // MIR for `unchecked_shl_unsigned_smaller` after Inline
-
- fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 {
- debug a => _1; // in scope 0 at $DIR/unchecked_shifts.rs:+0:46: +0:47
- debug b => _2; // in scope 0 at $DIR/unchecked_shifts.rs:+0:54: +0:55
- let mut _0: u16; // return place in scope 0 at $DIR/unchecked_shifts.rs:+0:65: +0:68
- let mut _3: u16; // in scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6
- let mut _4: u32; // in scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22
-+ scope 1 (inlined core::num::<impl u16>::unchecked_shl) { // at $DIR/unchecked_shifts.rs:11:7: 11:23
-+ debug self => _3; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ debug rhs => _4; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ let mut _5: u16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ let mut _6: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ let mut _7: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ scope 2 {
-+ scope 3 (inlined core::num::<impl u16>::unchecked_shl::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ debug x => _7; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ let mut _8: std::option::Option<u16>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ let mut _9: std::result::Result<u16, std::num::TryFromIntError>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ scope 4 {
-+ scope 5 (inlined <u32 as TryInto<u16>>::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ debug self => _7; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
-+ scope 6 (inlined convert::num::<impl TryFrom<u32> for u16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL
-+ debug u => _7; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ let mut _10: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ let mut _11: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ let mut _12: u16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ }
-+ }
-+ scope 7 (inlined Result::<u16, TryFromIntError>::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ debug self => _9; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ let mut _13: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ let _14: u16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ scope 8 {
-+ debug x => _14; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
-+ }
-+ }
-+ scope 9 (inlined #[track_caller] Option::<u16>::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ debug self => _8; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ let mut _15: &std::option::Option<u16>; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ let mut _16: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ scope 10 {
-+ debug val => _5; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL
-+ }
-+ scope 11 {
-+ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
-+ scope 14 {
-+ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
-+ }
-+ }
-+ }
-+ }
-+ scope 12 (inlined Option::<u16>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
-+ debug self => _15; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
-
- bb0: {
- StorageLive(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6
- _3 = _1; // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6
- StorageLive(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22
- _4 = _2; // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22
-- _0 = core::num::<impl u16>::unchecked_shl(move _3, move _4) -> bb1; // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:23
-- // mir::Constant
-- // + span: $DIR/unchecked_shifts.rs:11:7: 11:20
-- // + literal: Const { ty: unsafe fn(u16, u32) -> u16 {core::num::<impl u16>::unchecked_shl}, val: Value(<ZST>) }
-+ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageLive(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ _6 = (_4,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageLive(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ _7 = move (_6.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageLive(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageLive(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageLive(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _11 = const 65535_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _10 = Gt(_7, move _11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageDead(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ switchInt(move _10) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- }
-
- bb1: {
-+ StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- StorageDead(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
- StorageDead(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
- return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2
-+ }
-+
-+ bb2: {
-+ _9 = Result::<u16, TryFromIntError>::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: TryFromIntError, val: Value(<ZST>) }
-+ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ }
-+
-+ bb3: {
-+ StorageLive(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _12 = _7 as u16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _9 = Result::<u16, TryFromIntError>::Ok(move _12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageDead(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ }
-+
-+ bb4: {
-+ StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageLive(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ _13 = discriminant(_9); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ switchInt(move _13) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ }
-+
-+ bb5: {
-+ _8 = Option::<u16>::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ }
-+
-+ bb6: {
-+ unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ }
-+
-+ bb7: {
-+ _14 = move ((_9 as Ok).0: u16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ _8 = Option::<u16>::Some(move _14); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
-+ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ }
-+
-+ bb8: {
-+ StorageDead(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageDead(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageLive(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ _16 = discriminant(_8); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ switchInt(move _16) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ }
-+
-+ bb9: {
-+ _5 = move ((_8 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ StorageDead(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageDead(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageDead(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageDead(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ _0 = unchecked_shl::<u16>(_3, move _5) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ // mir::Constant
-+ // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u16, u16) -> u16 {unchecked_shl::<u16>}, val: Value(<ZST>) }
- }
- }
-
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff
new file mode 100644
index 000000000..d05221966
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff
@@ -0,0 +1,41 @@
+- // MIR for `unchecked_shl_unsigned_smaller` before Inline
++ // MIR for `unchecked_shl_unsigned_smaller` after Inline
+
+ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: u16;
+ let mut _3: u16;
+ let mut _4: u32;
++ scope 1 (inlined core::num::<impl u16>::unchecked_shl) {
++ debug self => _3;
++ debug rhs => _4;
++ let mut _5: u16;
++ let mut _6: bool;
++ scope 2 {
++ }
++ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = _1;
+ StorageLive(_4);
+ _4 = _2;
+- _0 = core::num::<impl u16>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind unreachable];
+- }
+-
+- bb1: {
++ StorageLive(_5);
++ StorageLive(_6);
++ _6 = Le(_4, const 65535_u32);
++ assume(move _6);
++ StorageDead(_6);
++ _5 = _4 as u16 (IntToInt);
++ _0 = ShlUnchecked(_3, move _5);
++ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff
new file mode 100644
index 000000000..67a5ac248
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff
@@ -0,0 +1,41 @@
+- // MIR for `unchecked_shl_unsigned_smaller` before Inline
++ // MIR for `unchecked_shl_unsigned_smaller` after Inline
+
+ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: u16;
+ let mut _3: u16;
+ let mut _4: u32;
++ scope 1 (inlined core::num::<impl u16>::unchecked_shl) {
++ debug self => _3;
++ debug rhs => _4;
++ let mut _5: u16;
++ let mut _6: bool;
++ scope 2 {
++ }
++ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = _1;
+ StorageLive(_4);
+ _4 = _2;
+- _0 = core::num::<impl u16>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind continue];
+- }
+-
+- bb1: {
++ StorageLive(_5);
++ StorageLive(_6);
++ _6 = Le(_4, const 65535_u32);
++ assume(move _6);
++ StorageDead(_6);
++ _5 = _4 as u16 (IntToInt);
++ _0 = ShlUnchecked(_3, move _5);
++ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir
deleted file mode 100644
index 3c175ed15..000000000
--- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir
+++ /dev/null
@@ -1,138 +0,0 @@
-// MIR for `unchecked_shl_unsigned_smaller` after PreCodegen
-
-fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 {
- debug a => _1; // in scope 0 at $DIR/unchecked_shifts.rs:+0:46: +0:47
- debug b => _2; // in scope 0 at $DIR/unchecked_shifts.rs:+0:54: +0:55
- let mut _0: u16; // return place in scope 0 at $DIR/unchecked_shifts.rs:+0:65: +0:68
- scope 1 (inlined core::num::<impl u16>::unchecked_shl) { // at $DIR/unchecked_shifts.rs:11:7: 11:23
- debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- let mut _3: u16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- let mut _4: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- let mut _5: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- scope 2 {
- scope 3 (inlined core::num::<impl u16>::unchecked_shl::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
- debug x => _5; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- let mut _6: std::option::Option<u16>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- let mut _7: std::result::Result<u16, std::num::TryFromIntError>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- scope 4 {
- scope 5 (inlined <u32 as TryInto<u16>>::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
- debug self => _5; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
- scope 6 (inlined convert::num::<impl TryFrom<u32> for u16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL
- debug u => _5; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- let mut _8: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- let mut _9: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- let mut _10: u16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- }
- }
- scope 7 (inlined Result::<u16, TryFromIntError>::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
- debug self => _7; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- let mut _11: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- let _12: u16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- scope 8 {
- debug x => _12; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
- }
- }
- scope 9 (inlined #[track_caller] Option::<u16>::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
- debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _13: &std::option::Option<u16>; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- scope 10 {
- debug val => _3; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL
- }
- scope 11 {
- scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
- scope 14 {
- scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- }
- }
- }
- }
- scope 12 (inlined Option::<u16>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
- debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL
- }
- }
- }
- }
- }
- }
-
- bb0: {
- StorageLive(_3); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageLive(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- _4 = (_2,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- _5 = move (_4.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageLive(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageLive(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageLive(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageLive(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _9 = const 65535_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _8 = Gt(_5, move _9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageDead(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- switchInt(move _8) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- }
-
- bb1: {
- StorageDead(_3); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2
- }
-
- bb2: {
- _7 = Result::<u16, TryFromIntError>::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- // mir::Constant
- // + span: no-location
- // + literal: Const { ty: TryFromIntError, val: Value(<ZST>) }
- goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- }
-
- bb3: {
- StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _10 = _5 as u16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _7 = Result::<u16, TryFromIntError>::Ok(move _10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- }
-
- bb4: {
- StorageDead(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageLive(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- _11 = discriminant(_7); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- switchInt(move _11) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- }
-
- bb5: {
- _6 = Option::<u16>::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- }
-
- bb6: {
- unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- }
-
- bb7: {
- _12 = move ((_7 as Ok).0: u16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- _6 = Option::<u16>::Some(move _12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
- goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- }
-
- bb8: {
- StorageDead(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageDead(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageLive(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- switchInt(move _14) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- }
-
- bb9: {
- _3 = move ((_6 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- StorageDead(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageDead(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageDead(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- _0 = unchecked_shl::<u16>(_1, move _3) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u16, u16) -> u16 {unchecked_shl::<u16>}, val: Value(<ZST>) }
- }
-}
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..f9dff62e0
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,27 @@
+// MIR for `unchecked_shl_unsigned_smaller` after PreCodegen
+
+fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: u16;
+ scope 1 (inlined core::num::<impl u16>::unchecked_shl) {
+ debug self => _1;
+ debug rhs => _2;
+ let mut _3: bool;
+ let mut _4: u16;
+ scope 2 {
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+ StorageLive(_3);
+ _3 = Le(_2, const 65535_u32);
+ assume(move _3);
+ StorageDead(_3);
+ _4 = _2 as u16 (IntToInt);
+ _0 = ShlUnchecked(_1, move _4);
+ StorageDead(_4);
+ return;
+ }
+}
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 000000000..f9dff62e0
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,27 @@
+// MIR for `unchecked_shl_unsigned_smaller` after PreCodegen
+
+fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: u16;
+ scope 1 (inlined core::num::<impl u16>::unchecked_shl) {
+ debug self => _1;
+ debug rhs => _2;
+ let mut _3: bool;
+ let mut _4: u16;
+ scope 2 {
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+ StorageLive(_3);
+ _3 = Le(_2, const 65535_u32);
+ assume(move _3);
+ StorageDead(_3);
+ _4 = _2 as u16 (IntToInt);
+ _0 = ShlUnchecked(_1, move _4);
+ StorageDead(_4);
+ return;
+ }
+}
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff
new file mode 100644
index 000000000..1e83fec4f
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff
@@ -0,0 +1,36 @@
+- // MIR for `unchecked_shr_signed_bigger` before Inline
++ // MIR for `unchecked_shr_signed_bigger` after Inline
+
+ fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: i64;
+ let mut _3: i64;
+ let mut _4: u32;
++ scope 1 (inlined core::num::<impl i64>::unchecked_shr) {
++ debug self => _3;
++ debug rhs => _4;
++ let mut _5: i64;
++ scope 2 {
++ }
++ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = _1;
+ StorageLive(_4);
+ _4 = _2;
+- _0 = core::num::<impl i64>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind unreachable];
+- }
+-
+- bb1: {
++ StorageLive(_5);
++ _5 = _4 as i64 (IntToInt);
++ _0 = ShrUnchecked(_3, move _5);
++ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff
new file mode 100644
index 000000000..6aafb61dc
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff
@@ -0,0 +1,36 @@
+- // MIR for `unchecked_shr_signed_bigger` before Inline
++ // MIR for `unchecked_shr_signed_bigger` after Inline
+
+ fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: i64;
+ let mut _3: i64;
+ let mut _4: u32;
++ scope 1 (inlined core::num::<impl i64>::unchecked_shr) {
++ debug self => _3;
++ debug rhs => _4;
++ let mut _5: i64;
++ scope 2 {
++ }
++ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = _1;
+ StorageLive(_4);
+ _4 = _2;
+- _0 = core::num::<impl i64>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind continue];
+- }
+-
+- bb1: {
++ StorageLive(_5);
++ _5 = _4 as i64 (IntToInt);
++ _0 = ShrUnchecked(_3, move _5);
++ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..7524ec497
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,22 @@
+// MIR for `unchecked_shr_signed_bigger` after PreCodegen
+
+fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: i64;
+ scope 1 (inlined core::num::<impl i64>::unchecked_shr) {
+ debug self => _1;
+ debug rhs => _2;
+ let mut _3: i64;
+ scope 2 {
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = _2 as i64 (IntToInt);
+ _0 = ShrUnchecked(_1, move _3);
+ StorageDead(_3);
+ return;
+ }
+}
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 000000000..7524ec497
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,22 @@
+// MIR for `unchecked_shr_signed_bigger` after PreCodegen
+
+fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: i64;
+ scope 1 (inlined core::num::<impl i64>::unchecked_shr) {
+ debug self => _1;
+ debug rhs => _2;
+ let mut _3: i64;
+ scope 2 {
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = _2 as i64 (IntToInt);
+ _0 = ShrUnchecked(_1, move _3);
+ StorageDead(_3);
+ return;
+ }
+}
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff
deleted file mode 100644
index f3d3e6090..000000000
--- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff
+++ /dev/null
@@ -1,152 +0,0 @@
-- // MIR for `unchecked_shr_signed_smaller` before Inline
-+ // MIR for `unchecked_shr_signed_smaller` after Inline
-
- fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 {
- debug a => _1; // in scope 0 at $DIR/unchecked_shifts.rs:+0:44: +0:45
- debug b => _2; // in scope 0 at $DIR/unchecked_shifts.rs:+0:52: +0:53
- let mut _0: i16; // return place in scope 0 at $DIR/unchecked_shifts.rs:+0:63: +0:66
- let mut _3: i16; // in scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6
- let mut _4: u32; // in scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22
-+ scope 1 (inlined core::num::<impl i16>::unchecked_shr) { // at $DIR/unchecked_shifts.rs:17:7: 17:23
-+ debug self => _3; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ debug rhs => _4; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ let mut _5: i16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ let mut _6: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ let mut _7: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ scope 2 {
-+ scope 3 (inlined core::num::<impl i16>::unchecked_shr::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ debug x => _7; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ let mut _8: std::option::Option<i16>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ let mut _9: std::result::Result<i16, std::num::TryFromIntError>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ scope 4 {
-+ scope 5 (inlined <u32 as TryInto<i16>>::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ debug self => _7; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
-+ scope 6 (inlined convert::num::<impl TryFrom<u32> for i16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL
-+ debug u => _7; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ let mut _10: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ let mut _11: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ let mut _12: i16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ }
-+ }
-+ scope 7 (inlined Result::<i16, TryFromIntError>::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ debug self => _9; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ let mut _13: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ let _14: i16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ scope 8 {
-+ debug x => _14; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
-+ }
-+ }
-+ scope 9 (inlined #[track_caller] Option::<i16>::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ debug self => _8; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ let mut _15: &std::option::Option<i16>; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ let mut _16: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ scope 10 {
-+ debug val => _5; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL
-+ }
-+ scope 11 {
-+ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
-+ scope 14 {
-+ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
-+ }
-+ }
-+ }
-+ }
-+ scope 12 (inlined Option::<i16>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
-+ debug self => _15; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
-
- bb0: {
- StorageLive(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6
- _3 = _1; // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:6
- StorageLive(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22
- _4 = _2; // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22
-- _0 = core::num::<impl i16>::unchecked_shr(move _3, move _4) -> bb1; // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:23
-- // mir::Constant
-- // + span: $DIR/unchecked_shifts.rs:17:7: 17:20
-- // + literal: Const { ty: unsafe fn(i16, u32) -> i16 {core::num::<impl i16>::unchecked_shr}, val: Value(<ZST>) }
-+ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageLive(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ _6 = (_4,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageLive(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ _7 = move (_6.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageLive(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageLive(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageLive(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _11 = const 32767_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _10 = Gt(_7, move _11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageDead(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ switchInt(move _10) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- }
-
- bb1: {
-+ StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- StorageDead(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
- StorageDead(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
- return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2
-+ }
-+
-+ bb2: {
-+ _9 = Result::<i16, TryFromIntError>::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: TryFromIntError, val: Value(<ZST>) }
-+ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ }
-+
-+ bb3: {
-+ StorageLive(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _12 = _7 as i16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _9 = Result::<i16, TryFromIntError>::Ok(move _12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageDead(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ }
-+
-+ bb4: {
-+ StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageLive(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ _13 = discriminant(_9); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ switchInt(move _13) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ }
-+
-+ bb5: {
-+ _8 = Option::<i16>::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ }
-+
-+ bb6: {
-+ unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ }
-+
-+ bb7: {
-+ _14 = move ((_9 as Ok).0: i16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ _8 = Option::<i16>::Some(move _14); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
-+ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
-+ }
-+
-+ bb8: {
-+ StorageDead(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageDead(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageLive(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ _16 = discriminant(_8); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ switchInt(move _16) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ }
-+
-+ bb9: {
-+ _5 = move ((_8 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ StorageDead(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageDead(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageDead(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ StorageDead(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
-+ _0 = unchecked_shr::<i16>(_3, move _5) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ // mir::Constant
-+ // + span: $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i16, i16) -> i16 {unchecked_shr::<i16>}, val: Value(<ZST>) }
- }
- }
-
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff
new file mode 100644
index 000000000..15b36b284
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff
@@ -0,0 +1,41 @@
+- // MIR for `unchecked_shr_signed_smaller` before Inline
++ // MIR for `unchecked_shr_signed_smaller` after Inline
+
+ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: i16;
+ let mut _3: i16;
+ let mut _4: u32;
++ scope 1 (inlined core::num::<impl i16>::unchecked_shr) {
++ debug self => _3;
++ debug rhs => _4;
++ let mut _5: i16;
++ let mut _6: bool;
++ scope 2 {
++ }
++ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = _1;
+ StorageLive(_4);
+ _4 = _2;
+- _0 = core::num::<impl i16>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind unreachable];
+- }
+-
+- bb1: {
++ StorageLive(_5);
++ StorageLive(_6);
++ _6 = Le(_4, const 32767_u32);
++ assume(move _6);
++ StorageDead(_6);
++ _5 = _4 as i16 (IntToInt);
++ _0 = ShrUnchecked(_3, move _5);
++ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff
new file mode 100644
index 000000000..8629f92db
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff
@@ -0,0 +1,41 @@
+- // MIR for `unchecked_shr_signed_smaller` before Inline
++ // MIR for `unchecked_shr_signed_smaller` after Inline
+
+ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: i16;
+ let mut _3: i16;
+ let mut _4: u32;
++ scope 1 (inlined core::num::<impl i16>::unchecked_shr) {
++ debug self => _3;
++ debug rhs => _4;
++ let mut _5: i16;
++ let mut _6: bool;
++ scope 2 {
++ }
++ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = _1;
+ StorageLive(_4);
+ _4 = _2;
+- _0 = core::num::<impl i16>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind continue];
+- }
+-
+- bb1: {
++ StorageLive(_5);
++ StorageLive(_6);
++ _6 = Le(_4, const 32767_u32);
++ assume(move _6);
++ StorageDead(_6);
++ _5 = _4 as i16 (IntToInt);
++ _0 = ShrUnchecked(_3, move _5);
++ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir
deleted file mode 100644
index 724b3c567..000000000
--- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir
+++ /dev/null
@@ -1,138 +0,0 @@
-// MIR for `unchecked_shr_signed_smaller` after PreCodegen
-
-fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 {
- debug a => _1; // in scope 0 at $DIR/unchecked_shifts.rs:+0:44: +0:45
- debug b => _2; // in scope 0 at $DIR/unchecked_shifts.rs:+0:52: +0:53
- let mut _0: i16; // return place in scope 0 at $DIR/unchecked_shifts.rs:+0:63: +0:66
- scope 1 (inlined core::num::<impl i16>::unchecked_shr) { // at $DIR/unchecked_shifts.rs:17:7: 17:23
- debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- let mut _3: i16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- let mut _4: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- let mut _5: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- scope 2 {
- scope 3 (inlined core::num::<impl i16>::unchecked_shr::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
- debug x => _5; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- let mut _6: std::option::Option<i16>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- let mut _7: std::result::Result<i16, std::num::TryFromIntError>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- scope 4 {
- scope 5 (inlined <u32 as TryInto<i16>>::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
- debug self => _5; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
- scope 6 (inlined convert::num::<impl TryFrom<u32> for i16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL
- debug u => _5; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- let mut _8: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- let mut _9: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- let mut _10: i16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- }
- }
- scope 7 (inlined Result::<i16, TryFromIntError>::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
- debug self => _7; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- let mut _11: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- let _12: i16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- scope 8 {
- debug x => _12; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
- }
- }
- scope 9 (inlined #[track_caller] Option::<i16>::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
- debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _13: &std::option::Option<i16>; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- scope 10 {
- debug val => _3; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL
- }
- scope 11 {
- scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
- scope 14 {
- scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- }
- }
- }
- }
- scope 12 (inlined Option::<i16>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
- debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL
- }
- }
- }
- }
- }
- }
-
- bb0: {
- StorageLive(_3); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageLive(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- _4 = (_2,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- _5 = move (_4.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageLive(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageLive(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageLive(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageLive(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _9 = const 32767_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _8 = Gt(_5, move _9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageDead(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- switchInt(move _8) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- }
-
- bb1: {
- StorageDead(_3); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2
- }
-
- bb2: {
- _7 = Result::<i16, TryFromIntError>::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- // mir::Constant
- // + span: no-location
- // + literal: Const { ty: TryFromIntError, val: Value(<ZST>) }
- goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- }
-
- bb3: {
- StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _10 = _5 as i16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _7 = Result::<i16, TryFromIntError>::Ok(move _10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- }
-
- bb4: {
- StorageDead(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageLive(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- _11 = discriminant(_7); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- switchInt(move _11) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- }
-
- bb5: {
- _6 = Option::<i16>::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- }
-
- bb6: {
- unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- }
-
- bb7: {
- _12 = move ((_7 as Ok).0: i16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- _6 = Option::<i16>::Some(move _12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
- goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- }
-
- bb8: {
- StorageDead(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageDead(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageLive(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- switchInt(move _14) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- }
-
- bb9: {
- _3 = move ((_6 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- StorageDead(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageDead(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- StorageDead(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
- _0 = unchecked_shr::<i16>(_1, move _3) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i16, i16) -> i16 {unchecked_shr::<i16>}, val: Value(<ZST>) }
- }
-}
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..65fa0d956
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,27 @@
+// MIR for `unchecked_shr_signed_smaller` after PreCodegen
+
+fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: i16;
+ scope 1 (inlined core::num::<impl i16>::unchecked_shr) {
+ debug self => _1;
+ debug rhs => _2;
+ let mut _3: bool;
+ let mut _4: i16;
+ scope 2 {
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+ StorageLive(_3);
+ _3 = Le(_2, const 32767_u32);
+ assume(move _3);
+ StorageDead(_3);
+ _4 = _2 as i16 (IntToInt);
+ _0 = ShrUnchecked(_1, move _4);
+ StorageDead(_4);
+ return;
+ }
+}
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 000000000..65fa0d956
--- /dev/null
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,27 @@
+// MIR for `unchecked_shr_signed_smaller` after PreCodegen
+
+fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: i16;
+ scope 1 (inlined core::num::<impl i16>::unchecked_shr) {
+ debug self => _1;
+ debug rhs => _2;
+ let mut _3: bool;
+ let mut _4: i16;
+ scope 2 {
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+ StorageLive(_3);
+ _3 = Le(_2, const 32767_u32);
+ assume(move _3);
+ StorageDead(_3);
+ _4 = _2 as i16 (IntToInt);
+ _0 = ShrUnchecked(_1, move _4);
+ StorageDead(_4);
+ return;
+ }
+}
diff --git a/tests/mir-opt/inline/unit_test.rs b/tests/mir-opt/inline/unit_test.rs
new file mode 100644
index 000000000..0d877bb10
--- /dev/null
+++ b/tests/mir-opt/inline/unit_test.rs
@@ -0,0 +1,19 @@
+// Check that `-Zmir-enable-passes=+Inline` does not ICE because of stolen MIR.
+// unit-test: Inline
+// skip-filecheck
+#![crate_type = "lib"]
+
+// Randomize `def_path_hash` by defining them under a module with different names
+macro_rules! emit {
+ ($($m:ident)*) => {$(
+ pub mod $m {
+ pub fn main() {
+ let func = || 123u8;
+ func();
+ }
+ }
+ )*};
+}
+
+// Increase the chance of triggering the bug
+emit!(m00 m01 m02 m03 m04 m05 m06 m07 m08 m09 m10 m11 m12 m13 m14 m15 m16 m17 m18 m19);
diff --git a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
index 745f2bb19..37083973f 100644
--- a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
+++ b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
@@ -2,49 +2,37 @@
+ // MIR for `caller` after Inline
fn caller(_1: Box<[i32]>) -> () {
- debug x => _1; // in scope 0 at $DIR/unsized_argument.rs:+0:11: +0:12
- let mut _0: (); // return place in scope 0 at $DIR/unsized_argument.rs:+0:26: +0:26
- let _2: (); // in scope 0 at $DIR/unsized_argument.rs:+1:5: +1:15
- let mut _3: std::boxed::Box<[i32]>; // in scope 0 at $DIR/unsized_argument.rs:+1:13: +1:14
- let mut _4: (); // in scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15
- let mut _5: (); // in scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15
- let mut _6: (); // in scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15
- let mut _7: *const [i32]; // in scope 0 at $DIR/unsized_argument.rs:+1:13: +1:14
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: std::boxed::Box<[i32]>;
+ let mut _4: *const [i32];
bb0: {
- StorageLive(_2); // scope 0 at $DIR/unsized_argument.rs:+1:5: +1:15
- StorageLive(_3); // scope 0 at $DIR/unsized_argument.rs:+1:13: +1:14
- _3 = move _1; // scope 0 at $DIR/unsized_argument.rs:+1:13: +1:14
- _7 = (((_3.0: std::ptr::Unique<[i32]>).0: std::ptr::NonNull<[i32]>).0: *const [i32]); // scope 0 at $DIR/unsized_argument.rs:+1:5: +1:15
- _2 = callee(move (*_7)) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/unsized_argument.rs:+1:5: +1:15
- // mir::Constant
- // + span: $DIR/unsized_argument.rs:9:5: 9:11
- // + literal: Const { ty: fn([i32]) {callee}, val: Value(<ZST>) }
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = move _1;
+ _4 = (((_3.0: std::ptr::Unique<[i32]>).0: std::ptr::NonNull<[i32]>).0: *const [i32]);
+ _2 = callee(move (*_4)) -> [return: bb1, unwind: bb3];
}
bb1: {
- StorageDead(_3); // scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15
- StorageDead(_2); // scope 0 at $DIR/unsized_argument.rs:+1:15: +1:16
- _0 = const (); // scope 0 at $DIR/unsized_argument.rs:+0:26: +2:2
- return; // scope 0 at $DIR/unsized_argument.rs:+2:2: +2:2
+ drop(_3) -> [return: bb2, unwind: bb4];
}
- bb2 (cleanup): {
- resume; // scope 0 at $DIR/unsized_argument.rs:+0:1: +2:2
+ bb2: {
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ return;
}
- bb3: {
- _4 = alloc::alloc::box_free::<[i32], std::alloc::Global>(move (_3.0: std::ptr::Unique<[i32]>), move (_3.1: std::alloc::Global)) -> bb1; // scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15
- // mir::Constant
- // + span: $DIR/unsized_argument.rs:9:14: 9:15
- // + literal: Const { ty: unsafe fn(Unique<[i32]>, std::alloc::Global) {alloc::alloc::box_free::<[i32], std::alloc::Global>}, val: Value(<ZST>) }
+ bb3 (cleanup): {
+ drop(_3) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
- _6 = alloc::alloc::box_free::<[i32], std::alloc::Global>(move (_3.0: std::ptr::Unique<[i32]>), move (_3.1: std::alloc::Global)) -> [return: bb2, unwind terminate]; // scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15
- // mir::Constant
- // + span: $DIR/unsized_argument.rs:9:14: 9:15
- // + literal: Const { ty: unsafe fn(Unique<[i32]>, std::alloc::Global) {alloc::alloc::box_free::<[i32], std::alloc::Global>}, val: Value(<ZST>) }
+ resume;
}
}
diff --git a/tests/mir-opt/inline/unsized_argument.rs b/tests/mir-opt/inline/unsized_argument.rs
index b2c51407f..e8c2bc10b 100644
--- a/tests/mir-opt/inline/unsized_argument.rs
+++ b/tests/mir-opt/inline/unsized_argument.rs
@@ -6,6 +6,8 @@ fn callee(y: [i32]) {}
// EMIT_MIR unsized_argument.caller.Inline.diff
fn caller(x: Box<[i32]>) {
+ // CHECK-LABEL: fn caller(
+ // CHECK-NOT: (inlined callee)
callee(*x);
}
diff --git a/tests/mir-opt/inline/unwrap_unchecked.rs b/tests/mir-opt/inline/unwrap_unchecked.rs
index 5856f1479..be133706e 100644
--- a/tests/mir-opt/inline/unwrap_unchecked.rs
+++ b/tests/mir-opt/inline/unwrap_unchecked.rs
@@ -1,11 +1,13 @@
#![crate_type = "lib"]
-// ignore-wasm32-bare compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// ignore-debug: the debug assertions prevent the inlining we are testing for
// compile-flags: -Zmir-opt-level=2 -Zinline-mir
// EMIT_MIR unwrap_unchecked.unwrap_unchecked.Inline.diff
// EMIT_MIR unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir
pub unsafe fn unwrap_unchecked<T>(slf: Option<T>) -> T {
+ // CHECK-LABEL: fn unwrap_unchecked(
+ // CHECK: (inlined #[track_caller] Option::<T>::unwrap_unchecked)
slf.unwrap_unchecked()
}
diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff
deleted file mode 100644
index 8a8cd896e..000000000
--- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff
+++ /dev/null
@@ -1,55 +0,0 @@
-- // MIR for `unwrap_unchecked` before Inline
-+ // MIR for `unwrap_unchecked` after Inline
-
- fn unwrap_unchecked(_1: Option<T>) -> T {
- debug slf => _1; // in scope 0 at $DIR/unwrap_unchecked.rs:+0:35: +0:38
- let mut _0: T; // return place in scope 0 at $DIR/unwrap_unchecked.rs:+0:54: +0:55
- let mut _2: std::option::Option<T>; // in scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:8
-+ scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) { // at $DIR/unwrap_unchecked.rs:10:9: 10:27
-+ debug self => _2; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
-+ let mut _3: &std::option::Option<T>; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
-+ let mut _4: isize; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
-+ scope 2 {
-+ debug val => _0; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
-+ }
-+ scope 3 {
-+ scope 5 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
-+ scope 6 {
-+ scope 7 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
-+ }
-+ }
-+ }
-+ }
-+ scope 4 (inlined Option::<T>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
-+ debug self => _3; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL
-+ }
-+ }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:8
- _2 = move _1; // scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:8
-- _0 = Option::<T>::unwrap_unchecked(move _2) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:27
-- // mir::Constant
-- // + span: $DIR/unwrap_unchecked.rs:10:9: 10:25
-- // + literal: Const { ty: unsafe fn(Option<T>) -> T {Option::<T>::unwrap_unchecked}, val: Value(<ZST>) }
-+ StorageLive(_3); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27
-+ _4 = discriminant(_2); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
-+ switchInt(move _4) -> [1: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
- }
-
- bb1: {
-- StorageDead(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:26: +1:27
-- return; // scope 0 at $DIR/unwrap_unchecked.rs:+2:2: +2:2
-+ unreachable; // scope 6 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- }
-
-- bb2 (cleanup): {
-- resume; // scope 0 at $DIR/unwrap_unchecked.rs:+0:1: +2:2
-+ bb2: {
-+ _0 = move ((_2 as Some).0: T); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
-+ StorageDead(_3); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27
-+ StorageDead(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:26: +1:27
-+ return; // scope 0 at $DIR/unwrap_unchecked.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff
new file mode 100644
index 000000000..2a36ad923
--- /dev/null
+++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff
@@ -0,0 +1,50 @@
+- // MIR for `unwrap_unchecked` before Inline
++ // MIR for `unwrap_unchecked` after Inline
+
+ fn unwrap_unchecked(_1: Option<T>) -> T {
+ debug slf => _1;
+ let mut _0: T;
+ let mut _2: std::option::Option<T>;
++ scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) {
++ debug self => _2;
++ let mut _3: &std::option::Option<T>;
++ let mut _4: isize;
++ let mut _5: bool;
++ scope 2 {
++ debug val => _0;
++ }
++ scope 3 {
++ scope 5 (inlined unreachable_unchecked) {
++ scope 6 {
++ scope 7 (inlined unreachable_unchecked::runtime) {
++ }
++ }
++ }
++ }
++ scope 4 (inlined Option::<T>::is_some) {
++ debug self => _3;
++ }
++ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = move _1;
+- _0 = Option::<T>::unwrap_unchecked(move _2) -> [return: bb1, unwind unreachable];
+- }
+-
+- bb1: {
++ StorageLive(_3);
++ StorageLive(_4);
++ StorageLive(_5);
++ _4 = discriminant(_2);
++ _5 = Eq(_4, const 1_isize);
++ assume(move _5);
++ _0 = move ((_2 as Some).0: T);
++ StorageDead(_5);
++ StorageDead(_4);
++ StorageDead(_3);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff
new file mode 100644
index 000000000..14c8c671d
--- /dev/null
+++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff
@@ -0,0 +1,54 @@
+- // MIR for `unwrap_unchecked` before Inline
++ // MIR for `unwrap_unchecked` after Inline
+
+ fn unwrap_unchecked(_1: Option<T>) -> T {
+ debug slf => _1;
+ let mut _0: T;
+ let mut _2: std::option::Option<T>;
++ scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) {
++ debug self => _2;
++ let mut _3: &std::option::Option<T>;
++ let mut _4: isize;
++ let mut _5: bool;
++ scope 2 {
++ debug val => _0;
++ }
++ scope 3 {
++ scope 5 (inlined unreachable_unchecked) {
++ scope 6 {
++ scope 7 (inlined unreachable_unchecked::runtime) {
++ }
++ }
++ }
++ }
++ scope 4 (inlined Option::<T>::is_some) {
++ debug self => _3;
++ }
++ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = move _1;
+- _0 = Option::<T>::unwrap_unchecked(move _2) -> [return: bb1, unwind: bb2];
+- }
+-
+- bb1: {
++ StorageLive(_3);
++ StorageLive(_4);
++ StorageLive(_5);
++ _4 = discriminant(_2);
++ _5 = Eq(_4, const 1_isize);
++ assume(move _5);
++ _0 = move ((_2 as Some).0: T);
++ StorageDead(_5);
++ StorageDead(_4);
++ StorageDead(_3);
+ StorageDead(_2);
+ return;
+- }
+-
+- bb2 (cleanup): {
+- resume;
+ }
+ }
+
diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir
deleted file mode 100644
index c5e2469fc..000000000
--- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir
+++ /dev/null
@@ -1,41 +0,0 @@
-// MIR for `unwrap_unchecked` after PreCodegen
-
-fn unwrap_unchecked(_1: Option<T>) -> T {
- debug slf => _1; // in scope 0 at $DIR/unwrap_unchecked.rs:+0:35: +0:38
- let mut _0: T; // return place in scope 0 at $DIR/unwrap_unchecked.rs:+0:54: +0:55
- scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) { // at $DIR/unwrap_unchecked.rs:10:9: 10:27
- debug self => _1; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _2: &std::option::Option<T>; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _3: isize; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
- scope 2 {
- debug val => _0; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
- }
- scope 3 {
- scope 5 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
- scope 6 {
- scope 7 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- }
- }
- }
- }
- scope 4 (inlined Option::<T>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
- debug self => _2; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL
- }
- }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27
- _3 = discriminant(_1); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
- switchInt(move _3) -> [1: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
- }
-
- bb1: {
- unreachable; // scope 6 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- }
-
- bb2: {
- _0 = move ((_1 as Some).0: T); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
- StorageDead(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27
- return; // scope 0 at $DIR/unwrap_unchecked.rs:+2:2: +2:2
- }
-}
diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..aeb93bd33
--- /dev/null
+++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,40 @@
+// MIR for `unwrap_unchecked` after PreCodegen
+
+fn unwrap_unchecked(_1: Option<T>) -> T {
+ debug slf => _1;
+ let mut _0: T;
+ scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) {
+ debug self => _1;
+ let mut _2: isize;
+ let mut _3: bool;
+ let mut _4: &std::option::Option<T>;
+ scope 2 {
+ debug val => _0;
+ }
+ scope 3 {
+ scope 5 (inlined unreachable_unchecked) {
+ scope 6 {
+ scope 7 (inlined unreachable_unchecked::runtime) {
+ }
+ }
+ }
+ }
+ scope 4 (inlined Option::<T>::is_some) {
+ debug self => _4;
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+ StorageLive(_2);
+ StorageLive(_3);
+ _2 = discriminant(_1);
+ _3 = Eq(_2, const 1_isize);
+ assume(move _3);
+ _0 = move ((_1 as Some).0: T);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_4);
+ return;
+ }
+}
diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 000000000..aeb93bd33
--- /dev/null
+++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,40 @@
+// MIR for `unwrap_unchecked` after PreCodegen
+
+fn unwrap_unchecked(_1: Option<T>) -> T {
+ debug slf => _1;
+ let mut _0: T;
+ scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) {
+ debug self => _1;
+ let mut _2: isize;
+ let mut _3: bool;
+ let mut _4: &std::option::Option<T>;
+ scope 2 {
+ debug val => _0;
+ }
+ scope 3 {
+ scope 5 (inlined unreachable_unchecked) {
+ scope 6 {
+ scope 7 (inlined unreachable_unchecked::runtime) {
+ }
+ }
+ }
+ }
+ scope 4 (inlined Option::<T>::is_some) {
+ debug self => _4;
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+ StorageLive(_2);
+ StorageLive(_3);
+ _2 = discriminant(_1);
+ _3 = Eq(_2, const 1_isize);
+ assume(move _3);
+ _0 = move ((_1 as Some).0: T);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_4);
+ return;
+ }
+}
diff --git a/tests/mir-opt/inline_generically_if_sized.call.Inline.diff b/tests/mir-opt/inline_generically_if_sized.call.Inline.diff
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..1a7512a4b
--- /dev/null
+++ b/tests/mir-opt/inline_generically_if_sized.rs
@@ -0,0 +1,18 @@
+// skip-filecheck
+// 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/instrument_coverage.bar.InstrumentCoverage.diff b/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff
index a3cee3ecf..1ef6b69ef 100644
--- a/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff
+++ b/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff
@@ -2,12 +2,14 @@
+ // MIR for `bar` after InstrumentCoverage
fn bar() -> bool {
- let mut _0: bool; // return place in scope 0 at /the/src/instrument_coverage.rs:+0:13: +0:17
+ let mut _0: bool;
++ coverage Counter(0) => /the/src/instrument_coverage.rs:21:1 - 23:2;
++
bb0: {
-+ Coverage::Counter(1) for /the/src/instrument_coverage.rs:20:1 - 22:2; // scope 0 at /the/src/instrument_coverage.rs:+2:2: +2:2
- _0 = const true; // scope 0 at /the/src/instrument_coverage.rs:+1:5: +1:9
- return; // scope 0 at /the/src/instrument_coverage.rs:+2:2: +2:2
++ Coverage::CounterIncrement(0);
+ _0 = const true;
+ return;
}
}
diff --git a/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff b/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff
index 49006e012..14b4833a5 100644
--- a/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff
+++ b/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff
@@ -2,50 +2,54 @@
+ // MIR for `main` after InstrumentCoverage
fn main() -> () {
- let mut _0: (); // return place in scope 0 at /the/src/instrument_coverage.rs:+0:11: +0:11
- let mut _1: (); // in scope 0 at /the/src/instrument_coverage.rs:+0:1: +6:2
- let mut _2: bool; // in scope 0 at /the/src/instrument_coverage.rs:+2:12: +2:17
- let mut _3: !; // in scope 0 at /the/src/instrument_coverage.rs:+2:18: +4:10
-
+ let mut _0: ();
+ let mut _1: ();
+ let mut _2: bool;
+ let mut _3: !;
+
++ coverage ExpressionId(0) => Expression { lhs: Counter(0), op: Add, rhs: Counter(1) };
++ coverage ExpressionId(1) => Expression { lhs: Expression(0), op: Subtract, rhs: Counter(1) };
++ coverage Counter(0) => /the/src/instrument_coverage.rs:12:1 - 12:11;
++ coverage Expression(0) => /the/src/instrument_coverage.rs:13:5 - 14:17;
++ coverage Expression(1) => /the/src/instrument_coverage.rs:15:13 - 15:18;
++ coverage Expression(1) => /the/src/instrument_coverage.rs:18:1 - 18:2;
++ coverage Counter(1) => /the/src/instrument_coverage.rs:16:10 - 16:11;
++
bb0: {
-+ Coverage::Counter(1) for /the/src/instrument_coverage.rs:11:1 - 11:11; // scope 0 at /the/src/instrument_coverage.rs:+1:5: +5:6
- goto -> bb1; // scope 0 at /the/src/instrument_coverage.rs:+1:5: +5:6
++ Coverage::CounterIncrement(0);
+ goto -> bb1;
}
bb1: {
-+ Coverage::Expression(4294967295) = 1 + 2 for /the/src/instrument_coverage.rs:12:5 - 13:17; // scope 0 at /the/src/instrument_coverage.rs:+1:5: +5:6
- falseUnwind -> [real: bb2, unwind: bb6]; // scope 0 at /the/src/instrument_coverage.rs:+1:5: +5:6
++ Coverage::ExpressionUsed(0);
+ falseUnwind -> [real: bb2, unwind: bb6];
}
bb2: {
- StorageLive(_2); // scope 0 at /the/src/instrument_coverage.rs:+2:12: +2:17
- _2 = bar() -> [return: bb3, unwind: bb6]; // scope 0 at /the/src/instrument_coverage.rs:+2:12: +2:17
- // mir::Constant
- // + span: /the/src/instrument_coverage.rs:13:12: 13:15
- // + literal: Const { ty: fn() -> bool {bar}, val: Value(<ZST>) }
+ StorageLive(_2);
+ _2 = bar() -> [return: bb3, unwind: bb6];
}
bb3: {
- switchInt(move _2) -> [0: bb5, otherwise: bb4]; // scope 0 at /the/src/instrument_coverage.rs:+2:12: +2:17
+ switchInt(move _2) -> [0: bb5, otherwise: bb4];
}
bb4: {
-+ Coverage::Expression(4294967293) = 4294967294 + 0 for /the/src/instrument_coverage.rs:17:1 - 17:2; // scope 0 at /the/src/instrument_coverage.rs:+6:2: +6:2
-+ Coverage::Expression(4294967294) = 4294967295 - 2 for /the/src/instrument_coverage.rs:14:13 - 14:18; // scope 0 at /the/src/instrument_coverage.rs:+6:2: +6:2
- _0 = const (); // scope 0 at /the/src/instrument_coverage.rs:+3:13: +3:18
- StorageDead(_2); // scope 0 at /the/src/instrument_coverage.rs:+4:9: +4:10
- return; // scope 0 at /the/src/instrument_coverage.rs:+6:2: +6:2
++ Coverage::ExpressionUsed(1);
+ _0 = const ();
+ StorageDead(_2);
+ return;
}
bb5: {
-+ Coverage::Counter(2) for /the/src/instrument_coverage.rs:15:10 - 15:11; // scope 0 at /the/src/instrument_coverage.rs:+1:5: +5:6
- _1 = const (); // scope 0 at /the/src/instrument_coverage.rs:+4:10: +4:10
- StorageDead(_2); // scope 0 at /the/src/instrument_coverage.rs:+4:9: +4:10
- goto -> bb1; // scope 0 at /the/src/instrument_coverage.rs:+1:5: +5:6
++ Coverage::CounterIncrement(1);
+ _1 = const ();
+ StorageDead(_2);
+ goto -> bb1;
}
bb6 (cleanup): {
- resume; // scope 0 at /the/src/instrument_coverage.rs:+0:1: +6:2
+ resume;
}
}
diff --git a/tests/mir-opt/instrument_coverage.rs b/tests/mir-opt/instrument_coverage.rs
index 7f6a0a0eb..f131fc0a3 100644
--- a/tests/mir-opt/instrument_coverage.rs
+++ b/tests/mir-opt/instrument_coverage.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that `-C instrument-coverage` injects Coverage statements. The Coverage Counter statements
// are later converted into LLVM instrprof.increment intrinsics, during codegen.
diff --git a/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff
new file mode 100644
index 000000000..5c09963d4
--- /dev/null
+++ b/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff
@@ -0,0 +1,36 @@
+- // MIR for `eq_false` before InstSimplify
++ // MIR for `eq_false` after InstSimplify
+
+ fn eq_false(_1: bool) -> u32 {
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Eq(move _3, const false);
++ _2 = Not(move _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;
+ }
+
+ bb3: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff
new file mode 100644
index 000000000..a80133b0e
--- /dev/null
+++ b/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff
@@ -0,0 +1,36 @@
+- // MIR for `eq_true` before InstSimplify
++ // MIR for `eq_true` after InstSimplify
+
+ fn eq_true(_1: bool) -> u32 {
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Eq(move _3, const true);
++ _2 = move _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;
+ }
+
+ bb3: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff
new file mode 100644
index 000000000..8235d5263
--- /dev/null
+++ b/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff
@@ -0,0 +1,36 @@
+- // MIR for `false_eq` before InstSimplify
++ // MIR for `false_eq` after InstSimplify
+
+ fn false_eq(_1: bool) -> u32 {
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Eq(const false, move _3);
++ _2 = Not(move _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;
+ }
+
+ bb3: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff
new file mode 100644
index 000000000..77d076c6c
--- /dev/null
+++ b/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff
@@ -0,0 +1,36 @@
+- // MIR for `false_ne` before InstSimplify
++ // MIR for `false_ne` after InstSimplify
+
+ fn false_ne(_1: bool) -> u32 {
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Ne(const false, move _3);
++ _2 = move _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;
+ }
+
+ bb3: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff
new file mode 100644
index 000000000..2362b1129
--- /dev/null
+++ b/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff
@@ -0,0 +1,36 @@
+- // MIR for `ne_false` before InstSimplify
++ // MIR for `ne_false` after InstSimplify
+
+ fn ne_false(_1: bool) -> u32 {
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Ne(move _3, const false);
++ _2 = move _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;
+ }
+
+ bb3: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff
new file mode 100644
index 000000000..6ccbd2fb7
--- /dev/null
+++ b/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff
@@ -0,0 +1,36 @@
+- // MIR for `ne_true` before InstSimplify
++ // MIR for `ne_true` after InstSimplify
+
+ fn ne_true(_1: bool) -> u32 {
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Ne(move _3, const true);
++ _2 = Not(move _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;
+ }
+
+ bb3: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/bool_compare.rs b/tests/mir-opt/instsimplify/bool_compare.rs
new file mode 100644
index 000000000..77f427b0d
--- /dev/null
+++ b/tests/mir-opt/instsimplify/bool_compare.rs
@@ -0,0 +1,68 @@
+// unit-test: InstSimplify
+
+// EMIT_MIR bool_compare.eq_true.InstSimplify.diff
+fn eq_true(x: bool) -> u32 {
+ // CHECK-LABEL: fn eq_true(
+ // CHECK-NOT: Eq(
+ if x == true { 0 } else { 1 }
+}
+
+// EMIT_MIR bool_compare.true_eq.InstSimplify.diff
+fn true_eq(x: bool) -> u32 {
+ // CHECK-LABEL: fn true_eq(
+ // CHECK-NOT: Eq(
+ if true == x { 0 } else { 1 }
+}
+
+// EMIT_MIR bool_compare.ne_true.InstSimplify.diff
+fn ne_true(x: bool) -> u32 {
+ // CHECK-LABEL: fn ne_true(
+ // CHECK: Not(
+ if x != true { 0 } else { 1 }
+}
+
+// EMIT_MIR bool_compare.true_ne.InstSimplify.diff
+fn true_ne(x: bool) -> u32 {
+ // CHECK-LABEL: fn true_ne(
+ // CHECK: Not(
+ if true != x { 0 } else { 1 }
+}
+
+// EMIT_MIR bool_compare.eq_false.InstSimplify.diff
+fn eq_false(x: bool) -> u32 {
+ // CHECK-LABEL: fn eq_false(
+ // CHECK: Not(
+ if x == false { 0 } else { 1 }
+}
+
+// EMIT_MIR bool_compare.false_eq.InstSimplify.diff
+fn false_eq(x: bool) -> u32 {
+ // CHECK-LABEL: fn false_eq(
+ // CHECK: Not(
+ if false == x { 0 } else { 1 }
+}
+
+// EMIT_MIR bool_compare.ne_false.InstSimplify.diff
+fn ne_false(x: bool) -> u32 {
+ // CHECK-LABEL: fn ne_false(
+ // CHECK-NOT: Ne(
+ if x != false { 0 } else { 1 }
+}
+
+// EMIT_MIR bool_compare.false_ne.InstSimplify.diff
+fn false_ne(x: bool) -> u32 {
+ // CHECK-LABEL: fn false_ne(
+ // CHECK-NOT: Ne(
+ if false != x { 0 } else { 1 }
+}
+
+fn main() {
+ eq_true(false);
+ true_eq(false);
+ ne_true(false);
+ true_ne(false);
+ eq_false(false);
+ false_eq(false);
+ ne_false(false);
+ false_ne(false);
+}
diff --git a/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff
new file mode 100644
index 000000000..18675329a
--- /dev/null
+++ b/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff
@@ -0,0 +1,36 @@
+- // MIR for `true_eq` before InstSimplify
++ // MIR for `true_eq` after InstSimplify
+
+ fn true_eq(_1: bool) -> u32 {
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Eq(const true, move _3);
++ _2 = move _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;
+ }
+
+ bb3: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff
new file mode 100644
index 000000000..dc91cf8a5
--- /dev/null
+++ b/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff
@@ -0,0 +1,36 @@
+- // MIR for `true_ne` before InstSimplify
++ // MIR for `true_ne` after InstSimplify
+
+ fn true_ne(_1: bool) -> u32 {
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Ne(const true, move _3);
++ _2 = Not(move _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;
+ }
+
+ bb3: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff b/tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff
new file mode 100644
index 000000000..9e1bce1ee
--- /dev/null
+++ b/tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff
@@ -0,0 +1,34 @@
+- // MIR for `redundant` before InstSimplify
++ // MIR for `redundant` after InstSimplify
+
+ fn redundant(_1: *const &u8) -> *const &u8 {
+ debug x => _1;
+ let mut _0: *const &u8;
+ let mut _2: *const &u8;
+ let mut _3: *const &u8;
+ let mut _4: *const &u8;
+ scope 1 (inlined generic_cast::<&u8, &u8>) {
+ debug x => _4;
+ let mut _5: *const &u8;
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ _5 = _4;
+- _3 = move _5 as *const &u8 (PtrToPtr);
++ _3 = move _5;
+ StorageDead(_5);
+ StorageDead(_4);
+- _2 = move _3 as *const &u8 (PtrToPtr);
++ _2 = move _3;
+ _0 = _2;
+ StorageDead(_3);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff b/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff
new file mode 100644
index 000000000..a6d68cd4e
--- /dev/null
+++ b/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff
@@ -0,0 +1,26 @@
+- // MIR for `roundtrip` before InstSimplify
++ // MIR for `roundtrip` after InstSimplify
+
+ fn roundtrip(_1: *const u8) -> *const u8 {
+ debug x => _1;
+ let mut _0: *const u8;
+ let mut _2: *const u8;
+ let mut _3: *mut u8;
+ let mut _4: *const u8;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ _3 = move _4 as *mut u8 (PtrToPtr);
+ _2 = move _3 as *const u8 (PointerCoercion(MutToConstPointer));
+ StorageDead(_4);
+ StorageDead(_3);
+- _0 = move _2 as *const u8 (PtrToPtr);
++ _0 = move _2;
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/casts.rs b/tests/mir-opt/instsimplify/casts.rs
new file mode 100644
index 000000000..86f9b34ea
--- /dev/null
+++ b/tests/mir-opt/instsimplify/casts.rs
@@ -0,0 +1,25 @@
+// unit-test: InstSimplify
+// compile-flags: -Zinline-mir
+#![crate_type = "lib"]
+
+#[inline(always)]
+fn generic_cast<T, U>(x: *const T) -> *const U {
+ x as *const U
+}
+
+// EMIT_MIR casts.redundant.InstSimplify.diff
+pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 {
+ // CHECK-LABEL: fn redundant(
+ // CHECK: inlined generic_cast
+ // CHECK-NOT: as
+ generic_cast::<&'a u8, &'b u8>(x) as *const &'a u8
+}
+
+// EMIT_MIR casts.roundtrip.InstSimplify.diff
+pub fn roundtrip(x: *const u8) -> *const u8 {
+ // CHECK-LABEL: fn roundtrip(
+ // CHECK: _4 = _1;
+ // CHECK: _3 = move _4 as *mut u8 (PtrToPtr);
+ // CHECK: _2 = move _3 as *const u8 (PointerCoercion(MutToConstPointer));
+ x as *mut u8 as *const u8
+}
diff --git a/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff
new file mode 100644
index 000000000..3e7d0ce51
--- /dev/null
+++ b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff
@@ -0,0 +1,77 @@
+- // MIR for `norm2` before InstSimplify
++ // MIR for `norm2` after InstSimplify
+
+ fn norm2(_1: [f32; 2]) -> f32 {
+ debug x => _1;
+ let mut _0: f32;
+ let _2: f32;
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ let _7: usize;
+ let mut _8: usize;
+ let mut _9: bool;
+ let mut _10: f32;
+ let mut _11: f32;
+ let mut _12: f32;
+ let mut _13: f32;
+ let mut _14: f32;
+ let mut _15: f32;
+ scope 1 {
+ debug a => _2;
+ let _6: f32;
+ scope 2 {
+ debug b => _6;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = const 0_usize;
+- _4 = Len(_1);
++ _4 = const 2_usize;
+ _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];
+ }
+
+ bb1: {
+ _2 = _1[_3];
+ StorageDead(_3);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = const 1_usize;
+- _8 = Len(_1);
++ _8 = const 2_usize;
+ _9 = Lt(_7, _8);
+ assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ _6 = _1[_7];
+ StorageDead(_7);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = _2;
+ StorageLive(_12);
+ _12 = _2;
+ _10 = Mul(move _11, move _12);
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_13);
+ StorageLive(_14);
+ _14 = _6;
+ StorageLive(_15);
+ _15 = _6;
+ _13 = Mul(move _14, move _15);
+ StorageDead(_15);
+ StorageDead(_14);
+ _0 = Add(move _10, move _13);
+ StorageDead(_13);
+ StorageDead(_10);
+ StorageDead(_6);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff
new file mode 100644
index 000000000..4833c1089
--- /dev/null
+++ b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff
@@ -0,0 +1,77 @@
+- // MIR for `norm2` before InstSimplify
++ // MIR for `norm2` after InstSimplify
+
+ fn norm2(_1: [f32; 2]) -> f32 {
+ debug x => _1;
+ let mut _0: f32;
+ let _2: f32;
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ let _7: usize;
+ let mut _8: usize;
+ let mut _9: bool;
+ let mut _10: f32;
+ let mut _11: f32;
+ let mut _12: f32;
+ let mut _13: f32;
+ let mut _14: f32;
+ let mut _15: f32;
+ scope 1 {
+ debug a => _2;
+ let _6: f32;
+ scope 2 {
+ debug b => _6;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = const 0_usize;
+- _4 = Len(_1);
++ _4 = const 2_usize;
+ _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];
+ }
+
+ bb1: {
+ _2 = _1[_3];
+ StorageDead(_3);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = const 1_usize;
+- _8 = Len(_1);
++ _8 = const 2_usize;
+ _9 = Lt(_7, _8);
+ assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind continue];
+ }
+
+ bb2: {
+ _6 = _1[_7];
+ StorageDead(_7);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = _2;
+ StorageLive(_12);
+ _12 = _2;
+ _10 = Mul(move _11, move _12);
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_13);
+ StorageLive(_14);
+ _14 = _6;
+ StorageLive(_15);
+ _15 = _6;
+ _13 = Mul(move _14, move _15);
+ StorageDead(_15);
+ StorageDead(_14);
+ _0 = Add(move _10, move _13);
+ StorageDead(_13);
+ StorageDead(_10);
+ StorageDead(_6);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/combine_array_len.rs b/tests/mir-opt/instsimplify/combine_array_len.rs
index 970cafafc..3b6795bc9 100644
--- a/tests/mir-opt/combine_array_len.rs
+++ b/tests/mir-opt/instsimplify/combine_array_len.rs
@@ -1,8 +1,10 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: InstSimplify
-// EMIT_MIR combine_array_len.norm2.InstSimplify.diff
+// EMIT_MIR combine_array_len.norm2.InstSimplify.diff
fn norm2(x: [f32; 2]) -> f32 {
+ // CHECK-LABEL: fn norm2(
+ // CHECK-NOT: Len(
let a = x[0];
let b = x[1];
a*a + b*b
diff --git a/tests/mir-opt/combine_clone_of_primitives.rs b/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs
index 1deee9dd6..2adbe778d 100644
--- a/tests/mir-opt/combine_clone_of_primitives.rs
+++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs
@@ -1,8 +1,7 @@
// unit-test: InstSimplify
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff
-
#[derive(Clone)]
struct MyThing<T> {
v: T,
@@ -10,6 +9,11 @@ struct MyThing<T> {
a: [f32; 3],
}
+// CHECK-LABEL: ::clone(
+// CHECK: <T as Clone>::clone(
+// CHECK-NOT: <u64 as Clone>::clone(
+// CHECK-NOT: <[f32; 3] as Clone>::clone(
+
fn main() {
let x = MyThing::<i16> { v: 2, i: 3, a: [0.0; 3] };
let y = x.clone();
diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff
new file mode 100644
index 000000000..48586f8b3
--- /dev/null
+++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff
@@ -0,0 +1,65 @@
+- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` before InstSimplify
++ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` after InstSimplify
+
+ fn <impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone(_1: &MyThing<T>) -> MyThing<T> {
+ debug self => _1;
+ let mut _0: MyThing<T>;
+ let mut _2: T;
+ let mut _3: &T;
+ let _4: &T;
+ let mut _5: u64;
+ let mut _6: &u64;
+ let _7: &u64;
+ let mut _8: [f32; 3];
+ let mut _9: &[f32; 3];
+ let _10: &[f32; 3];
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &((*_1).0: T);
+- _3 = &(*_4);
++ _3 = _4;
+ _2 = <T as Clone>::clone(move _3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &((*_1).1: u64);
+- _6 = &(*_7);
+- _5 = <u64 as Clone>::clone(move _6) -> [return: bb2, unwind unreachable];
++ _6 = _7;
++ _5 = (*_6);
++ goto -> bb2;
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageLive(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = &((*_1).2: [f32; 3]);
+- _9 = &(*_10);
+- _8 = <[f32; 3] as Clone>::clone(move _9) -> [return: bb3, unwind unreachable];
++ _9 = _10;
++ _8 = (*_9);
++ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_9);
+ _0 = MyThing::<T> { v: move _2, i: move _5, a: move _8 };
+ StorageDead(_8);
+ StorageDead(_5);
+ StorageDead(_2);
+ StorageDead(_10);
+ StorageDead(_7);
+ StorageDead(_4);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff
new file mode 100644
index 000000000..a57266e9c
--- /dev/null
+++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff
@@ -0,0 +1,73 @@
+- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` before InstSimplify
++ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` after InstSimplify
+
+ fn <impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone(_1: &MyThing<T>) -> MyThing<T> {
+ debug self => _1;
+ let mut _0: MyThing<T>;
+ let mut _2: T;
+ let mut _3: &T;
+ let _4: &T;
+ let mut _5: u64;
+ let mut _6: &u64;
+ let _7: &u64;
+ let mut _8: [f32; 3];
+ let mut _9: &[f32; 3];
+ let _10: &[f32; 3];
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &((*_1).0: T);
+- _3 = &(*_4);
++ _3 = _4;
+ _2 = <T as Clone>::clone(move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &((*_1).1: u64);
+- _6 = &(*_7);
+- _5 = <u64 as Clone>::clone(move _6) -> [return: bb2, unwind: bb4];
++ _6 = _7;
++ _5 = (*_6);
++ goto -> bb2;
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageLive(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = &((*_1).2: [f32; 3]);
+- _9 = &(*_10);
+- _8 = <[f32; 3] as Clone>::clone(move _9) -> [return: bb3, unwind: bb4];
++ _9 = _10;
++ _8 = (*_9);
++ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_9);
+ _0 = MyThing::<T> { v: move _2, i: move _5, a: move _8 };
+ StorageDead(_8);
+ StorageDead(_5);
+ StorageDead(_2);
+ StorageDead(_10);
+ StorageDead(_7);
+ StorageDead(_4);
+ return;
+ }
+
+ bb4 (cleanup): {
+ drop(_2) -> [return: bb5, unwind terminate(cleanup)];
+ }
+
+ bb5 (cleanup): {
+ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff
new file mode 100644
index 000000000..cb623e83f
--- /dev/null
+++ b/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff
@@ -0,0 +1,83 @@
+- // MIR for `adt_transmutes` before InstSimplify
++ // MIR for `adt_transmutes` after InstSimplify
+
+ fn adt_transmutes() -> () {
+ let mut _0: ();
+ let _1: u8;
+ let mut _2: std::option::Option<std::num::NonZeroU8>;
+ let mut _4: std::num::Wrapping<i16>;
+ let mut _6: std::num::Wrapping<i16>;
+ let mut _8: Union32;
+ let mut _10: Union32;
+ let mut _12: std::mem::MaybeUninit<std::string::String>;
+ scope 1 {
+ debug _a => _1;
+ let _3: i16;
+ scope 2 {
+ debug _a => _3;
+ let _5: u16;
+ scope 3 {
+ debug _a => _5;
+ let _7: u32;
+ scope 4 {
+ debug _a => _7;
+ let _9: i32;
+ scope 5 {
+ debug _a => _9;
+ let _11: std::mem::ManuallyDrop<std::string::String>;
+ scope 6 {
+ debug _a => _11;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = Option::<NonZeroU8>::Some(const _);
+ _1 = move _2 as u8 (Transmute);
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = Wrapping::<i16>(const 0_i16);
+- _3 = move _4 as i16 (Transmute);
++ _3 = move (_4.0: i16);
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = Wrapping::<i16>(const 0_i16);
+ _5 = move _6 as u16 (Transmute);
+ StorageDead(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = Union32 { u32: const 0_i32 };
+ _7 = move _8 as u32 (Transmute);
+ StorageDead(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = Union32 { u32: const 0_u32 };
+ _9 = move _10 as i32 (Transmute);
+ StorageDead(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = MaybeUninit::<String>::uninit() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _11 = move _12 as std::mem::ManuallyDrop<std::string::String> (Transmute);
++ _11 = move (_12.1: std::mem::ManuallyDrop<std::string::String>);
+ StorageDead(_12);
+ _0 = const ();
+ StorageDead(_11);
+ StorageDead(_9);
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff
new file mode 100644
index 000000000..58ae59190
--- /dev/null
+++ b/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff
@@ -0,0 +1,39 @@
+- // MIR for `identity_transmutes` before InstSimplify
++ // MIR for `identity_transmutes` after InstSimplify
+
+ fn identity_transmutes() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _3: std::vec::Vec<i32>;
+ scope 1 {
+ debug _a => _1;
+ let _2: std::vec::Vec<i32>;
+ scope 2 {
+ debug _a => _2;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = const 1_i32 as i32 (Transmute);
++ _1 = const 1_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = Vec::<i32>::new() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _2 = move _3 as std::vec::Vec<i32> (Transmute);
++ _2 = move _3;
+ StorageDead(_3);
+ _0 = const ();
+ drop(_2) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff
new file mode 100644
index 000000000..8eff802dd
--- /dev/null
+++ b/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff
@@ -0,0 +1,24 @@
+- // MIR for `integer_transmutes` before InstSimplify
++ // MIR for `integer_transmutes` after InstSimplify
+
+ fn integer_transmutes() -> () {
+ let mut _0: ();
+ let mut _1: u32;
+ let mut _2: i64;
+ let mut _3: i64;
+ let mut _4: u32;
+ let mut _5: usize;
+
+ bb0: {
+- _1 = const 1_i32 as u32 (Transmute);
++ _1 = const 1_i32 as u32 (IntToInt);
+ _2 = const 1_i32 as i64 (Transmute);
+- _3 = const 1_u64 as i64 (Transmute);
++ _3 = const 1_u64 as i64 (IntToInt);
+ _4 = const 1_u64 as u32 (Transmute);
+- _5 = const 1_isize as usize (Transmute);
++ _5 = const 1_isize as usize (IntToInt);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/combine_transmutes.rs b/tests/mir-opt/instsimplify/combine_transmutes.rs
index 403f9356c..b8e15da90 100644
--- a/tests/mir-opt/combine_transmutes.rs
+++ b/tests/mir-opt/instsimplify/combine_transmutes.rs
@@ -10,6 +10,10 @@ use std::mem::{MaybeUninit, ManuallyDrop, transmute};
// EMIT_MIR combine_transmutes.identity_transmutes.InstSimplify.diff
pub unsafe fn identity_transmutes() {
+ // CHECK-LABEL: fn identity_transmutes(
+ // CHECK-NOT: as i32 (Transmute);
+ // CHECK-NOT: as Vec<i32> (Transmute);
+
// These are nops and should be removed
let _a = transmute::<i32, i32>(1);
let _a = transmute::<Vec<i32>, Vec<i32>>(Vec::new());
@@ -18,6 +22,16 @@ pub unsafe fn identity_transmutes() {
#[custom_mir(dialect = "runtime", phase = "initial")]
// EMIT_MIR combine_transmutes.integer_transmutes.InstSimplify.diff
pub unsafe fn integer_transmutes() {
+ // CHECK-LABEL: fn integer_transmutes(
+ // CHECK-NOT: _i32 as u32 (Transmute);
+ // CHECK: _i32 as u32 (IntToInt);
+ // CHECK: _i32 as i64 (Transmute);
+ // CHECK-NOT: _u64 as i64 (Transmute);
+ // CHECK: _u64 as i64 (IntToInt);
+ // CHECK: _u64 as u32 (Transmute);
+ // CHECK-NOT: _isize as usize (Transmute);
+ // CHECK: _isize as usize (IntToInt);
+
mir! {
{
let A = CastTransmute::<i32, u32>(1); // Can be a cast
@@ -32,6 +46,14 @@ pub unsafe fn integer_transmutes() {
// EMIT_MIR combine_transmutes.adt_transmutes.InstSimplify.diff
pub unsafe fn adt_transmutes() {
+ // CHECK-LABEL: fn adt_transmutes(
+ // CHECK: as u8 (Transmute);
+ // CHECK: ({{_.*}}.0: i16);
+ // CHECK: as u16 (Transmute);
+ // CHECK: as u32 (Transmute);
+ // CHECK: as i32 (Transmute);
+ // CHECK: ({{_.*}}.1: std::mem::ManuallyDrop<std::string::String>);
+
let _a: u8 = transmute(Some(std::num::NonZeroU8::MAX));
let _a: i16 = transmute(std::num::Wrapping(0_i16));
let _a: u16 = transmute(std::num::Wrapping(0_i16));
diff --git a/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff b/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff
new file mode 100644
index 000000000..e2b45c882
--- /dev/null
+++ b/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff
@@ -0,0 +1,21 @@
+- // MIR for `assert_zero` before InstSimplify
++ // MIR for `assert_zero` after InstSimplify
+
+ fn assert_zero(_1: u8) -> u8 {
+ let mut _0: u8;
+
+ bb0: {
+- switchInt(_1) -> [0: bb2, 1: bb1, otherwise: bb1];
++ switchInt(_1) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ unreachable;
+ }
+
+ bb2: {
+ _0 = _1;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify_duplicate_switch_targets.rs b/tests/mir-opt/instsimplify/duplicate_switch_targets.rs
index 3e280a40f..e40bc7eda 100644
--- a/tests/mir-opt/instsimplify_duplicate_switch_targets.rs
+++ b/tests/mir-opt/instsimplify/duplicate_switch_targets.rs
@@ -1,13 +1,15 @@
+// unit-test: InstSimplify
+
#![feature(custom_mir, core_intrinsics)]
#![crate_type = "lib"]
use std::intrinsics::mir::*;
-// unit-test: InstSimplify
-
-// EMIT_MIR instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff
+// EMIT_MIR duplicate_switch_targets.assert_zero.InstSimplify.diff
#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
pub unsafe fn assert_zero(x: u8) -> u8 {
+ // CHECK-LABEL: fn assert_zero(
+ // CHECK: switchInt({{.*}}) -> [0: {{bb.*}}, otherwise: {{bb.*}}]
mir!(
{
match x {
diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify.diff
new file mode 100644
index 000000000..2ecacb5e3
--- /dev/null
+++ b/tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify.diff
@@ -0,0 +1,33 @@
+- // MIR for `generic` before InstSimplify
++ // MIR for `generic` after InstSimplify
+
+ fn generic() -> () {
+ let mut _0: ();
+ let _1: ();
+ let _2: ();
+ let _3: ();
+
+ bb0: {
+ StorageLive(_1);
+ _1 = assert_inhabited::<T>() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ StorageLive(_2);
+ _2 = assert_zero_valid::<T>() -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_2);
+ StorageLive(_3);
+ _3 = assert_mem_uninitialized_valid::<T>() -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_3);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff
new file mode 100644
index 000000000..d29af0945
--- /dev/null
+++ b/tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff
@@ -0,0 +1,19 @@
+- // MIR for `generic_ref` before InstSimplify
++ // MIR for `generic_ref` after InstSimplify
+
+ fn generic_ref() -> () {
+ let mut _0: ();
+ let _1: ();
+
+ bb0: {
+ StorageLive(_1);
+ _1 = assert_mem_uninitialized_valid::<&T>() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff
new file mode 100644
index 000000000..1be386acf
--- /dev/null
+++ b/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff
@@ -0,0 +1,36 @@
+- // MIR for `panics` before InstSimplify
++ // MIR for `panics` after InstSimplify
+
+ fn panics() -> () {
+ let mut _0: ();
+ let _1: ();
+ let _2: ();
+ let _3: ();
+
+ bb0: {
+ StorageLive(_1);
+- _1 = assert_inhabited::<Never>() -> [return: bb1, unwind unreachable];
++ _1 = assert_inhabited::<Never>() -> unwind unreachable;
+ }
+
+ bb1: {
+ StorageDead(_1);
+ StorageLive(_2);
+- _2 = assert_zero_valid::<&u8>() -> [return: bb2, unwind unreachable];
++ _2 = assert_zero_valid::<&u8>() -> unwind unreachable;
+ }
+
+ bb2: {
+ StorageDead(_2);
+ StorageLive(_3);
+- _3 = assert_mem_uninitialized_valid::<&u8>() -> [return: bb3, unwind unreachable];
++ _3 = assert_mem_uninitialized_valid::<&u8>() -> unwind unreachable;
+ }
+
+ bb3: {
+ StorageDead(_3);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff
new file mode 100644
index 000000000..f2e697838
--- /dev/null
+++ b/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff
@@ -0,0 +1,36 @@
+- // MIR for `removable` before InstSimplify
++ // MIR for `removable` after InstSimplify
+
+ fn removable() -> () {
+ let mut _0: ();
+ let _1: ();
+ let _2: ();
+ let _3: ();
+
+ bb0: {
+ StorageLive(_1);
+- _1 = assert_inhabited::<()>() -> [return: bb1, unwind unreachable];
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_1);
+ StorageLive(_2);
+- _2 = assert_zero_valid::<u8>() -> [return: bb2, unwind unreachable];
++ goto -> bb2;
+ }
+
+ bb2: {
+ StorageDead(_2);
+ StorageLive(_3);
+- _3 = assert_mem_uninitialized_valid::<u8>() -> [return: bb3, unwind unreachable];
++ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_3);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/intrinsic_asserts.rs b/tests/mir-opt/instsimplify/intrinsic_asserts.rs
index 302d4bda1..43998b2db 100644
--- a/tests/mir-opt/intrinsic_asserts.rs
+++ b/tests/mir-opt/instsimplify/intrinsic_asserts.rs
@@ -1,9 +1,15 @@
+// unit-test: InstSimplify
+
#![crate_type = "lib"]
#![feature(core_intrinsics)]
// All these assertions pass, so all the intrinsic calls should be deleted.
// EMIT_MIR intrinsic_asserts.removable.InstSimplify.diff
pub fn removable() {
+ // CHECK-LABEL: fn removable(
+ // CHECK-NOT: assert_inhabited
+ // CHECK-NOT: assert_zero_valid
+ // CHECK-NOT: assert_mem_uninitialized_valid
core::intrinsics::assert_inhabited::<()>();
core::intrinsics::assert_zero_valid::<u8>();
core::intrinsics::assert_mem_uninitialized_valid::<u8>();
@@ -14,6 +20,10 @@ enum Never {}
// These assertions all diverge, so their target blocks should become None.
// EMIT_MIR intrinsic_asserts.panics.InstSimplify.diff
pub fn panics() {
+ // CHECK-LABEL: fn panics(
+ // CHECK: assert_inhabited::<Never>() -> unwind
+ // CHECK: assert_zero_valid::<&u8>() -> unwind
+ // CHECK: assert_mem_uninitialized_valid::<&u8>() -> unwind
core::intrinsics::assert_inhabited::<Never>();
core::intrinsics::assert_zero_valid::<&u8>();
core::intrinsics::assert_mem_uninitialized_valid::<&u8>();
@@ -22,7 +32,19 @@ pub fn panics() {
// Whether or not these asserts pass isn't known, so they shouldn't be modified.
// EMIT_MIR intrinsic_asserts.generic.InstSimplify.diff
pub fn generic<T>() {
+ // CHECK-LABEL: fn generic(
+ // CHECK: assert_inhabited::<T>() -> [return:
+ // CHECK: assert_zero_valid::<T>() -> [return:
+ // CHECK: assert_mem_uninitialized_valid::<T>() -> [return:
core::intrinsics::assert_inhabited::<T>();
core::intrinsics::assert_zero_valid::<T>();
core::intrinsics::assert_mem_uninitialized_valid::<T>();
}
+
+// Whether or not these asserts pass isn't known, so they shouldn't be modified.
+// EMIT_MIR intrinsic_asserts.generic_ref.InstSimplify.diff
+pub fn generic_ref<T>() {
+ // CHECK-LABEL: fn generic_ref(
+ // CHECK: assert_mem_uninitialized_valid::<&T>() -> [return:
+ core::intrinsics::assert_mem_uninitialized_valid::<&T>();
+}
diff --git a/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff b/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff
deleted file mode 100644
index 04ba8dd8e..000000000
--- a/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff
+++ /dev/null
@@ -1,21 +0,0 @@
-- // MIR for `assert_zero` before InstSimplify
-+ // MIR for `assert_zero` after InstSimplify
-
- fn assert_zero(_1: u8) -> u8 {
- let mut _0: u8; // return place in scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+0:37: +0:39
-
- bb0: {
-- switchInt(_1) -> [0: bb2, 1: bb1, otherwise: bb1]; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+3:13: +7:14
-+ switchInt(_1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+3:13: +7:14
- }
-
- bb1: {
- unreachable; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+10:13: +10:26
- }
-
- bb2: {
- _0 = _1; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+13:13: +13:20
- return; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+14:13: +14:21
- }
- }
-
diff --git a/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff b/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff
deleted file mode 100644
index a59f4a43a..000000000
--- a/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff
+++ /dev/null
@@ -1,42 +0,0 @@
-- // MIR for `generic` before InstSimplify
-+ // MIR for `generic` after InstSimplify
-
- fn generic() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:21: +0:21
- let _1: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:46
- let _2: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:47
- let _3: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:60
-
- bb0: {
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:46
- _1 = assert_inhabited::<T>() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:46
- // mir::Constant
- // + span: $DIR/intrinsic_asserts.rs:25:5: 25:44
- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_inhabited::<T>}, val: Value(<ZST>) }
- }
-
- bb1: {
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:46: +1:47
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:47
- _2 = assert_zero_valid::<T>() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:47
- // mir::Constant
- // + span: $DIR/intrinsic_asserts.rs:26:5: 26:45
- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_zero_valid::<T>}, val: Value(<ZST>) }
- }
-
- bb2: {
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:47: +2:48
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:60
- _3 = assert_mem_uninitialized_valid::<T>() -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:60
- // mir::Constant
- // + span: $DIR/intrinsic_asserts.rs:27:5: 27:58
- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_mem_uninitialized_valid::<T>}, val: Value(<ZST>) }
- }
-
- bb3: {
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:60: +3:61
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+0:21: +4:2
- return; // scope 0 at $DIR/intrinsic_asserts.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff b/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff
deleted file mode 100644
index 195e8bd4e..000000000
--- a/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff
+++ /dev/null
@@ -1,47 +0,0 @@
-- // MIR for `panics` before InstSimplify
-+ // MIR for `panics` after InstSimplify
-
- fn panics() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:17: +0:17
- let _1: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:50
- let _2: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:49
- let _3: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62
-
- bb0: {
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:50
-- _1 = assert_inhabited::<Never>() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:50
-+ _1 = assert_inhabited::<Never>() -> unwind unreachable; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:50
- // mir::Constant
- // + span: $DIR/intrinsic_asserts.rs:17:5: 17:48
- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_inhabited::<Never>}, val: Value(<ZST>) }
- }
-
- bb1: {
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:50: +1:51
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:49
-- _2 = assert_zero_valid::<&u8>() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:49
-+ _2 = assert_zero_valid::<&u8>() -> unwind unreachable; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:49
- // mir::Constant
- // + span: $DIR/intrinsic_asserts.rs:18:5: 18:47
- // + user_ty: UserType(0)
- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_zero_valid::<&u8>}, val: Value(<ZST>) }
- }
-
- bb2: {
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:49: +2:50
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62
-- _3 = assert_mem_uninitialized_valid::<&u8>() -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62
-+ _3 = assert_mem_uninitialized_valid::<&u8>() -> unwind unreachable; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62
- // mir::Constant
- // + span: $DIR/intrinsic_asserts.rs:19:5: 19:60
- // + user_ty: UserType(1)
- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_mem_uninitialized_valid::<&u8>}, val: Value(<ZST>) }
- }
-
- bb3: {
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:62: +3:63
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+0:17: +4:2
- return; // scope 0 at $DIR/intrinsic_asserts.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff b/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff
deleted file mode 100644
index a4a65074c..000000000
--- a/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff
+++ /dev/null
@@ -1,45 +0,0 @@
-- // MIR for `removable` before InstSimplify
-+ // MIR for `removable` after InstSimplify
-
- fn removable() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:20: +0:20
- let _1: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:47
- let _2: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:48
- let _3: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:61
-
- bb0: {
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:47
-- _1 = assert_inhabited::<()>() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:47
-- // mir::Constant
-- // + span: $DIR/intrinsic_asserts.rs:7:5: 7:45
-- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_inhabited::<()>}, val: Value(<ZST>) }
-+ goto -> bb1; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:47
- }
-
- bb1: {
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:47: +1:48
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:48
-- _2 = assert_zero_valid::<u8>() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:48
-- // mir::Constant
-- // + span: $DIR/intrinsic_asserts.rs:8:5: 8:46
-- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_zero_valid::<u8>}, val: Value(<ZST>) }
-+ goto -> bb2; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:48
- }
-
- bb2: {
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:48: +2:49
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:61
-- _3 = assert_mem_uninitialized_valid::<u8>() -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:61
-- // mir::Constant
-- // + span: $DIR/intrinsic_asserts.rs:9:5: 9:59
-- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_mem_uninitialized_valid::<u8>}, val: Value(<ZST>) }
-+ goto -> bb3; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:61
- }
-
- bb3: {
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:61: +3:62
- nop; // scope 0 at $DIR/intrinsic_asserts.rs:+0:20: +4:2
- return; // scope 0 at $DIR/intrinsic_asserts.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.diff b/tests/mir-opt/issue_101973.inner.ConstProp.diff
deleted file mode 100644
index d048b9e65..000000000
--- a/tests/mir-opt/issue_101973.inner.ConstProp.diff
+++ /dev/null
@@ -1,85 +0,0 @@
-- // MIR for `inner` before ConstProp
-+ // MIR for `inner` after ConstProp
-
- fn inner(_1: u32) -> i64 {
- debug fields => _1; // in scope 0 at $DIR/issue_101973.rs:+0:14: +0:20
- let mut _0: i64; // return place in scope 0 at $DIR/issue_101973.rs:+0:30: +0:33
- let mut _2: i32; // in scope 0 at $DIR/issue_101973.rs:+1:5: +1:65
- let mut _3: u32; // in scope 0 at $DIR/issue_101973.rs:+1:5: +1:58
- let mut _4: u32; // in scope 0 at $DIR/issue_101973.rs:+1:5: +1:17
- let mut _5: u32; // in scope 0 at $DIR/issue_101973.rs:+1:10: +1:16
- let mut _6: u32; // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
- let mut _7: u32; // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:52
- let mut _8: u32; // in scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
- let mut _9: u32; // in scope 0 at $DIR/issue_101973.rs:+1:33: +1:39
- let mut _10: u32; // in scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
- let mut _11: bool; // in scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
- let mut _12: u32; // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
- let mut _13: bool; // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
- scope 1 (inlined imm8) { // at $DIR/issue_101973.rs:15:5: 15:17
- debug x => _1; // in scope 1 at $DIR/issue_101973.rs:6:13: 6:14
- let mut _14: u32; // in scope 1 at $DIR/issue_101973.rs:8:12: 8:27
- let mut _15: u32; // in scope 1 at $DIR/issue_101973.rs:8:12: 8:20
- scope 2 {
- debug out => _4; // in scope 2 at $DIR/issue_101973.rs:7:9: 7:16
- }
- }
- scope 3 (inlined core::num::<impl u32>::rotate_right) { // at $DIR/issue_101973.rs:15:18: 15:58
- debug self => _4; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- debug n => _6; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:65
- StorageLive(_3); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:58
- StorageLive(_4); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:17
- StorageLive(_14); // scope 2 at $DIR/issue_101973.rs:8:12: 8:27
- StorageLive(_15); // scope 2 at $DIR/issue_101973.rs:8:12: 8:20
- _15 = Shr(_1, const 0_i32); // scope 2 at $DIR/issue_101973.rs:8:12: 8:20
- _14 = BitAnd(move _15, const 255_u32); // scope 2 at $DIR/issue_101973.rs:8:12: 8:27
- StorageDead(_15); // scope 2 at $DIR/issue_101973.rs:8:26: 8:27
- _4 = BitOr(const 0_u32, move _14); // scope 2 at $DIR/issue_101973.rs:8:5: 8:27
- StorageDead(_14); // scope 2 at $DIR/issue_101973.rs:8:26: 8:27
- StorageLive(_6); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
- StorageLive(_7); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:52
- StorageLive(_8); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
-- _10 = const 8_i32 as u32 (IntToInt); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
-- _11 = Lt(move _10, const 32_u32); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
-- assert(move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> bb1; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
-+ _10 = const 8_u32; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
-+ _11 = const true; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
-+ assert(const true, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> bb1; // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
- }
-
- bb1: {
- _8 = Shr(_1, const 8_i32); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45
- _7 = BitAnd(move _8, const 15_u32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:52
- StorageDead(_8); // scope 0 at $DIR/issue_101973.rs:+1:51: +1:52
-- _12 = const 1_i32 as u32 (IntToInt); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
-- _13 = Lt(move _12, const 32_u32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
-- assert(move _13, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> bb2; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
-+ _12 = const 1_u32; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
-+ _13 = const true; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
-+ assert(const true, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> bb2; // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
- }
-
- bb2: {
- _6 = Shl(move _7, const 1_i32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
- StorageDead(_7); // scope 0 at $DIR/issue_101973.rs:+1:56: +1:57
- _3 = rotate_right::<u32>(_4, _6) -> [return: bb3, unwind unreachable]; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- // + literal: Const { ty: extern "rust-intrinsic" fn(u32, u32) -> u32 {rotate_right::<u32>}, val: Value(<ZST>) }
- }
-
- bb3: {
- StorageDead(_6); // scope 0 at $DIR/issue_101973.rs:+1:57: +1:58
- StorageDead(_4); // scope 0 at $DIR/issue_101973.rs:+1:57: +1:58
- _2 = move _3 as i32 (IntToInt); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:65
- StorageDead(_3); // scope 0 at $DIR/issue_101973.rs:+1:64: +1:65
- _0 = move _2 as i64 (IntToInt); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:72
- StorageDead(_2); // scope 0 at $DIR/issue_101973.rs:+1:71: +1:72
- return; // scope 0 at $DIR/issue_101973.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff b/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..3748d1483
--- /dev/null
+++ b/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff
@@ -0,0 +1,83 @@
+- // MIR for `inner` before ConstProp
++ // MIR for `inner` after ConstProp
+
+ fn inner(_1: u32) -> i64 {
+ debug fields => _1;
+ let mut _0: i64;
+ let mut _2: i32;
+ let mut _3: u32;
+ let mut _4: u32;
+ let mut _5: u32;
+ let mut _6: u32;
+ let mut _7: u32;
+ let mut _8: u32;
+ let mut _9: u32;
+ let mut _10: u32;
+ let mut _11: bool;
+ let mut _12: u32;
+ let mut _13: bool;
+ scope 1 (inlined imm8) {
+ debug x => _1;
+ let mut _14: u32;
+ let mut _15: u32;
+ scope 2 {
+ debug out => _4;
+ }
+ }
+ scope 3 (inlined core::num::<impl u32>::rotate_right) {
+ debug self => _4;
+ debug n => _6;
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = const 0_u32;
+ StorageLive(_15);
+ StorageLive(_14);
+ _14 = Shr(_1, const 0_i32);
+ _15 = BitAnd(move _14, const 255_u32);
+ StorageDead(_14);
+ _4 = BitOr(const 0_u32, move _15);
+ StorageDead(_15);
+ StorageLive(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+- _10 = const 8_i32 as u32 (IntToInt);
+- _11 = Lt(move _10, const 32_u32);
+- assert(move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind unreachable];
++ _10 = const 8_u32;
++ _11 = const true;
++ assert(const true, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _8 = Shr(_1, const 8_i32);
+ _7 = BitAnd(move _8, const 15_u32);
+ StorageDead(_8);
+- _12 = const 1_i32 as u32 (IntToInt);
+- _13 = Lt(move _12, const 32_u32);
+- assert(move _13, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> [success: bb2, unwind unreachable];
++ _12 = const 1_u32;
++ _13 = const true;
++ assert(const true, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> [success: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ _6 = Shl(move _7, const 1_i32);
+ StorageDead(_7);
+ _3 = rotate_right::<u32>(move _4, move _6) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_6);
+ StorageDead(_4);
+ _2 = move _3 as i32 (IntToInt);
+ StorageDead(_3);
+ _0 = move _2 as i64 (IntToInt);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff b/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff
new file mode 100644
index 000000000..9dab4233c
--- /dev/null
+++ b/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff
@@ -0,0 +1,83 @@
+- // MIR for `inner` before ConstProp
++ // MIR for `inner` after ConstProp
+
+ fn inner(_1: u32) -> i64 {
+ debug fields => _1;
+ let mut _0: i64;
+ let mut _2: i32;
+ let mut _3: u32;
+ let mut _4: u32;
+ let mut _5: u32;
+ let mut _6: u32;
+ let mut _7: u32;
+ let mut _8: u32;
+ let mut _9: u32;
+ let mut _10: u32;
+ let mut _11: bool;
+ let mut _12: u32;
+ let mut _13: bool;
+ scope 1 (inlined imm8) {
+ debug x => _1;
+ let mut _14: u32;
+ let mut _15: u32;
+ scope 2 {
+ debug out => _4;
+ }
+ }
+ scope 3 (inlined core::num::<impl u32>::rotate_right) {
+ debug self => _4;
+ debug n => _6;
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = const 0_u32;
+ StorageLive(_15);
+ StorageLive(_14);
+ _14 = Shr(_1, const 0_i32);
+ _15 = BitAnd(move _14, const 255_u32);
+ StorageDead(_14);
+ _4 = BitOr(const 0_u32, move _15);
+ StorageDead(_15);
+ StorageLive(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+- _10 = const 8_i32 as u32 (IntToInt);
+- _11 = Lt(move _10, const 32_u32);
+- assert(move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind continue];
++ _10 = const 8_u32;
++ _11 = const true;
++ assert(const true, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+ _8 = Shr(_1, const 8_i32);
+ _7 = BitAnd(move _8, const 15_u32);
+ StorageDead(_8);
+- _12 = const 1_i32 as u32 (IntToInt);
+- _13 = Lt(move _12, const 32_u32);
+- assert(move _13, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> [success: bb2, unwind continue];
++ _12 = const 1_u32;
++ _13 = const true;
++ assert(const true, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> [success: bb2, unwind continue];
+ }
+
+ bb2: {
+ _6 = Shl(move _7, const 1_i32);
+ StorageDead(_7);
+ _3 = rotate_right::<u32>(move _4, move _6) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_6);
+ StorageDead(_4);
+ _2 = move _3 as i32 (IntToInt);
+ StorageDead(_3);
+ _0 = move _2 as i64 (IntToInt);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/issue_101973.rs b/tests/mir-opt/issue_101973.rs
index da388f149..3de325bc1 100644
--- a/tests/mir-opt/issue_101973.rs
+++ b/tests/mir-opt/issue_101973.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -O -C debug-assertions=on
// This needs inlining followed by ConstProp to reproduce, so we cannot use "unit-test".
diff --git a/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.mir b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.mir
deleted file mode 100644
index f50c0eb47..000000000
--- a/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.mir
+++ /dev/null
@@ -1,25 +0,0 @@
-// MIR for `main` after AbortUnwindingCalls
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/issue_104451_unwindable_intrinsics.rs:+0:11: +0:11
- let mut _1: !; // in scope 0 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:9: +2:62
- let mut _2: (); // in scope 0 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:45: +2:47
- scope 1 {
- }
-
- bb0: {
- StorageLive(_1); // scope 1 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:9: +2:62
- StorageLive(_2); // scope 1 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:45: +2:47
- _2 = (); // scope 1 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:45: +2:47
- _1 = const_eval_select::<(), fn() -> ! {ow_ct}, fn() -> ! {ow_ct}, !>(move _2, ow_ct, ow_ct); // scope 1 at $DIR/issue_104451_unwindable_intrinsics.rs:+2:9: +2:62
- // mir::Constant
- // + span: $DIR/issue_104451_unwindable_intrinsics.rs:8:9: 8:44
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn((), fn() -> ! {ow_ct}, fn() -> ! {ow_ct}) -> ! {const_eval_select::<(), fn() -> ! {ow_ct}, fn() -> ! {ow_ct}, !>}, val: Value(<ZST>) }
- // mir::Constant
- // + span: $DIR/issue_104451_unwindable_intrinsics.rs:8:49: 8:54
- // + literal: Const { ty: fn() -> ! {ow_ct}, val: Value(<ZST>) }
- // mir::Constant
- // + span: $DIR/issue_104451_unwindable_intrinsics.rs:8:56: 8:61
- // + literal: Const { ty: fn() -> ! {ow_ct}, val: Value(<ZST>) }
- }
-}
diff --git a/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-abort.mir b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-abort.mir
new file mode 100644
index 000000000..b4f212409
--- /dev/null
+++ b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-abort.mir
@@ -0,0 +1,16 @@
+// MIR for `main` after AbortUnwindingCalls
+
+fn main() -> () {
+ let mut _0: ();
+ let mut _1: !;
+ let mut _2: ();
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = ();
+ _1 = const_eval_select::<(), fn() -> ! {ow_ct}, fn() -> ! {ow_ct}, !>(move _2, ow_ct, ow_ct) -> unwind unreachable;
+ }
+}
diff --git a/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-unwind.mir b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-unwind.mir
new file mode 100644
index 000000000..1851747f0
--- /dev/null
+++ b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-unwind.mir
@@ -0,0 +1,16 @@
+// MIR for `main` after AbortUnwindingCalls
+
+fn main() -> () {
+ let mut _0: ();
+ let mut _1: !;
+ let mut _2: ();
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = ();
+ _1 = const_eval_select::<(), fn() -> ! {ow_ct}, fn() -> ! {ow_ct}, !>(move _2, ow_ct, ow_ct) -> unwind continue;
+ }
+}
diff --git a/tests/mir-opt/issue_104451_unwindable_intrinsics.rs b/tests/mir-opt/issue_104451_unwindable_intrinsics.rs
index 9babd4aae..cd068f122 100644
--- a/tests/mir-opt/issue_104451_unwindable_intrinsics.rs
+++ b/tests/mir-opt/issue_104451_unwindable_intrinsics.rs
@@ -1,5 +1,6 @@
+// skip-filecheck
// Check that `UnwindAction::Unreachable` is not generated for unwindable intrinsics.
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![feature(core_intrinsics)]
// EMIT_MIR issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.mir
diff --git a/tests/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir b/tests/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir
index ccaa508c1..632b55806 100644
--- a/tests/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir
@@ -1,52 +1,52 @@
// MIR for `main` after SimplifyCfg-initial
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/issue_38669.rs:+0:11: +0:11
- let mut _1: bool; // in scope 0 at $DIR/issue_38669.rs:+1:9: +1:25
- let mut _2: (); // in scope 0 at $DIR/issue_38669.rs:+0:1: +8:2
- let _3: (); // in scope 0 at $DIR/issue_38669.rs:+3:9: +5:10
- let mut _4: bool; // in scope 0 at $DIR/issue_38669.rs:+3:12: +3:24
- let mut _5: !; // in scope 0 at $DIR/issue_38669.rs:+3:25: +5:10
+ let mut _0: ();
+ let mut _1: bool;
+ let mut _2: ();
+ let _3: ();
+ let mut _4: bool;
+ let mut _5: !;
scope 1 {
- debug should_break => _1; // in scope 1 at $DIR/issue_38669.rs:+1:9: +1:25
+ debug should_break => _1;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/issue_38669.rs:+1:9: +1:25
- _1 = const false; // scope 0 at $DIR/issue_38669.rs:+1:28: +1:33
- FakeRead(ForLet(None), _1); // scope 0 at $DIR/issue_38669.rs:+1:9: +1:25
- goto -> bb1; // scope 1 at $DIR/issue_38669.rs:+2:5: +7:6
+ StorageLive(_1);
+ _1 = const false;
+ FakeRead(ForLet(None), _1);
+ goto -> bb1;
}
bb1: {
- falseUnwind -> [real: bb2, unwind: bb5]; // scope 1 at $DIR/issue_38669.rs:+2:5: +7:6
+ falseUnwind -> [real: bb2, unwind: bb5];
}
bb2: {
- StorageLive(_3); // scope 1 at $DIR/issue_38669.rs:+3:9: +5:10
- StorageLive(_4); // scope 1 at $DIR/issue_38669.rs:+3:12: +3:24
- _4 = _1; // scope 1 at $DIR/issue_38669.rs:+3:12: +3:24
- switchInt(move _4) -> [0: bb4, otherwise: bb3]; // scope 1 at $DIR/issue_38669.rs:+3:12: +3:24
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ switchInt(move _4) -> [0: bb4, otherwise: bb3];
}
bb3: {
- _0 = const (); // scope 1 at $DIR/issue_38669.rs:+4:13: +4:18
- StorageDead(_4); // scope 1 at $DIR/issue_38669.rs:+5:9: +5:10
- StorageDead(_3); // scope 1 at $DIR/issue_38669.rs:+5:9: +5:10
- StorageDead(_1); // scope 0 at $DIR/issue_38669.rs:+8:1: +8:2
- return; // scope 0 at $DIR/issue_38669.rs:+8:2: +8:2
+ _0 = const ();
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
}
bb4: {
- _3 = const (); // scope 1 at $DIR/issue_38669.rs:+5:10: +5:10
- StorageDead(_4); // scope 1 at $DIR/issue_38669.rs:+5:9: +5:10
- StorageDead(_3); // scope 1 at $DIR/issue_38669.rs:+5:9: +5:10
- _1 = const true; // scope 1 at $DIR/issue_38669.rs:+6:9: +6:28
- _2 = const (); // scope 1 at $DIR/issue_38669.rs:+2:10: +7:6
- goto -> bb1; // scope 1 at $DIR/issue_38669.rs:+2:5: +7:6
+ _3 = const ();
+ StorageDead(_4);
+ StorageDead(_3);
+ _1 = const true;
+ _2 = const ();
+ goto -> bb1;
}
bb5 (cleanup): {
- resume; // scope 0 at $DIR/issue_38669.rs:+0:1: +8:2
+ resume;
}
}
diff --git a/tests/mir-opt/issue_38669.rs b/tests/mir-opt/issue_38669.rs
index db3f89472..9da4c89bb 100644
--- a/tests/mir-opt/issue_38669.rs
+++ b/tests/mir-opt/issue_38669.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// check that we don't StorageDead booleans before they are used
// EMIT_MIR issue_38669.main.SimplifyCfg-initial.after.mir
diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.diff
deleted file mode 100644
index ac2520249..000000000
--- a/tests/mir-opt/issue_41110.main.ElaborateDrops.diff
+++ /dev/null
@@ -1,75 +0,0 @@
-- // MIR for `main` before ElaborateDrops
-+ // MIR for `main` after ElaborateDrops
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/issue_41110.rs:+0:11: +0:11
- let _1: (); // in scope 0 at $DIR/issue_41110.rs:+1:9: +1:10
- let mut _2: S; // in scope 0 at $DIR/issue_41110.rs:+1:13: +1:14
- let mut _3: S; // in scope 0 at $DIR/issue_41110.rs:+1:21: +1:27
- let mut _4: S; // in scope 0 at $DIR/issue_41110.rs:+1:21: +1:22
-+ let mut _5: bool; // in scope 0 at $DIR/issue_41110.rs:+1:27: +1:28
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/issue_41110.rs:+1:9: +1:10
- }
-
- bb0: {
-+ _5 = const false; // scope 0 at $DIR/issue_41110.rs:+1:9: +1:10
- StorageLive(_1); // scope 0 at $DIR/issue_41110.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/issue_41110.rs:+1:13: +1:14
-+ _5 = const true; // scope 0 at $DIR/issue_41110.rs:+1:13: +1:14
- _2 = S; // scope 0 at $DIR/issue_41110.rs:+1:13: +1:14
- StorageLive(_3); // scope 0 at $DIR/issue_41110.rs:+1:21: +1:27
- StorageLive(_4); // scope 0 at $DIR/issue_41110.rs:+1:21: +1:22
- _4 = S; // scope 0 at $DIR/issue_41110.rs:+1:21: +1:22
- _3 = S::id(move _4) -> [return: bb1, unwind: bb4]; // scope 0 at $DIR/issue_41110.rs:+1:21: +1:27
- // mir::Constant
- // + span: $DIR/issue_41110.rs:8:23: 8:25
- // + literal: Const { ty: fn(S) -> S {S::id}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_4); // scope 0 at $DIR/issue_41110.rs:+1:26: +1:27
-+ _5 = const false; // scope 0 at $DIR/issue_41110.rs:+1:13: +1:28
- _1 = S::other(move _2, move _3) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/issue_41110.rs:+1:13: +1:28
- // mir::Constant
- // + span: $DIR/issue_41110.rs:8:15: 8:20
- // + literal: Const { ty: fn(S, S) {S::other}, val: Value(<ZST>) }
- }
-
- bb2: {
- StorageDead(_3); // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28
-+ _5 = const false; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28
- StorageDead(_2); // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28
- _0 = const (); // scope 0 at $DIR/issue_41110.rs:+0:11: +2:2
- StorageDead(_1); // scope 0 at $DIR/issue_41110.rs:+2:1: +2:2
- return; // scope 0 at $DIR/issue_41110.rs:+2:2: +2:2
- }
-
- bb3 (cleanup): {
-- drop(_3) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28
-+ goto -> bb5; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28
- }
-
- bb4 (cleanup): {
-- drop(_4) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+1:26: +1:27
-+ goto -> bb5; // scope 0 at $DIR/issue_41110.rs:+1:26: +1:27
- }
-
- bb5 (cleanup): {
-- drop(_2) -> [return: bb6, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28
-+ goto -> bb8; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28
- }
-
- bb6 (cleanup): {
- resume; // scope 0 at $DIR/issue_41110.rs:+0:1: +2:2
-+ }
-+
-+ bb7 (cleanup): {
-+ drop(_2) -> [return: bb6, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28
-+ }
-+
-+ bb8 (cleanup): {
-+ switchInt(_5) -> [0: bb6, otherwise: bb7]; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28
- }
- }
-
diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff
new file mode 100644
index 000000000..4469270a9
--- /dev/null
+++ b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff
@@ -0,0 +1,69 @@
+- // MIR for `main` before ElaborateDrops
++ // MIR for `main` after ElaborateDrops
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
+ let mut _2: S;
+ let mut _3: S;
+ let mut _4: S;
++ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
++ _5 = const false;
+ StorageLive(_1);
+ StorageLive(_2);
++ _5 = const true;
+ _2 = S;
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = S;
+ _3 = S::id(move _4) -> [return: bb1, unwind: bb4];
+ }
+
+ bb1: {
+ StorageDead(_4);
++ _5 = const false;
+ _1 = S::other(move _2, move _3) -> [return: bb2, unwind: bb3];
+ }
+
+ bb2: {
+ StorageDead(_3);
++ _5 = const false;
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+
+ bb3 (cleanup): {
+- drop(_3) -> [return: bb5, unwind terminate(cleanup)];
++ goto -> bb5;
+ }
+
+ bb4 (cleanup): {
+- drop(_4) -> [return: bb5, unwind terminate(cleanup)];
++ goto -> bb5;
+ }
+
+ bb5 (cleanup): {
+- drop(_2) -> [return: bb6, unwind terminate(cleanup)];
++ goto -> bb8;
+ }
+
+ bb6 (cleanup): {
+ resume;
++ }
++
++ bb7 (cleanup): {
++ drop(_2) -> [return: bb6, unwind terminate(cleanup)];
++ }
++
++ bb8 (cleanup): {
++ switchInt(_5) -> [0: bb6, otherwise: bb7];
+ }
+ }
+
diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff
new file mode 100644
index 000000000..4469270a9
--- /dev/null
+++ b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff
@@ -0,0 +1,69 @@
+- // MIR for `main` before ElaborateDrops
++ // MIR for `main` after ElaborateDrops
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
+ let mut _2: S;
+ let mut _3: S;
+ let mut _4: S;
++ let mut _5: bool;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
++ _5 = const false;
+ StorageLive(_1);
+ StorageLive(_2);
++ _5 = const true;
+ _2 = S;
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = S;
+ _3 = S::id(move _4) -> [return: bb1, unwind: bb4];
+ }
+
+ bb1: {
+ StorageDead(_4);
++ _5 = const false;
+ _1 = S::other(move _2, move _3) -> [return: bb2, unwind: bb3];
+ }
+
+ bb2: {
+ StorageDead(_3);
++ _5 = const false;
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+
+ bb3 (cleanup): {
+- drop(_3) -> [return: bb5, unwind terminate(cleanup)];
++ goto -> bb5;
+ }
+
+ bb4 (cleanup): {
+- drop(_4) -> [return: bb5, unwind terminate(cleanup)];
++ goto -> bb5;
+ }
+
+ bb5 (cleanup): {
+- drop(_2) -> [return: bb6, unwind terminate(cleanup)];
++ goto -> bb8;
+ }
+
+ bb6 (cleanup): {
+ resume;
++ }
++
++ bb7 (cleanup): {
++ drop(_2) -> [return: bb6, unwind terminate(cleanup)];
++ }
++
++ bb8 (cleanup): {
++ switchInt(_5) -> [0: bb6, otherwise: bb7];
+ }
+ }
+
diff --git a/tests/mir-opt/issue_41110.rs b/tests/mir-opt/issue_41110.rs
index e1067ce53..38602d5ea 100644
--- a/tests/mir-opt/issue_41110.rs
+++ b/tests/mir-opt/issue_41110.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32-bare compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// check that we don't emit multiple drop flags when they are not needed.
diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.diff
deleted file mode 100644
index a4a07ad12..000000000
--- a/tests/mir-opt/issue_41110.test.ElaborateDrops.diff
+++ /dev/null
@@ -1,105 +0,0 @@
-- // MIR for `test` before ElaborateDrops
-+ // MIR for `test` after ElaborateDrops
-
- fn test() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/issue_41110.rs:+0:15: +0:15
- let _1: S; // in scope 0 at $DIR/issue_41110.rs:+1:9: +1:10
- let _3: (); // in scope 0 at $DIR/issue_41110.rs:+3:5: +3:12
- let mut _4: S; // in scope 0 at $DIR/issue_41110.rs:+3:10: +3:11
- let mut _5: S; // in scope 0 at $DIR/issue_41110.rs:+4:9: +4:10
-+ let mut _6: bool; // in scope 0 at $DIR/issue_41110.rs:+5:1: +5:2
- scope 1 {
- debug u => _1; // in scope 1 at $DIR/issue_41110.rs:+1:9: +1:10
- let mut _2: S; // in scope 1 at $DIR/issue_41110.rs:+2:9: +2:14
- scope 2 {
- debug v => _2; // in scope 2 at $DIR/issue_41110.rs:+2:9: +2:14
- }
- }
-
- bb0: {
-+ _6 = const false; // scope 0 at $DIR/issue_41110.rs:+1:9: +1:10
- StorageLive(_1); // scope 0 at $DIR/issue_41110.rs:+1:9: +1:10
-+ _6 = const true; // scope 0 at $DIR/issue_41110.rs:+1:13: +1:14
- _1 = S; // scope 0 at $DIR/issue_41110.rs:+1:13: +1:14
- StorageLive(_2); // scope 1 at $DIR/issue_41110.rs:+2:9: +2:14
- _2 = S; // scope 1 at $DIR/issue_41110.rs:+2:17: +2:18
- StorageLive(_3); // scope 2 at $DIR/issue_41110.rs:+3:5: +3:12
- StorageLive(_4); // scope 2 at $DIR/issue_41110.rs:+3:10: +3:11
- _4 = move _2; // scope 2 at $DIR/issue_41110.rs:+3:10: +3:11
- _3 = std::mem::drop::<S>(move _4) -> [return: bb1, unwind: bb7]; // scope 2 at $DIR/issue_41110.rs:+3:5: +3:12
- // mir::Constant
- // + span: $DIR/issue_41110.rs:17:5: 17:9
- // + literal: Const { ty: fn(S) {std::mem::drop::<S>}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_4); // scope 2 at $DIR/issue_41110.rs:+3:11: +3:12
- StorageDead(_3); // scope 2 at $DIR/issue_41110.rs:+3:12: +3:13
- StorageLive(_5); // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10
-+ _6 = const false; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10
- _5 = move _1; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10
-- drop(_2) -> [return: bb2, unwind: bb3]; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6
-+ goto -> bb2; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6
- }
-
- bb2: {
- _2 = move _5; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6
-- drop(_5) -> [return: bb4, unwind: bb8]; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10
-+ goto -> bb4; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10
- }
-
- bb3 (cleanup): {
- _2 = move _5; // scope 2 at $DIR/issue_41110.rs:+4:5: +4:6
- drop(_5) -> [return: bb8, unwind terminate]; // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10
- }
-
- bb4: {
- StorageDead(_5); // scope 2 at $DIR/issue_41110.rs:+4:9: +4:10
- _0 = const (); // scope 0 at $DIR/issue_41110.rs:+0:15: +5:2
- drop(_2) -> [return: bb5, unwind: bb9]; // scope 1 at $DIR/issue_41110.rs:+5:1: +5:2
- }
-
- bb5: {
- StorageDead(_2); // scope 1 at $DIR/issue_41110.rs:+5:1: +5:2
-- drop(_1) -> bb6; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2
-+ goto -> bb6; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2
- }
-
- bb6: {
-+ _6 = const false; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2
- StorageDead(_1); // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2
- return; // scope 0 at $DIR/issue_41110.rs:+5:2: +5:2
- }
-
- bb7 (cleanup): {
-- drop(_4) -> [return: bb8, unwind terminate]; // scope 2 at $DIR/issue_41110.rs:+3:11: +3:12
-+ goto -> bb8; // scope 2 at $DIR/issue_41110.rs:+3:11: +3:12
- }
-
- bb8 (cleanup): {
-- drop(_2) -> [return: bb9, unwind terminate]; // scope 1 at $DIR/issue_41110.rs:+5:1: +5:2
-+ goto -> bb9; // scope 1 at $DIR/issue_41110.rs:+5:1: +5:2
- }
-
- bb9 (cleanup): {
-- drop(_1) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2
-+ goto -> bb13; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2
- }
-
- bb10 (cleanup): {
- resume; // scope 0 at $DIR/issue_41110.rs:+0:1: +5:2
-+ }
-+
-+ bb11 (cleanup): {
-+ unreachable; // scope 0 at $DIR/issue_41110.rs:+0:1: +5:2
-+ }
-+
-+ bb12 (cleanup): {
-+ drop(_1) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2
-+ }
-+
-+ bb13 (cleanup): {
-+ switchInt(_6) -> [0: bb10, otherwise: bb12]; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2
- }
- }
-
diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff
new file mode 100644
index 000000000..78184f6ae
--- /dev/null
+++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff
@@ -0,0 +1,99 @@
+- // MIR for `test` before ElaborateDrops
++ // MIR for `test` after ElaborateDrops
+
+ fn test() -> () {
+ let mut _0: ();
+ let _1: S;
+ let _3: ();
+ let mut _4: S;
+ let mut _5: S;
++ let mut _6: bool;
+ scope 1 {
+ debug u => _1;
+ let mut _2: S;
+ scope 2 {
+ debug v => _2;
+ }
+ }
+
+ bb0: {
++ _6 = const false;
+ StorageLive(_1);
++ _6 = const true;
+ _1 = S;
+ StorageLive(_2);
+ _2 = S;
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = move _2;
+ _3 = std::mem::drop::<S>(move _4) -> [return: bb1, unwind: bb7];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageLive(_5);
++ _6 = const false;
+ _5 = move _1;
+- drop(_2) -> [return: bb2, unwind: bb3];
++ goto -> bb2;
+ }
+
+ bb2: {
+ _2 = move _5;
+- drop(_5) -> [return: bb4, unwind: bb8];
++ goto -> bb4;
+ }
+
+ bb3 (cleanup): {
+ _2 = move _5;
+- drop(_5) -> [return: bb8, unwind terminate(cleanup)];
++ goto -> bb8;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ _0 = const ();
+ drop(_2) -> [return: bb5, unwind: bb9];
+ }
+
+ bb5: {
+ StorageDead(_2);
+- drop(_1) -> [return: bb6, unwind: bb10];
++ goto -> bb6;
+ }
+
+ bb6: {
++ _6 = const false;
+ StorageDead(_1);
+ return;
+ }
+
+ bb7 (cleanup): {
+- drop(_4) -> [return: bb8, unwind terminate(cleanup)];
++ goto -> bb8;
+ }
+
+ bb8 (cleanup): {
+- drop(_2) -> [return: bb9, unwind terminate(cleanup)];
++ goto -> bb9;
+ }
+
+ bb9 (cleanup): {
+- drop(_1) -> [return: bb10, unwind terminate(cleanup)];
++ goto -> bb12;
+ }
+
+ bb10 (cleanup): {
+ resume;
++ }
++
++ bb11 (cleanup): {
++ drop(_1) -> [return: bb10, unwind terminate(cleanup)];
++ }
++
++ bb12 (cleanup): {
++ switchInt(_6) -> [0: bb10, otherwise: bb11];
+ }
+ }
+
diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff
new file mode 100644
index 000000000..688887c3c
--- /dev/null
+++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff
@@ -0,0 +1,99 @@
+- // MIR for `test` before ElaborateDrops
++ // MIR for `test` after ElaborateDrops
+
+ fn test() -> () {
+ let mut _0: ();
+ let _1: S;
+ let _3: ();
+ let mut _4: S;
+ let mut _5: S;
++ let mut _6: bool;
+ scope 1 {
+ debug u => _1;
+ let mut _2: S;
+ scope 2 {
+ debug v => _2;
+ }
+ }
+
+ bb0: {
++ _6 = const false;
+ StorageLive(_1);
++ _6 = const true;
+ _1 = S;
+ StorageLive(_2);
+ _2 = S;
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = move _2;
+ _3 = std::mem::drop::<S>(move _4) -> [return: bb1, unwind: bb7];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageLive(_5);
++ _6 = const false;
+ _5 = move _1;
+- drop(_2) -> [return: bb2, unwind: bb3];
++ goto -> bb2;
+ }
+
+ bb2: {
+ _2 = move _5;
+- drop(_5) -> [return: bb4, unwind: bb8];
++ goto -> bb4;
+ }
+
+ bb3 (cleanup): {
+ _2 = move _5;
+- drop(_5) -> [return: bb8, unwind terminate(cleanup)];
++ goto -> bb8;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ _0 = const ();
+ drop(_2) -> [return: bb5, unwind: bb9];
+ }
+
+ bb5: {
+ StorageDead(_2);
+- drop(_1) -> [return: bb6, unwind continue];
++ goto -> bb6;
+ }
+
+ bb6: {
++ _6 = const false;
+ StorageDead(_1);
+ return;
+ }
+
+ bb7 (cleanup): {
+- drop(_4) -> [return: bb8, unwind terminate(cleanup)];
++ goto -> bb8;
+ }
+
+ bb8 (cleanup): {
+- drop(_2) -> [return: bb9, unwind terminate(cleanup)];
++ goto -> bb9;
+ }
+
+ bb9 (cleanup): {
+- drop(_1) -> [return: bb10, unwind terminate(cleanup)];
++ goto -> bb12;
+ }
+
+ bb10 (cleanup): {
+ resume;
++ }
++
++ bb11 (cleanup): {
++ drop(_1) -> [return: bb10, unwind terminate(cleanup)];
++ }
++
++ bb12 (cleanup): {
++ switchInt(_6) -> [0: bb10, otherwise: bb11];
+ }
+ }
+
diff --git a/tests/mir-opt/issue_41697.rs b/tests/mir-opt/issue_41697.rs
index cbd8633a3..92d382c39 100644
--- a/tests/mir-opt/issue_41697.rs
+++ b/tests/mir-opt/issue_41697.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Regression test for #41697. Using dump-mir was triggering
// artificial cycles: during type-checking, we had to get the MIR for
// the constant expressions in `[u8; 2]`, which in turn would trigger
diff --git a/tests/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir b/tests/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir
index 8af087d84..7dafeabaa 100644
--- a/tests/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir
+++ b/tests/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir
@@ -1,20 +1,20 @@
-// MIR for `<impl at $DIR/issue_41697.rs:18:1: 18:23>::{constant#0}` after SimplifyCfg-promote-consts
+// MIR for `<impl at $DIR/issue_41697.rs:19:1: 19:23>::{constant#0}` after SimplifyCfg-promote-consts
-<impl at $DIR/issue_41697.rs:18:1: 18:23>::{constant#0}: usize = {
- let mut _0: usize; // return place in scope 0 at $DIR/issue_41697.rs:+0:19: +0:22
- let mut _1: (usize, bool); // in scope 0 at $DIR/issue_41697.rs:+0:19: +0:22
+<impl at $DIR/issue_41697.rs:19:1: 19:23>::{constant#0}: usize = {
+ let mut _0: usize;
+ let mut _1: (usize, bool);
bb0: {
- _1 = CheckedAdd(const 1_usize, const 1_usize); // scope 0 at $DIR/issue_41697.rs:+0:19: +0:22
- assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 1_usize, const 1_usize) -> [success: bb1, unwind: bb2]; // scope 0 at $DIR/issue_41697.rs:+0:19: +0:22
+ _1 = CheckedAdd(const 1_usize, const 1_usize);
+ assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 1_usize, const 1_usize) -> [success: bb1, unwind: bb2];
}
bb1: {
- _0 = move (_1.0: usize); // scope 0 at $DIR/issue_41697.rs:+0:19: +0:22
- return; // scope 0 at $DIR/issue_41697.rs:+0:19: +0:22
+ _0 = move (_1.0: usize);
+ return;
}
bb2 (cleanup): {
- resume; // scope 0 at $DIR/issue_41697.rs:+0:19: +0:22
+ resume;
}
}
diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.diff
deleted file mode 100644
index 46b450a4e..000000000
--- a/tests/mir-opt/issue_41888.main.ElaborateDrops.diff
+++ /dev/null
@@ -1,151 +0,0 @@
-- // MIR for `main` before ElaborateDrops
-+ // MIR for `main` after ElaborateDrops
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/issue_41888.rs:+0:11: +0:11
- let _1: E; // in scope 0 at $DIR/issue_41888.rs:+1:9: +1:10
- let mut _2: bool; // in scope 0 at $DIR/issue_41888.rs:+2:8: +2:14
- let mut _3: E; // in scope 0 at $DIR/issue_41888.rs:+3:13: +3:20
- let mut _4: K; // in scope 0 at $DIR/issue_41888.rs:+3:18: +3:19
- let mut _5: isize; // in scope 0 at $DIR/issue_41888.rs:+4:16: +4:24
-+ let mut _7: bool; // in scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ let mut _8: bool; // in scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ let mut _9: bool; // in scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ let mut _10: isize; // in scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ let mut _11: isize; // in scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
- scope 1 {
- debug e => _1; // in scope 1 at $DIR/issue_41888.rs:+1:9: +1:10
- scope 2 {
- debug _k => _6; // in scope 2 at $DIR/issue_41888.rs:+4:21: +4:23
- let _6: K; // in scope 2 at $DIR/issue_41888.rs:+4:21: +4:23
- }
- }
-
- bb0: {
-+ _7 = const false; // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10
-+ _8 = const false; // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10
-+ _9 = const false; // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10
- StorageLive(_1); // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10
- StorageLive(_2); // scope 1 at $DIR/issue_41888.rs:+2:8: +2:14
- _2 = cond() -> [return: bb1, unwind: bb11]; // scope 1 at $DIR/issue_41888.rs:+2:8: +2:14
- // mir::Constant
- // + span: $DIR/issue_41888.rs:8:8: 8:12
- // + literal: Const { ty: fn() -> bool {cond}, val: Value(<ZST>) }
- }
-
- bb1: {
- switchInt(move _2) -> [0: bb8, otherwise: bb2]; // scope 1 at $DIR/issue_41888.rs:+2:8: +2:14
- }
-
- bb2: {
- StorageLive(_3); // scope 1 at $DIR/issue_41888.rs:+3:13: +3:20
- StorageLive(_4); // scope 1 at $DIR/issue_41888.rs:+3:18: +3:19
- _4 = K; // scope 1 at $DIR/issue_41888.rs:+3:18: +3:19
- _3 = E::F(move _4); // scope 1 at $DIR/issue_41888.rs:+3:13: +3:20
- StorageDead(_4); // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20
-- drop(_1) -> [return: bb3, unwind: bb4]; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10
-+ goto -> bb3; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10
- }
-
- bb3: {
-+ _7 = const true; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10
-+ _8 = const true; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10
-+ _9 = const true; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10
- _1 = move _3; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10
-- drop(_3) -> [return: bb5, unwind: bb11]; // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20
-+ goto -> bb5; // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20
- }
-
- bb4 (cleanup): {
- _1 = move _3; // scope 1 at $DIR/issue_41888.rs:+3:9: +3:10
- drop(_3) -> [return: bb11, unwind terminate]; // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20
- }
-
- bb5: {
- StorageDead(_3); // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20
- _5 = discriminant(_1); // scope 2 at $DIR/issue_41888.rs:+4:16: +4:24
- switchInt(move _5) -> [0: bb6, otherwise: bb7]; // scope 2 at $DIR/issue_41888.rs:+4:16: +4:24
- }
-
- bb6: {
- StorageLive(_6); // scope 2 at $DIR/issue_41888.rs:+4:21: +4:23
-+ _9 = const false; // scope 2 at $DIR/issue_41888.rs:+4:21: +4:23
- _6 = move ((_1 as F).0: K); // scope 2 at $DIR/issue_41888.rs:+4:21: +4:23
- _0 = const (); // scope 2 at $DIR/issue_41888.rs:+4:29: +7:10
- StorageDead(_6); // scope 1 at $DIR/issue_41888.rs:+7:9: +7:10
- goto -> bb9; // scope 1 at $DIR/issue_41888.rs:+4:9: +7:10
- }
-
- bb7: {
- _0 = const (); // scope 1 at $DIR/issue_41888.rs:+7:10: +7:10
- goto -> bb9; // scope 1 at $DIR/issue_41888.rs:+4:9: +7:10
- }
-
- bb8: {
- _0 = const (); // scope 1 at $DIR/issue_41888.rs:+8:6: +8:6
- goto -> bb9; // scope 1 at $DIR/issue_41888.rs:+2:5: +8:6
- }
-
- bb9: {
- StorageDead(_2); // scope 1 at $DIR/issue_41888.rs:+8:5: +8:6
-- drop(_1) -> bb10; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ goto -> bb19; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
- }
-
- bb10: {
-+ _7 = const false; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ _8 = const false; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ _9 = const false; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
- StorageDead(_1); // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
- return; // scope 0 at $DIR/issue_41888.rs:+9:2: +9:2
- }
-
- bb11 (cleanup): {
-- drop(_1) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ goto -> bb12; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
- }
-
- bb12 (cleanup): {
- resume; // scope 0 at $DIR/issue_41888.rs:+0:1: +9:2
-+ }
-+
-+ bb13 (cleanup): {
-+ unreachable; // scope 0 at $DIR/issue_41888.rs:+0:1: +9:2
-+ }
-+
-+ bb14: {
-+ _7 = const false; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ goto -> bb10; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ }
-+
-+ bb15 (cleanup): {
-+ goto -> bb12; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ }
-+
-+ bb16: {
-+ drop(_1) -> [return: bb14, unwind: bb12]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ }
-+
-+ bb17 (cleanup): {
-+ drop(_1) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ }
-+
-+ bb18: {
-+ _10 = discriminant(_1); // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ switchInt(move _10) -> [0: bb14, otherwise: bb16]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ }
-+
-+ bb19: {
-+ switchInt(_7) -> [0: bb14, otherwise: bb18]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ }
-+
-+ bb20 (cleanup): {
-+ _11 = discriminant(_1); // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ switchInt(move _11) -> [0: bb15, otherwise: bb17]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
-+ }
-+
-+ bb21 (cleanup): {
-+ switchInt(_7) -> [0: bb12, otherwise: bb20]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2
- }
- }
-
diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff
new file mode 100644
index 000000000..55d2629a5
--- /dev/null
+++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff
@@ -0,0 +1,147 @@
+- // MIR for `main` before ElaborateDrops
++ // MIR for `main` after ElaborateDrops
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: E;
+ let mut _2: bool;
+ let mut _3: E;
+ let mut _4: K;
+ let mut _5: isize;
++ let mut _7: bool;
++ let mut _8: bool;
++ let mut _9: isize;
++ let mut _10: isize;
+ scope 1 {
+ debug e => _1;
+ scope 2 {
+ debug _k => _6;
+ let _6: K;
+ }
+ }
+
+ bb0: {
++ _7 = const false;
++ _8 = const false;
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = cond() -> [return: bb1, unwind: bb11];
+ }
+
+ bb1: {
+ switchInt(move _2) -> [0: bb8, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = K;
+ _3 = E::F(move _4);
+ StorageDead(_4);
+- drop(_1) -> [return: bb3, unwind: bb4];
++ goto -> bb3;
+ }
+
+ bb3: {
++ _7 = const true;
++ _8 = const true;
+ _1 = move _3;
+- drop(_3) -> [return: bb5, unwind: bb11];
++ goto -> bb5;
+ }
+
+ bb4 (cleanup): {
++ _7 = const true;
++ _8 = const true;
+ _1 = move _3;
+- drop(_3) -> [return: bb11, unwind terminate(cleanup)];
++ goto -> bb11;
+ }
+
+ bb5: {
+ StorageDead(_3);
+ PlaceMention(_1);
+ _5 = discriminant(_1);
+ switchInt(move _5) -> [0: bb6, otherwise: bb7];
+ }
+
+ bb6: {
+ StorageLive(_6);
+ _6 = move ((_1 as F).0: K);
+ _0 = const ();
+ StorageDead(_6);
+ goto -> bb9;
+ }
+
+ bb7: {
+ _0 = const ();
+ goto -> bb9;
+ }
+
+ bb8: {
+ _0 = const ();
+ goto -> bb9;
+ }
+
+ bb9: {
+ StorageDead(_2);
+- drop(_1) -> [return: bb10, unwind: bb12];
++ goto -> bb19;
+ }
+
+ bb10: {
++ _7 = const false;
++ _8 = const false;
+ StorageDead(_1);
+ return;
+ }
+
+ bb11 (cleanup): {
+- drop(_1) -> [return: bb12, unwind terminate(cleanup)];
++ goto -> bb12;
+ }
+
+ bb12 (cleanup): {
+ resume;
++ }
++
++ bb13: {
++ _7 = const false;
++ goto -> bb10;
++ }
++
++ bb14 (cleanup): {
++ drop(((_1 as F).0: K)) -> [return: bb12, unwind terminate(cleanup)];
++ }
++
++ bb15 (cleanup): {
++ switchInt(_7) -> [0: bb12, otherwise: bb14];
++ }
++
++ bb16: {
++ drop(_1) -> [return: bb13, unwind: bb12];
++ }
++
++ bb17 (cleanup): {
++ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
++ }
++
++ bb18: {
++ _9 = discriminant(_1);
++ switchInt(move _9) -> [0: bb13, otherwise: bb16];
++ }
++
++ bb19: {
++ switchInt(_7) -> [0: bb13, otherwise: bb18];
++ }
++
++ bb20 (cleanup): {
++ _10 = discriminant(_1);
++ switchInt(move _10) -> [0: bb15, otherwise: bb17];
++ }
++
++ bb21 (cleanup): {
++ switchInt(_7) -> [0: bb12, otherwise: bb20];
+ }
+ }
+
diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff
new file mode 100644
index 000000000..c731b5646
--- /dev/null
+++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff
@@ -0,0 +1,147 @@
+- // MIR for `main` before ElaborateDrops
++ // MIR for `main` after ElaborateDrops
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: E;
+ let mut _2: bool;
+ let mut _3: E;
+ let mut _4: K;
+ let mut _5: isize;
++ let mut _7: bool;
++ let mut _8: bool;
++ let mut _9: isize;
++ let mut _10: isize;
+ scope 1 {
+ debug e => _1;
+ scope 2 {
+ debug _k => _6;
+ let _6: K;
+ }
+ }
+
+ bb0: {
++ _7 = const false;
++ _8 = const false;
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = cond() -> [return: bb1, unwind: bb11];
+ }
+
+ bb1: {
+ switchInt(move _2) -> [0: bb8, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = K;
+ _3 = E::F(move _4);
+ StorageDead(_4);
+- drop(_1) -> [return: bb3, unwind: bb4];
++ goto -> bb3;
+ }
+
+ bb3: {
++ _7 = const true;
++ _8 = const true;
+ _1 = move _3;
+- drop(_3) -> [return: bb5, unwind: bb11];
++ goto -> bb5;
+ }
+
+ bb4 (cleanup): {
++ _7 = const true;
++ _8 = const true;
+ _1 = move _3;
+- drop(_3) -> [return: bb11, unwind terminate(cleanup)];
++ goto -> bb11;
+ }
+
+ bb5: {
+ StorageDead(_3);
+ PlaceMention(_1);
+ _5 = discriminant(_1);
+ switchInt(move _5) -> [0: bb6, otherwise: bb7];
+ }
+
+ bb6: {
+ StorageLive(_6);
+ _6 = move ((_1 as F).0: K);
+ _0 = const ();
+ StorageDead(_6);
+ goto -> bb9;
+ }
+
+ bb7: {
+ _0 = const ();
+ goto -> bb9;
+ }
+
+ bb8: {
+ _0 = const ();
+ goto -> bb9;
+ }
+
+ bb9: {
+ StorageDead(_2);
+- drop(_1) -> [return: bb10, unwind continue];
++ goto -> bb19;
+ }
+
+ bb10: {
++ _7 = const false;
++ _8 = const false;
+ StorageDead(_1);
+ return;
+ }
+
+ bb11 (cleanup): {
+- drop(_1) -> [return: bb12, unwind terminate(cleanup)];
++ goto -> bb12;
+ }
+
+ bb12 (cleanup): {
+ resume;
++ }
++
++ bb13: {
++ _7 = const false;
++ goto -> bb10;
++ }
++
++ bb14 (cleanup): {
++ drop(((_1 as F).0: K)) -> [return: bb12, unwind terminate(cleanup)];
++ }
++
++ bb15 (cleanup): {
++ switchInt(_7) -> [0: bb12, otherwise: bb14];
++ }
++
++ bb16: {
++ drop(_1) -> [return: bb13, unwind: bb12];
++ }
++
++ bb17 (cleanup): {
++ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
++ }
++
++ bb18: {
++ _9 = discriminant(_1);
++ switchInt(move _9) -> [0: bb13, otherwise: bb16];
++ }
++
++ bb19: {
++ switchInt(_7) -> [0: bb13, otherwise: bb18];
++ }
++
++ bb20 (cleanup): {
++ _10 = discriminant(_1);
++ switchInt(move _10) -> [0: bb15, otherwise: bb17];
++ }
++
++ bb21 (cleanup): {
++ switchInt(_7) -> [0: bb12, otherwise: bb20];
+ }
+ }
+
diff --git a/tests/mir-opt/issue_41888.rs b/tests/mir-opt/issue_41888.rs
index 0f10c0a1d..70b202186 100644
--- a/tests/mir-opt/issue_41888.rs
+++ b/tests/mir-opt/issue_41888.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32-bare compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// check that we clear the "ADT master drop flag" even when there are
// no fields to be dropped.
diff --git a/tests/mir-opt/issue_62289.rs b/tests/mir-opt/issue_62289.rs
index af1bfea3f..40e8352cf 100644
--- a/tests/mir-opt/issue_62289.rs
+++ b/tests/mir-opt/issue_62289.rs
@@ -1,6 +1,7 @@
+// skip-filecheck
// check that we don't forget to drop the Box if we early return before
// initializing it
-// ignore-wasm32-bare compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![feature(rustc_attrs)]
diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.mir
deleted file mode 100644
index 8ed910150..000000000
--- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.mir
+++ /dev/null
@@ -1,122 +0,0 @@
-// MIR for `test` before ElaborateDrops
-
-fn test() -> Option<Box<u32>> {
- let mut _0: std::option::Option<std::boxed::Box<u32>>; // return place in scope 0 at $DIR/issue_62289.rs:+0:14: +0:30
- let mut _1: std::boxed::Box<u32>; // in scope 0 at $DIR/issue_62289.rs:+3:9: +3:24
- let mut _2: usize; // in scope 0 at $DIR/issue_62289.rs:+3:9: +3:24
- let mut _3: usize; // in scope 0 at $DIR/issue_62289.rs:+3:9: +3:24
- let mut _4: *mut u8; // in scope 0 at $DIR/issue_62289.rs:+3:9: +3:24
- let mut _5: std::boxed::Box<u32>; // in scope 0 at $DIR/issue_62289.rs:+3:9: +3:24
- let mut _6: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, u32>; // in scope 0 at $DIR/issue_62289.rs:+3:18: +3:23
- let mut _7: std::option::Option<u32>; // in scope 0 at $DIR/issue_62289.rs:+3:18: +3:22
- let mut _8: isize; // in scope 0 at $DIR/issue_62289.rs:+3:22: +3:23
- let _9: std::option::Option<std::convert::Infallible>; // in scope 0 at $DIR/issue_62289.rs:+3:22: +3:23
- let mut _10: !; // in scope 0 at $DIR/issue_62289.rs:+3:22: +3:23
- let mut _11: std::option::Option<std::convert::Infallible>; // in scope 0 at $DIR/issue_62289.rs:+3:22: +3:23
- let _12: u32; // in scope 0 at $DIR/issue_62289.rs:+3:18: +3:23
- scope 1 {
- }
- scope 2 {
- debug residual => _9; // in scope 2 at $DIR/issue_62289.rs:+3:22: +3:23
- scope 3 {
- }
- }
- scope 4 {
- debug val => _12; // in scope 4 at $DIR/issue_62289.rs:+3:18: +3:23
- scope 5 {
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/issue_62289.rs:+3:9: +3:24
- _2 = SizeOf(u32); // scope 1 at $DIR/issue_62289.rs:+3:9: +3:24
- _3 = AlignOf(u32); // scope 1 at $DIR/issue_62289.rs:+3:9: +3:24
- _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; // scope 1 at $DIR/issue_62289.rs:+3:9: +3:24
- // mir::Constant
- // + span: $DIR/issue_62289.rs:11:9: 11:24
- // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageLive(_5); // scope 0 at $DIR/issue_62289.rs:+3:9: +3:24
- _5 = ShallowInitBox(move _4, u32); // scope 0 at $DIR/issue_62289.rs:+3:9: +3:24
- StorageLive(_6); // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23
- StorageLive(_7); // scope 0 at $DIR/issue_62289.rs:+3:18: +3:22
- _7 = Option::<u32>::None; // scope 0 at $DIR/issue_62289.rs:+3:18: +3:22
- _6 = <Option<u32> as Try>::branch(move _7) -> [return: bb2, unwind: bb12]; // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23
- // mir::Constant
- // + span: $DIR/issue_62289.rs:11:18: 11:23
- // + literal: Const { ty: fn(Option<u32>) -> ControlFlow<<Option<u32> as Try>::Residual, <Option<u32> as Try>::Output> {<Option<u32> as Try>::branch}, val: Value(<ZST>) }
- }
-
- bb2: {
- StorageDead(_7); // scope 0 at $DIR/issue_62289.rs:+3:22: +3:23
- _8 = discriminant(_6); // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23
- switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4]; // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23
- }
-
- bb3: {
- StorageLive(_12); // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23
- _12 = ((_6 as Continue).0: u32); // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23
- (*_5) = _12; // scope 5 at $DIR/issue_62289.rs:+3:18: +3:23
- StorageDead(_12); // scope 0 at $DIR/issue_62289.rs:+3:22: +3:23
- _1 = move _5; // scope 0 at $DIR/issue_62289.rs:+3:9: +3:24
- drop(_5) -> [return: bb7, unwind: bb11]; // scope 0 at $DIR/issue_62289.rs:+3:23: +3:24
- }
-
- bb4: {
- unreachable; // scope 0 at $DIR/issue_62289.rs:+3:18: +3:23
- }
-
- bb5: {
- StorageLive(_9); // scope 0 at $DIR/issue_62289.rs:+3:22: +3:23
- _9 = ((_6 as Break).0: std::option::Option<std::convert::Infallible>); // scope 0 at $DIR/issue_62289.rs:+3:22: +3:23
- StorageLive(_11); // scope 3 at $DIR/issue_62289.rs:+3:22: +3:23
- _11 = _9; // scope 3 at $DIR/issue_62289.rs:+3:22: +3:23
- _0 = <Option<Box<u32>> as FromResidual<Option<Infallible>>>::from_residual(move _11) -> [return: bb6, unwind: bb12]; // scope 3 at $DIR/issue_62289.rs:+3:18: +3:23
- // mir::Constant
- // + span: $DIR/issue_62289.rs:11:22: 11:23
- // + literal: Const { ty: fn(Option<Infallible>) -> Option<Box<u32>> {<Option<Box<u32>> as FromResidual<Option<Infallible>>>::from_residual}, val: Value(<ZST>) }
- }
-
- bb6: {
- StorageDead(_11); // scope 3 at $DIR/issue_62289.rs:+3:22: +3:23
- StorageDead(_9); // scope 0 at $DIR/issue_62289.rs:+3:22: +3:23
- drop(_5) -> bb9; // scope 0 at $DIR/issue_62289.rs:+3:23: +3:24
- }
-
- bb7: {
- StorageDead(_5); // scope 0 at $DIR/issue_62289.rs:+3:23: +3:24
- _0 = Option::<Box<u32>>::Some(move _1); // scope 0 at $DIR/issue_62289.rs:+1:5: +4:6
- drop(_1) -> bb8; // scope 0 at $DIR/issue_62289.rs:+4:5: +4:6
- }
-
- bb8: {
- StorageDead(_1); // scope 0 at $DIR/issue_62289.rs:+4:5: +4:6
- StorageDead(_6); // scope 0 at $DIR/issue_62289.rs:+5:1: +5:2
- goto -> bb10; // scope 0 at $DIR/issue_62289.rs:+5:2: +5:2
- }
-
- bb9: {
- StorageDead(_5); // scope 0 at $DIR/issue_62289.rs:+3:23: +3:24
- StorageDead(_1); // scope 0 at $DIR/issue_62289.rs:+4:5: +4:6
- StorageDead(_6); // scope 0 at $DIR/issue_62289.rs:+5:1: +5:2
- goto -> bb10; // scope 0 at $DIR/issue_62289.rs:+5:2: +5:2
- }
-
- bb10: {
- return; // scope 0 at $DIR/issue_62289.rs:+5:2: +5:2
- }
-
- bb11 (cleanup): {
- drop(_1) -> [return: bb13, unwind terminate]; // scope 0 at $DIR/issue_62289.rs:+4:5: +4:6
- }
-
- bb12 (cleanup): {
- drop(_5) -> [return: bb13, unwind terminate]; // scope 0 at $DIR/issue_62289.rs:+3:23: +3:24
- }
-
- bb13 (cleanup): {
- resume; // scope 0 at $DIR/issue_62289.rs:+0:1: +5:2
- }
-}
diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir
new file mode 100644
index 000000000..fadfdfc87
--- /dev/null
+++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir
@@ -0,0 +1,114 @@
+// MIR for `test` before ElaborateDrops
+
+fn test() -> Option<Box<u32>> {
+ let mut _0: std::option::Option<std::boxed::Box<u32>>;
+ let mut _1: std::boxed::Box<u32>;
+ let mut _2: usize;
+ let mut _3: usize;
+ let mut _4: *mut u8;
+ let mut _5: std::boxed::Box<u32>;
+ let mut _6: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, u32>;
+ let mut _7: std::option::Option<u32>;
+ let mut _8: isize;
+ let _9: std::option::Option<std::convert::Infallible>;
+ let mut _10: !;
+ let mut _11: std::option::Option<std::convert::Infallible>;
+ let _12: u32;
+ scope 1 {
+ }
+ scope 2 {
+ debug residual => _9;
+ scope 3 {
+ }
+ }
+ scope 4 {
+ debug val => _12;
+ scope 5 {
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _2 = SizeOf(u32);
+ _3 = AlignOf(u32);
+ _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind: bb13];
+ }
+
+ bb1: {
+ StorageLive(_5);
+ _5 = ShallowInitBox(move _4, u32);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = Option::<u32>::None;
+ _6 = <Option<u32> as Try>::branch(move _7) -> [return: bb2, unwind: bb12];
+ }
+
+ bb2: {
+ StorageDead(_7);
+ PlaceMention(_6);
+ _8 = discriminant(_6);
+ switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4];
+ }
+
+ bb3: {
+ StorageLive(_12);
+ _12 = ((_6 as Continue).0: u32);
+ (*_5) = _12;
+ StorageDead(_12);
+ _1 = move _5;
+ drop(_5) -> [return: bb7, unwind: bb11];
+ }
+
+ bb4: {
+ unreachable;
+ }
+
+ bb5: {
+ StorageLive(_9);
+ _9 = ((_6 as Break).0: std::option::Option<std::convert::Infallible>);
+ StorageLive(_11);
+ _11 = _9;
+ _0 = <Option<Box<u32>> as FromResidual<Option<Infallible>>>::from_residual(move _11) -> [return: bb6, unwind: bb12];
+ }
+
+ bb6: {
+ StorageDead(_11);
+ StorageDead(_9);
+ drop(_5) -> [return: bb9, unwind: bb13];
+ }
+
+ bb7: {
+ StorageDead(_5);
+ _0 = Option::<Box<u32>>::Some(move _1);
+ drop(_1) -> [return: bb8, unwind: bb13];
+ }
+
+ bb8: {
+ StorageDead(_1);
+ StorageDead(_6);
+ goto -> bb10;
+ }
+
+ bb9: {
+ StorageDead(_5);
+ StorageDead(_1);
+ StorageDead(_6);
+ goto -> bb10;
+ }
+
+ bb10: {
+ return;
+ }
+
+ bb11 (cleanup): {
+ drop(_1) -> [return: bb13, unwind terminate(cleanup)];
+ }
+
+ bb12 (cleanup): {
+ drop(_5) -> [return: bb13, unwind terminate(cleanup)];
+ }
+
+ bb13 (cleanup): {
+ resume;
+ }
+}
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
new file mode 100644
index 000000000..8f94165a1
--- /dev/null
+++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir
@@ -0,0 +1,114 @@
+// MIR for `test` before ElaborateDrops
+
+fn test() -> Option<Box<u32>> {
+ let mut _0: std::option::Option<std::boxed::Box<u32>>;
+ let mut _1: std::boxed::Box<u32>;
+ let mut _2: usize;
+ let mut _3: usize;
+ let mut _4: *mut u8;
+ let mut _5: std::boxed::Box<u32>;
+ let mut _6: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, u32>;
+ let mut _7: std::option::Option<u32>;
+ let mut _8: isize;
+ let _9: std::option::Option<std::convert::Infallible>;
+ let mut _10: !;
+ let mut _11: std::option::Option<std::convert::Infallible>;
+ let _12: u32;
+ scope 1 {
+ }
+ scope 2 {
+ debug residual => _9;
+ scope 3 {
+ }
+ }
+ scope 4 {
+ debug val => _12;
+ scope 5 {
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _2 = SizeOf(u32);
+ _3 = AlignOf(u32);
+ _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageLive(_5);
+ _5 = ShallowInitBox(move _4, u32);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = Option::<u32>::None;
+ _6 = <Option<u32> as Try>::branch(move _7) -> [return: bb2, unwind: bb12];
+ }
+
+ bb2: {
+ StorageDead(_7);
+ PlaceMention(_6);
+ _8 = discriminant(_6);
+ switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4];
+ }
+
+ bb3: {
+ StorageLive(_12);
+ _12 = ((_6 as Continue).0: u32);
+ (*_5) = _12;
+ StorageDead(_12);
+ _1 = move _5;
+ drop(_5) -> [return: bb7, unwind: bb11];
+ }
+
+ bb4: {
+ unreachable;
+ }
+
+ bb5: {
+ StorageLive(_9);
+ _9 = ((_6 as Break).0: std::option::Option<std::convert::Infallible>);
+ StorageLive(_11);
+ _11 = _9;
+ _0 = <Option<Box<u32>> as FromResidual<Option<Infallible>>>::from_residual(move _11) -> [return: bb6, unwind: bb12];
+ }
+
+ bb6: {
+ StorageDead(_11);
+ StorageDead(_9);
+ drop(_5) -> [return: bb9, unwind continue];
+ }
+
+ bb7: {
+ StorageDead(_5);
+ _0 = Option::<Box<u32>>::Some(move _1);
+ drop(_1) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+ StorageDead(_1);
+ StorageDead(_6);
+ goto -> bb10;
+ }
+
+ bb9: {
+ StorageDead(_5);
+ StorageDead(_1);
+ StorageDead(_6);
+ goto -> bb10;
+ }
+
+ bb10: {
+ return;
+ }
+
+ bb11 (cleanup): {
+ drop(_1) -> [return: bb13, unwind terminate(cleanup)];
+ }
+
+ bb12 (cleanup): {
+ drop(_5) -> [return: bb13, unwind terminate(cleanup)];
+ }
+
+ bb13 (cleanup): {
+ resume;
+ }
+}
diff --git a/tests/mir-opt/issue_72181.bar.built.after.mir b/tests/mir-opt/issue_72181.bar.built.after.mir
index ebee89001..c2e4e2072 100644
--- a/tests/mir-opt/issue_72181.bar.built.after.mir
+++ b/tests/mir-opt/issue_72181.bar.built.after.mir
@@ -1,17 +1,17 @@
// MIR for `bar` after built
fn bar(_1: [(Never, u32); 1]) -> u32 {
- let mut _0: u32; // return place in scope 0 at $DIR/issue_72181.rs:+0:40: +0:43
- let _2: u32; // in scope 0 at $DIR/issue_72181.rs:+0:13: +0:14
+ let mut _0: u32;
+ let _2: u32;
scope 1 {
- debug x => _2; // in scope 1 at $DIR/issue_72181.rs:+0:13: +0:14
+ debug x => _2;
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_72181.rs:+0:13: +0:14
- _2 = (_1[0 of 1].1: u32); // scope 0 at $DIR/issue_72181.rs:+0:13: +0:14
- _0 = _2; // scope 1 at $DIR/issue_72181.rs:+0:46: +0:47
- StorageDead(_2); // scope 0 at $DIR/issue_72181.rs:+0:48: +0:49
- return; // scope 0 at $DIR/issue_72181.rs:+0:49: +0:49
+ StorageLive(_2);
+ _2 = (_1[0 of 1].1: u32);
+ _0 = _2;
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/issue_72181.foo.built.after.mir b/tests/mir-opt/issue_72181.foo.built.after.mir
index 90c978520..f78942cc5 100644
--- a/tests/mir-opt/issue_72181.foo.built.after.mir
+++ b/tests/mir-opt/issue_72181.foo.built.after.mir
@@ -1,27 +1,27 @@
// MIR for `foo` after built
fn foo(_1: [(Never, u32); 1]) -> u32 {
- debug xs => _1; // in scope 0 at $DIR/issue_72181.rs:+0:8: +0:10
- let mut _0: u32; // return place in scope 0 at $DIR/issue_72181.rs:+0:34: +0:37
- let _2: usize; // in scope 0 at $DIR/issue_72181.rs:+0:43: +0:44
- let mut _3: usize; // in scope 0 at $DIR/issue_72181.rs:+0:40: +0:45
- let mut _4: bool; // in scope 0 at $DIR/issue_72181.rs:+0:40: +0:45
+ debug xs => _1;
+ let mut _0: u32;
+ let _2: usize;
+ let mut _3: usize;
+ let mut _4: bool;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_72181.rs:+0:43: +0:44
- _2 = const 0_usize; // scope 0 at $DIR/issue_72181.rs:+0:43: +0:44
- _3 = Len(_1); // scope 0 at $DIR/issue_72181.rs:+0:40: +0:45
- _4 = Lt(_2, _3); // scope 0 at $DIR/issue_72181.rs:+0:40: +0:45
- assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, _2) -> [success: bb1, unwind: bb2]; // scope 0 at $DIR/issue_72181.rs:+0:40: +0:45
+ StorageLive(_2);
+ _2 = const 0_usize;
+ _3 = Len(_1);
+ _4 = Lt(_2, _3);
+ assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, _2) -> [success: bb1, unwind: bb2];
}
bb1: {
- _0 = (_1[_2].1: u32); // scope 0 at $DIR/issue_72181.rs:+0:40: +0:47
- StorageDead(_2); // scope 0 at $DIR/issue_72181.rs:+0:48: +0:49
- return; // scope 0 at $DIR/issue_72181.rs:+0:49: +0:49
+ _0 = (_1[_2].1: u32);
+ StorageDead(_2);
+ return;
}
bb2 (cleanup): {
- resume; // scope 0 at $DIR/issue_72181.rs:+0:1: +0:49
+ resume;
}
}
diff --git a/tests/mir-opt/issue_72181.main.built.after.mir b/tests/mir-opt/issue_72181.main.built.after.mir
index 724e55e17..4e4071536 100644
--- a/tests/mir-opt/issue_72181.main.built.after.mir
+++ b/tests/mir-opt/issue_72181.main.built.after.mir
@@ -1,18 +1,18 @@
// MIR for `main` after built
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/issue_72181.rs:+0:11: +0:11
- let mut _1: usize; // in scope 0 at $DIR/issue_72181.rs:+1:13: +1:34
- let mut _3: Foo; // in scope 0 at $DIR/issue_72181.rs:+3:14: +3:27
- let mut _4: Foo; // in scope 0 at $DIR/issue_72181.rs:+3:29: +3:42
- let mut _5: u64; // in scope 0 at $DIR/issue_72181.rs:+4:13: +4:30
- let _6: usize; // in scope 0 at $DIR/issue_72181.rs:+4:24: +4:25
- let mut _7: usize; // in scope 0 at $DIR/issue_72181.rs:+4:22: +4:26
- let mut _8: bool; // in scope 0 at $DIR/issue_72181.rs:+4:22: +4:26
+ let mut _0: ();
+ let mut _1: usize;
+ let mut _3: Foo;
+ let mut _4: Foo;
+ let mut _5: u64;
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: bool;
scope 1 {
- let _2: [Foo; 2]; // in scope 1 at $DIR/issue_72181.rs:+3:9: +3:10
+ let _2: [Foo; 2];
scope 2 {
- debug f => _2; // in scope 2 at $DIR/issue_72181.rs:+3:9: +3:10
+ debug f => _2;
scope 3 {
}
scope 4 {
@@ -21,44 +21,41 @@ fn main() -> () {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/issue_72181.rs:+1:13: +1:34
- _1 = std::mem::size_of::<Foo>() -> [return: bb1, unwind: bb3]; // scope 0 at $DIR/issue_72181.rs:+1:13: +1:34
- // mir::Constant
- // + span: $DIR/issue_72181.rs:24:13: 24:32
- // + literal: Const { ty: fn() -> usize {std::mem::size_of::<Foo>}, val: Value(<ZST>) }
+ StorageLive(_1);
+ _1 = std::mem::size_of::<Foo>() -> [return: bb1, unwind: bb3];
}
bb1: {
- PlaceMention(_1); // scope 0 at $DIR/issue_72181.rs:+1:13: +1:34
- StorageDead(_1); // scope 0 at $DIR/issue_72181.rs:+1:34: +1:35
- StorageLive(_2); // scope 1 at $DIR/issue_72181.rs:+3:9: +3:10
- StorageLive(_3); // scope 1 at $DIR/issue_72181.rs:+3:14: +3:27
- _3 = Foo { a: const 42_u64 }; // scope 1 at $DIR/issue_72181.rs:+3:14: +3:27
- StorageLive(_4); // scope 1 at $DIR/issue_72181.rs:+3:29: +3:42
- _4 = Foo { a: const 10_u64 }; // scope 1 at $DIR/issue_72181.rs:+3:29: +3:42
- _2 = [move _3, move _4]; // scope 1 at $DIR/issue_72181.rs:+3:13: +3:43
- StorageDead(_4); // scope 1 at $DIR/issue_72181.rs:+3:42: +3:43
- StorageDead(_3); // scope 1 at $DIR/issue_72181.rs:+3:42: +3:43
- FakeRead(ForLet(None), _2); // scope 1 at $DIR/issue_72181.rs:+3:9: +3:10
- StorageLive(_5); // scope 2 at $DIR/issue_72181.rs:+4:13: +4:30
- StorageLive(_6); // scope 4 at $DIR/issue_72181.rs:+4:24: +4:25
- _6 = const 0_usize; // scope 4 at $DIR/issue_72181.rs:+4:24: +4:25
- _7 = Len(_2); // scope 4 at $DIR/issue_72181.rs:+4:22: +4:26
- _8 = Lt(_6, _7); // scope 4 at $DIR/issue_72181.rs:+4:22: +4:26
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb2, unwind: bb3]; // scope 4 at $DIR/issue_72181.rs:+4:22: +4:26
+ PlaceMention(_1);
+ StorageDead(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = Foo { a: const 42_u64 };
+ StorageLive(_4);
+ _4 = Foo { a: const 10_u64 };
+ _2 = [move _3, move _4];
+ StorageDead(_4);
+ StorageDead(_3);
+ FakeRead(ForLet(None), _2);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = const 0_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: bb2, unwind: bb3];
}
bb2: {
- _5 = (_2[_6].0: u64); // scope 4 at $DIR/issue_72181.rs:+4:22: +4:28
- PlaceMention(_5); // scope 2 at $DIR/issue_72181.rs:+4:13: +4:30
- StorageDead(_6); // scope 2 at $DIR/issue_72181.rs:+4:30: +4:31
- StorageDead(_5); // scope 2 at $DIR/issue_72181.rs:+4:30: +4:31
- _0 = const (); // scope 0 at $DIR/issue_72181.rs:+0:11: +5:2
- StorageDead(_2); // scope 1 at $DIR/issue_72181.rs:+5:1: +5:2
- return; // scope 0 at $DIR/issue_72181.rs:+5:2: +5:2
+ _5 = (_2[_6].0: u64);
+ PlaceMention(_5);
+ StorageDead(_6);
+ StorageDead(_5);
+ _0 = const ();
+ StorageDead(_2);
+ return;
}
bb3 (cleanup): {
- resume; // scope 0 at $DIR/issue_72181.rs:+0:1: +5:2
+ resume;
}
}
diff --git a/tests/mir-opt/issue_72181.rs b/tests/mir-opt/issue_72181.rs
index 6a32d4bbe..226709bab 100644
--- a/tests/mir-opt/issue_72181.rs
+++ b/tests/mir-opt/issue_72181.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z mir-opt-level=1
// Regression test for #72181, this ICE requires `-Z mir-opt-level=1` flags.
diff --git a/tests/mir-opt/issue_72181_1.f.built.after.mir b/tests/mir-opt/issue_72181_1.f.built.after.mir
index 25f472251..89da9a801 100644
--- a/tests/mir-opt/issue_72181_1.f.built.after.mir
+++ b/tests/mir-opt/issue_72181_1.f.built.after.mir
@@ -1,15 +1,16 @@
// MIR for `f` after built
fn f(_1: Void) -> ! {
- debug v => _1; // in scope 0 at $DIR/issue_72181_1.rs:+0:6: +0:7
- let mut _0: !; // return place in scope 0 at $DIR/issue_72181_1.rs:+0:18: +0:19
+ debug v => _1;
+ let mut _0: !;
bb0: {
- FakeRead(ForMatchedPlace(None), _1); // scope 0 at $DIR/issue_72181_1.rs:+1:11: +1:12
- unreachable; // scope 0 at $DIR/issue_72181_1.rs:+1:11: +1:12
+ PlaceMention(_1);
+ FakeRead(ForMatchedPlace(None), _1);
+ unreachable;
}
bb1: {
- return; // scope 0 at $DIR/issue_72181_1.rs:+2:2: +2:2
+ return;
}
}
diff --git a/tests/mir-opt/issue_72181_1.main.built.after.mir b/tests/mir-opt/issue_72181_1.main.built.after.mir
index e1d896cbc..d35aada95 100644
--- a/tests/mir-opt/issue_72181_1.main.built.after.mir
+++ b/tests/mir-opt/issue_72181_1.main.built.after.mir
@@ -1,57 +1,51 @@
// MIR for `main` after built
| User Type Annotations
-| 0: user_ty: Canonical { value: Ty(Void), max_universe: U0, variables: [] }, span: $DIR/issue_72181_1.rs:16:12: 16:16, inferred_ty: Void
-| 1: user_ty: Canonical { value: Ty(Void), max_universe: U0, variables: [] }, span: $DIR/issue_72181_1.rs:16:12: 16:16, inferred_ty: Void
+| 0: user_ty: Canonical { value: Ty(Void), max_universe: U0, variables: [] }, span: $DIR/issue_72181_1.rs:17:12: 17:16, inferred_ty: Void
+| 1: user_ty: Canonical { value: Ty(Void), max_universe: U0, variables: [] }, span: $DIR/issue_72181_1.rs:17:12: 17:16, inferred_ty: Void
|
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/issue_72181_1.rs:+0:11: +0:11
- let mut _1: !; // in scope 0 at $DIR/issue_72181_1.rs:+0:11: +6:2
- let _2: Void as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/issue_72181_1.rs:+1:9: +1:10
- let mut _3: (); // in scope 0 at $DIR/issue_72181_1.rs:+2:41: +2:43
- let _4: !; // in scope 0 at $DIR/issue_72181_1.rs:+5:5: +5:9
- let mut _5: Void; // in scope 0 at $DIR/issue_72181_1.rs:+5:7: +5:8
+ let mut _0: ();
+ let mut _1: !;
+ let _2: Void as UserTypeProjection { base: UserType(0), projs: [] };
+ let mut _3: ();
+ let _4: !;
+ let mut _5: Void;
scope 1 {
- debug v => _2; // in scope 1 at $DIR/issue_72181_1.rs:+1:9: +1:10
+ debug v => _2;
}
scope 2 {
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_72181_1.rs:+1:9: +1:10
- StorageLive(_3); // scope 2 at $DIR/issue_72181_1.rs:+2:41: +2:43
- _3 = (); // scope 2 at $DIR/issue_72181_1.rs:+2:41: +2:43
- _2 = transmute::<(), Void>(move _3) -> bb4; // scope 2 at $DIR/issue_72181_1.rs:+2:9: +2:44
- // mir::Constant
- // + span: $DIR/issue_72181_1.rs:17:9: 17:40
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(()) -> Void {transmute::<(), Void>}, val: Value(<ZST>) }
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = ();
+ _2 = transmute::<(), Void>(move _3) -> bb4;
}
bb1: {
- StorageDead(_3); // scope 2 at $DIR/issue_72181_1.rs:+2:43: +2:44
- FakeRead(ForLet(None), _2); // scope 0 at $DIR/issue_72181_1.rs:+1:9: +1:10
- AscribeUserType(_2, o, UserTypeProjection { base: UserType(1), projs: [] }); // scope 0 at $DIR/issue_72181_1.rs:+1:12: +1:16
- StorageLive(_4); // scope 1 at $DIR/issue_72181_1.rs:+5:5: +5:9
- StorageLive(_5); // scope 1 at $DIR/issue_72181_1.rs:+5:7: +5:8
- _5 = move _2; // scope 1 at $DIR/issue_72181_1.rs:+5:7: +5:8
- _4 = f(move _5) -> bb4; // scope 1 at $DIR/issue_72181_1.rs:+5:5: +5:9
- // mir::Constant
- // + span: $DIR/issue_72181_1.rs:20:5: 20:6
- // + literal: Const { ty: fn(Void) -> ! {f}, val: Value(<ZST>) }
+ StorageDead(_3);
+ FakeRead(ForLet(None), _2);
+ AscribeUserType(_2, o, UserTypeProjection { base: UserType(1), projs: [] });
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = move _2;
+ _4 = f(move _5) -> bb4;
}
bb2: {
- StorageDead(_5); // scope 1 at $DIR/issue_72181_1.rs:+5:8: +5:9
- StorageDead(_4); // scope 1 at $DIR/issue_72181_1.rs:+5:9: +5:10
- StorageDead(_2); // scope 0 at $DIR/issue_72181_1.rs:+6:1: +6:2
- unreachable; // scope 0 at $DIR/issue_72181_1.rs:+0:11: +6:2
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_2);
+ unreachable;
}
bb3: {
- return; // scope 0 at $DIR/issue_72181_1.rs:+6:2: +6:2
+ return;
}
bb4 (cleanup): {
- resume; // scope 0 at $DIR/issue_72181_1.rs:+0:1: +6:2
+ resume;
}
}
diff --git a/tests/mir-opt/issue_72181_1.rs b/tests/mir-opt/issue_72181_1.rs
index 8ae2599ec..f9ee33ef9 100644
--- a/tests/mir-opt/issue_72181_1.rs
+++ b/tests/mir-opt/issue_72181_1.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z mir-opt-level=1
// Regression test for #72181, this ICE requires `-Z mir-opt-level=1` flags.
diff --git a/tests/mir-opt/issue_76432.rs b/tests/mir-opt/issue_76432.rs
index 76bb11aae..f0f12c535 100644
--- a/tests/mir-opt/issue_76432.rs
+++ b/tests/mir-opt/issue_76432.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -Zmir-enable-passes=-NormalizeArrayLen
// Check that we do not insert StorageDead at each target if StorageDead was never seen
diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff
deleted file mode 100644
index 73b9ea46c..000000000
--- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff
+++ /dev/null
@@ -1,60 +0,0 @@
-- // MIR for `test` before SimplifyComparisonIntegral
-+ // MIR for `test` after SimplifyComparisonIntegral
-
- fn test(_1: T) -> () {
- debug x => _1; // in scope 0 at $DIR/issue_76432.rs:+0:38: +0:39
- let mut _0: (); // return place in scope 0 at $DIR/issue_76432.rs:+0:44: +0:44
- let _2: &[T]; // in scope 0 at $DIR/issue_76432.rs:+1:9: +1:10
- let mut _3: &[T; 3]; // in scope 0 at $DIR/issue_76432.rs:+1:19: +1:29
- let _4: &[T; 3]; // in scope 0 at $DIR/issue_76432.rs:+1:19: +1:29
- let _5: [T; 3]; // in scope 0 at $DIR/issue_76432.rs:+1:20: +1:29
- let mut _6: T; // in scope 0 at $DIR/issue_76432.rs:+1:21: +1:22
- let mut _7: T; // in scope 0 at $DIR/issue_76432.rs:+1:24: +1:25
- let mut _8: T; // in scope 0 at $DIR/issue_76432.rs:+1:27: +1:28
- let mut _9: usize; // in scope 0 at $DIR/issue_76432.rs:+3:9: +3:33
- let mut _10: usize; // in scope 0 at $DIR/issue_76432.rs:+3:9: +3:33
- let mut _11: bool; // in scope 0 at $DIR/issue_76432.rs:+3:9: +3:33
- let mut _15: !; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL
- scope 1 {
- debug v => _2; // in scope 1 at $DIR/issue_76432.rs:+1:9: +1:10
- let _12: &T; // in scope 1 at $DIR/issue_76432.rs:+3:10: +3:16
- let _13: &T; // in scope 1 at $DIR/issue_76432.rs:+3:18: +3:24
- let _14: &T; // in scope 1 at $DIR/issue_76432.rs:+3:26: +3:32
- scope 2 {
- debug v1 => &(*_2)[0 of 3]; // in scope 2 at $DIR/issue_76432.rs:+3:10: +3:16
- debug v2 => &(*_2)[1 of 3]; // in scope 2 at $DIR/issue_76432.rs:+3:18: +3:24
- debug v3 => &(*_2)[2 of 3]; // in scope 2 at $DIR/issue_76432.rs:+3:26: +3:32
- }
- }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_76432.rs:+1:9: +1:10
- StorageLive(_5); // scope 0 at $DIR/issue_76432.rs:+1:20: +1:29
- _5 = [_1, _1, _1]; // scope 0 at $DIR/issue_76432.rs:+1:20: +1:29
- _4 = &_5; // scope 0 at $DIR/issue_76432.rs:+1:19: +1:29
- _2 = _4 as &[T] (Pointer(Unsize)); // scope 0 at $DIR/issue_76432.rs:+1:19: +1:29
- _9 = Len((*_2)); // scope 1 at $DIR/issue_76432.rs:+3:9: +3:33
- _10 = const 3_usize; // scope 1 at $DIR/issue_76432.rs:+3:9: +3:33
-- _11 = Eq(move _9, const 3_usize); // scope 1 at $DIR/issue_76432.rs:+3:9: +3:33
-- switchInt(move _11) -> [0: bb1, otherwise: bb2]; // scope 1 at $DIR/issue_76432.rs:+3:9: +3:33
-+ nop; // scope 1 at $DIR/issue_76432.rs:+3:9: +3:33
-+ switchInt(move _9) -> [3: bb2, otherwise: bb1]; // scope 1 at $DIR/issue_76432.rs:+3:9: +3:33
- }
-
- bb1: {
- _15 = core::panicking::panic(const "internal error: entered unreachable code"); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/panic.rs:LL:COL
- // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(<ZST>) }
- // mir::Constant
- // + span: $SRC_DIR/core/src/panic.rs:LL:COL
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- }
-
- bb2: {
- StorageDead(_5); // scope 0 at $DIR/issue_76432.rs:+6:1: +6:2
- StorageDead(_2); // scope 0 at $DIR/issue_76432.rs:+6:1: +6:2
- return; // scope 0 at $DIR/issue_76432.rs:+6:2: +6:2
- }
- }
-
diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff
new file mode 100644
index 000000000..b2539f391
--- /dev/null
+++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff
@@ -0,0 +1,55 @@
+- // MIR for `test` before SimplifyComparisonIntegral
++ // MIR for `test` after SimplifyComparisonIntegral
+
+ fn test(_1: T) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: &[T];
+ let mut _3: &[T; 3];
+ let _4: [T; 3];
+ let mut _5: usize;
+ let mut _6: bool;
+ let mut _10: !;
+ scope 1 {
+ debug v => _2;
+ let _7: &T;
+ let _8: &T;
+ let _9: &T;
+ scope 2 {
+ debug v1 => _7;
+ debug v2 => _8;
+ debug v3 => _9;
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = [_1, _1, _1];
+ _3 = &_4;
+ _2 = move _3 as &[T] (PointerCoercion(Unsize));
+ StorageDead(_3);
+ _5 = const 3_usize;
+ _6 = const true;
+ goto -> bb2;
+ }
+
+ bb1: {
+ _10 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind unreachable;
+ }
+
+ bb2: {
+ StorageLive(_7);
+ _7 = &(*_2)[0 of 3];
+ StorageLive(_8);
+ _8 = &(*_2)[1 of 3];
+ StorageLive(_9);
+ _9 = &(*_2)[2 of 3];
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_4);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff
new file mode 100644
index 000000000..ff7f12c09
--- /dev/null
+++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff
@@ -0,0 +1,55 @@
+- // MIR for `test` before SimplifyComparisonIntegral
++ // MIR for `test` after SimplifyComparisonIntegral
+
+ fn test(_1: T) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: &[T];
+ let mut _3: &[T; 3];
+ let _4: [T; 3];
+ let mut _5: usize;
+ let mut _6: bool;
+ let mut _10: !;
+ scope 1 {
+ debug v => _2;
+ let _7: &T;
+ let _8: &T;
+ let _9: &T;
+ scope 2 {
+ debug v1 => _7;
+ debug v2 => _8;
+ debug v3 => _9;
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = [_1, _1, _1];
+ _3 = &_4;
+ _2 = move _3 as &[T] (PointerCoercion(Unsize));
+ StorageDead(_3);
+ _5 = const 3_usize;
+ _6 = const true;
+ goto -> bb2;
+ }
+
+ bb1: {
+ _10 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind continue;
+ }
+
+ bb2: {
+ StorageLive(_7);
+ _7 = &(*_2)[0 of 3];
+ StorageLive(_8);
+ _8 = &(*_2)[1 of 3];
+ StorageLive(_9);
+ _9 = &(*_2)[2 of 3];
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_4);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/issue_78192.f.InstSimplify.diff b/tests/mir-opt/issue_78192.f.InstSimplify.diff
index 914d7ceb2..10e3dd203 100644
--- a/tests/mir-opt/issue_78192.f.InstSimplify.diff
+++ b/tests/mir-opt/issue_78192.f.InstSimplify.diff
@@ -2,28 +2,28 @@
+ // MIR for `f` after InstSimplify
fn f(_1: &T) -> *const T {
- debug a => _1; // in scope 0 at $DIR/issue_78192.rs:+0:13: +0:14
- let mut _0: *const T; // return place in scope 0 at $DIR/issue_78192.rs:+0:23: +0:31
- let _2: &*const T; // in scope 0 at $DIR/issue_78192.rs:+1:9: +1:10
- let _3: &*const T; // in scope 0 at $DIR/issue_78192.rs:+1:24: +1:40
- let _4: *const T; // in scope 0 at $DIR/issue_78192.rs:+1:25: +1:40
+ debug a => _1;
+ let mut _0: *const T;
+ let _2: &*const T;
+ let _3: &*const T;
+ let _4: *const T;
scope 1 {
- debug b => _2; // in scope 1 at $DIR/issue_78192.rs:+1:9: +1:10
+ debug b => _2;
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_78192.rs:+1:9: +1:10
- StorageLive(_3); // scope 0 at $DIR/issue_78192.rs:+1:24: +1:40
- StorageLive(_4); // scope 0 at $DIR/issue_78192.rs:+1:25: +1:40
- _4 = &raw const (*_1); // scope 0 at $DIR/issue_78192.rs:+1:26: +1:27
- _3 = &_4; // scope 0 at $DIR/issue_78192.rs:+1:24: +1:40
-- _2 = &(*_3); // scope 0 at $DIR/issue_78192.rs:+1:24: +1:40
-+ _2 = _3; // scope 0 at $DIR/issue_78192.rs:+1:24: +1:40
- StorageDead(_3); // scope 0 at $DIR/issue_78192.rs:+1:40: +1:41
- _0 = (*_2); // scope 1 at $DIR/issue_78192.rs:+2:5: +2:7
- StorageDead(_4); // scope 0 at $DIR/issue_78192.rs:+3:1: +3:2
- StorageDead(_2); // scope 0 at $DIR/issue_78192.rs:+3:1: +3:2
- return; // scope 0 at $DIR/issue_78192.rs:+3:2: +3:2
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &raw const (*_1);
+ _3 = &_4;
+- _2 = &(*_3);
++ _2 = _3;
+ StorageDead(_3);
+ _0 = (*_2);
+ StorageDead(_4);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/issue_78192.rs b/tests/mir-opt/issue_78192.rs
index 95142a3e4..b08c3615e 100644
--- a/tests/mir-opt/issue_78192.rs
+++ b/tests/mir-opt/issue_78192.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Zmir-opt-level=1 -Zinline-mir
pub fn f<T>(a: &T) -> *const T {
let b: &*const T = &(a as *const T);
diff --git a/tests/mir-opt/issue_91633.bar.built.after.mir b/tests/mir-opt/issue_91633.bar.built.after.mir
index 88a383015..cce1a1fd2 100644
--- a/tests/mir-opt/issue_91633.bar.built.after.mir
+++ b/tests/mir-opt/issue_91633.bar.built.after.mir
@@ -1,40 +1,37 @@
// MIR for `bar` after built
fn bar(_1: Box<[T]>) -> () {
- debug it => _1; // in scope 0 at $DIR/issue_91633.rs:+0:12: +0:14
- let mut _0: (); // return place in scope 0 at $DIR/issue_91633.rs:+1:2: +1:2
- let mut _2: &<[T] as std::ops::Index<usize>>::Output; // in scope 0 at $DIR/issue_91633.rs:+4:14: +4:19
- let mut _3: &[T]; // in scope 0 at $DIR/issue_91633.rs:+4:14: +4:16
+ debug it => _1;
+ let mut _0: ();
+ let mut _2: &<[T] as std::ops::Index<usize>>::Output;
+ let mut _3: &[T];
scope 1 {
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_91633.rs:+4:14: +4:19
- StorageLive(_3); // scope 0 at $DIR/issue_91633.rs:+4:14: +4:16
- _3 = &(*_1); // scope 0 at $DIR/issue_91633.rs:+4:14: +4:16
- _2 = <[T] as Index<usize>>::index(move _3, const 0_usize) -> [return: bb1, unwind: bb3]; // scope 0 at $DIR/issue_91633.rs:+4:14: +4:19
- // mir::Constant
- // + span: $DIR/issue_91633.rs:15:14: 15:19
- // + literal: Const { ty: for<'a> fn(&'a [T], usize) -> &'a <[T] as Index<usize>>::Output {<[T] as Index<usize>>::index}, val: Value(<ZST>) }
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &(*_1);
+ _2 = <[T] as Index<usize>>::index(move _3, const 0_usize) -> [return: bb1, unwind: bb3];
}
bb1: {
- StorageDead(_3); // scope 0 at $DIR/issue_91633.rs:+4:18: +4:19
- PlaceMention((*_2)); // scope 0 at $DIR/issue_91633.rs:+4:14: +4:19
- StorageDead(_2); // scope 0 at $DIR/issue_91633.rs:+4:19: +4:20
- _0 = const (); // scope 0 at $DIR/issue_91633.rs:+3:2: +5:3
- drop(_1) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/issue_91633.rs:+5:2: +5:3
+ StorageDead(_3);
+ PlaceMention((*_2));
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb2, unwind: bb4];
}
bb2: {
- return; // scope 0 at $DIR/issue_91633.rs:+5:3: +5:3
+ return;
}
bb3 (cleanup): {
- drop(_1) -> [return: bb4, unwind terminate]; // scope 0 at $DIR/issue_91633.rs:+5:2: +5:3
+ drop(_1) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
- resume; // scope 0 at $DIR/issue_91633.rs:+0:1: +5:3
+ resume;
}
}
diff --git a/tests/mir-opt/issue_91633.foo.built.after.mir b/tests/mir-opt/issue_91633.foo.built.after.mir
index 569135803..a66769f0d 100644
--- a/tests/mir-opt/issue_91633.foo.built.after.mir
+++ b/tests/mir-opt/issue_91633.foo.built.after.mir
@@ -1,57 +1,54 @@
// MIR for `foo` after built
fn foo(_1: Box<[T]>) -> T {
- debug it => _1; // in scope 0 at $DIR/issue_91633.rs:+0:19: +0:21
- let mut _0: T; // return place in scope 0 at $DIR/issue_91633.rs:+0:36: +0:37
- let _2: T; // in scope 0 at $DIR/issue_91633.rs:+2:10: +2:11
- let mut _3: &T; // in scope 0 at $DIR/issue_91633.rs:+2:14: +2:27
- let _4: usize; // in scope 0 at $DIR/issue_91633.rs:+2:17: +2:18
- let mut _5: usize; // in scope 0 at $DIR/issue_91633.rs:+2:14: +2:19
- let mut _6: bool; // in scope 0 at $DIR/issue_91633.rs:+2:14: +2:19
+ debug it => _1;
+ let mut _0: T;
+ let _2: T;
+ let mut _3: &T;
+ let _4: usize;
+ let mut _5: usize;
+ let mut _6: bool;
scope 1 {
- debug f => _2; // in scope 1 at $DIR/issue_91633.rs:+2:10: +2:11
+ debug f => _2;
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_91633.rs:+2:10: +2:11
- StorageLive(_3); // scope 0 at $DIR/issue_91633.rs:+2:14: +2:27
- StorageLive(_4); // scope 0 at $DIR/issue_91633.rs:+2:17: +2:18
- _4 = const 0_usize; // scope 0 at $DIR/issue_91633.rs:+2:17: +2:18
- _5 = Len((*_1)); // scope 0 at $DIR/issue_91633.rs:+2:14: +2:19
- _6 = Lt(_4, _5); // scope 0 at $DIR/issue_91633.rs:+2:14: +2:19
- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind: bb5]; // scope 0 at $DIR/issue_91633.rs:+2:14: +2:19
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = const 0_usize;
+ _5 = Len((*_1));
+ _6 = Lt(_4, _5);
+ assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind: bb5];
}
bb1: {
- _3 = &(*_1)[_4]; // scope 0 at $DIR/issue_91633.rs:+2:14: +2:27
- _2 = <T as Clone>::clone(move _3) -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/issue_91633.rs:+2:14: +2:27
- // mir::Constant
- // + span: $DIR/issue_91633.rs:28:20: 28:25
- // + literal: Const { ty: for<'a> fn(&'a T) -> T {<T as Clone>::clone}, val: Value(<ZST>) }
+ _3 = &(*_1)[_4];
+ _2 = <T as Clone>::clone(move _3) -> [return: bb2, unwind: bb5];
}
bb2: {
- StorageDead(_3); // scope 0 at $DIR/issue_91633.rs:+2:26: +2:27
- FakeRead(ForLet(None), _2); // scope 0 at $DIR/issue_91633.rs:+2:10: +2:11
- StorageDead(_4); // scope 0 at $DIR/issue_91633.rs:+2:27: +2:28
- _0 = move _2; // scope 1 at $DIR/issue_91633.rs:+3:6: +3:7
- drop(_2) -> [return: bb3, unwind: bb5]; // scope 0 at $DIR/issue_91633.rs:+4:2: +4:3
+ StorageDead(_3);
+ FakeRead(ForLet(None), _2);
+ StorageDead(_4);
+ _0 = move _2;
+ drop(_2) -> [return: bb3, unwind: bb5];
}
bb3: {
- StorageDead(_2); // scope 0 at $DIR/issue_91633.rs:+4:2: +4:3
- drop(_1) -> [return: bb4, unwind: bb6]; // scope 0 at $DIR/issue_91633.rs:+4:2: +4:3
+ StorageDead(_2);
+ drop(_1) -> [return: bb4, unwind: bb6];
}
bb4: {
- return; // scope 0 at $DIR/issue_91633.rs:+4:3: +4:3
+ return;
}
bb5 (cleanup): {
- drop(_1) -> [return: bb6, unwind terminate]; // scope 0 at $DIR/issue_91633.rs:+4:2: +4:3
+ drop(_1) -> [return: bb6, unwind terminate(cleanup)];
}
bb6 (cleanup): {
- resume; // scope 0 at $DIR/issue_91633.rs:+0:1: +4:3
+ resume;
}
}
diff --git a/tests/mir-opt/issue_91633.fun.built.after.mir b/tests/mir-opt/issue_91633.fun.built.after.mir
index 42486d3a5..7175c9e80 100644
--- a/tests/mir-opt/issue_91633.fun.built.after.mir
+++ b/tests/mir-opt/issue_91633.fun.built.after.mir
@@ -1,35 +1,35 @@
// MIR for `fun` after built
fn fun(_1: &[T]) -> &T {
- debug it => _1; // in scope 0 at $DIR/issue_91633.rs:+0:12: +0:14
- let mut _0: &T; // return place in scope 0 at $DIR/issue_91633.rs:+0:25: +0:27
- let _2: &T; // in scope 0 at $DIR/issue_91633.rs:+2:10: +2:11
- let _3: usize; // in scope 0 at $DIR/issue_91633.rs:+2:18: +2:19
- let mut _4: usize; // in scope 0 at $DIR/issue_91633.rs:+2:15: +2:20
- let mut _5: bool; // in scope 0 at $DIR/issue_91633.rs:+2:15: +2:20
+ debug it => _1;
+ let mut _0: &T;
+ let _2: &T;
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
scope 1 {
- debug f => _2; // in scope 1 at $DIR/issue_91633.rs:+2:10: +2:11
+ debug f => _2;
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_91633.rs:+2:10: +2:11
- StorageLive(_3); // scope 0 at $DIR/issue_91633.rs:+2:18: +2:19
- _3 = const 0_usize; // scope 0 at $DIR/issue_91633.rs:+2:18: +2:19
- _4 = Len((*_1)); // scope 0 at $DIR/issue_91633.rs:+2:15: +2:20
- _5 = Lt(_3, _4); // scope 0 at $DIR/issue_91633.rs:+2:15: +2:20
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind: bb2]; // scope 0 at $DIR/issue_91633.rs:+2:15: +2:20
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = const 0_usize;
+ _4 = Len((*_1));
+ _5 = Lt(_3, _4);
+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind: bb2];
}
bb1: {
- _2 = &(*_1)[_3]; // scope 0 at $DIR/issue_91633.rs:+2:14: +2:20
- FakeRead(ForLet(None), _2); // scope 0 at $DIR/issue_91633.rs:+2:10: +2:11
- _0 = &(*_2); // scope 1 at $DIR/issue_91633.rs:+3:6: +3:7
- StorageDead(_3); // scope 0 at $DIR/issue_91633.rs:+4:2: +4:3
- StorageDead(_2); // scope 0 at $DIR/issue_91633.rs:+4:2: +4:3
- return; // scope 0 at $DIR/issue_91633.rs:+4:3: +4:3
+ _2 = &(*_1)[_3];
+ FakeRead(ForLet(None), _2);
+ _0 = &(*_2);
+ StorageDead(_3);
+ StorageDead(_2);
+ return;
}
bb2 (cleanup): {
- resume; // scope 0 at $DIR/issue_91633.rs:+0:1: +4:3
+ resume;
}
}
diff --git a/tests/mir-opt/issue_91633.hey.built.after.mir b/tests/mir-opt/issue_91633.hey.built.after.mir
index 19f0c133e..aa8f31f81 100644
--- a/tests/mir-opt/issue_91633.hey.built.after.mir
+++ b/tests/mir-opt/issue_91633.hey.built.after.mir
@@ -1,36 +1,33 @@
// MIR for `hey` after built
fn hey(_1: &[T]) -> () {
- debug it => _1; // in scope 0 at $DIR/issue_91633.rs:+0:12: +0:14
- let mut _0: (); // return place in scope 0 at $DIR/issue_91633.rs:+1:2: +1:2
- let mut _2: &<[T] as std::ops::Index<usize>>::Output; // in scope 0 at $DIR/issue_91633.rs:+4:14: +4:20
- let _3: &<[T] as std::ops::Index<usize>>::Output; // in scope 0 at $DIR/issue_91633.rs:+4:15: +4:20
- let mut _4: &[T]; // in scope 0 at $DIR/issue_91633.rs:+4:15: +4:17
+ debug it => _1;
+ let mut _0: ();
+ let mut _2: &<[T] as std::ops::Index<usize>>::Output;
+ let _3: &<[T] as std::ops::Index<usize>>::Output;
+ let mut _4: &[T];
scope 1 {
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_91633.rs:+4:14: +4:20
- StorageLive(_3); // scope 0 at $DIR/issue_91633.rs:+4:15: +4:20
- StorageLive(_4); // scope 0 at $DIR/issue_91633.rs:+4:15: +4:17
- _4 = &(*_1); // scope 0 at $DIR/issue_91633.rs:+4:15: +4:17
- _3 = <[T] as Index<usize>>::index(move _4, const 0_usize) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/issue_91633.rs:+4:15: +4:20
- // mir::Constant
- // + span: $DIR/issue_91633.rs:7:15: 7:20
- // + literal: Const { ty: for<'a> fn(&'a [T], usize) -> &'a <[T] as Index<usize>>::Output {<[T] as Index<usize>>::index}, val: Value(<ZST>) }
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &(*_1);
+ _3 = <[T] as Index<usize>>::index(move _4, const 0_usize) -> [return: bb1, unwind: bb2];
}
bb1: {
- StorageDead(_4); // scope 0 at $DIR/issue_91633.rs:+4:19: +4:20
- _2 = &(*_3); // scope 0 at $DIR/issue_91633.rs:+4:14: +4:20
- PlaceMention(_2); // scope 0 at $DIR/issue_91633.rs:+4:14: +4:20
- StorageDead(_2); // scope 0 at $DIR/issue_91633.rs:+4:20: +4:21
- _0 = const (); // scope 0 at $DIR/issue_91633.rs:+3:2: +5:3
- StorageDead(_3); // scope 0 at $DIR/issue_91633.rs:+5:2: +5:3
- return; // scope 0 at $DIR/issue_91633.rs:+5:3: +5:3
+ StorageDead(_4);
+ _2 = &(*_3);
+ PlaceMention(_2);
+ StorageDead(_2);
+ _0 = const ();
+ StorageDead(_3);
+ return;
}
bb2 (cleanup): {
- resume; // scope 0 at $DIR/issue_91633.rs:+0:1: +5:3
+ resume;
}
}
diff --git a/tests/mir-opt/issue_91633.rs b/tests/mir-opt/issue_91633.rs
index 9127cacc9..047a0cd9b 100644
--- a/tests/mir-opt/issue_91633.rs
+++ b/tests/mir-opt/issue_91633.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z mir-opt-level=0
// EMIT_MIR issue_91633.hey.built.after.mir
fn hey<T> (it: &[T])
diff --git a/tests/mir-opt/issue_99325.main.built.after.32bit.mir b/tests/mir-opt/issue_99325.main.built.after.32bit.mir
new file mode 100644
index 000000000..ffb1aedd2
--- /dev/null
+++ b/tests/mir-opt/issue_99325.main.built.after.32bit.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:13:16: 13: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:14:16: 14: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);
+ PlaceMention(_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);
+ PlaceMention(_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;
+ }
+}
+
+ALLOC0 (size: 4, align: 1) {
+ 41 41 41 41 │ AAAA
+}
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..ffb1aedd2
--- /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:13:16: 13: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:14:16: 14: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);
+ PlaceMention(_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);
+ PlaceMention(_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;
+ }
+}
+
+ALLOC0 (size: 4, align: 1) {
+ 41 41 41 41 │ AAAA
+}
diff --git a/tests/mir-opt/issue_99325.main.built.after.mir b/tests/mir-opt/issue_99325.main.built.after.mir
deleted file mode 100644
index 0424ce3ab..000000000
--- a/tests/mir-opt/issue_99325.main.built.after.mir
+++ /dev/null
@@ -1,295 +0,0 @@
-// MIR for `main` after built
-
-| User Type Annotations
-| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserSubsts { substs: [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), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Unevaluated([], DefId(0:8 ~ issue_99325[22bb]::main::{constant#1})) }], 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">}
-|
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/issue_99325.rs:+0:15: +0:15
- let _1: (); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _2: (&&[u8], &&[u8; 4]); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _3: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _4: &[u8]; // in scope 0 at $DIR/issue_99325.rs:+1:16: +1:48
- let mut _5: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _6: &[u8; 4]; // in scope 0 at $DIR/issue_99325.rs:+1:50: +1:75
- let _7: [u8; 4]; // in scope 0 at $DIR/issue_99325.rs:+1:51: +1:75
- let _8: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _9: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _10: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _11: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _12: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _13: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _14: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _16: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _17: core::panicking::AssertKind; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _18: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _19: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _20: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _21: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _22: std::option::Option<std::fmt::Arguments<'_>>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _23: (); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _24: (&&[u8], &&[u8; 4]); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _25: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _26: &[u8]; // in scope 0 at $DIR/issue_99325.rs:+2:16: +2:70
- let mut _27: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _28: &[u8; 4]; // in scope 0 at $DIR/issue_99325.rs:+2:72: +2:79
- let _29: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _30: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _31: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _32: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _33: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _34: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _35: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _37: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _38: core::panicking::AssertKind; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _39: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _40: &&[u8]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _41: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _42: &&[u8; 4]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _43: std::option::Option<std::fmt::Arguments<'_>>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- scope 1 {
- debug left_val => _8; // in scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- debug right_val => _9; // in scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _15: core::panicking::AssertKind; // in scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- scope 2 {
- debug kind => _15; // in scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
- }
- scope 3 {
- debug left_val => _29; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- debug right_val => _30; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _36: core::panicking::AssertKind; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- scope 4 {
- debug kind => _36; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_3); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_4); // scope 0 at $DIR/issue_99325.rs:+1:16: +1:48
- _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb19]; // scope 0 at $DIR/issue_99325.rs:+1:16: +1:48
- // mir::Constant
- // + span: $DIR/issue_99325.rs:10:16: 10:46
- // + user_ty: UserType(0)
- // + literal: Const { ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}, val: Value(<ZST>) }
- }
-
- bb1: {
- _3 = &_4; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_5); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_6); // scope 0 at $DIR/issue_99325.rs:+1:50: +1:75
- StorageLive(_7); // scope 0 at $DIR/issue_99325.rs:+1:51: +1:75
- _7 = [const 65_u8, const 65_u8, const 65_u8, const 65_u8]; // scope 0 at $DIR/issue_99325.rs:+1:51: +1:75
- _6 = &_7; // scope 0 at $DIR/issue_99325.rs:+1:50: +1:75
- _5 = &_6; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _2 = (move _3, move _5); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_5); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_3); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- FakeRead(ForMatchedPlace(None), _2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_8); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _8 = (_2.0: &&[u8]); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_9); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _9 = (_2.1: &&[u8; 4]); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_10); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_11); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_12); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _12 = &(*_8); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_13); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _13 = &(*_9); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _11 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _12, move _13) -> [return: bb2, unwind: bb19]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
- // + literal: Const { ty: for<'a, 'b> fn(&'a &[u8], &'b &[u8; 4]) -> bool {<&[u8] as PartialEq<&[u8; 4]>>::eq}, val: Value(<ZST>) }
- }
-
- bb2: {
- StorageDead(_13); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_12); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _10 = Not(move _11); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_11); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- switchInt(move _10) -> [0: bb4, otherwise: bb3]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb3: {
- StorageLive(_15); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _15 = core::panicking::AssertKind::Eq; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- FakeRead(ForLet(None), _15); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_16); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_17); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _17 = move _15; // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_18); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_19); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _19 = &(*_8); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _18 = &(*_19); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_20); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_21); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _21 = &(*_9); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _20 = &(*_21); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_22); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _22 = Option::<Arguments<'_>>::None; // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _16 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _17, move _18, move _20, move _22) -> bb19; // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
- // + literal: Const { ty: for<'a, 'b, 'c> fn(core::panicking::AssertKind, &'a &[u8], &'b &[u8; 4], Option<Arguments<'c>>) -> ! {core::panicking::assert_failed::<&[u8], &[u8; 4]>}, val: Value(<ZST>) }
- }
-
- bb4: {
- goto -> bb7; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb5: {
- StorageDead(_22); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_20); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_18); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_17); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_21); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_19); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_16); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_15); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- unreachable; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb6: {
- goto -> bb8; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb7: {
- _1 = const (); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- goto -> bb8; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb8: {
- StorageDead(_10); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_9); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_8); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- goto -> bb9; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb9: {
- StorageDead(_7); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_6); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_4); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_1); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_23); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_24); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_25); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_26); // scope 0 at $DIR/issue_99325.rs:+2:16: +2:70
- _26 = function_with_bytes::<&*b"AAAA">() -> [return: bb10, unwind: bb19]; // scope 0 at $DIR/issue_99325.rs:+2:16: +2:70
- // mir::Constant
- // + span: $DIR/issue_99325.rs:11:16: 11:68
- // + user_ty: UserType(1)
- // + literal: Const { ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}, val: Value(<ZST>) }
- }
-
- bb10: {
- _25 = &_26; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_27); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_28); // scope 0 at $DIR/issue_99325.rs:+2:72: +2:79
- _28 = const b"AAAA"; // scope 0 at $DIR/issue_99325.rs:+2:72: +2:79
- // mir::Constant
- // + span: $DIR/issue_99325.rs:11:72: 11:79
- // + literal: Const { ty: &[u8; 4], val: Value(Scalar(alloc4)) }
- _27 = &_28; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _24 = (move _25, move _27); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_27); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_25); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- FakeRead(ForMatchedPlace(None), _24); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_29); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _29 = (_24.0: &&[u8]); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_30); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _30 = (_24.1: &&[u8; 4]); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_31); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_33); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _33 = &(*_29); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_34); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _34 = &(*_30); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _32 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _33, move _34) -> [return: bb11, unwind: bb19]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
- // + literal: Const { ty: for<'a, 'b> fn(&'a &[u8], &'b &[u8; 4]) -> bool {<&[u8] as PartialEq<&[u8; 4]>>::eq}, val: Value(<ZST>) }
- }
-
- bb11: {
- StorageDead(_34); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_33); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _31 = Not(move _32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- switchInt(move _31) -> [0: bb13, otherwise: bb12]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb12: {
- StorageLive(_36); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _36 = core::panicking::AssertKind::Eq; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- FakeRead(ForLet(None), _36); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_37); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_38); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _38 = move _36; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_39); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_40); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _40 = &(*_29); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _39 = &(*_40); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_41); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_42); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _42 = &(*_30); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _41 = &(*_42); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_43); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _43 = Option::<Arguments<'_>>::None; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _37 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _38, move _39, move _41, move _43) -> bb19; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
- // + literal: Const { ty: for<'a, 'b, 'c> fn(core::panicking::AssertKind, &'a &[u8], &'b &[u8; 4], Option<Arguments<'c>>) -> ! {core::panicking::assert_failed::<&[u8], &[u8; 4]>}, val: Value(<ZST>) }
- }
-
- bb13: {
- goto -> bb16; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb14: {
- StorageDead(_43); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_41); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_39); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_38); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_42); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_40); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_37); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_36); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- unreachable; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb15: {
- goto -> bb17; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb16: {
- _23 = const (); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- goto -> bb17; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb17: {
- StorageDead(_31); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_30); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_29); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- goto -> bb18; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb18: {
- StorageDead(_28); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_26); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_24); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_23); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _0 = const (); // scope 0 at $DIR/issue_99325.rs:+0:15: +3:2
- return; // scope 0 at $DIR/issue_99325.rs:+3:2: +3:2
- }
-
- bb19 (cleanup): {
- resume; // scope 0 at $DIR/issue_99325.rs:+0:1: +3:2
- }
-}
-
-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..2638b69e2 100644
--- a/tests/mir-opt/issue_99325.rs
+++ b/tests/mir-opt/issue_99325.rs
@@ -1,3 +1,6 @@
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
#![feature(adt_const_params)]
#![allow(incomplete_features)]
diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir
deleted file mode 100644
index 9f955b471..000000000
--- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir
+++ /dev/null
@@ -1,84 +0,0 @@
-// MIR for `num_to_digit` after PreCodegen
-
-fn num_to_digit(_1: char) -> u32 {
- debug num => _1; // in scope 0 at $DIR/issue_59352.rs:+0:21: +0:24
- let mut _0: u32; // return place in scope 0 at $DIR/issue_59352.rs:+0:35: +0:38
- let mut _2: std::option::Option<u32>; // in scope 0 at $DIR/issue_59352.rs:+2:26: +2:41
- scope 1 (inlined char::methods::<impl char>::is_digit) { // at $DIR/issue_59352.rs:15:12: 15:23
- debug self => _1; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- debug radix => const 8_u32; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- let mut _3: &std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- let _4: std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- scope 2 (inlined Option::<u32>::is_some) { // at $SRC_DIR/core/src/char/methods.rs:LL:COL
- debug self => _3; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _5: isize; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
- }
- }
- scope 3 (inlined #[track_caller] Option::<u32>::unwrap) { // at $DIR/issue_59352.rs:15:42: 15:50
- debug self => _2; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _6: isize; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _7: !; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
- scope 4 {
- debug val => _0; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL
- }
- }
-
- bb0: {
- StorageLive(_3); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- StorageLive(_4); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- _4 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/char/methods.rs:LL:COL
- // + literal: Const { ty: fn(char, u32) -> Option<u32> {char::methods::<impl char>::to_digit}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageLive(_2); // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41
- _2 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> bb2; // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41
- // mir::Constant
- // + span: $DIR/issue_59352.rs:15:30: 15:38
- // + literal: Const { ty: fn(char, u32) -> Option<u32> {char::methods::<impl char>::to_digit}, val: Value(<ZST>) }
- }
-
- bb2: {
- _6 = discriminant(_2); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
- switchInt(move _6) -> [0: bb6, 1: bb8, otherwise: bb7]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
- }
-
- bb3: {
- _0 = const 0_u32; // scope 0 at $DIR/issue_59352.rs:+2:60: +2:61
- goto -> bb4; // scope 0 at $DIR/issue_59352.rs:+2:5: +2:63
- }
-
- bb4: {
- return; // scope 0 at $DIR/issue_59352.rs:+3:2: +3:2
- }
-
- bb5: {
- _3 = &_4; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- _5 = discriminant((*_3)); // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
- StorageDead(_3); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- StorageDead(_4); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- switchInt(move _5) -> [1: bb1, otherwise: bb3]; // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
- }
-
- bb6: {
- _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value"); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/option.rs:LL:COL
- // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(<ZST>) }
- // mir::Constant
- // + span: $SRC_DIR/core/src/option.rs:LL:COL
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- }
-
- bb7: {
- unreachable; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
- }
-
- bb8: {
- _0 = move ((_2 as Some).0: u32); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
- StorageDead(_2); // scope 0 at $DIR/issue_59352.rs:+2:49: +2:50
- goto -> bb4; // scope 0 at $DIR/issue_59352.rs:+2:5: +2:63
- }
-}
diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..5d25c6557
--- /dev/null
+++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,77 @@
+// MIR for `num_to_digit` after PreCodegen
+
+fn num_to_digit(_1: char) -> u32 {
+ debug num => _1;
+ let mut _0: u32;
+ let mut _5: std::option::Option<u32>;
+ scope 1 (inlined char::methods::<impl char>::is_digit) {
+ debug self => _1;
+ debug radix => const 8_u32;
+ let _2: std::option::Option<u32>;
+ let mut _3: &std::option::Option<u32>;
+ scope 2 (inlined Option::<u32>::is_some) {
+ debug self => _3;
+ let mut _4: isize;
+ }
+ }
+ scope 3 (inlined #[track_caller] Option::<u32>::unwrap) {
+ debug self => _5;
+ let mut _6: isize;
+ let mut _7: !;
+ scope 4 {
+ debug val => _0;
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_2);
+ _2 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _3 = &_2;
+ StorageLive(_4);
+ _4 = discriminant(_2);
+ StorageDead(_3);
+ StorageDead(_2);
+ switchInt(move _4) -> [1: bb2, otherwise: bb7];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_5);
+ _5 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageLive(_6);
+ _6 = discriminant(_5);
+ switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb6];
+ }
+
+ bb4: {
+ _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable;
+ }
+
+ bb5: {
+ _0 = move ((_5 as Some).0: u32);
+ StorageDead(_6);
+ StorageDead(_5);
+ goto -> bb8;
+ }
+
+ bb6: {
+ unreachable;
+ }
+
+ bb7: {
+ StorageDead(_4);
+ _0 = const 0_u32;
+ goto -> bb8;
+ }
+
+ bb8: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 000000000..4677c0108
--- /dev/null
+++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,77 @@
+// MIR for `num_to_digit` after PreCodegen
+
+fn num_to_digit(_1: char) -> u32 {
+ debug num => _1;
+ let mut _0: u32;
+ let mut _5: std::option::Option<u32>;
+ scope 1 (inlined char::methods::<impl char>::is_digit) {
+ debug self => _1;
+ debug radix => const 8_u32;
+ let _2: std::option::Option<u32>;
+ let mut _3: &std::option::Option<u32>;
+ scope 2 (inlined Option::<u32>::is_some) {
+ debug self => _3;
+ let mut _4: isize;
+ }
+ }
+ scope 3 (inlined #[track_caller] Option::<u32>::unwrap) {
+ debug self => _5;
+ let mut _6: isize;
+ let mut _7: !;
+ scope 4 {
+ debug val => _0;
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_2);
+ _2 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ _3 = &_2;
+ StorageLive(_4);
+ _4 = discriminant(_2);
+ StorageDead(_3);
+ StorageDead(_2);
+ switchInt(move _4) -> [1: bb2, otherwise: bb7];
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageLive(_5);
+ _5 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageLive(_6);
+ _6 = discriminant(_5);
+ switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb6];
+ }
+
+ bb4: {
+ _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue;
+ }
+
+ bb5: {
+ _0 = move ((_5 as Some).0: u32);
+ StorageDead(_6);
+ StorageDead(_5);
+ goto -> bb8;
+ }
+
+ bb6: {
+ unreachable;
+ }
+
+ bb7: {
+ StorageDead(_4);
+ _0 = const 0_u32;
+ goto -> bb8;
+ }
+
+ bb8: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/issues/issue_59352.rs b/tests/mir-opt/issues/issue_59352.rs
index 92011bd65..1cbeaec28 100644
--- a/tests/mir-opt/issues/issue_59352.rs
+++ b/tests/mir-opt/issues/issue_59352.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// This test is a mirror of codegen/issue-59352.rs.
// The LLVM inliner doesn't inline `char::method::is_digit()` and so it doesn't recognize this case
// as effectively `if x.is_some() { x.unwrap() } else { 0 }`.
diff --git a/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff b/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff
index 8e6e6fc0e..f1d18b0f7 100644
--- a/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff
+++ b/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff
@@ -2,17 +2,17 @@
+ // MIR for `foo` after MatchBranchSimplification
fn foo(_1: [u8; 16]) -> Option<[u8; 4]> {
- debug bytes => _1; // in scope 0 at $DIR/issue_75439.rs:+0:12: +0:17
- let mut _0: std::option::Option<[u8; 4]>; // return place in scope 0 at $DIR/issue_75439.rs:+0:32: +0:47
- let _2: [u32; 4]; // in scope 0 at $DIR/issue_75439.rs:+2:9: +2:15
- let mut _3: [u8; 16]; // in scope 0 at $DIR/issue_75439.rs:+2:47: +2:52
- let mut _5: [u8; 4]; // in scope 0 at $DIR/issue_75439.rs:+5:14: +5:38
- let mut _6: u32; // in scope 0 at $DIR/issue_75439.rs:+5:33: +5:35
+ debug bytes => _1;
+ let mut _0: std::option::Option<[u8; 4]>;
+ let _2: [u32; 4];
+ let mut _3: [u8; 16];
+ let mut _5: [u8; 4];
+ let mut _6: u32;
scope 1 {
- debug dwords => _2; // in scope 1 at $DIR/issue_75439.rs:+2:9: +2:15
+ debug dwords => _2;
scope 3 {
- debug ip => _4; // in scope 3 at $DIR/issue_75439.rs:+4:27: +4:29
- let _4: u32; // in scope 3 at $DIR/issue_75439.rs:+4:27: +4:29
+ debug ip => _4;
+ let _4: u32;
scope 4 {
}
}
@@ -21,54 +21,54 @@
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_75439.rs:+2:9: +2:15
- StorageLive(_3); // scope 2 at $DIR/issue_75439.rs:+2:47: +2:52
- _3 = _1; // scope 2 at $DIR/issue_75439.rs:+2:47: +2:52
- _2 = move _3 as [u32; 4] (Transmute); // scope 2 at $DIR/issue_75439.rs:+2:37: +2:53
- StorageDead(_3); // scope 2 at $DIR/issue_75439.rs:+2:52: +2:53
- switchInt(_2[0 of 4]) -> [0: bb1, otherwise: bb6]; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _2 = move _3 as [u32; 4] (Transmute);
+ StorageDead(_3);
+ switchInt(_2[0 of 4]) -> [0: bb1, otherwise: bb6];
}
bb1: {
- switchInt(_2[1 of 4]) -> [0: bb2, otherwise: bb6]; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30
+ switchInt(_2[1 of 4]) -> [0: bb2, otherwise: bb6];
}
bb2: {
- switchInt(_2[2 of 4]) -> [0: bb4, 4294901760: bb5, otherwise: bb6]; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30
+ switchInt(_2[2 of 4]) -> [0: bb4, 4294901760: bb5, otherwise: bb6];
}
bb3: {
- StorageLive(_5); // scope 3 at $DIR/issue_75439.rs:+5:14: +5:38
- StorageLive(_6); // scope 4 at $DIR/issue_75439.rs:+5:33: +5:35
- _6 = _4; // scope 4 at $DIR/issue_75439.rs:+5:33: +5:35
- _5 = move _6 as [u8; 4] (Transmute); // scope 4 at $DIR/issue_75439.rs:+5:23: +5:36
- StorageDead(_6); // scope 4 at $DIR/issue_75439.rs:+5:35: +5:36
- _0 = Option::<[u8; 4]>::Some(move _5); // scope 3 at $DIR/issue_75439.rs:+5:9: +5:39
- StorageDead(_5); // scope 3 at $DIR/issue_75439.rs:+5:38: +5:39
- StorageDead(_4); // scope 1 at $DIR/issue_75439.rs:+6:5: +6:6
- goto -> bb7; // scope 1 at $DIR/issue_75439.rs:+4:5: +8:6
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = _4;
+ _5 = move _6 as [u8; 4] (Transmute);
+ StorageDead(_6);
+ _0 = Option::<[u8; 4]>::Some(move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ goto -> bb7;
}
bb4: {
- StorageLive(_4); // scope 3 at $DIR/issue_75439.rs:+4:27: +4:29
- _4 = _2[3 of 4]; // scope 3 at $DIR/issue_75439.rs:+4:27: +4:29
- goto -> bb3; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30
+ StorageLive(_4);
+ _4 = _2[3 of 4];
+ goto -> bb3;
}
bb5: {
- StorageLive(_4); // scope 3 at $DIR/issue_75439.rs:+4:27: +4:29
- _4 = _2[3 of 4]; // scope 3 at $DIR/issue_75439.rs:+4:27: +4:29
- goto -> bb3; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30
+ StorageLive(_4);
+ _4 = _2[3 of 4];
+ goto -> bb3;
}
bb6: {
- _0 = Option::<[u8; 4]>::None; // scope 1 at $DIR/issue_75439.rs:+7:9: +7:13
- goto -> bb7; // scope 1 at $DIR/issue_75439.rs:+4:5: +8:6
+ _0 = Option::<[u8; 4]>::None;
+ goto -> bb7;
}
bb7: {
- StorageDead(_2); // scope 0 at $DIR/issue_75439.rs:+9:1: +9:2
- return; // scope 0 at $DIR/issue_75439.rs:+9:2: +9:2
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/issues/issue_75439.rs b/tests/mir-opt/issues/issue_75439.rs
index 4c749a150..0ab496e47 100644
--- a/tests/mir-opt/issues/issue_75439.rs
+++ b/tests/mir-opt/issues/issue_75439.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR issue_75439.foo.MatchBranchSimplification.diff
// ignore-endian-big
diff --git a/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..462cc2077
--- /dev/null
+++ b/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-abort.diff
@@ -0,0 +1,57 @@
+- // MIR for `custom_discr` before JumpThreading
++ // MIR for `custom_discr` after JumpThreading
+
+ fn custom_discr(_1: bool) -> u8 {
+ debug x => _1;
+ let mut _0: u8;
+ let mut _2: CustomDiscr;
+ let mut _3: bool;
+ let mut _4: u8;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ switchInt(move _3) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ _2 = CustomDiscr::A;
+- goto -> bb3;
++ goto -> bb7;
+ }
+
+ bb2: {
+ _2 = CustomDiscr::B;
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_3);
+ _4 = discriminant(_2);
+- switchInt(move _4) -> [35: bb5, otherwise: bb4];
++ goto -> bb4;
+ }
+
+ bb4: {
+ _0 = const 13_u8;
+ goto -> bb6;
+ }
+
+ bb5: {
+ _0 = const 5_u8;
+ goto -> bb6;
+ }
+
+ bb6: {
+ StorageDead(_2);
+ return;
++ }
++
++ bb7: {
++ StorageDead(_3);
++ _4 = discriminant(_2);
++ goto -> bb5;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..462cc2077
--- /dev/null
+++ b/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-unwind.diff
@@ -0,0 +1,57 @@
+- // MIR for `custom_discr` before JumpThreading
++ // MIR for `custom_discr` after JumpThreading
+
+ fn custom_discr(_1: bool) -> u8 {
+ debug x => _1;
+ let mut _0: u8;
+ let mut _2: CustomDiscr;
+ let mut _3: bool;
+ let mut _4: u8;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ switchInt(move _3) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ _2 = CustomDiscr::A;
+- goto -> bb3;
++ goto -> bb7;
+ }
+
+ bb2: {
+ _2 = CustomDiscr::B;
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_3);
+ _4 = discriminant(_2);
+- switchInt(move _4) -> [35: bb5, otherwise: bb4];
++ goto -> bb4;
+ }
+
+ bb4: {
+ _0 = const 13_u8;
+ goto -> bb6;
+ }
+
+ bb5: {
+ _0 = const 5_u8;
+ goto -> bb6;
+ }
+
+ bb6: {
+ StorageDead(_2);
+ return;
++ }
++
++ bb7: {
++ StorageDead(_3);
++ _4 = discriminant(_2);
++ goto -> bb5;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..ad5846c97
--- /dev/null
+++ b/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-abort.diff
@@ -0,0 +1,68 @@
+- // MIR for `dfa` before JumpThreading
++ // MIR for `dfa` after JumpThreading
+
+ fn dfa() -> () {
+ let mut _0: ();
+ let mut _1: DFA;
+ let mut _2: !;
+ let mut _3: ();
+ let mut _4: isize;
+ let mut _5: DFA;
+ let mut _6: DFA;
+ let mut _7: DFA;
+ let mut _8: !;
+ scope 1 {
+ debug state => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = DFA::A;
+ StorageLive(_2);
+ goto -> bb1;
+ }
+
+ bb1: {
+ _4 = discriminant(_1);
+ switchInt(move _4) -> [0: bb4, 1: bb5, 2: bb6, 3: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+ StorageLive(_5);
+ _5 = DFA::B;
+ _1 = move _5;
+ _3 = const ();
+ StorageDead(_5);
+ goto -> bb1;
+ }
+
+ bb5: {
+ StorageLive(_6);
+ _6 = DFA::C;
+ _1 = move _6;
+ _3 = const ();
+ StorageDead(_6);
+ goto -> bb1;
+ }
+
+ bb6: {
+ StorageLive(_7);
+ _7 = DFA::D;
+ _1 = move _7;
+ _3 = const ();
+ StorageDead(_7);
+ goto -> bb1;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..ad5846c97
--- /dev/null
+++ b/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-unwind.diff
@@ -0,0 +1,68 @@
+- // MIR for `dfa` before JumpThreading
++ // MIR for `dfa` after JumpThreading
+
+ fn dfa() -> () {
+ let mut _0: ();
+ let mut _1: DFA;
+ let mut _2: !;
+ let mut _3: ();
+ let mut _4: isize;
+ let mut _5: DFA;
+ let mut _6: DFA;
+ let mut _7: DFA;
+ let mut _8: !;
+ scope 1 {
+ debug state => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = DFA::A;
+ StorageLive(_2);
+ goto -> bb1;
+ }
+
+ bb1: {
+ _4 = discriminant(_1);
+ switchInt(move _4) -> [0: bb4, 1: bb5, 2: bb6, 3: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+ StorageLive(_5);
+ _5 = DFA::B;
+ _1 = move _5;
+ _3 = const ();
+ StorageDead(_5);
+ goto -> bb1;
+ }
+
+ bb5: {
+ StorageLive(_6);
+ _6 = DFA::C;
+ _1 = move _6;
+ _3 = const ();
+ StorageDead(_6);
+ goto -> bb1;
+ }
+
+ bb6: {
+ StorageLive(_7);
+ _7 = DFA::D;
+ _1 = move _7;
+ _3 = const ();
+ StorageDead(_7);
+ goto -> bb1;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..f290da84e
--- /dev/null
+++ b/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-abort.diff
@@ -0,0 +1,59 @@
+- // MIR for `disappearing_bb` before JumpThreading
++ // MIR for `disappearing_bb` after JumpThreading
+
+ fn disappearing_bb(_1: u8) -> u8 {
+ let mut _0: u8;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ _2 = const true;
+ _3 = const true;
+ switchInt(_1) -> [0: bb3, 1: bb3, 2: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _3 = const false;
+- goto -> bb4;
++ goto -> bb9;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ _2 = const false;
+ goto -> bb4;
+ }
+
+ bb4: {
+ switchInt(_3) -> [0: bb5, otherwise: bb7];
+ }
+
+ bb5: {
+ switchInt(_2) -> [0: bb6, otherwise: bb8];
+ }
+
+ bb6: {
+ return;
+ }
+
+ bb7: {
+- goto -> bb5;
++ goto -> bb10;
+ }
+
+ bb8: {
++ goto -> bb6;
++ }
++
++ bb9: {
++ goto -> bb5;
++ }
++
++ bb10: {
+ goto -> bb6;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..f290da84e
--- /dev/null
+++ b/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-unwind.diff
@@ -0,0 +1,59 @@
+- // MIR for `disappearing_bb` before JumpThreading
++ // MIR for `disappearing_bb` after JumpThreading
+
+ fn disappearing_bb(_1: u8) -> u8 {
+ let mut _0: u8;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ _2 = const true;
+ _3 = const true;
+ switchInt(_1) -> [0: bb3, 1: bb3, 2: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _3 = const false;
+- goto -> bb4;
++ goto -> bb9;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ _2 = const false;
+ goto -> bb4;
+ }
+
+ bb4: {
+ switchInt(_3) -> [0: bb5, otherwise: bb7];
+ }
+
+ bb5: {
+ switchInt(_2) -> [0: bb6, otherwise: bb8];
+ }
+
+ bb6: {
+ return;
+ }
+
+ bb7: {
+- goto -> bb5;
++ goto -> bb10;
+ }
+
+ bb8: {
++ goto -> bb6;
++ }
++
++ bb9: {
++ goto -> bb5;
++ }
++
++ bb10: {
+ goto -> bb6;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..adcedfb36
--- /dev/null
+++ b/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-abort.diff
@@ -0,0 +1,45 @@
+- // MIR for `duplicate_chain` before JumpThreading
++ // MIR for `duplicate_chain` after JumpThreading
+
+ fn duplicate_chain(_1: bool) -> u8 {
+ let mut _0: u8;
+ let mut _2: u8;
+ let mut _3: i32;
+ let mut _4: i32;
+
+ bb0: {
+ switchInt(_1) -> [1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _2 = const 5_u8;
+ goto -> bb3;
+ }
+
+ bb2: {
+ _2 = const 5_u8;
+ goto -> bb3;
+ }
+
+ bb3: {
+ _3 = const 13_i32;
+ goto -> bb4;
+ }
+
+ bb4: {
+ _4 = const 15_i32;
+- switchInt(_2) -> [5: bb5, otherwise: bb6];
++ goto -> bb5;
+ }
+
+ bb5: {
+ _0 = const 7_u8;
+ return;
+ }
+
+ bb6: {
+ _0 = const 9_u8;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..adcedfb36
--- /dev/null
+++ b/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-unwind.diff
@@ -0,0 +1,45 @@
+- // MIR for `duplicate_chain` before JumpThreading
++ // MIR for `duplicate_chain` after JumpThreading
+
+ fn duplicate_chain(_1: bool) -> u8 {
+ let mut _0: u8;
+ let mut _2: u8;
+ let mut _3: i32;
+ let mut _4: i32;
+
+ bb0: {
+ switchInt(_1) -> [1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _2 = const 5_u8;
+ goto -> bb3;
+ }
+
+ bb2: {
+ _2 = const 5_u8;
+ goto -> bb3;
+ }
+
+ bb3: {
+ _3 = const 13_i32;
+ goto -> bb4;
+ }
+
+ bb4: {
+ _4 = const 15_i32;
+- switchInt(_2) -> [5: bb5, otherwise: bb6];
++ goto -> bb5;
+ }
+
+ bb5: {
+ _0 = const 7_u8;
+ return;
+ }
+
+ bb6: {
+ _0 = const 9_u8;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..f50603a66
--- /dev/null
+++ b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff
@@ -0,0 +1,139 @@
+- // MIR for `identity` before JumpThreading
++ // MIR for `identity` after JumpThreading
+
+ fn identity(_1: Result<i32, i32>) -> Result<i32, i32> {
+ debug x => _1;
+ let mut _0: std::result::Result<i32, i32>;
+ let mut _2: i32;
+ let mut _3: std::ops::ControlFlow<std::result::Result<std::convert::Infallible, i32>, i32>;
+ let mut _4: std::result::Result<i32, i32>;
+ let mut _5: isize;
+ let _6: std::result::Result<std::convert::Infallible, i32>;
+ let mut _7: !;
+ let mut _8: std::result::Result<std::convert::Infallible, i32>;
+ let _9: i32;
+ scope 1 {
+ debug residual => _6;
+ scope 2 {
+ scope 8 (inlined #[track_caller] <Result<i32, i32> as FromResidual<Result<Infallible, i32>>>::from_residual) {
+ debug residual => _8;
+ let _14: i32;
+ let mut _15: i32;
+ scope 9 {
+ debug e => _14;
+ scope 10 (inlined <i32 as From<i32>>::from) {
+ debug t => _14;
+ }
+ }
+ }
+ }
+ }
+ scope 3 {
+ debug val => _9;
+ scope 4 {
+ }
+ }
+ scope 5 (inlined <Result<i32, i32> as Try>::branch) {
+ debug self => _4;
+ let mut _10: isize;
+ let _11: i32;
+ let _12: i32;
+ let mut _13: std::result::Result<std::convert::Infallible, i32>;
+ scope 6 {
+ debug v => _11;
+ }
+ scope 7 {
+ debug e => _12;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _10 = discriminant(_4);
+ switchInt(move _10) -> [0: bb8, 1: bb6, otherwise: bb7];
+ }
+
+ bb1: {
+ StorageLive(_9);
+ _9 = ((_3 as Continue).0: i32);
+ _2 = _9;
+ StorageDead(_9);
+ _0 = Result::<i32, i32>::Ok(move _2);
+ StorageDead(_2);
+ StorageDead(_3);
+ goto -> bb4;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_6);
+ _6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>);
+ StorageLive(_8);
+ _8 = _6;
+ StorageLive(_14);
+ _14 = move ((_8 as Err).0: i32);
+ StorageLive(_15);
+ _15 = move _14;
+ _0 = Result::<i32, i32>::Err(move _15);
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageDead(_8);
+ StorageDead(_6);
+ StorageDead(_2);
+ StorageDead(_3);
+ goto -> bb4;
+ }
+
+ bb4: {
+ return;
+ }
+
+ bb5: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_4);
+ _5 = discriminant(_3);
+- switchInt(move _5) -> [0: bb1, 1: bb3, otherwise: bb2];
++ goto -> bb1;
+ }
+
+ bb6: {
+ _12 = move ((_4 as Err).0: i32);
+ StorageLive(_13);
+ _13 = Result::<Infallible, i32>::Err(move _12);
+ _3 = ControlFlow::<Result<Infallible, i32>, i32>::Break(move _13);
+ StorageDead(_13);
+- goto -> bb5;
++ goto -> bb9;
+ }
+
+ bb7: {
+ unreachable;
+ }
+
+ bb8: {
+ _11 = move ((_4 as Ok).0: i32);
+ _3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(move _11);
+ goto -> bb5;
++ }
++
++ bb9: {
++ StorageDead(_12);
++ StorageDead(_11);
++ StorageDead(_10);
++ StorageDead(_4);
++ _5 = discriminant(_3);
++ goto -> bb3;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..f50603a66
--- /dev/null
+++ b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff
@@ -0,0 +1,139 @@
+- // MIR for `identity` before JumpThreading
++ // MIR for `identity` after JumpThreading
+
+ fn identity(_1: Result<i32, i32>) -> Result<i32, i32> {
+ debug x => _1;
+ let mut _0: std::result::Result<i32, i32>;
+ let mut _2: i32;
+ let mut _3: std::ops::ControlFlow<std::result::Result<std::convert::Infallible, i32>, i32>;
+ let mut _4: std::result::Result<i32, i32>;
+ let mut _5: isize;
+ let _6: std::result::Result<std::convert::Infallible, i32>;
+ let mut _7: !;
+ let mut _8: std::result::Result<std::convert::Infallible, i32>;
+ let _9: i32;
+ scope 1 {
+ debug residual => _6;
+ scope 2 {
+ scope 8 (inlined #[track_caller] <Result<i32, i32> as FromResidual<Result<Infallible, i32>>>::from_residual) {
+ debug residual => _8;
+ let _14: i32;
+ let mut _15: i32;
+ scope 9 {
+ debug e => _14;
+ scope 10 (inlined <i32 as From<i32>>::from) {
+ debug t => _14;
+ }
+ }
+ }
+ }
+ }
+ scope 3 {
+ debug val => _9;
+ scope 4 {
+ }
+ }
+ scope 5 (inlined <Result<i32, i32> as Try>::branch) {
+ debug self => _4;
+ let mut _10: isize;
+ let _11: i32;
+ let _12: i32;
+ let mut _13: std::result::Result<std::convert::Infallible, i32>;
+ scope 6 {
+ debug v => _11;
+ }
+ scope 7 {
+ debug e => _12;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _10 = discriminant(_4);
+ switchInt(move _10) -> [0: bb8, 1: bb6, otherwise: bb7];
+ }
+
+ bb1: {
+ StorageLive(_9);
+ _9 = ((_3 as Continue).0: i32);
+ _2 = _9;
+ StorageDead(_9);
+ _0 = Result::<i32, i32>::Ok(move _2);
+ StorageDead(_2);
+ StorageDead(_3);
+ goto -> bb4;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_6);
+ _6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>);
+ StorageLive(_8);
+ _8 = _6;
+ StorageLive(_14);
+ _14 = move ((_8 as Err).0: i32);
+ StorageLive(_15);
+ _15 = move _14;
+ _0 = Result::<i32, i32>::Err(move _15);
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageDead(_8);
+ StorageDead(_6);
+ StorageDead(_2);
+ StorageDead(_3);
+ goto -> bb4;
+ }
+
+ bb4: {
+ return;
+ }
+
+ bb5: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_4);
+ _5 = discriminant(_3);
+- switchInt(move _5) -> [0: bb1, 1: bb3, otherwise: bb2];
++ goto -> bb1;
+ }
+
+ bb6: {
+ _12 = move ((_4 as Err).0: i32);
+ StorageLive(_13);
+ _13 = Result::<Infallible, i32>::Err(move _12);
+ _3 = ControlFlow::<Result<Infallible, i32>, i32>::Break(move _13);
+ StorageDead(_13);
+- goto -> bb5;
++ goto -> bb9;
+ }
+
+ bb7: {
+ unreachable;
+ }
+
+ bb8: {
+ _11 = move ((_4 as Ok).0: i32);
+ _3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(move _11);
+ goto -> bb5;
++ }
++
++ bb9: {
++ StorageDead(_12);
++ StorageDead(_11);
++ StorageDead(_10);
++ StorageDead(_4);
++ _5 = discriminant(_3);
++ goto -> bb3;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..2ca03e439
--- /dev/null
+++ b/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-abort.diff
@@ -0,0 +1,54 @@
+- // MIR for `multiple_match` before JumpThreading
++ // MIR for `multiple_match` after JumpThreading
+
+ fn multiple_match(_1: u8) -> u8 {
+ let mut _0: u8;
+ let mut _2: u8;
+ let mut _3: u8;
+
+ bb0: {
+ switchInt(_1) -> [3: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _2 = _1;
+- switchInt(_2) -> [3: bb3, otherwise: bb4];
++ goto -> bb3;
+ }
+
+ bb2: {
+ _3 = _1;
+- switchInt(_3) -> [3: bb5, otherwise: bb6];
++ goto -> bb6;
+ }
+
+ bb3: {
+ _0 = const 5_u8;
+ return;
+ }
+
+ bb4: {
+ _0 = const 7_u8;
+ return;
+ }
+
+ bb5: {
+ _0 = const 9_u8;
+ return;
+ }
+
+ bb6: {
+ switchInt(_3) -> [1: bb7, otherwise: bb8];
+ }
+
+ bb7: {
+ _0 = const 9_u8;
+ return;
+ }
+
+ bb8: {
+ _0 = const 11_u8;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..2ca03e439
--- /dev/null
+++ b/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-unwind.diff
@@ -0,0 +1,54 @@
+- // MIR for `multiple_match` before JumpThreading
++ // MIR for `multiple_match` after JumpThreading
+
+ fn multiple_match(_1: u8) -> u8 {
+ let mut _0: u8;
+ let mut _2: u8;
+ let mut _3: u8;
+
+ bb0: {
+ switchInt(_1) -> [3: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _2 = _1;
+- switchInt(_2) -> [3: bb3, otherwise: bb4];
++ goto -> bb3;
+ }
+
+ bb2: {
+ _3 = _1;
+- switchInt(_3) -> [3: bb5, otherwise: bb6];
++ goto -> bb6;
+ }
+
+ bb3: {
+ _0 = const 5_u8;
+ return;
+ }
+
+ bb4: {
+ _0 = const 7_u8;
+ return;
+ }
+
+ bb5: {
+ _0 = const 9_u8;
+ return;
+ }
+
+ bb6: {
+ switchInt(_3) -> [1: bb7, otherwise: bb8];
+ }
+
+ bb7: {
+ _0 = const 9_u8;
+ return;
+ }
+
+ bb8: {
+ _0 = const 11_u8;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..80a422636
--- /dev/null
+++ b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff
@@ -0,0 +1,56 @@
+- // MIR for `mutable_ref` before JumpThreading
++ // MIR for `mutable_ref` after JumpThreading
+
+ fn mutable_ref() -> bool {
+ let mut _0: bool;
+ let mut _1: i32;
+ let _3: ();
+ let mut _4: bool;
+ let mut _5: i32;
+ scope 1 {
+ debug x => _1;
+ let _2: *mut i32;
+ scope 2 {
+ debug a => _2;
+ scope 3 {
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 5_i32;
+ StorageLive(_2);
+ _2 = &raw mut _1;
+ _1 = const 7_i32;
+ StorageLive(_3);
+ (*_2) = const 8_i32;
+ _3 = const ();
+ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ _4 = Eq(move _5, const 7_i32);
+ switchInt(move _4) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ _0 = const true;
+ goto -> bb3;
+ }
+
+ bb2: {
+ StorageDead(_5);
+ _0 = const false;
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..80a422636
--- /dev/null
+++ b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff
@@ -0,0 +1,56 @@
+- // MIR for `mutable_ref` before JumpThreading
++ // MIR for `mutable_ref` after JumpThreading
+
+ fn mutable_ref() -> bool {
+ let mut _0: bool;
+ let mut _1: i32;
+ let _3: ();
+ let mut _4: bool;
+ let mut _5: i32;
+ scope 1 {
+ debug x => _1;
+ let _2: *mut i32;
+ scope 2 {
+ debug a => _2;
+ scope 3 {
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 5_i32;
+ StorageLive(_2);
+ _2 = &raw mut _1;
+ _1 = const 7_i32;
+ StorageLive(_3);
+ (*_2) = const 8_i32;
+ _3 = const ();
+ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ _4 = Eq(move _5, const 7_i32);
+ switchInt(move _4) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ _0 = const true;
+ goto -> bb3;
+ }
+
+ bb2: {
+ StorageDead(_5);
+ _0 = const false;
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..8821b47c3
--- /dev/null
+++ b/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-abort.diff
@@ -0,0 +1,26 @@
+- // MIR for `mutate_discriminant` before JumpThreading
++ // MIR for `mutate_discriminant` after JumpThreading
+
+ 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/jump_threading.mutate_discriminant.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..8821b47c3
--- /dev/null
+++ b/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-unwind.diff
@@ -0,0 +1,26 @@
+- // MIR for `mutate_discriminant` before JumpThreading
++ // MIR for `mutate_discriminant` after JumpThreading
+
+ 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/jump_threading.renumbered_bb.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..2d943a4be
--- /dev/null
+++ b/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-abort.diff
@@ -0,0 +1,57 @@
+- // MIR for `renumbered_bb` before JumpThreading
++ // MIR for `renumbered_bb` after JumpThreading
+
+ fn renumbered_bb(_1: bool) -> u8 {
+ let mut _0: u8;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ _3 = const false;
+ switchInt(_1) -> [1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _2 = const false;
+- goto -> bb3;
++ goto -> bb8;
+ }
+
+ bb2: {
+ _2 = _1;
+ _3 = _1;
+ goto -> bb3;
+ }
+
+ bb3: {
+ switchInt(_2) -> [0: bb4, otherwise: bb5];
+ }
+
+ bb4: {
+ switchInt(_3) -> [0: bb6, otherwise: bb7];
+ }
+
+ bb5: {
+ _0 = const 7_u8;
+ return;
+ }
+
+ bb6: {
+ _0 = const 9_u8;
+ return;
+ }
+
+ bb7: {
+ _0 = const 11_u8;
+ return;
++ }
++
++ bb8: {
++ goto -> bb9;
++ }
++
++ bb9: {
++ goto -> bb6;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..2d943a4be
--- /dev/null
+++ b/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-unwind.diff
@@ -0,0 +1,57 @@
+- // MIR for `renumbered_bb` before JumpThreading
++ // MIR for `renumbered_bb` after JumpThreading
+
+ fn renumbered_bb(_1: bool) -> u8 {
+ let mut _0: u8;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ _3 = const false;
+ switchInt(_1) -> [1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _2 = const false;
+- goto -> bb3;
++ goto -> bb8;
+ }
+
+ bb2: {
+ _2 = _1;
+ _3 = _1;
+ goto -> bb3;
+ }
+
+ bb3: {
+ switchInt(_2) -> [0: bb4, otherwise: bb5];
+ }
+
+ bb4: {
+ switchInt(_3) -> [0: bb6, otherwise: bb7];
+ }
+
+ bb5: {
+ _0 = const 7_u8;
+ return;
+ }
+
+ bb6: {
+ _0 = const 9_u8;
+ return;
+ }
+
+ bb7: {
+ _0 = const 11_u8;
+ return;
++ }
++
++ bb8: {
++ goto -> bb9;
++ }
++
++ bb9: {
++ goto -> bb6;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.rs b/tests/mir-opt/jump_threading.rs
new file mode 100644
index 000000000..66e5c5d3c
--- /dev/null
+++ b/tests/mir-opt/jump_threading.rs
@@ -0,0 +1,480 @@
+// unit-test: JumpThreading
+// compile-flags: -Zmir-enable-passes=+Inline
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
+#![feature(control_flow_enum)]
+#![feature(try_trait_v2)]
+#![feature(custom_mir, core_intrinsics, rustc_attrs)]
+
+use std::intrinsics::mir::*;
+use std::ops::ControlFlow;
+
+fn too_complex(x: Result<i32, usize>) -> Option<i32> {
+ // CHECK-LABEL: fn too_complex(
+ // CHECK: bb0: {
+ // CHECK: switchInt(move {{_.*}}) -> [0: bb3, 1: bb1, otherwise: bb2];
+ // CHECK: bb1: {
+ // CHECK: [[controlflow:_.*]] = ControlFlow::<usize, i32>::Break(
+ // CHECK: goto -> bb8;
+ // CHECK: bb2: {
+ // CHECK: unreachable;
+ // CHECK: bb3: {
+ // CHECK: [[controlflow]] = ControlFlow::<usize, i32>::Continue(
+ // CHECK: goto -> bb4;
+ // CHECK: bb4: {
+ // CHECK: goto -> bb6;
+ // CHECK: bb5: {
+ // CHECK: {{_.*}} = (([[controlflow]] as Break).0: usize);
+ // CHECK: _0 = Option::<i32>::None;
+ // CHECK: goto -> bb7;
+ // CHECK: bb6: {
+ // CHECK: {{_.*}} = (([[controlflow]] as Continue).0: i32);
+ // CHECK: _0 = Option::<i32>::Some(
+ // CHECK: goto -> bb7;
+ // CHECK: bb7: {
+ // CHECK: return;
+ // CHECK: bb8: {
+ // CHECK: goto -> bb5;
+ match {
+ match x {
+ Ok(v) => ControlFlow::Continue(v),
+ Err(r) => ControlFlow::Break(r),
+ }
+ } {
+ ControlFlow::Continue(v) => Some(v),
+ ControlFlow::Break(r) => None,
+ }
+}
+
+fn identity(x: Result<i32, i32>) -> Result<i32, i32> {
+ // CHECK-LABEL: fn identity(
+ // CHECK: bb0: {
+ // CHECK: [[x:_.*]] = _1;
+ // CHECK: switchInt(move {{_.*}}) -> [0: bb8, 1: bb6, otherwise: bb7];
+ // CHECK: bb1: {
+ // CHECK: {{_.*}} = (([[controlflow:_.*]] as Continue).0: i32);
+ // CHECK: _0 = Result::<i32, i32>::Ok(
+ // CHECK: goto -> bb4;
+ // CHECK: bb2: {
+ // CHECK: unreachable;
+ // CHECK: bb3: {
+ // CHECK: {{_.*}} = (([[controlflow]] as Break).0: std::result::Result<std::convert::Infallible, i32>);
+ // CHECK: _0 = Result::<i32, i32>::Err(
+ // CHECK: goto -> bb4;
+ // CHECK: bb4: {
+ // CHECK: return;
+ // CHECK: bb5: {
+ // CHECK: goto -> bb1;
+ // CHECK: bb6: {
+ // CHECK: {{_.*}} = move (([[x]] as Err).0: i32);
+ // CHECK: [[controlflow]] = ControlFlow::<Result<Infallible, i32>, i32>::Break(
+ // CHECK: goto -> bb9;
+ // CHECK: bb7: {
+ // CHECK: unreachable;
+ // CHECK: bb8: {
+ // CHECK: {{_.*}} = move (([[x]] as Ok).0: i32);
+ // CHECK: [[controlflow]] = ControlFlow::<Result<Infallible, i32>, i32>::Continue(
+ // CHECK: goto -> bb5;
+ // CHECK: bb9: {
+ // CHECK: goto -> bb3;
+ Ok(x?)
+}
+
+enum DFA {
+ A,
+ B,
+ C,
+ D,
+}
+
+/// Check that we do not thread through a loop header,
+/// to avoid creating an irreducible CFG.
+fn dfa() {
+ // CHECK-LABEL: fn dfa(
+ // CHECK: bb0: {
+ // CHECK: {{_.*}} = DFA::A;
+ // CHECK: goto -> bb1;
+ // CHECK: bb1: {
+ // CHECK: switchInt({{.*}}) -> [0: bb4, 1: bb5, 2: bb6, 3: bb2, otherwise: bb3];
+ // CHECK: bb2: {
+ // CHECK: return;
+ // CHECK: bb3: {
+ // CHECK: unreachable;
+ // CHECK: bb4: {
+ // CHECK: {{_.*}} = DFA::B;
+ // CHECK: goto -> bb1;
+ // CHECK: bb5: {
+ // CHECK: {{_.*}} = DFA::C;
+ // CHECK: goto -> bb1;
+ // CHECK: bb6: {
+ // CHECK: {{_.*}} = DFA::D;
+ // CHECK: goto -> bb1;
+ let mut state = DFA::A;
+ loop {
+ match state {
+ DFA::A => state = DFA::B,
+ DFA::B => state = DFA::C,
+ DFA::C => state = DFA::D,
+ DFA::D => return,
+ }
+ }
+}
+
+#[repr(u8)]
+enum CustomDiscr {
+ A = 35,
+ B = 73,
+ C = 99,
+}
+
+/// Verify that we correctly match the discriminant value, and not its index.
+fn custom_discr(x: bool) -> u8 {
+ // CHECK-LABEL: fn custom_discr(
+ // CHECK: bb0: {
+ // CHECK: switchInt({{.*}}) -> [0: bb2, otherwise: bb1];
+ // CHECK: bb1: {
+ // CHECK: {{_.*}} = CustomDiscr::A;
+ // CHECK: goto -> bb7;
+ // CHECK: bb2: {
+ // CHECK: {{_.*}} = CustomDiscr::B;
+ // CHECK: goto -> bb3;
+ // CHECK: bb3: {
+ // CHECK: goto -> bb4;
+ // CHECK: bb4: {
+ // CHECK: _0 = const 13_u8;
+ // CHECK: goto -> bb6;
+ // CHECK: bb5: {
+ // CHECK: _0 = const 5_u8;
+ // CHECK: goto -> bb6;
+ // CHECK: bb6: {
+ // CHECK: return;
+ // CHECK: bb7: {
+ // CHECK: goto -> bb5;
+ match if x { CustomDiscr::A } else { CustomDiscr::B } {
+ CustomDiscr::A => 5,
+ _ => 13,
+ }
+}
+
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+fn multiple_match(x: u8) -> u8 {
+ // CHECK-LABEL: fn multiple_match(
+ mir!(
+ {
+ // CHECK: bb0: {
+ // CHECK: switchInt([[x:_.*]]) -> [3: bb1, otherwise: bb2];
+ match x { 3 => bb1, _ => bb2 }
+ }
+ bb1 = {
+ // We know `x == 3`, so we can take `bb3`.
+ // CHECK: bb1: {
+ // CHECK: {{_.*}} = [[x]];
+ // CHECK: goto -> bb3;
+ let y = x;
+ match y { 3 => bb3, _ => bb4 }
+ }
+ bb2 = {
+ // We know `x != 3`, so we can take `bb6`.
+ // CHECK: bb2: {
+ // CHECK: [[z:_.*]] = [[x]];
+ // CHECK: goto -> bb6;
+ let z = x;
+ match z { 3 => bb5, _ => bb6 }
+ }
+ bb3 = {
+ // CHECK: bb3: {
+ // CHECK: _0 = const 5_u8;
+ // CHECK: return;
+ RET = 5;
+ Return()
+ }
+ bb4 = {
+ // CHECK: bb4: {
+ // CHECK: _0 = const 7_u8;
+ // CHECK: return;
+ RET = 7;
+ Return()
+ }
+ bb5 = {
+ // CHECK: bb5: {
+ // CHECK: _0 = const 9_u8;
+ // CHECK: return;
+ RET = 9;
+ Return()
+ }
+ bb6 = {
+ // We know `z != 3`, so we CANNOT take `bb7`.
+ // CHECK: bb6: {
+ // CHECK: switchInt([[z]]) -> [1: bb7, otherwise: bb8];
+ match z { 1 => bb7, _ => bb8 }
+ }
+ bb7 = {
+ // CHECK: bb7: {
+ // CHECK: _0 = const 9_u8;
+ // CHECK: return;
+ RET = 9;
+ Return()
+ }
+ bb8 = {
+ // CHECK: bb8: {
+ // CHECK: _0 = const 11_u8;
+ // CHECK: return;
+ RET = 11;
+ Return()
+ }
+ )
+}
+
+/// Both 1-3-4 and 2-3-4 are threadable. As 1 and 2 are the only predecessors of 3,
+/// verify that we only thread the 3-4 part.
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+fn duplicate_chain(x: bool) -> u8 {
+ // CHECK-LABEL: fn duplicate_chain(
+ mir!(
+ let a: u8;
+ {
+ // CHECK: bb0: {
+ // CHECK: switchInt({{.*}}) -> [1: bb1, otherwise: bb2];
+ match x { true => bb1, _ => bb2 }
+ }
+ bb1 = {
+ // CHECK: bb1: {
+ // CHECK: [[a:_.*]] = const 5_u8;
+ // CHECK: goto -> bb3;
+ a = 5;
+ Goto(bb3)
+ }
+ bb2 = {
+ // CHECK: bb2: {
+ // CHECK: [[a]] = const 5_u8;
+ // CHECK: goto -> bb3;
+ a = 5;
+ Goto(bb3)
+ }
+ bb3 = {
+ // CHECK: bb3: {
+ // CHECK: {{_.*}} = const 13_i32;
+ // CHECK: goto -> bb4;
+ let b = 13;
+ Goto(bb4)
+ }
+ bb4 = {
+ // CHECK: bb4: {
+ // CHECK: {{_.*}} = const 15_i32;
+ // CHECK-NOT: switchInt(
+ // CHECK: goto -> bb5;
+ let c = 15;
+ match a { 5 => bb5, _ => bb6 }
+ }
+ bb5 = {
+ // CHECK: bb5: {
+ // CHECK: _0 = const 7_u8;
+ // CHECK: return;
+ RET = 7;
+ Return()
+ }
+ bb6 = {
+ // CHECK: bb6: {
+ // CHECK: _0 = const 9_u8;
+ // CHECK: return;
+ RET = 9;
+ Return()
+ }
+ )
+}
+
+#[rustc_layout_scalar_valid_range_start(1)]
+#[rustc_nonnull_optimization_guaranteed]
+struct NonZeroUsize(usize);
+
+/// Verify that we correctly discard threads that may mutate a discriminant by aliasing.
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+fn mutate_discriminant() -> u8 {
+ // CHECK-LABEL: fn mutate_discriminant(
+ // CHECK-NOT: goto -> {{bb.*}};
+ // CHECK: switchInt(
+ // CHECK-NOT: goto -> {{bb.*}};
+ mir!(
+ let x: Option<NonZeroUsize>;
+ {
+ SetDiscriminant(x, 1);
+ // This assignment overwrites the niche in which the discriminant is stored.
+ place!(Field(Field(Variant(x, 1), 0), 0)) = 0_usize;
+ // So we cannot know the value of this discriminant.
+ let a = Discriminant(x);
+ match a {
+ 0 => bb1,
+ _ => bad,
+ }
+ }
+ bb1 = {
+ RET = 1;
+ Return()
+ }
+ bad = {
+ RET = 2;
+ Unreachable()
+ }
+ )
+}
+
+/// Verify that we do not try to reason when there are mutable pointers involved.
+fn mutable_ref() -> bool {
+ // CHECK-LABEL: fn mutable_ref(
+ // CHECK-NOT: goto -> {{bb.*}};
+ // CHECK: switchInt(
+ // CHECK: goto -> [[bbret:bb.*]];
+ // CHECK: goto -> [[bbret]];
+ // CHECK: [[bbret]]: {
+ // CHECK-NOT: {{bb.*}}: {
+ // CHECK: return;
+ let mut x = 5;
+ let a = std::ptr::addr_of_mut!(x);
+ x = 7;
+ unsafe { *a = 8 };
+ if x == 7 {
+ true
+ } else {
+ false
+ }
+}
+
+/// This function has 2 TOs: 1-3-4 and 0-1-3-4-6.
+/// We verify that the second TO does not modify 3 once the first has been applied.
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+fn renumbered_bb(x: bool) -> u8 {
+ // CHECK-LABEL: fn renumbered_bb(
+ mir!(
+ let a: bool;
+ let b: bool;
+ {
+ // CHECK: bb0: {
+ // CHECK: switchInt({{.*}}) -> [1: bb1, otherwise: bb2];
+ b = false;
+ match x { true => bb1, _ => bb2 }
+ }
+ bb1 = {
+ // CHECK: bb1: {
+ // CHECK: goto -> bb8;
+ a = false;
+ Goto(bb3)
+ }
+ bb2 = {
+ // CHECK: bb2: {
+ // CHECK: goto -> bb3;
+ a = x;
+ b = x;
+ Goto(bb3)
+ }
+ bb3 = {
+ // CHECK: bb3: {
+ // CHECK: switchInt({{.*}}) -> [0: bb4, otherwise: bb5];
+ match a { false => bb4, _ => bb5 }
+ }
+ bb4 = {
+ // CHECK: bb4: {
+ // CHECK: switchInt({{.*}}) -> [0: bb6, otherwise: bb7];
+ match b { false => bb6, _ => bb7 }
+ }
+ bb5 = {
+ // CHECK: bb5: {
+ // CHECK: _0 = const 7_u8;
+ RET = 7;
+ Return()
+ }
+ bb6 = {
+ // CHECK: bb6: {
+ // CHECK: _0 = const 9_u8;
+ RET = 9;
+ Return()
+ }
+ bb7 = {
+ // CHECK: bb7: {
+ // CHECK: _0 = const 11_u8;
+ RET = 11;
+ Return()
+ }
+ // Duplicate of bb3.
+ // CHECK: bb8: {
+ // CHECK-NEXT: goto -> bb9;
+ // Duplicate of bb4.
+ // CHECK: bb9: {
+ // CHECK-NEXT: goto -> bb6;
+ )
+}
+
+/// This function has 3 TOs: 1-4-5, 0-1-4-7-5-8 and 3-4-7-5-6
+/// After applying the first TO, we create bb9 to replace 4, and rename 1-4 edge by 1-9. The
+/// second TO may try to thread non-existing edge 9-4.
+/// This test verifies that we preserve semantics by bailing out of this second TO.
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+fn disappearing_bb(x: u8) -> u8 {
+ // CHECK-LABEL: fn disappearing_bb(
+ mir!(
+ let a: bool;
+ let b: bool;
+ {
+ a = true;
+ b = true;
+ match x { 0 => bb3, 1 => bb3, 2 => bb1, _ => bb2 }
+ }
+ bb1 = {
+ // CHECK: bb1: {
+ // CHECK: goto -> bb9;
+ b = false;
+ Goto(bb4)
+ }
+ bb2 = {
+ Unreachable()
+ }
+ bb3 = {
+ // CHECK: bb3: {
+ // CHECK: goto -> bb10;
+ a = false;
+ Goto(bb4)
+ }
+ bb4 = {
+ match b { false => bb5, _ => bb7 }
+ }
+ bb5 = {
+ match a { false => bb6, _ => bb8 }
+ }
+ bb6 = {
+ Return()
+ }
+ bb7 = {
+ Goto(bb5)
+ }
+ bb8 = {
+ Goto(bb6)
+ }
+ // CHECK: bb9: {
+ // CHECK: goto -> bb5;
+ // CHECK: bb10: {
+ // CHECK: goto -> bb6;
+ )
+}
+
+fn main() {
+ too_complex(Ok(0));
+ identity(Ok(0));
+ custom_discr(false);
+ dfa();
+ multiple_match(5);
+ duplicate_chain(false);
+ mutate_discriminant();
+ mutable_ref();
+ renumbered_bb(true);
+ disappearing_bb(7);
+}
+
+// EMIT_MIR jump_threading.too_complex.JumpThreading.diff
+// EMIT_MIR jump_threading.identity.JumpThreading.diff
+// EMIT_MIR jump_threading.custom_discr.JumpThreading.diff
+// EMIT_MIR jump_threading.dfa.JumpThreading.diff
+// EMIT_MIR jump_threading.multiple_match.JumpThreading.diff
+// EMIT_MIR jump_threading.duplicate_chain.JumpThreading.diff
+// EMIT_MIR jump_threading.mutate_discriminant.JumpThreading.diff
+// EMIT_MIR jump_threading.mutable_ref.JumpThreading.diff
+// EMIT_MIR jump_threading.renumbered_bb.JumpThreading.diff
+// EMIT_MIR jump_threading.disappearing_bb.JumpThreading.diff
diff --git a/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..f5eade4a9
--- /dev/null
+++ b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff
@@ -0,0 +1,98 @@
+- // MIR for `too_complex` before JumpThreading
++ // MIR for `too_complex` after JumpThreading
+
+ fn too_complex(_1: Result<i32, usize>) -> Option<i32> {
+ debug x => _1;
+ let mut _0: std::option::Option<i32>;
+ let mut _2: std::ops::ControlFlow<usize, i32>;
+ let mut _3: isize;
+ let _4: i32;
+ let mut _5: i32;
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: isize;
+ let _9: i32;
+ let mut _10: i32;
+ let _11: usize;
+ scope 1 {
+ debug v => _4;
+ }
+ scope 2 {
+ debug r => _6;
+ }
+ scope 3 {
+ debug v => _9;
+ }
+ scope 4 {
+ debug r => _11;
+ }
+
+ bb0: {
+ StorageLive(_2);
+ _3 = discriminant(_1);
+ switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = ((_1 as Err).0: usize);
+ StorageLive(_7);
+ _7 = _6;
+ _2 = ControlFlow::<usize, i32>::Break(move _7);
+ StorageDead(_7);
+ StorageDead(_6);
+- goto -> bb4;
++ goto -> bb8;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_4);
+ _4 = ((_1 as Ok).0: i32);
+ StorageLive(_5);
+ _5 = _4;
+ _2 = ControlFlow::<usize, i32>::Continue(move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ goto -> bb4;
+ }
+
+ bb4: {
+ _8 = discriminant(_2);
+- switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb2];
++ goto -> bb6;
+ }
+
+ bb5: {
+ StorageLive(_11);
+ _11 = ((_2 as Break).0: usize);
+ _0 = Option::<i32>::None;
+ StorageDead(_11);
+ goto -> bb7;
+ }
+
+ bb6: {
+ StorageLive(_9);
+ _9 = ((_2 as Continue).0: i32);
+ StorageLive(_10);
+ _10 = _9;
+ _0 = Option::<i32>::Some(move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ goto -> bb7;
+ }
+
+ bb7: {
+ StorageDead(_2);
+ return;
++ }
++
++ bb8: {
++ _8 = discriminant(_2);
++ goto -> bb5;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..f5eade4a9
--- /dev/null
+++ b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff
@@ -0,0 +1,98 @@
+- // MIR for `too_complex` before JumpThreading
++ // MIR for `too_complex` after JumpThreading
+
+ fn too_complex(_1: Result<i32, usize>) -> Option<i32> {
+ debug x => _1;
+ let mut _0: std::option::Option<i32>;
+ let mut _2: std::ops::ControlFlow<usize, i32>;
+ let mut _3: isize;
+ let _4: i32;
+ let mut _5: i32;
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: isize;
+ let _9: i32;
+ let mut _10: i32;
+ let _11: usize;
+ scope 1 {
+ debug v => _4;
+ }
+ scope 2 {
+ debug r => _6;
+ }
+ scope 3 {
+ debug v => _9;
+ }
+ scope 4 {
+ debug r => _11;
+ }
+
+ bb0: {
+ StorageLive(_2);
+ _3 = discriminant(_1);
+ switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = ((_1 as Err).0: usize);
+ StorageLive(_7);
+ _7 = _6;
+ _2 = ControlFlow::<usize, i32>::Break(move _7);
+ StorageDead(_7);
+ StorageDead(_6);
+- goto -> bb4;
++ goto -> bb8;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_4);
+ _4 = ((_1 as Ok).0: i32);
+ StorageLive(_5);
+ _5 = _4;
+ _2 = ControlFlow::<usize, i32>::Continue(move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ goto -> bb4;
+ }
+
+ bb4: {
+ _8 = discriminant(_2);
+- switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb2];
++ goto -> bb6;
+ }
+
+ bb5: {
+ StorageLive(_11);
+ _11 = ((_2 as Break).0: usize);
+ _0 = Option::<i32>::None;
+ StorageDead(_11);
+ goto -> bb7;
+ }
+
+ bb6: {
+ StorageLive(_9);
+ _9 = ((_2 as Continue).0: i32);
+ StorageLive(_10);
+ _10 = _9;
+ _0 = Option::<i32>::Some(move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ goto -> bb7;
+ }
+
+ bb7: {
+ StorageDead(_2);
+ return;
++ }
++
++ bb8: {
++ _8 = discriminant(_2);
++ goto -> bb5;
+ }
+ }
+
diff --git a/tests/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir b/tests/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir
index 43d00b29e..74754bc16 100644
--- a/tests/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir
+++ b/tests/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir
@@ -1,52 +1,52 @@
// MIR for `main` after SimplifyCfg-promote-consts
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/loop_test.rs:+0:11: +0:11
- let _1: (); // in scope 0 at $DIR/loop_test.rs:+4:5: +6:6
- let mut _2: bool; // in scope 0 at $DIR/loop_test.rs:+4:8: +4:12
- let mut _3: !; // in scope 0 at $DIR/loop_test.rs:+4:13: +6:6
- let mut _4: !; // in scope 0 at $DIR/loop_test.rs:+7:5: +10:6
- let mut _5: (); // in scope 0 at $DIR/loop_test.rs:+0:1: +11:2
- let _6: i32; // in scope 0 at $DIR/loop_test.rs:+8:13: +8:14
+ let mut _0: ();
+ let _1: ();
+ let mut _2: bool;
+ let mut _3: !;
+ let mut _4: !;
+ let mut _5: ();
+ let _6: i32;
scope 1 {
- debug x => _6; // in scope 1 at $DIR/loop_test.rs:+8:13: +8:14
+ debug x => _6;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/loop_test.rs:+4:5: +6:6
- StorageLive(_2); // scope 0 at $DIR/loop_test.rs:+4:8: +4:12
- _2 = const true; // scope 0 at $DIR/loop_test.rs:+4:8: +4:12
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/loop_test.rs:+4:8: +4:12
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const true;
+ switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
- _0 = const (); // scope 0 at $DIR/loop_test.rs:+5:9: +5:15
- StorageDead(_2); // scope 0 at $DIR/loop_test.rs:+6:5: +6:6
- StorageDead(_1); // scope 0 at $DIR/loop_test.rs:+6:5: +6:6
- return; // scope 0 at $DIR/loop_test.rs:+11:2: +11:2
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
bb2: {
- _1 = const (); // scope 0 at $DIR/loop_test.rs:+6:6: +6:6
- StorageDead(_2); // scope 0 at $DIR/loop_test.rs:+6:5: +6:6
- StorageDead(_1); // scope 0 at $DIR/loop_test.rs:+6:5: +6:6
- StorageLive(_4); // scope 0 at $DIR/loop_test.rs:+7:5: +10:6
- goto -> bb3; // scope 0 at $DIR/loop_test.rs:+7:5: +10:6
+ _1 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ StorageLive(_4);
+ goto -> bb3;
}
bb3: {
- falseUnwind -> [real: bb4, unwind: bb5]; // scope 0 at $DIR/loop_test.rs:+7:5: +10:6
+ falseUnwind -> [real: bb4, unwind: bb5];
}
bb4: {
- StorageLive(_6); // scope 0 at $DIR/loop_test.rs:+8:13: +8:14
- _6 = const 1_i32; // scope 0 at $DIR/loop_test.rs:+8:17: +8:18
- FakeRead(ForLet(None), _6); // scope 0 at $DIR/loop_test.rs:+8:13: +8:14
- StorageDead(_6); // scope 0 at $DIR/loop_test.rs:+10:5: +10:6
- goto -> bb3; // scope 0 at no-location
+ StorageLive(_6);
+ _6 = const 1_i32;
+ FakeRead(ForLet(None), _6);
+ StorageDead(_6);
+ goto -> bb3;
}
bb5 (cleanup): {
- resume; // scope 0 at $DIR/loop_test.rs:+0:1: +11:2
+ resume;
}
}
diff --git a/tests/mir-opt/loop_test.rs b/tests/mir-opt/loop_test.rs
index 7ded5b575..81a0d9df0 100644
--- a/tests/mir-opt/loop_test.rs
+++ b/tests/mir-opt/loop_test.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z identify_regions
// Tests to make sure we correctly generate falseUnwind edges in loops
diff --git a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff
deleted file mode 100644
index 59de067f4..000000000
--- a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff
+++ /dev/null
@@ -1,64 +0,0 @@
-- // MIR for `array_bound` before NormalizeArrayLen
-+ // MIR for `array_bound` after NormalizeArrayLen
-
- fn array_bound(_1: usize, _2: &[u8; N]) -> u8 {
- debug index => _1; // in scope 0 at $DIR/lower_array_len.rs:+0:36: +0:41
- debug slice => _2; // in scope 0 at $DIR/lower_array_len.rs:+0:50: +0:55
- let mut _0: u8; // return place in scope 0 at $DIR/lower_array_len.rs:+0:70: +0:72
- let mut _3: bool; // in scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27
- let mut _4: usize; // in scope 0 at $DIR/lower_array_len.rs:+1:8: +1:13
- let mut _5: usize; // in scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- let mut _6: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- let mut _7: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- let _8: usize; // in scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20
- let mut _9: usize; // in scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21
- let mut _10: bool; // in scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21
-
- bb0: {
- StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27
- StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:13
- _4 = _1; // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:13
- StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- _7 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:+1:20: +1:21
-- _5 = Len((*_6)); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
-+ _5 = const N; // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- goto -> bb1; // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- }
-
- bb1: {
- StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27
- _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27
- StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27
- StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27
- switchInt(move _3) -> [0: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27
- }
-
- bb2: {
- StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20
- _8 = _1; // scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20
- _9 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21
- _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21
- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb3; // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21
- }
-
- bb3: {
- _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21
- StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:+3:5: +3:6
- goto -> bb5; // scope 0 at $DIR/lower_array_len.rs:+1:5: +5:6
- }
-
- bb4: {
- _0 = const 42_u8; // scope 0 at $DIR/lower_array_len.rs:+4:9: +4:11
- goto -> bb5; // scope 0 at $DIR/lower_array_len.rs:+1:5: +5:6
- }
-
- bb5: {
- StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:+5:5: +5:6
- return; // scope 0 at $DIR/lower_array_len.rs:+6:2: +6:2
- }
- }
-
diff --git a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff
new file mode 100644
index 000000000..5242c5f6a
--- /dev/null
+++ b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff
@@ -0,0 +1,66 @@
+- // MIR for `array_bound` before NormalizeArrayLen
++ // MIR for `array_bound` after NormalizeArrayLen
+
+ fn array_bound(_1: usize, _2: &[u8; N]) -> u8 {
+ debug index => _1;
+ debug slice => _2;
+ let mut _0: u8;
+ let mut _3: bool;
+ let mut _4: usize;
+ let mut _5: usize;
+ let mut _6: &[u8];
+ let mut _7: &[u8; N];
+ let _8: usize;
+ let mut _9: usize;
+ let mut _10: bool;
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &(*_2);
+ _6 = move _7 as &[u8] (PointerCoercion(Unsize));
+ StorageDead(_7);
+- _5 = Len((*_6));
++ _5 = const N;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_6);
+ _3 = Lt(move _4, move _5);
+ switchInt(move _3) -> [0: bb4, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_8);
+ _8 = _1;
+ _9 = Len((*_2));
+ _10 = Lt(_8, _9);
+ assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ _0 = (*_2)[_8];
+ StorageDead(_8);
+ goto -> bb5;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
+ _0 = const 42_u8;
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_3);
+ return;
+ }
+ }
+
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
new file mode 100644
index 000000000..a9e99933b
--- /dev/null
+++ b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff
@@ -0,0 +1,66 @@
+- // MIR for `array_bound` before NormalizeArrayLen
++ // MIR for `array_bound` after NormalizeArrayLen
+
+ fn array_bound(_1: usize, _2: &[u8; N]) -> u8 {
+ debug index => _1;
+ debug slice => _2;
+ let mut _0: u8;
+ let mut _3: bool;
+ let mut _4: usize;
+ let mut _5: usize;
+ let mut _6: &[u8];
+ let mut _7: &[u8; N];
+ let _8: usize;
+ let mut _9: usize;
+ let mut _10: bool;
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &(*_2);
+ _6 = move _7 as &[u8] (PointerCoercion(Unsize));
+ StorageDead(_7);
+- _5 = Len((*_6));
++ _5 = const N;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_6);
+ _3 = Lt(move _4, move _5);
+ switchInt(move _3) -> [0: bb4, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_8);
+ _8 = _1;
+ _9 = Len((*_2));
+ _10 = Lt(_8, _9);
+ assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind continue];
+ }
+
+ bb3: {
+ _0 = (*_2)[_8];
+ StorageDead(_8);
+ goto -> bb5;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
+ _0 = const 42_u8;
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff
deleted file mode 100644
index 17574b1b6..000000000
--- a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff
+++ /dev/null
@@ -1,77 +0,0 @@
-- // MIR for `array_bound_mut` before NormalizeArrayLen
-+ // MIR for `array_bound_mut` after NormalizeArrayLen
-
- fn array_bound_mut(_1: usize, _2: &mut [u8; N]) -> u8 {
- debug index => _1; // in scope 0 at $DIR/lower_array_len.rs:+0:40: +0:45
- debug slice => _2; // in scope 0 at $DIR/lower_array_len.rs:+0:54: +0:59
- let mut _0: u8; // return place in scope 0 at $DIR/lower_array_len.rs:+0:78: +0:80
- let mut _3: bool; // in scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27
- let mut _4: usize; // in scope 0 at $DIR/lower_array_len.rs:+1:8: +1:13
- let mut _5: usize; // in scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- let mut _6: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- let mut _7: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- let _8: usize; // in scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20
- let mut _9: usize; // in scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21
- let mut _10: bool; // in scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21
- let _11: usize; // in scope 0 at $DIR/lower_array_len.rs:+4:15: +4:16
- let mut _12: usize; // in scope 0 at $DIR/lower_array_len.rs:+4:9: +4:17
- let mut _13: bool; // in scope 0 at $DIR/lower_array_len.rs:+4:9: +4:17
-
- bb0: {
- StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27
- StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:13
- _4 = _1; // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:13
- StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- _7 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:+1:20: +1:21
-- _5 = Len((*_6)); // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
-+ _5 = const N; // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- goto -> bb1; // scope 0 at $DIR/lower_array_len.rs:+1:16: +1:27
- }
-
- bb1: {
- StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27
- _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27
- StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27
- StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27
- switchInt(move _3) -> [0: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27
- }
-
- bb2: {
- StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20
- _8 = _1; // scope 0 at $DIR/lower_array_len.rs:+2:15: +2:20
- _9 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21
- _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21
- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb3; // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21
- }
-
- bb3: {
- _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:+2:9: +2:21
- StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:+3:5: +3:6
- goto -> bb6; // scope 0 at $DIR/lower_array_len.rs:+1:5: +7:6
- }
-
- bb4: {
- StorageLive(_11); // scope 0 at $DIR/lower_array_len.rs:+4:15: +4:16
- _11 = const 0_usize; // scope 0 at $DIR/lower_array_len.rs:+4:15: +4:16
- _12 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:+4:9: +4:17
- _13 = Lt(_11, _12); // scope 0 at $DIR/lower_array_len.rs:+4:9: +4:17
- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> bb5; // scope 0 at $DIR/lower_array_len.rs:+4:9: +4:17
- }
-
- bb5: {
- (*_2)[_11] = const 42_u8; // scope 0 at $DIR/lower_array_len.rs:+4:9: +4:22
- StorageDead(_11); // scope 0 at $DIR/lower_array_len.rs:+4:22: +4:23
- _0 = const 42_u8; // scope 0 at $DIR/lower_array_len.rs:+6:9: +6:11
- goto -> bb6; // scope 0 at $DIR/lower_array_len.rs:+1:5: +7:6
- }
-
- bb6: {
- StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:+7:5: +7:6
- return; // scope 0 at $DIR/lower_array_len.rs:+8:2: +8:2
- }
- }
-
diff --git a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff
new file mode 100644
index 000000000..7749ba6be
--- /dev/null
+++ b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff
@@ -0,0 +1,79 @@
+- // MIR for `array_bound_mut` before NormalizeArrayLen
++ // MIR for `array_bound_mut` after NormalizeArrayLen
+
+ fn array_bound_mut(_1: usize, _2: &mut [u8; N]) -> u8 {
+ debug index => _1;
+ debug slice => _2;
+ let mut _0: u8;
+ let mut _3: bool;
+ let mut _4: usize;
+ let mut _5: usize;
+ let mut _6: &[u8];
+ let mut _7: &[u8; N];
+ let _8: usize;
+ let mut _9: usize;
+ let mut _10: bool;
+ let _11: usize;
+ let mut _12: usize;
+ let mut _13: bool;
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &(*_2);
+ _6 = move _7 as &[u8] (PointerCoercion(Unsize));
+ StorageDead(_7);
+- _5 = Len((*_6));
++ _5 = const N;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_6);
+ _3 = Lt(move _4, move _5);
+ switchInt(move _3) -> [0: bb4, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_8);
+ _8 = _1;
+ _9 = Len((*_2));
+ _10 = Lt(_8, _9);
+ assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ _0 = (*_2)[_8];
+ StorageDead(_8);
+ goto -> bb6;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_11);
+ _11 = const 0_usize;
+ _12 = Len((*_2));
+ _13 = Lt(_11, _12);
+ assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ (*_2)[_11] = const 42_u8;
+ StorageDead(_11);
+ _0 = const 42_u8;
+ goto -> bb6;
+ }
+
+ bb6: {
+ StorageDead(_3);
+ return;
+ }
+ }
+
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
new file mode 100644
index 000000000..fcc2c1653
--- /dev/null
+++ b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff
@@ -0,0 +1,79 @@
+- // MIR for `array_bound_mut` before NormalizeArrayLen
++ // MIR for `array_bound_mut` after NormalizeArrayLen
+
+ fn array_bound_mut(_1: usize, _2: &mut [u8; N]) -> u8 {
+ debug index => _1;
+ debug slice => _2;
+ let mut _0: u8;
+ let mut _3: bool;
+ let mut _4: usize;
+ let mut _5: usize;
+ let mut _6: &[u8];
+ let mut _7: &[u8; N];
+ let _8: usize;
+ let mut _9: usize;
+ let mut _10: bool;
+ let _11: usize;
+ let mut _12: usize;
+ let mut _13: bool;
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &(*_2);
+ _6 = move _7 as &[u8] (PointerCoercion(Unsize));
+ StorageDead(_7);
+- _5 = Len((*_6));
++ _5 = const N;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_6);
+ _3 = Lt(move _4, move _5);
+ switchInt(move _3) -> [0: bb4, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_8);
+ _8 = _1;
+ _9 = Len((*_2));
+ _10 = Lt(_8, _9);
+ assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind continue];
+ }
+
+ bb3: {
+ _0 = (*_2)[_8];
+ StorageDead(_8);
+ goto -> bb6;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_11);
+ _11 = const 0_usize;
+ _12 = Len((*_2));
+ _13 = Lt(_11, _12);
+ assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb5, unwind continue];
+ }
+
+ bb5: {
+ (*_2)[_11] = const 42_u8;
+ StorageDead(_11);
+ _0 = const 42_u8;
+ goto -> bb6;
+ }
+
+ bb6: {
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.diff b/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.diff
deleted file mode 100644
index 66feff62f..000000000
--- a/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.diff
+++ /dev/null
@@ -1,26 +0,0 @@
-- // MIR for `array_len` before NormalizeArrayLen
-+ // MIR for `array_len` after NormalizeArrayLen
-
- fn array_len(_1: &[u8; N]) -> usize {
- debug arr => _1; // in scope 0 at $DIR/lower_array_len.rs:+0:34: +0:37
- let mut _0: usize; // return place in scope 0 at $DIR/lower_array_len.rs:+0:52: +0:57
- let mut _2: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
- let mut _3: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
- StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
- _3 = &(*_1); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
- _2 = move _3 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
- StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:+1:7: +1:8
-- _0 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
-+ _0 = const N; // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
- goto -> bb1; // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
- }
-
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/lower_array_len.rs:+1:13: +1:14
- return; // scope 0 at $DIR/lower_array_len.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-abort.diff b/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-abort.diff
new file mode 100644
index 000000000..1bdc62183
--- /dev/null
+++ b/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-abort.diff
@@ -0,0 +1,26 @@
+- // MIR for `array_len` before NormalizeArrayLen
++ // MIR for `array_len` after NormalizeArrayLen
+
+ fn array_len(_1: &[u8; N]) -> usize {
+ debug arr => _1;
+ let mut _0: usize;
+ let mut _2: &[u8];
+ let mut _3: &[u8; N];
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &(*_1);
+ _2 = move _3 as &[u8] (PointerCoercion(Unsize));
+ StorageDead(_3);
+- _0 = Len((*_2));
++ _0 = const N;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-unwind.diff
new file mode 100644
index 000000000..1bdc62183
--- /dev/null
+++ b/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-unwind.diff
@@ -0,0 +1,26 @@
+- // MIR for `array_len` before NormalizeArrayLen
++ // MIR for `array_len` after NormalizeArrayLen
+
+ fn array_len(_1: &[u8; N]) -> usize {
+ debug arr => _1;
+ let mut _0: usize;
+ let mut _2: &[u8];
+ let mut _3: &[u8; N];
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &(*_1);
+ _2 = move _3 as &[u8] (PointerCoercion(Unsize));
+ StorageDead(_3);
+- _0 = Len((*_2));
++ _0 = const N;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.diff b/tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.diff
deleted file mode 100644
index c0a277edc..000000000
--- a/tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.diff
+++ /dev/null
@@ -1,26 +0,0 @@
-- // MIR for `array_len_by_value` before NormalizeArrayLen
-+ // MIR for `array_len_by_value` after NormalizeArrayLen
-
- fn array_len_by_value(_1: [u8; N]) -> usize {
- debug arr => _1; // in scope 0 at $DIR/lower_array_len.rs:+0:43: +0:46
- let mut _0: usize; // return place in scope 0 at $DIR/lower_array_len.rs:+0:60: +0:65
- let mut _2: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
- let mut _3: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
- StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
- _3 = &_1; // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
- _2 = move _3 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
- StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:+1:7: +1:8
-- _0 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
-+ _0 = const N; // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
- goto -> bb1; // scope 0 at $DIR/lower_array_len.rs:+1:5: +1:14
- }
-
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/lower_array_len.rs:+1:13: +1:14
- return; // scope 0 at $DIR/lower_array_len.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.panic-abort.diff b/tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.panic-abort.diff
new file mode 100644
index 000000000..9862b2fad
--- /dev/null
+++ b/tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.panic-abort.diff
@@ -0,0 +1,26 @@
+- // MIR for `array_len_by_value` before NormalizeArrayLen
++ // MIR for `array_len_by_value` after NormalizeArrayLen
+
+ fn array_len_by_value(_1: [u8; N]) -> usize {
+ debug arr => _1;
+ let mut _0: usize;
+ let mut _2: &[u8];
+ let mut _3: &[u8; N];
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &_1;
+ _2 = move _3 as &[u8] (PointerCoercion(Unsize));
+ StorageDead(_3);
+- _0 = Len((*_2));
++ _0 = const N;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.panic-unwind.diff
new file mode 100644
index 000000000..9862b2fad
--- /dev/null
+++ b/tests/mir-opt/lower_array_len.array_len_by_value.NormalizeArrayLen.panic-unwind.diff
@@ -0,0 +1,26 @@
+- // MIR for `array_len_by_value` before NormalizeArrayLen
++ // MIR for `array_len_by_value` after NormalizeArrayLen
+
+ fn array_len_by_value(_1: [u8; N]) -> usize {
+ debug arr => _1;
+ let mut _0: usize;
+ let mut _2: &[u8];
+ let mut _3: &[u8; N];
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = &_1;
+ _2 = move _3 as &[u8] (PointerCoercion(Unsize));
+ StorageDead(_3);
+- _0 = Len((*_2));
++ _0 = const N;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff b/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff
deleted file mode 100644
index 8b35fd57f..000000000
--- a/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff
+++ /dev/null
@@ -1,50 +0,0 @@
-- // MIR for `array_len_raw` before NormalizeArrayLen
-+ // MIR for `array_len_raw` after NormalizeArrayLen
-
- fn array_len_raw(_1: [u8; N]) -> usize {
- debug arr => _1; // in scope 0 at $DIR/lower_array_len.rs:+0:38: +0:41
- let mut _0: usize; // return place in scope 0 at $DIR/lower_array_len.rs:+0:55: +0:60
- let _2: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+1:9: +1:12
- let mut _3: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25
- let _4: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25
- let mut _6: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+3:5: +3:27
- let _7: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+3:14: +3:19
- scope 1 {
- debug arr => _2; // in scope 1 at $DIR/lower_array_len.rs:+1:9: +1:12
- let _5: *const [u8]; // in scope 1 at $DIR/lower_array_len.rs:+2:9: +2:12
- scope 2 {
- debug arr => _5; // in scope 2 at $DIR/lower_array_len.rs:+2:9: +2:12
- scope 3 {
- }
- }
- }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/lower_array_len.rs:+1:9: +1:12
- StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25
- StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25
- _4 = &_1; // scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25
- _3 = &(*_4); // scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25
- _2 = move _3 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25
- StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:+1:24: +1:25
- StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:25: +1:26
- StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:+2:9: +2:12
- _5 = &raw const (*_2); // scope 1 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- StorageLive(_6); // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:27
- StorageLive(_7); // scope 2 at $DIR/lower_array_len.rs:+3:14: +3:19
- _7 = &(*_5); // scope 3 at $DIR/lower_array_len.rs:+3:14: +3:19
- _6 = &(*_7); // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:27
-- _0 = Len((*_6)); // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:27
-+ _0 = const N; // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:27
- goto -> bb1; // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:27
- }
-
- bb1: {
- StorageDead(_6); // scope 2 at $DIR/lower_array_len.rs:+3:26: +3:27
- StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:+4:1: +4:2
- StorageDead(_2); // scope 0 at $DIR/lower_array_len.rs:+4:1: +4:2
- StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:+4:1: +4:2
- return; // scope 0 at $DIR/lower_array_len.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-abort.diff b/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-abort.diff
new file mode 100644
index 000000000..f9f73bf99
--- /dev/null
+++ b/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-abort.diff
@@ -0,0 +1,50 @@
+- // MIR for `array_len_raw` before NormalizeArrayLen
++ // MIR for `array_len_raw` after NormalizeArrayLen
+
+ fn array_len_raw(_1: [u8; N]) -> usize {
+ debug arr => _1;
+ let mut _0: usize;
+ let _2: &[u8];
+ let mut _3: &[u8; N];
+ let _4: &[u8; N];
+ let mut _6: &[u8];
+ let _7: &[u8];
+ scope 1 {
+ debug arr => _2;
+ let _5: *const [u8];
+ scope 2 {
+ debug arr => _5;
+ scope 3 {
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &_1;
+ _3 = &(*_4);
+ _2 = move _3 as &[u8] (PointerCoercion(Unsize));
+ StorageDead(_3);
+ StorageDead(_4);
+ StorageLive(_5);
+ _5 = &raw const (*_2);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &(*_5);
+ _6 = &(*_7);
+- _0 = Len((*_6));
++ _0 = const N;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_2);
+ StorageDead(_7);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-unwind.diff
new file mode 100644
index 000000000..f9f73bf99
--- /dev/null
+++ b/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.panic-unwind.diff
@@ -0,0 +1,50 @@
+- // MIR for `array_len_raw` before NormalizeArrayLen
++ // MIR for `array_len_raw` after NormalizeArrayLen
+
+ fn array_len_raw(_1: [u8; N]) -> usize {
+ debug arr => _1;
+ let mut _0: usize;
+ let _2: &[u8];
+ let mut _3: &[u8; N];
+ let _4: &[u8; N];
+ let mut _6: &[u8];
+ let _7: &[u8];
+ scope 1 {
+ debug arr => _2;
+ let _5: *const [u8];
+ scope 2 {
+ debug arr => _5;
+ scope 3 {
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &_1;
+ _3 = &(*_4);
+ _2 = move _3 as &[u8] (PointerCoercion(Unsize));
+ StorageDead(_3);
+ StorageDead(_4);
+ StorageLive(_5);
+ _5 = &raw const (*_2);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &(*_5);
+ _6 = &(*_7);
+- _0 = Len((*_6));
++ _0 = const N;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_2);
+ StorageDead(_7);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.diff b/tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.diff
deleted file mode 100644
index 8bdd2ede6..000000000
--- a/tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.diff
+++ /dev/null
@@ -1,44 +0,0 @@
-- // MIR for `array_len_reborrow` before NormalizeArrayLen
-+ // MIR for `array_len_reborrow` after NormalizeArrayLen
-
- fn array_len_reborrow(_1: [u8; N]) -> usize {
- debug arr => _1; // in scope 0 at $DIR/lower_array_len.rs:+0:43: +0:50
- let mut _0: usize; // return place in scope 0 at $DIR/lower_array_len.rs:+0:64: +0:69
- let _2: &mut [u8]; // in scope 0 at $DIR/lower_array_len.rs:+1:9: +1:12
- let mut _3: &mut [u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:25: +1:33
- let mut _4: &mut [u8; N]; // in scope 0 at $DIR/lower_array_len.rs:+1:25: +1:33
- let mut _6: &[u8]; // in scope 0 at $DIR/lower_array_len.rs:+3:5: +3:14
- scope 1 {
- debug arr => _2; // in scope 1 at $DIR/lower_array_len.rs:+1:9: +1:12
- let _5: &[u8]; // in scope 1 at $DIR/lower_array_len.rs:+2:9: +2:12
- scope 2 {
- debug arr => _5; // in scope 2 at $DIR/lower_array_len.rs:+2:9: +2:12
- }
- }
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/lower_array_len.rs:+1:9: +1:12
- StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:+1:25: +1:33
- StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:+1:25: +1:33
- _4 = &mut _1; // scope 0 at $DIR/lower_array_len.rs:+1:25: +1:33
- _3 = &mut (*_4); // scope 0 at $DIR/lower_array_len.rs:+1:25: +1:33
- _2 = move _3 as &mut [u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:+1:25: +1:33
- StorageDead(_3); // scope 0 at $DIR/lower_array_len.rs:+1:32: +1:33
- StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:33: +1:34
- StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:+2:9: +2:12
- _5 = &(*_2); // scope 1 at $DIR/lower_array_len.rs:+2:15: +2:20
- StorageLive(_6); // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:14
- _6 = &(*_5); // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:14
-- _0 = Len((*_6)); // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:14
-+ _0 = const N; // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:14
- goto -> bb1; // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:14
- }
-
- bb1: {
- StorageDead(_6); // scope 2 at $DIR/lower_array_len.rs:+3:13: +3:14
- StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:+4:1: +4:2
- StorageDead(_2); // scope 0 at $DIR/lower_array_len.rs:+4:1: +4:2
- return; // scope 0 at $DIR/lower_array_len.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.panic-abort.diff b/tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.panic-abort.diff
new file mode 100644
index 000000000..ecba06a2e
--- /dev/null
+++ b/tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.panic-abort.diff
@@ -0,0 +1,44 @@
+- // MIR for `array_len_reborrow` before NormalizeArrayLen
++ // MIR for `array_len_reborrow` after NormalizeArrayLen
+
+ fn array_len_reborrow(_1: [u8; N]) -> usize {
+ debug arr => _1;
+ let mut _0: usize;
+ let _2: &mut [u8];
+ let mut _3: &mut [u8; N];
+ let mut _4: &mut [u8; N];
+ let mut _6: &[u8];
+ scope 1 {
+ debug arr => _2;
+ let _5: &[u8];
+ scope 2 {
+ debug arr => _5;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &mut _1;
+ _3 = &mut (*_4);
+ _2 = move _3 as &mut [u8] (PointerCoercion(Unsize));
+ StorageDead(_3);
+ StorageDead(_4);
+ StorageLive(_5);
+ _5 = &(*_2);
+ StorageLive(_6);
+ _6 = &(*_5);
+- _0 = Len((*_6));
++ _0 = const N;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.panic-unwind.diff
new file mode 100644
index 000000000..ecba06a2e
--- /dev/null
+++ b/tests/mir-opt/lower_array_len.array_len_reborrow.NormalizeArrayLen.panic-unwind.diff
@@ -0,0 +1,44 @@
+- // MIR for `array_len_reborrow` before NormalizeArrayLen
++ // MIR for `array_len_reborrow` after NormalizeArrayLen
+
+ fn array_len_reborrow(_1: [u8; N]) -> usize {
+ debug arr => _1;
+ let mut _0: usize;
+ let _2: &mut [u8];
+ let mut _3: &mut [u8; N];
+ let mut _4: &mut [u8; N];
+ let mut _6: &[u8];
+ scope 1 {
+ debug arr => _2;
+ let _5: &[u8];
+ scope 2 {
+ debug arr => _5;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &mut _1;
+ _3 = &mut (*_4);
+ _2 = move _3 as &mut [u8] (PointerCoercion(Unsize));
+ StorageDead(_3);
+ StorageDead(_4);
+ StorageLive(_5);
+ _5 = &(*_2);
+ StorageLive(_6);
+ _6 = &(*_5);
+- _0 = Len((*_6));
++ _0 = const N;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_array_len.rs b/tests/mir-opt/lower_array_len.rs
index e1bb51f2d..effd83b6a 100644
--- a/tests/mir-opt/lower_array_len.rs
+++ b/tests/mir-opt/lower_array_len.rs
@@ -1,9 +1,12 @@
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: NormalizeArrayLen
// compile-flags: -Zmir-enable-passes=+LowerSliceLenCalls
// EMIT_MIR lower_array_len.array_bound.NormalizeArrayLen.diff
pub fn array_bound<const N: usize>(index: usize, slice: &[u8; N]) -> u8 {
+ // CHECK-LABEL: fn array_bound(
+ // CHECK: [[len:_.*]] = const N;
+ // CHECK: Lt(move {{_.*}}, move [[len]]);
if index < slice.len() {
slice[index]
} else {
@@ -13,6 +16,9 @@ pub fn array_bound<const N: usize>(index: usize, slice: &[u8; N]) -> u8 {
// EMIT_MIR lower_array_len.array_bound_mut.NormalizeArrayLen.diff
pub fn array_bound_mut<const N: usize>(index: usize, slice: &mut [u8; N]) -> u8 {
+ // CHECK-LABEL: fn array_bound_mut(
+ // CHECK: [[len:_.*]] = const N;
+ // CHECK: Lt(move {{_.*}}, move [[len]]);
if index < slice.len() {
slice[index]
} else {
@@ -24,16 +30,22 @@ pub fn array_bound_mut<const N: usize>(index: usize, slice: &mut [u8; N]) -> u8
// EMIT_MIR lower_array_len.array_len.NormalizeArrayLen.diff
pub fn array_len<const N: usize>(arr: &[u8; N]) -> usize {
+ // CHECK-LABEL: fn array_len(
+ // CHECK: _0 = const N;
arr.len()
}
// EMIT_MIR lower_array_len.array_len_by_value.NormalizeArrayLen.diff
pub fn array_len_by_value<const N: usize>(arr: [u8; N]) -> usize {
+ // CHECK-LABEL: fn array_len_by_value(
+ // CHECK: _0 = const N;
arr.len()
}
// EMIT_MIR lower_array_len.array_len_reborrow.NormalizeArrayLen.diff
pub fn array_len_reborrow<const N: usize>(mut arr: [u8; N]) -> usize {
+ // CHECK-LABEL: fn array_len_reborrow(
+ // CHECK: _0 = const N;
let arr: &mut [_] = &mut arr;
let arr = &*arr;
arr.len()
@@ -41,6 +53,8 @@ pub fn array_len_reborrow<const N: usize>(mut arr: [u8; N]) -> usize {
// EMIT_MIR lower_array_len.array_len_raw.NormalizeArrayLen.diff
pub fn array_len_raw<const N: usize>(arr: [u8; N]) -> usize {
+ // CHECK-LABEL: fn array_len_raw(
+ // CHECK: _0 = const N;
let arr: &[_] = &arr;
let arr = std::ptr::addr_of!(*arr);
unsafe { &*arr }.len()
diff --git a/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.diff
deleted file mode 100644
index dd742d87a..000000000
--- a/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.diff
+++ /dev/null
@@ -1,20 +0,0 @@
-- // MIR for `align_of` before LowerIntrinsics
-+ // MIR for `align_of` after LowerIntrinsics
-
- fn align_of() -> usize {
- let mut _0: usize; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:25: +0:30
-
- bb0: {
-- _0 = std::intrinsics::min_align_of::<T>() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:42
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:21:5: 21:40
-- // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::min_align_of::<T>}, val: Value(<ZST>) }
-+ _0 = AlignOf(T); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:42
-+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:42
- }
-
- bb1: {
- return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..8ebd07b9c
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,17 @@
+- // MIR for `align_of` before LowerIntrinsics
++ // MIR for `align_of` after LowerIntrinsics
+
+ fn align_of() -> usize {
+ let mut _0: usize;
+
+ bb0: {
+- _0 = std::intrinsics::min_align_of::<T>() -> [return: bb1, unwind unreachable];
++ _0 = AlignOf(T);
++ goto -> bb1;
+ }
+
+ bb1: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..8ebd07b9c
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.align_of.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,17 @@
+- // MIR for `align_of` before LowerIntrinsics
++ // MIR for `align_of` after LowerIntrinsics
+
+ fn align_of() -> usize {
+ let mut _0: usize;
+
+ bb0: {
+- _0 = std::intrinsics::min_align_of::<T>() -> [return: bb1, unwind unreachable];
++ _0 = AlignOf(T);
++ goto -> bb1;
+ }
+
+ bb1: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.diff
deleted file mode 100644
index e95c3f9bc..000000000
--- a/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.diff
+++ /dev/null
@@ -1,26 +0,0 @@
-- // MIR for `assume` before LowerIntrinsics
-+ // MIR for `assume` after LowerIntrinsics
-
- fn assume() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:17: +0:17
- let _1: (); // in scope 0 at $DIR/lower_intrinsics.rs:+2:9: +2:38
- scope 1 {
- }
-
- bb0: {
- StorageLive(_1); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38
-- _1 = std::intrinsics::assume(const true) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:106:9: 106:32
-- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(bool) {std::intrinsics::assume}, val: Value(<ZST>) }
-+ assume(const true); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38
-+ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:38
- }
-
- bb1: {
- StorageDead(_1); // scope 1 at $DIR/lower_intrinsics.rs:+2:38: +2:39
- _0 = const (); // scope 1 at $DIR/lower_intrinsics.rs:+1:5: +3:6
- return; // scope 0 at $DIR/lower_intrinsics.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..79635f23e
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,23 @@
+- // MIR for `assume` before LowerIntrinsics
++ // MIR for `assume` after LowerIntrinsics
+
+ fn assume() -> () {
+ let mut _0: ();
+ let _1: ();
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = std::intrinsics::assume(const true) -> [return: bb1, unwind unreachable];
++ assume(const true);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..79635f23e
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.assume.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,23 @@
+- // MIR for `assume` before LowerIntrinsics
++ // MIR for `assume` after LowerIntrinsics
+
+ fn assume() -> () {
+ let mut _0: ();
+ let _1: ();
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = std::intrinsics::assume(const true) -> [return: bb1, unwind unreachable];
++ assume(const true);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff
deleted file mode 100644
index 1f03b7b0b..000000000
--- a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.diff
+++ /dev/null
@@ -1,119 +0,0 @@
-- // MIR for `discriminant` before LowerIntrinsics
-+ // MIR for `discriminant` after LowerIntrinsics
-
- fn discriminant(_1: T) -> () {
- debug t => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:24: +0:25
- let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:30: +0:30
- let _2: <T as std::marker::DiscriminantKind>::Discriminant; // in scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45
- let mut _3: &T; // in scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44
- let _4: &T; // in scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44
- let _5: u8; // in scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45
- let mut _6: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
- let _7: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
- let _8: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:43: +2:44
- let _9: u8; // in scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46
- let mut _10: &(); // in scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
- let _11: &(); // in scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
- let _12: (); // in scope 0 at $DIR/lower_intrinsics.rs:+3:43: +3:45
- let _13: isize; // in scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48
- let mut _14: &E; // in scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
- let _15: &E; // in scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
- let _16: E; // in scope 0 at $DIR/lower_intrinsics.rs:+4:43: +4:47
- let mut _17: &E; // in scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
- let mut _18: &(); // in scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
- let mut _19: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45
- StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44
- StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44
- _4 = &_1; // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44
- _3 = &(*_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:42: +1:44
-- _2 = discriminant_value::<T>(move _3) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:82:5: 82:41
-- // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a T) -> <T as DiscriminantKind>::Discriminant {discriminant_value::<T>}, val: Value(<ZST>) }
-+ _2 = discriminant((*_3)); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45
-+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:45
- }
-
- bb1: {
- StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:44: +1:45
- StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:45: +1:46
- StorageDead(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:45: +1:46
- StorageLive(_5); // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45
- StorageLive(_6); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
- StorageLive(_7); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
- _19 = const _; // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
- // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:83:42: 83:44
- // + literal: Const { ty: &i32, val: Unevaluated(discriminant, [T], Some(promoted[2])) }
- _7 = &(*_19); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
- _6 = &(*_7); // scope 0 at $DIR/lower_intrinsics.rs:+2:42: +2:44
-- _5 = discriminant_value::<i32>(move _6) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:83:5: 83:41
-- // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a i32) -> <i32 as DiscriminantKind>::Discriminant {discriminant_value::<i32>}, val: Value(<ZST>) }
-+ _5 = discriminant((*_6)); // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45
-+ goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:45
- }
-
- bb2: {
- StorageDead(_6); // scope 0 at $DIR/lower_intrinsics.rs:+2:44: +2:45
- StorageDead(_7); // scope 0 at $DIR/lower_intrinsics.rs:+2:45: +2:46
- StorageDead(_5); // scope 0 at $DIR/lower_intrinsics.rs:+2:45: +2:46
- StorageLive(_9); // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46
- StorageLive(_10); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
- StorageLive(_11); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
- _18 = const _; // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
- // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:84:42: 84:45
- // + literal: Const { ty: &(), val: Unevaluated(discriminant, [T], Some(promoted[1])) }
- _11 = &(*_18); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
- _10 = &(*_11); // scope 0 at $DIR/lower_intrinsics.rs:+3:42: +3:45
-- _9 = discriminant_value::<()>(move _10) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:84:5: 84:41
-- // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a ()) -> <() as DiscriminantKind>::Discriminant {discriminant_value::<()>}, val: Value(<ZST>) }
-+ _9 = discriminant((*_10)); // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46
-+ goto -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:46
- }
-
- bb3: {
- StorageDead(_10); // scope 0 at $DIR/lower_intrinsics.rs:+3:45: +3:46
- StorageDead(_11); // scope 0 at $DIR/lower_intrinsics.rs:+3:46: +3:47
- StorageDead(_9); // scope 0 at $DIR/lower_intrinsics.rs:+3:46: +3:47
- StorageLive(_13); // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48
- StorageLive(_14); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
- StorageLive(_15); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
- _17 = const _; // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
- // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:85:42: 85:47
- // + literal: Const { ty: &E, val: Unevaluated(discriminant, [T], Some(promoted[0])) }
- _15 = &(*_17); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
- _14 = &(*_15); // scope 0 at $DIR/lower_intrinsics.rs:+4:42: +4:47
-- _13 = discriminant_value::<E>(move _14) -> [return: bb4, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:85:5: 85:41
-- // + literal: Const { ty: for<'a> extern "rust-intrinsic" fn(&'a E) -> <E as DiscriminantKind>::Discriminant {discriminant_value::<E>}, val: Value(<ZST>) }
-+ _13 = discriminant((*_14)); // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48
-+ goto -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:+4:5: +4:48
- }
-
- bb4: {
- StorageDead(_14); // scope 0 at $DIR/lower_intrinsics.rs:+4:47: +4:48
- StorageDead(_15); // scope 0 at $DIR/lower_intrinsics.rs:+4:48: +4:49
- StorageDead(_13); // scope 0 at $DIR/lower_intrinsics.rs:+4:48: +4:49
- _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:+0:30: +5:2
- drop(_1) -> [return: bb5, unwind: bb6]; // scope 0 at $DIR/lower_intrinsics.rs:+5:1: +5:2
- }
-
- bb5: {
- return; // scope 0 at $DIR/lower_intrinsics.rs:+5:2: +5:2
- }
-
- bb6 (cleanup): {
- resume; // scope 0 at $DIR/lower_intrinsics.rs:+0:1: +5:2
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..4b5275f0f
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,94 @@
+- // MIR for `discriminant` before LowerIntrinsics
++ // MIR for `discriminant` after LowerIntrinsics
+
+ fn discriminant(_1: T) -> () {
+ debug t => _1;
+ let mut _0: ();
+ let _2: <T as std::marker::DiscriminantKind>::Discriminant;
+ let mut _3: &T;
+ let _4: &T;
+ let _5: u8;
+ let mut _6: &i32;
+ let _7: &i32;
+ let _8: i32;
+ let _9: u8;
+ let mut _10: &();
+ let _11: &();
+ let _12: ();
+ let _13: isize;
+ let mut _14: &E;
+ let _15: &E;
+ let _16: E;
+ let mut _17: &E;
+ let mut _18: &();
+ let mut _19: &i32;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &_1;
+ _3 = &(*_4);
+- _2 = discriminant_value::<T>(move _3) -> [return: bb1, unwind unreachable];
++ _2 = discriminant((*_3));
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _19 = const _;
+ _7 = &(*_19);
+ _6 = &(*_7);
+- _5 = discriminant_value::<i32>(move _6) -> [return: bb2, unwind unreachable];
++ _5 = discriminant((*_6));
++ goto -> bb2;
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageLive(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ _18 = const _;
+ _11 = &(*_18);
+ _10 = &(*_11);
+- _9 = discriminant_value::<()>(move _10) -> [return: bb3, unwind unreachable];
++ _9 = discriminant((*_10));
++ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_10);
+ StorageDead(_11);
+ StorageDead(_9);
+ StorageLive(_13);
+ StorageLive(_14);
+ StorageLive(_15);
+ _17 = const _;
+ _15 = &(*_17);
+ _14 = &(*_15);
+- _13 = discriminant_value::<E>(move _14) -> [return: bb4, unwind unreachable];
++ _13 = discriminant((*_14));
++ goto -> bb4;
+ }
+
+ bb4: {
+ StorageDead(_14);
+ StorageDead(_15);
+ StorageDead(_13);
+ _0 = const ();
+ drop(_1) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..5848288ec
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.discriminant.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,98 @@
+- // MIR for `discriminant` before LowerIntrinsics
++ // MIR for `discriminant` after LowerIntrinsics
+
+ fn discriminant(_1: T) -> () {
+ debug t => _1;
+ let mut _0: ();
+ let _2: <T as std::marker::DiscriminantKind>::Discriminant;
+ let mut _3: &T;
+ let _4: &T;
+ let _5: u8;
+ let mut _6: &i32;
+ let _7: &i32;
+ let _8: i32;
+ let _9: u8;
+ let mut _10: &();
+ let _11: &();
+ let _12: ();
+ let _13: isize;
+ let mut _14: &E;
+ let _15: &E;
+ let _16: E;
+ let mut _17: &E;
+ let mut _18: &();
+ let mut _19: &i32;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &_1;
+ _3 = &(*_4);
+- _2 = discriminant_value::<T>(move _3) -> [return: bb1, unwind unreachable];
++ _2 = discriminant((*_3));
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _19 = const _;
+ _7 = &(*_19);
+ _6 = &(*_7);
+- _5 = discriminant_value::<i32>(move _6) -> [return: bb2, unwind unreachable];
++ _5 = discriminant((*_6));
++ goto -> bb2;
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageLive(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ _18 = const _;
+ _11 = &(*_18);
+ _10 = &(*_11);
+- _9 = discriminant_value::<()>(move _10) -> [return: bb3, unwind unreachable];
++ _9 = discriminant((*_10));
++ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_10);
+ StorageDead(_11);
+ StorageDead(_9);
+ StorageLive(_13);
+ StorageLive(_14);
+ StorageLive(_15);
+ _17 = const _;
+ _15 = &(*_17);
+ _14 = &(*_15);
+- _13 = discriminant_value::<E>(move _14) -> [return: bb4, unwind unreachable];
++ _13 = discriminant((*_14));
++ goto -> bb4;
+ }
+
+ bb4: {
+ StorageDead(_14);
+ StorageDead(_15);
+ StorageDead(_13);
+ _0 = const ();
+ drop(_1) -> [return: bb5, unwind: bb6];
+ }
+
+ bb5: {
+ return;
+ }
+
+ bb6 (cleanup): {
+ resume;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff
deleted file mode 100644
index a54e9a932..000000000
--- a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff
+++ /dev/null
@@ -1,72 +0,0 @@
-- // MIR for `f_copy_nonoverlapping` before LowerIntrinsics
-+ // MIR for `f_copy_nonoverlapping` after LowerIntrinsics
-
- fn f_copy_nonoverlapping() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:32: +0:32
- let _1: (); // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:12
- let _3: (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:9: +4:95
- let mut _4: *const i32; // in scope 0 at $DIR/lower_intrinsics.rs:+4:29: +4:59
- let mut _5: *const (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:29: +4:45
- let mut _6: *const (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:29: +4:45
- let _7: &(); // in scope 0 at $DIR/lower_intrinsics.rs:+4:29: +4:33
- let mut _8: *mut i32; // in scope 0 at $DIR/lower_intrinsics.rs:+4:61: +4:91
- let mut _9: *mut (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:61: +4:79
- let mut _10: *mut (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:61: +4:79
- let mut _11: &mut (); // in scope 0 at $DIR/lower_intrinsics.rs:+4:61: +4:69
- scope 1 {
- debug src => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:12
- let mut _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:16
- scope 2 {
- debug dst => _2; // in scope 2 at $DIR/lower_intrinsics.rs:+2:9: +2:16
- scope 3 {
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:12
- _1 = (); // scope 0 at $DIR/lower_intrinsics.rs:+1:15: +1:17
- StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:16
- _2 = (); // scope 1 at $DIR/lower_intrinsics.rs:+2:19: +2:21
- StorageLive(_3); // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95
- StorageLive(_4); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:59
- StorageLive(_5); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:45
- StorageLive(_6); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:45
- StorageLive(_7); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:33
- _7 = &_1; // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:33
- _6 = &raw const (*_7); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:33
- _5 = _6; // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:45
- _4 = move _5 as *const i32 (PtrToPtr); // scope 3 at $DIR/lower_intrinsics.rs:+4:29: +4:59
- StorageDead(_5); // scope 3 at $DIR/lower_intrinsics.rs:+4:58: +4:59
- StorageLive(_8); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:91
- StorageLive(_9); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:79
- StorageLive(_10); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:79
- StorageLive(_11); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:69
- _11 = &mut _2; // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:69
- _10 = &raw mut (*_11); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:69
- _9 = _10; // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:79
- _8 = move _9 as *mut i32 (PtrToPtr); // scope 3 at $DIR/lower_intrinsics.rs:+4:61: +4:91
- StorageDead(_9); // scope 3 at $DIR/lower_intrinsics.rs:+4:90: +4:91
-- _3 = copy_nonoverlapping::<i32>(move _4, move _8, const 0_usize) -> [return: bb1, unwind unreachable]; // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:99:9: 99:28
-- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32, *mut i32, usize) {copy_nonoverlapping::<i32>}, val: Value(<ZST>) }
-+ copy_nonoverlapping(dst = move _8, src = move _4, count = const 0_usize); // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95
-+ goto -> bb1; // scope 3 at $DIR/lower_intrinsics.rs:+4:9: +4:95
- }
-
- bb1: {
- StorageDead(_8); // scope 3 at $DIR/lower_intrinsics.rs:+4:94: +4:95
- StorageDead(_4); // scope 3 at $DIR/lower_intrinsics.rs:+4:94: +4:95
- StorageDead(_11); // scope 3 at $DIR/lower_intrinsics.rs:+4:95: +4:96
- StorageDead(_10); // scope 3 at $DIR/lower_intrinsics.rs:+4:95: +4:96
- StorageDead(_7); // scope 3 at $DIR/lower_intrinsics.rs:+4:95: +4:96
- StorageDead(_6); // scope 3 at $DIR/lower_intrinsics.rs:+4:95: +4:96
- StorageDead(_3); // scope 3 at $DIR/lower_intrinsics.rs:+4:95: +4:96
- _0 = const (); // scope 3 at $DIR/lower_intrinsics.rs:+3:5: +5:6
- StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:+6:1: +6:2
- StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:+6:1: +6:2
- return; // scope 0 at $DIR/lower_intrinsics.rs:+6:2: +6:2
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..6de5f2c4f
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,69 @@
+- // MIR for `f_copy_nonoverlapping` before LowerIntrinsics
++ // MIR for `f_copy_nonoverlapping` after LowerIntrinsics
+
+ fn f_copy_nonoverlapping() -> () {
+ let mut _0: ();
+ let _1: ();
+ let _3: ();
+ let mut _4: *const i32;
+ let mut _5: *const ();
+ let mut _6: *const ();
+ let _7: &();
+ let mut _8: *mut i32;
+ let mut _9: *mut ();
+ let mut _10: *mut ();
+ let mut _11: &mut ();
+ scope 1 {
+ debug src => _1;
+ let mut _2: ();
+ scope 2 {
+ debug dst => _2;
+ scope 3 {
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = ();
+ StorageLive(_2);
+ _2 = ();
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &_1;
+ _6 = &raw const (*_7);
+ _5 = _6;
+ _4 = move _5 as *const i32 (PtrToPtr);
+ StorageDead(_5);
+ StorageLive(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = &mut _2;
+ _10 = &raw mut (*_11);
+ _9 = _10;
+ _8 = move _9 as *mut i32 (PtrToPtr);
+ StorageDead(_9);
+- _3 = copy_nonoverlapping::<i32>(move _4, move _8, const 0_usize) -> [return: bb1, unwind unreachable];
++ copy_nonoverlapping(dst = move _8, src = move _4, count = const 0_usize);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_8);
+ StorageDead(_4);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..6de5f2c4f
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,69 @@
+- // MIR for `f_copy_nonoverlapping` before LowerIntrinsics
++ // MIR for `f_copy_nonoverlapping` after LowerIntrinsics
+
+ fn f_copy_nonoverlapping() -> () {
+ let mut _0: ();
+ let _1: ();
+ let _3: ();
+ let mut _4: *const i32;
+ let mut _5: *const ();
+ let mut _6: *const ();
+ let _7: &();
+ let mut _8: *mut i32;
+ let mut _9: *mut ();
+ let mut _10: *mut ();
+ let mut _11: &mut ();
+ scope 1 {
+ debug src => _1;
+ let mut _2: ();
+ scope 2 {
+ debug dst => _2;
+ scope 3 {
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = ();
+ StorageLive(_2);
+ _2 = ();
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &_1;
+ _6 = &raw const (*_7);
+ _5 = _6;
+ _4 = move _5 as *const i32 (PtrToPtr);
+ StorageDead(_5);
+ StorageLive(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = &mut _2;
+ _10 = &raw mut (*_11);
+ _9 = _10;
+ _8 = move _9 as *mut i32 (PtrToPtr);
+ StorageDead(_9);
+- _3 = copy_nonoverlapping::<i32>(move _4, move _8, const 0_usize) -> [return: bb1, unwind unreachable];
++ copy_nonoverlapping(dst = move _8, src = move _4, count = const 0_usize);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_8);
+ StorageDead(_4);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.diff
deleted file mode 100644
index bfb000ccd..000000000
--- a/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.diff
+++ /dev/null
@@ -1,29 +0,0 @@
-- // MIR for `forget` before LowerIntrinsics
-+ // MIR for `forget` after LowerIntrinsics
-
- fn forget(_1: T) -> () {
- debug t => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:18: +0:19
- let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:24: +0:24
- let mut _2: T; // in scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31
- _2 = move _1; // scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31
-- _0 = std::intrinsics::forget::<T>(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:32
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:26:5: 26:29
-- // + literal: Const { ty: extern "rust-intrinsic" fn(T) {std::intrinsics::forget::<T>}, val: Value(<ZST>) }
-+ _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:32
-+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:32
- }
-
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:31: +1:32
- goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:+2:1: +2:2
- }
-
- bb2: {
- return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..7d300e6c6
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,26 @@
+- // MIR for `forget` before LowerIntrinsics
++ // MIR for `forget` after LowerIntrinsics
+
+ fn forget(_1: T) -> () {
+ debug t => _1;
+ let mut _0: ();
+ let mut _2: T;
+
+ bb0: {
+ StorageLive(_2);
+ _2 = move _1;
+- _0 = std::intrinsics::forget::<T>(move _2) -> [return: bb1, unwind unreachable];
++ _0 = const ();
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_2);
+ goto -> bb2;
+ }
+
+ bb2: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..7d300e6c6
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.forget.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,26 @@
+- // MIR for `forget` before LowerIntrinsics
++ // MIR for `forget` after LowerIntrinsics
+
+ fn forget(_1: T) -> () {
+ debug t => _1;
+ let mut _0: ();
+ let mut _2: T;
+
+ bb0: {
+ StorageLive(_2);
+ _2 = move _1;
+- _0 = std::intrinsics::forget::<T>(move _2) -> [return: bb1, unwind unreachable];
++ _0 = const ();
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_2);
+ goto -> bb2;
+ }
+
+ bb2: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.diff
deleted file mode 100644
index 64d82907c..000000000
--- a/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.diff
+++ /dev/null
@@ -1,31 +0,0 @@
-- // MIR for `non_const` before LowerIntrinsics
-+ // MIR for `non_const` after LowerIntrinsics
-
- fn non_const() -> usize {
- let mut _0: usize; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:26: +0:31
- let _1: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}; // in scope 0 at $DIR/lower_intrinsics.rs:+2:9: +2:18
- let mut _2: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}; // in scope 0 at $DIR/lower_intrinsics.rs:+3:5: +3:14
- scope 1 {
- debug size_of_t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:18
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+2:9: +2:18
- _1 = std::intrinsics::size_of::<T>; // scope 0 at $DIR/lower_intrinsics.rs:+2:21: +2:51
- // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:37:21: 37:51
- // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}, val: Value(<ZST>) }
- StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:14
- _2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:14
-- _0 = move _2() -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:16
-+ _0 = SizeOf(T); // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:16
-+ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+3:5: +3:16
- }
-
- bb1: {
- StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:+3:15: +3:16
- StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:+4:1: +4:2
- return; // scope 0 at $DIR/lower_intrinsics.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..801e28ff2
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,28 @@
+- // MIR for `non_const` before LowerIntrinsics
++ // MIR for `non_const` after LowerIntrinsics
+
+ fn non_const() -> usize {
+ let mut _0: usize;
+ let _1: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>};
+ let mut _2: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>};
+ scope 1 {
+ debug size_of_t => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = std::intrinsics::size_of::<T>;
+ StorageLive(_2);
+ _2 = _1;
+- _0 = move _2() -> [return: bb1, unwind unreachable];
++ _0 = SizeOf(T);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..801e28ff2
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,28 @@
+- // MIR for `non_const` before LowerIntrinsics
++ // MIR for `non_const` after LowerIntrinsics
+
+ fn non_const() -> usize {
+ let mut _0: usize;
+ let _1: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>};
+ let mut _2: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>};
+ scope 1 {
+ debug size_of_t => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = std::intrinsics::size_of::<T>;
+ StorageLive(_2);
+ _2 = _1;
+- _0 = move _2() -> [return: bb1, unwind unreachable];
++ _0 = SizeOf(T);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff
deleted file mode 100644
index b022e2ba4..000000000
--- a/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff
+++ /dev/null
@@ -1,54 +0,0 @@
-- // MIR for `option_payload` before LowerIntrinsics
-+ // MIR for `option_payload` after LowerIntrinsics
-
- fn option_payload(_1: &Option<usize>, _2: &Option<String>) -> () {
- debug o => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:23: +0:24
- debug p => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:42: +0:43
- let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:62: +0:62
- let mut _4: *const std::option::Option<usize>; // in scope 0 at $DIR/lower_intrinsics.rs:+2:55: +2:56
- let mut _6: *const std::option::Option<std::string::String>; // in scope 0 at $DIR/lower_intrinsics.rs:+3:55: +3:56
- scope 1 {
- let _3: *const usize; // in scope 1 at $DIR/lower_intrinsics.rs:+2:13: +2:15
- scope 2 {
- debug _x => _3; // in scope 2 at $DIR/lower_intrinsics.rs:+2:13: +2:15
- let _5: *const std::string::String; // in scope 2 at $DIR/lower_intrinsics.rs:+3:13: +3:15
- scope 3 {
- debug _y => _5; // in scope 3 at $DIR/lower_intrinsics.rs:+3:13: +3:15
- }
- }
- }
-
- bb0: {
- StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:+2:13: +2:15
- StorageLive(_4); // scope 1 at $DIR/lower_intrinsics.rs:+2:55: +2:56
- _4 = &raw const (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+2:55: +2:56
-- _3 = option_payload_ptr::<usize>(move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:137:18: 137:54
-- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Option<usize>) -> *const usize {option_payload_ptr::<usize>}, val: Value(<ZST>) }
-+ _3 = &raw const (((*_4) as Some).0: usize); // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57
-+ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57
- }
-
- bb1: {
- StorageDead(_4); // scope 1 at $DIR/lower_intrinsics.rs:+2:56: +2:57
- StorageLive(_5); // scope 2 at $DIR/lower_intrinsics.rs:+3:13: +3:15
- StorageLive(_6); // scope 2 at $DIR/lower_intrinsics.rs:+3:55: +3:56
- _6 = &raw const (*_2); // scope 2 at $DIR/lower_intrinsics.rs:+3:55: +3:56
-- _5 = option_payload_ptr::<String>(move _6) -> [return: bb2, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:138:18: 138:54
-- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Option<String>) -> *const String {option_payload_ptr::<String>}, val: Value(<ZST>) }
-+ _5 = &raw const (((*_6) as Some).0: std::string::String); // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57
-+ goto -> bb2; // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57
- }
-
- bb2: {
- StorageDead(_6); // scope 2 at $DIR/lower_intrinsics.rs:+3:56: +3:57
- _0 = const (); // scope 1 at $DIR/lower_intrinsics.rs:+1:5: +4:6
- StorageDead(_5); // scope 2 at $DIR/lower_intrinsics.rs:+4:5: +4:6
- StorageDead(_3); // scope 1 at $DIR/lower_intrinsics.rs:+4:5: +4:6
- return; // scope 0 at $DIR/lower_intrinsics.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff
deleted file mode 100644
index 60a1dd0ba..000000000
--- a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff
+++ /dev/null
@@ -1,30 +0,0 @@
-- // MIR for `ptr_offset` before LowerIntrinsics
-+ // MIR for `ptr_offset` after LowerIntrinsics
-
- fn ptr_offset(_1: *const i32, _2: isize) -> *const i32 {
- debug p => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:26: +0:27
- debug d => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:41: +0:42
- let mut _0: *const i32; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:54: +0:64
- let mut _3: *const i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31
- let mut _4: isize; // in scope 0 at $DIR/lower_intrinsics.rs:+1:33: +1:34
-
- bb0: {
- StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31
- _3 = _1; // scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31
- StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:33: +1:34
- _4 = _2; // scope 0 at $DIR/lower_intrinsics.rs:+1:33: +1:34
-- _0 = offset::<*const i32, isize>(move _3, move _4) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:144:5: 144:29
-- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32, isize) -> *const i32 {offset::<*const i32, isize>}, val: Value(<ZST>) }
-+ _0 = Offset(move _3, move _4); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35
-+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35
- }
-
- bb1: {
- StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:34: +1:35
- StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:34: +1:35
- return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..4f7ad0b60
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,27 @@
+- // MIR for `ptr_offset` before LowerIntrinsics
++ // MIR for `ptr_offset` after LowerIntrinsics
+
+ fn ptr_offset(_1: *const i32, _2: isize) -> *const i32 {
+ debug p => _1;
+ debug d => _2;
+ let mut _0: *const i32;
+ let mut _3: *const i32;
+ let mut _4: isize;
+
+ bb0: {
+ StorageLive(_3);
+ _3 = _1;
+ StorageLive(_4);
+ _4 = _2;
+- _0 = offset::<*const i32, isize>(move _3, move _4) -> [return: bb1, unwind unreachable];
++ _0 = Offset(move _3, move _4);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..4f7ad0b60
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,27 @@
+- // MIR for `ptr_offset` before LowerIntrinsics
++ // MIR for `ptr_offset` after LowerIntrinsics
+
+ fn ptr_offset(_1: *const i32, _2: isize) -> *const i32 {
+ debug p => _1;
+ debug d => _2;
+ let mut _0: *const i32;
+ let mut _3: *const i32;
+ let mut _4: isize;
+
+ bb0: {
+ StorageLive(_3);
+ _3 = _1;
+ StorageLive(_4);
+ _4 = _2;
+- _0 = offset::<*const i32, isize>(move _3, move _4) -> [return: bb1, unwind unreachable];
++ _0 = Offset(move _3, move _4);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff
deleted file mode 100644
index 5805df48f..000000000
--- a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff
+++ /dev/null
@@ -1,27 +0,0 @@
-- // MIR for `read_via_copy_primitive` before LowerIntrinsics
-+ // MIR for `read_via_copy_primitive` after LowerIntrinsics
-
- fn read_via_copy_primitive(_1: &i32) -> i32 {
- debug r => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:32: +0:33
- let mut _0: i32; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:44: +0:47
- let mut _2: *const i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:46: +1:47
- scope 1 {
- }
-
- bb0: {
- StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:46: +1:47
- _2 = &raw const (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+1:46: +1:47
-- _0 = read_via_copy::<i32>(move _2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:119:14: 119:45
-- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32) -> i32 {read_via_copy::<i32>}, val: Value(<ZST>) }
-+ _0 = (*_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48
-+ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48
- }
-
- bb1: {
- StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48
- return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..147c48a3c
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,24 @@
+- // MIR for `read_via_copy_primitive` before LowerIntrinsics
++ // MIR for `read_via_copy_primitive` after LowerIntrinsics
+
+ fn read_via_copy_primitive(_1: &i32) -> i32 {
+ debug r => _1;
+ let mut _0: i32;
+ let mut _2: *const i32;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = &raw const (*_1);
+- _0 = read_via_copy::<i32>(move _2) -> [return: bb1, unwind unreachable];
++ _0 = (*_2);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..147c48a3c
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,24 @@
+- // MIR for `read_via_copy_primitive` before LowerIntrinsics
++ // MIR for `read_via_copy_primitive` after LowerIntrinsics
+
+ fn read_via_copy_primitive(_1: &i32) -> i32 {
+ debug r => _1;
+ let mut _0: i32;
+ let mut _2: *const i32;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = &raw const (*_1);
+- _0 = read_via_copy::<i32>(move _2) -> [return: bb1, unwind unreachable];
++ _0 = (*_2);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff
deleted file mode 100644
index 95b2ec49d..000000000
--- a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff
+++ /dev/null
@@ -1,21 +0,0 @@
-- // MIR for `read_via_copy_uninhabited` before LowerIntrinsics
-+ // MIR for `read_via_copy_uninhabited` after LowerIntrinsics
-
- fn read_via_copy_uninhabited(_1: &Never) -> Never {
- debug r => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:34: +0:35
- let mut _0: Never; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:48: +0:53
- let mut _2: *const Never; // in scope 0 at $DIR/lower_intrinsics.rs:+1:46: +1:47
- scope 1 {
- }
-
- bb0: {
- StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:46: +1:47
- _2 = &raw const (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+1:46: +1:47
-- _0 = read_via_copy::<Never>(move _2) -> unwind unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:124:14: 124:45
-- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Never) -> Never {read_via_copy::<Never>}, val: Value(<ZST>) }
-+ unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:48
- }
- }
-
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
new file mode 100644
index 000000000..b2cf3cc1c
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,19 @@
+- // MIR for `read_via_copy_uninhabited` before LowerIntrinsics
++ // MIR for `read_via_copy_uninhabited` after LowerIntrinsics
+
+ fn read_via_copy_uninhabited(_1: &Never) -> Never {
+ debug r => _1;
+ let mut _0: Never;
+ let mut _2: *const Never;
+ scope 1 {
+ }
+
+ bb0: {
+ 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
new file mode 100644
index 000000000..b2cf3cc1c
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,19 @@
+- // MIR for `read_via_copy_uninhabited` before LowerIntrinsics
++ // MIR for `read_via_copy_uninhabited` after LowerIntrinsics
+
+ fn read_via_copy_uninhabited(_1: &Never) -> Never {
+ debug r => _1;
+ let mut _0: Never;
+ let mut _2: *const Never;
+ scope 1 {
+ }
+
+ bb0: {
+ 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.rs b/tests/mir-opt/lower_intrinsics.rs
index 0ca88a42e..cba2bc18d 100644
--- a/tests/mir-opt/lower_intrinsics.rs
+++ b/tests/mir-opt/lower_intrinsics.rs
@@ -1,38 +1,74 @@
// unit-test: LowerIntrinsics
-// ignore-wasm32 compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![feature(core_intrinsics, intrinsics, rustc_attrs)]
#![crate_type = "lib"]
// EMIT_MIR lower_intrinsics.wrapping.LowerIntrinsics.diff
pub fn wrapping(a: i32, b: i32) {
+ // CHECK-LABEL: fn wrapping(
+ // CHECK: {{_.*}} = Add(
+ // CHECK: {{_.*}} = Sub(
+ // CHECK: {{_.*}} = Mul(
let _x = core::intrinsics::wrapping_add(a, b);
let _y = core::intrinsics::wrapping_sub(a, b);
let _z = core::intrinsics::wrapping_mul(a, b);
}
+// EMIT_MIR lower_intrinsics.unchecked.LowerIntrinsics.diff
+pub unsafe fn unchecked(a: i32, b: i32) {
+ // CHECK-LABEL: fn unchecked(
+ // CHECK: {{_.*}} = AddUnchecked(
+ // CHECK: {{_.*}} = SubUnchecked(
+ // CHECK: {{_.*}} = MulUnchecked(
+ // CHECK: {{_.*}} = Div(
+ // CHECK: {{_.*}} = Rem(
+ // CHECK: {{_.*}} = ShlUnchecked(
+ // CHECK: {{_.*}} = ShrUnchecked(
+ let _a = core::intrinsics::unchecked_add(a, b);
+ let _b = core::intrinsics::unchecked_sub(a, b);
+ let _c = core::intrinsics::unchecked_mul(a, b);
+ let _x = core::intrinsics::unchecked_div(a, b);
+ let _y = core::intrinsics::unchecked_rem(a, b);
+ let _i = core::intrinsics::unchecked_shl(a, b);
+ let _j = core::intrinsics::unchecked_shr(a, b);
+}
+
// EMIT_MIR lower_intrinsics.size_of.LowerIntrinsics.diff
pub fn size_of<T>() -> usize {
+ // CHECK-LABEL: fn size_of(
+ // CHECK: {{_.*}} = SizeOf(T);
core::intrinsics::size_of::<T>()
}
// EMIT_MIR lower_intrinsics.align_of.LowerIntrinsics.diff
pub fn align_of<T>() -> usize {
+ // CHECK-LABEL: fn align_of(
+ // CHECK: {{_.*}} = AlignOf(T);
core::intrinsics::min_align_of::<T>()
}
// EMIT_MIR lower_intrinsics.forget.LowerIntrinsics.diff
pub fn forget<T>(t: T) {
+ // CHECK-LABEL: fn forget(
+ // CHECK-NOT: Drop(
+ // CHECK: return;
+ // CHECK-NOT: Drop(
core::intrinsics::forget(t)
}
// EMIT_MIR lower_intrinsics.unreachable.LowerIntrinsics.diff
pub fn unreachable() -> ! {
+ // CHECK-LABEL: fn unreachable(
+ // CHECK: unreachable;
unsafe { core::intrinsics::unreachable() };
}
// EMIT_MIR lower_intrinsics.non_const.LowerIntrinsics.diff
pub fn non_const<T>() -> usize {
+ // CHECK-LABEL: fn non_const(
+ // CHECK: SizeOf(T);
+
// Check that lowering works with non-const operand as a func.
let size_of_t = core::intrinsics::size_of::<T>;
size_of_t()
@@ -40,33 +76,55 @@ pub fn non_const<T>() -> usize {
// EMIT_MIR lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff
pub fn transmute_inhabited(c: std::cmp::Ordering) -> i8 {
+ // CHECK-LABEL: fn transmute_inhabited(
+ // CHECK: {{_.*}} = {{.*}} as i8 (Transmute);
+
unsafe { std::mem::transmute(c) }
}
// EMIT_MIR lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff
pub unsafe fn transmute_uninhabited(u: ()) -> Never {
+ // CHECK-LABEL: fn transmute_uninhabited(
+ // CHECK: {{_.*}} = {{.*}} as Never (Transmute);
+ // CHECK: unreachable;
+
unsafe { std::mem::transmute::<(), Never>(u) }
}
// EMIT_MIR lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff
pub unsafe fn transmute_ref_dst<T: ?Sized>(u: &T) -> *const T {
+ // CHECK-LABEL: fn transmute_ref_dst(
+ // CHECK: {{_.*}} = {{.*}} as *const T (Transmute);
+
unsafe { std::mem::transmute(u) }
}
// EMIT_MIR lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff
pub unsafe fn transmute_to_ref_uninhabited() -> ! {
+ // CHECK-LABEL: fn transmute_to_ref_uninhabited(
+ // CHECK: {{_.*}} = {{.*}} as &Never (Transmute);
+ // CHECK: unreachable;
+
let x: &Never = std::mem::transmute(1usize);
match *x {}
}
// EMIT_MIR lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff
pub unsafe fn transmute_to_mut_uninhabited() -> ! {
+ // CHECK-LABEL: fn transmute_to_mut_uninhabited(
+ // CHECK: {{_.*}} = {{.*}} as &mut Never (Transmute);
+ // CHECK: unreachable;
+
let x: &mut Never = std::mem::transmute(1usize);
match *x {}
}
// EMIT_MIR lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff
pub unsafe fn transmute_to_box_uninhabited() -> ! {
+ // CHECK-LABEL: fn transmute_to_box_uninhabited(
+ // CHECK: {{_.*}} = {{.*}} as std::boxed::Box<Never> (Transmute);
+ // CHECK: unreachable;
+
let x: Box<Never> = std::mem::transmute(1usize);
match *x {}
}
@@ -79,6 +137,12 @@ pub enum E {
// EMIT_MIR lower_intrinsics.discriminant.LowerIntrinsics.diff
pub fn discriminant<T>(t: T) {
+ // CHECK-LABEL: fn discriminant(
+ // CHECK: {{_.*}} = discriminant(
+ // CHECK: {{_.*}} = discriminant(
+ // CHECK: {{_.*}} = discriminant(
+ // CHECK: {{_.*}} = discriminant(
+
core::intrinsics::discriminant_value(&t);
core::intrinsics::discriminant_value(&0);
core::intrinsics::discriminant_value(&());
@@ -93,6 +157,9 @@ extern "rust-intrinsic" {
// EMIT_MIR lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff
pub fn f_copy_nonoverlapping() {
+ // CHECK-LABEL: fn f_copy_nonoverlapping(
+ // CHECK: copy_nonoverlapping({{.*}});
+
let src = ();
let mut dst = ();
unsafe {
@@ -102,6 +169,9 @@ pub fn f_copy_nonoverlapping() {
// EMIT_MIR lower_intrinsics.assume.LowerIntrinsics.diff
pub fn assume() {
+ // CHECK-LABEL: fn assume(
+ // CHECK: assume({{.*}});
+
unsafe {
std::intrinsics::assume(true);
}
@@ -109,6 +179,11 @@ pub fn assume() {
// EMIT_MIR lower_intrinsics.with_overflow.LowerIntrinsics.diff
pub fn with_overflow(a: i32, b: i32) {
+ // CHECK-LABEL: fn with_overflow(
+ // CHECK: CheckedAdd(
+ // CHECK: CheckedSub(
+ // CHECK: CheckedMul(
+
let _x = core::intrinsics::add_with_overflow(a, b);
let _y = core::intrinsics::sub_with_overflow(a, b);
let _z = core::intrinsics::mul_with_overflow(a, b);
@@ -116,30 +191,41 @@ pub fn with_overflow(a: i32, b: i32) {
// EMIT_MIR lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff
pub fn read_via_copy_primitive(r: &i32) -> i32 {
+ // CHECK-LABEL: fn read_via_copy_primitive(
+ // CHECK: [[tmp:_.*]] = &raw const (*_1);
+ // CHECK: _0 = (*[[tmp]]);
+ // CHECK: return;
+
unsafe { core::intrinsics::read_via_copy(r) }
}
// EMIT_MIR lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff
pub fn read_via_copy_uninhabited(r: &Never) -> Never {
+ // CHECK-LABEL: fn read_via_copy_uninhabited(
+ // CHECK: [[tmp:_.*]] = &raw const (*_1);
+ // CHECK: _0 = (*[[tmp]]);
+ // CHECK: unreachable;
+
unsafe { core::intrinsics::read_via_copy(r) }
}
// EMIT_MIR lower_intrinsics.write_via_move_string.LowerIntrinsics.diff
pub fn write_via_move_string(r: &mut String, v: String) {
+ // CHECK-LABEL: fn write_via_move_string(
+ // CHECK: [[ptr:_.*]] = &raw mut (*_1);
+ // CHECK: [[tmp:_.*]] = move _2;
+ // CHECK: (*[[ptr]]) = move [[tmp]];
+ // CHECK: return;
+
unsafe { core::intrinsics::write_via_move(r, v) }
}
pub enum Never {}
-// EMIT_MIR lower_intrinsics.option_payload.LowerIntrinsics.diff
-pub fn option_payload(o: &Option<usize>, p: &Option<String>) {
- unsafe {
- let _x = core::intrinsics::option_payload_ptr(o);
- let _y = core::intrinsics::option_payload_ptr(p);
- }
-}
-
// EMIT_MIR lower_intrinsics.ptr_offset.LowerIntrinsics.diff
pub unsafe fn ptr_offset(p: *const i32, d: isize) -> *const i32 {
+ // CHECK-LABEL: fn ptr_offset(
+ // CHECK: _0 = Offset(
+
core::intrinsics::offset(p, d)
}
diff --git a/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.diff
deleted file mode 100644
index 27e8accea..000000000
--- a/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.diff
+++ /dev/null
@@ -1,20 +0,0 @@
-- // MIR for `size_of` before LowerIntrinsics
-+ // MIR for `size_of` after LowerIntrinsics
-
- fn size_of() -> usize {
- let mut _0: usize; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:24: +0:29
-
- bb0: {
-- _0 = std::intrinsics::size_of::<T>() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:37
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:16:5: 16:35
-- // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}, val: Value(<ZST>) }
-+ _0 = SizeOf(T); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:37
-+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:37
- }
-
- bb1: {
- return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..a547bdf37
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,17 @@
+- // MIR for `size_of` before LowerIntrinsics
++ // MIR for `size_of` after LowerIntrinsics
+
+ fn size_of() -> usize {
+ let mut _0: usize;
+
+ bb0: {
+- _0 = std::intrinsics::size_of::<T>() -> [return: bb1, unwind unreachable];
++ _0 = SizeOf(T);
++ goto -> bb1;
+ }
+
+ bb1: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..a547bdf37
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.size_of.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,17 @@
+- // MIR for `size_of` before LowerIntrinsics
++ // MIR for `size_of` after LowerIntrinsics
+
+ fn size_of() -> usize {
+ let mut _0: usize;
+
+ bb0: {
+- _0 = std::intrinsics::size_of::<T>() -> [return: bb1, unwind unreachable];
++ _0 = SizeOf(T);
++ goto -> bb1;
+ }
+
+ bb1: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff
deleted file mode 100644
index 1b3b76851..000000000
--- a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff
+++ /dev/null
@@ -1,27 +0,0 @@
-- // MIR for `transmute_inhabited` before LowerIntrinsics
-+ // MIR for `transmute_inhabited` after LowerIntrinsics
-
- fn transmute_inhabited(_1: std::cmp::Ordering) -> i8 {
- debug c => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:28: +0:29
- let mut _0: i8; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:54: +0:56
- let mut _2: std::cmp::Ordering; // in scope 0 at $DIR/lower_intrinsics.rs:+1:34: +1:35
- scope 1 {
- }
-
- bb0: {
- StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:34: +1:35
- _2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+1:34: +1:35
-- _0 = transmute::<std::cmp::Ordering, i8>(move _2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:43:14: 43:33
-- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(std::cmp::Ordering) -> i8 {transmute::<std::cmp::Ordering, i8>}, val: Value(<ZST>) }
-+ _0 = move _2 as i8 (Transmute); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36
-+ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36
- }
-
- bb1: {
- StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:35: +1:36
- return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..3b4051e4a
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,24 @@
+- // MIR for `transmute_inhabited` before LowerIntrinsics
++ // MIR for `transmute_inhabited` after LowerIntrinsics
+
+ fn transmute_inhabited(_1: std::cmp::Ordering) -> i8 {
+ debug c => _1;
+ let mut _0: i8;
+ let mut _2: std::cmp::Ordering;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = _1;
+- _0 = transmute::<std::cmp::Ordering, i8>(move _2) -> [return: bb1, unwind unreachable];
++ _0 = move _2 as i8 (Transmute);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..3b4051e4a
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,24 @@
+- // MIR for `transmute_inhabited` before LowerIntrinsics
++ // MIR for `transmute_inhabited` after LowerIntrinsics
+
+ fn transmute_inhabited(_1: std::cmp::Ordering) -> i8 {
+ debug c => _1;
+ let mut _0: i8;
+ let mut _2: std::cmp::Ordering;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = _1;
+- _0 = transmute::<std::cmp::Ordering, i8>(move _2) -> [return: bb1, unwind unreachable];
++ _0 = move _2 as i8 (Transmute);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff
deleted file mode 100644
index c6a7d2287..000000000
--- a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff
+++ /dev/null
@@ -1,27 +0,0 @@
-- // MIR for `transmute_ref_dst` before LowerIntrinsics
-+ // MIR for `transmute_ref_dst` after LowerIntrinsics
-
- fn transmute_ref_dst(_1: &T) -> *const T {
- debug u => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:44: +0:45
- let mut _0: *const T; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:54: +0:62
- let mut _2: &T; // in scope 0 at $DIR/lower_intrinsics.rs:+1:34: +1:35
- scope 1 {
- }
-
- bb0: {
- StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:34: +1:35
- _2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+1:34: +1:35
-- _0 = transmute::<&T, *const T>(move _2) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:53:14: 53:33
-- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&T) -> *const T {transmute::<&T, *const T>}, val: Value(<ZST>) }
-+ _0 = move _2 as *const T (Transmute); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36
-+ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:36
- }
-
- bb1: {
- StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:35: +1:36
- return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..91276a1b5
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,24 @@
+- // MIR for `transmute_ref_dst` before LowerIntrinsics
++ // MIR for `transmute_ref_dst` after LowerIntrinsics
+
+ fn transmute_ref_dst(_1: &T) -> *const T {
+ debug u => _1;
+ let mut _0: *const T;
+ let mut _2: &T;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = _1;
+- _0 = transmute::<&T, *const T>(move _2) -> [return: bb1, unwind unreachable];
++ _0 = move _2 as *const T (Transmute);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..91276a1b5
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,24 @@
+- // MIR for `transmute_ref_dst` before LowerIntrinsics
++ // MIR for `transmute_ref_dst` after LowerIntrinsics
+
+ fn transmute_ref_dst(_1: &T) -> *const T {
+ debug u => _1;
+ let mut _0: *const T;
+ let mut _2: &T;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = _1;
+- _0 = transmute::<&T, *const T>(move _2) -> [return: bb1, unwind unreachable];
++ _0 = move _2 as *const T (Transmute);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff
deleted file mode 100644
index aa5d9619d..000000000
--- a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff
+++ /dev/null
@@ -1,25 +0,0 @@
-- // MIR for `transmute_to_box_uninhabited` before LowerIntrinsics
-+ // MIR for `transmute_to_box_uninhabited` after LowerIntrinsics
-
- fn transmute_to_box_uninhabited() -> ! {
- let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:49: +0:50
- let _1: std::boxed::Box<Never>; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
-- _1 = transmute::<usize, Box<Never>>(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:70:25: 70:44
-- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize) -> Box<Never> {transmute::<usize, Box<Never>>}, val: Value(<ZST>) }
-+ _1 = const 1_usize as std::boxed::Box<Never> (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
-+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
- }
-
- bb1: {
- unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+2:11: +2:13
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..c4a3358ff
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,25 @@
+- // MIR for `transmute_to_box_uninhabited` before LowerIntrinsics
++ // MIR for `transmute_to_box_uninhabited` after LowerIntrinsics
+
+ fn transmute_to_box_uninhabited() -> ! {
+ let mut _0: !;
+ let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = transmute::<usize, Box<Never>>(const 1_usize) -> [return: bb1, unwind unreachable];
++ _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
++ goto -> bb1;
+ }
+
+ bb1: {
+ _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
+ PlaceMention((*_2));
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..c4a3358ff
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,25 @@
+- // MIR for `transmute_to_box_uninhabited` before LowerIntrinsics
++ // MIR for `transmute_to_box_uninhabited` after LowerIntrinsics
+
+ fn transmute_to_box_uninhabited() -> ! {
+ let mut _0: !;
+ let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = transmute::<usize, Box<Never>>(const 1_usize) -> [return: bb1, unwind unreachable];
++ _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
++ goto -> bb1;
+ }
+
+ bb1: {
+ _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
+ PlaceMention((*_2));
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff
deleted file mode 100644
index 5fafd45fe..000000000
--- a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff
+++ /dev/null
@@ -1,25 +0,0 @@
-- // MIR for `transmute_to_mut_uninhabited` before LowerIntrinsics
-+ // MIR for `transmute_to_mut_uninhabited` after LowerIntrinsics
-
- fn transmute_to_mut_uninhabited() -> ! {
- let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:49: +0:50
- let _1: &mut Never; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
-- _1 = transmute::<usize, &mut Never>(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:64:25: 64:44
-- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize) -> &mut Never {transmute::<usize, &mut Never>}, val: Value(<ZST>) }
-+ _1 = const 1_usize as &mut Never (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
-+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
- }
-
- bb1: {
- unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+2:11: +2:13
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..c2c4ec000
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,23 @@
+- // MIR for `transmute_to_mut_uninhabited` before LowerIntrinsics
++ // MIR for `transmute_to_mut_uninhabited` after LowerIntrinsics
+
+ fn transmute_to_mut_uninhabited() -> ! {
+ let mut _0: !;
+ let _1: &mut Never;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = transmute::<usize, &mut Never>(const 1_usize) -> [return: bb1, unwind unreachable];
++ _1 = const 1_usize as &mut Never (Transmute);
++ goto -> bb1;
+ }
+
+ bb1: {
+ PlaceMention((*_1));
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..c2c4ec000
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,23 @@
+- // MIR for `transmute_to_mut_uninhabited` before LowerIntrinsics
++ // MIR for `transmute_to_mut_uninhabited` after LowerIntrinsics
+
+ fn transmute_to_mut_uninhabited() -> ! {
+ let mut _0: !;
+ let _1: &mut Never;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = transmute::<usize, &mut Never>(const 1_usize) -> [return: bb1, unwind unreachable];
++ _1 = const 1_usize as &mut Never (Transmute);
++ goto -> bb1;
+ }
+
+ bb1: {
+ PlaceMention((*_1));
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff
deleted file mode 100644
index 08dead132..000000000
--- a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff
+++ /dev/null
@@ -1,25 +0,0 @@
-- // MIR for `transmute_to_ref_uninhabited` before LowerIntrinsics
-+ // MIR for `transmute_to_ref_uninhabited` after LowerIntrinsics
-
- fn transmute_to_ref_uninhabited() -> ! {
- let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:49: +0:50
- let _1: &Never; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
-- _1 = transmute::<usize, &Never>(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:58:21: 58:40
-- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize) -> &Never {transmute::<usize, &Never>}, val: Value(<ZST>) }
-+ _1 = const 1_usize as &Never (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48
-+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48
- }
-
- bb1: {
- unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+2:11: +2:13
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..1b516a1f5
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,23 @@
+- // MIR for `transmute_to_ref_uninhabited` before LowerIntrinsics
++ // MIR for `transmute_to_ref_uninhabited` after LowerIntrinsics
+
+ fn transmute_to_ref_uninhabited() -> ! {
+ let mut _0: !;
+ let _1: &Never;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = transmute::<usize, &Never>(const 1_usize) -> [return: bb1, unwind unreachable];
++ _1 = const 1_usize as &Never (Transmute);
++ goto -> bb1;
+ }
+
+ bb1: {
+ PlaceMention((*_1));
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..1b516a1f5
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,23 @@
+- // MIR for `transmute_to_ref_uninhabited` before LowerIntrinsics
++ // MIR for `transmute_to_ref_uninhabited` after LowerIntrinsics
+
+ fn transmute_to_ref_uninhabited() -> ! {
+ let mut _0: !;
+ let _1: &Never;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = transmute::<usize, &Never>(const 1_usize) -> [return: bb1, unwind unreachable];
++ _1 = const 1_usize as &Never (Transmute);
++ goto -> bb1;
+ }
+
+ bb1: {
+ PlaceMention((*_1));
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff
deleted file mode 100644
index f0b76127d..000000000
--- a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff
+++ /dev/null
@@ -1,22 +0,0 @@
-- // MIR for `transmute_uninhabited` before LowerIntrinsics
-+ // MIR for `transmute_uninhabited` after LowerIntrinsics
-
- fn transmute_uninhabited(_1: ()) -> Never {
- debug u => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:37: +0:38
- let mut _0: Never; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:47: +0:52
- let mut _2: (); // in scope 0 at $DIR/lower_intrinsics.rs:+1:47: +1:48
- scope 1 {
- }
-
- bb0: {
- StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48
- _2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48
-- _0 = transmute::<(), Never>(move _2) -> unwind unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:49
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:48:14: 48:46
-- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(()) -> Never {transmute::<(), Never>}, val: Value(<ZST>) }
-+ _0 = move _2 as Never (Transmute); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:49
-+ unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:49
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..792c77d57
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,19 @@
+- // MIR for `transmute_uninhabited` before LowerIntrinsics
++ // MIR for `transmute_uninhabited` after LowerIntrinsics
+
+ fn transmute_uninhabited(_1: ()) -> Never {
+ debug u => _1;
+ let mut _0: Never;
+ let mut _2: ();
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = _1;
+- _0 = transmute::<(), Never>(move _2) -> unwind unreachable;
++ _0 = move _2 as Never (Transmute);
++ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..792c77d57
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,19 @@
+- // MIR for `transmute_uninhabited` before LowerIntrinsics
++ // MIR for `transmute_uninhabited` after LowerIntrinsics
+
+ fn transmute_uninhabited(_1: ()) -> Never {
+ debug u => _1;
+ let mut _0: Never;
+ let mut _2: ();
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = _1;
+- _0 = transmute::<(), Never>(move _2) -> unwind unreachable;
++ _0 = move _2 as Never (Transmute);
++ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..dd92b8d6d
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,154 @@
+- // MIR for `unchecked` before LowerIntrinsics
++ // MIR for `unchecked` after LowerIntrinsics
+
+ fn unchecked(_1: i32, _2: i32) -> () {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: ();
+ let _3: i32;
+ let mut _4: i32;
+ let mut _5: i32;
+ let mut _7: i32;
+ let mut _8: i32;
+ let mut _10: i32;
+ let mut _11: i32;
+ let mut _13: i32;
+ let mut _14: i32;
+ let mut _16: i32;
+ let mut _17: i32;
+ let mut _19: i32;
+ let mut _20: i32;
+ let mut _22: i32;
+ let mut _23: i32;
+ scope 1 {
+ debug _a => _3;
+ let _6: i32;
+ scope 2 {
+ debug _b => _6;
+ let _9: i32;
+ scope 3 {
+ debug _c => _9;
+ let _12: i32;
+ scope 4 {
+ debug _x => _12;
+ let _15: i32;
+ scope 5 {
+ debug _y => _15;
+ let _18: i32;
+ scope 6 {
+ debug _i => _18;
+ let _21: i32;
+ scope 7 {
+ debug _j => _21;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ _5 = _2;
+- _3 = unchecked_add::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable];
++ _3 = AddUnchecked(move _4, move _5);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = _1;
+ StorageLive(_8);
+ _8 = _2;
+- _6 = unchecked_sub::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable];
++ _6 = SubUnchecked(move _7, move _8);
++ goto -> bb2;
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = _1;
+ StorageLive(_11);
+ _11 = _2;
+- _9 = unchecked_mul::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable];
++ _9 = MulUnchecked(move _10, move _11);
++ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = _1;
+ StorageLive(_14);
+ _14 = _2;
+- _12 = unchecked_div::<i32>(move _13, move _14) -> [return: bb4, unwind unreachable];
++ _12 = Div(move _13, move _14);
++ goto -> bb4;
+ }
+
+ bb4: {
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageLive(_15);
+ StorageLive(_16);
+ _16 = _1;
+ StorageLive(_17);
+ _17 = _2;
+- _15 = unchecked_rem::<i32>(move _16, move _17) -> [return: bb5, unwind unreachable];
++ _15 = Rem(move _16, move _17);
++ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_18);
+ StorageLive(_19);
+ _19 = _1;
+ StorageLive(_20);
+ _20 = _2;
+- _18 = unchecked_shl::<i32>(move _19, move _20) -> [return: bb6, unwind unreachable];
++ _18 = ShlUnchecked(move _19, move _20);
++ goto -> bb6;
+ }
+
+ bb6: {
+ StorageDead(_20);
+ StorageDead(_19);
+ StorageLive(_21);
+ StorageLive(_22);
+ _22 = _1;
+ StorageLive(_23);
+ _23 = _2;
+- _21 = unchecked_shr::<i32>(move _22, move _23) -> [return: bb7, unwind unreachable];
++ _21 = ShrUnchecked(move _22, move _23);
++ goto -> bb7;
+ }
+
+ bb7: {
+ StorageDead(_23);
+ StorageDead(_22);
+ _0 = const ();
+ StorageDead(_21);
+ StorageDead(_18);
+ StorageDead(_15);
+ StorageDead(_12);
+ StorageDead(_9);
+ StorageDead(_6);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..dd92b8d6d
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,154 @@
+- // MIR for `unchecked` before LowerIntrinsics
++ // MIR for `unchecked` after LowerIntrinsics
+
+ fn unchecked(_1: i32, _2: i32) -> () {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: ();
+ let _3: i32;
+ let mut _4: i32;
+ let mut _5: i32;
+ let mut _7: i32;
+ let mut _8: i32;
+ let mut _10: i32;
+ let mut _11: i32;
+ let mut _13: i32;
+ let mut _14: i32;
+ let mut _16: i32;
+ let mut _17: i32;
+ let mut _19: i32;
+ let mut _20: i32;
+ let mut _22: i32;
+ let mut _23: i32;
+ scope 1 {
+ debug _a => _3;
+ let _6: i32;
+ scope 2 {
+ debug _b => _6;
+ let _9: i32;
+ scope 3 {
+ debug _c => _9;
+ let _12: i32;
+ scope 4 {
+ debug _x => _12;
+ let _15: i32;
+ scope 5 {
+ debug _y => _15;
+ let _18: i32;
+ scope 6 {
+ debug _i => _18;
+ let _21: i32;
+ scope 7 {
+ debug _j => _21;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ _5 = _2;
+- _3 = unchecked_add::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable];
++ _3 = AddUnchecked(move _4, move _5);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = _1;
+ StorageLive(_8);
+ _8 = _2;
+- _6 = unchecked_sub::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable];
++ _6 = SubUnchecked(move _7, move _8);
++ goto -> bb2;
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = _1;
+ StorageLive(_11);
+ _11 = _2;
+- _9 = unchecked_mul::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable];
++ _9 = MulUnchecked(move _10, move _11);
++ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = _1;
+ StorageLive(_14);
+ _14 = _2;
+- _12 = unchecked_div::<i32>(move _13, move _14) -> [return: bb4, unwind unreachable];
++ _12 = Div(move _13, move _14);
++ goto -> bb4;
+ }
+
+ bb4: {
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageLive(_15);
+ StorageLive(_16);
+ _16 = _1;
+ StorageLive(_17);
+ _17 = _2;
+- _15 = unchecked_rem::<i32>(move _16, move _17) -> [return: bb5, unwind unreachable];
++ _15 = Rem(move _16, move _17);
++ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageLive(_18);
+ StorageLive(_19);
+ _19 = _1;
+ StorageLive(_20);
+ _20 = _2;
+- _18 = unchecked_shl::<i32>(move _19, move _20) -> [return: bb6, unwind unreachable];
++ _18 = ShlUnchecked(move _19, move _20);
++ goto -> bb6;
+ }
+
+ bb6: {
+ StorageDead(_20);
+ StorageDead(_19);
+ StorageLive(_21);
+ StorageLive(_22);
+ _22 = _1;
+ StorageLive(_23);
+ _23 = _2;
+- _21 = unchecked_shr::<i32>(move _22, move _23) -> [return: bb7, unwind unreachable];
++ _21 = ShrUnchecked(move _22, move _23);
++ goto -> bb7;
+ }
+
+ bb7: {
+ StorageDead(_23);
+ StorageDead(_22);
+ _0 = const ();
+ StorageDead(_21);
+ StorageDead(_18);
+ StorageDead(_15);
+ StorageDead(_12);
+ StorageDead(_9);
+ StorageDead(_6);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff
deleted file mode 100644
index 28e45909c..000000000
--- a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff
+++ /dev/null
@@ -1,21 +0,0 @@
-- // MIR for `unreachable` before LowerIntrinsics
-+ // MIR for `unreachable` after LowerIntrinsics
-
- fn unreachable() -> ! {
- let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:25: +0:26
- let _1: (); // in scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:45
- let mut _2: !; // in scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:45
- scope 1 {
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:47
- StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45
-- _2 = std::intrinsics::unreachable() -> unwind unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:31:14: 31:43
-- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn() -> ! {std::intrinsics::unreachable}, val: Value(<ZST>) }
-+ unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..f5646e7f1
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,18 @@
+- // MIR for `unreachable` before LowerIntrinsics
++ // MIR for `unreachable` after LowerIntrinsics
+
+ fn unreachable() -> ! {
+ let mut _0: !;
+ let _1: ();
+ let mut _2: !;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = std::intrinsics::unreachable() -> unwind unreachable;
++ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..f5646e7f1
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,18 @@
+- // MIR for `unreachable` before LowerIntrinsics
++ // MIR for `unreachable` after LowerIntrinsics
+
+ fn unreachable() -> ! {
+ let mut _0: !;
+ let _1: ();
+ let mut _2: !;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = std::intrinsics::unreachable() -> unwind unreachable;
++ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.diff
deleted file mode 100644
index 9cf4fbb88..000000000
--- a/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.diff
+++ /dev/null
@@ -1,83 +0,0 @@
-- // MIR for `with_overflow` before LowerIntrinsics
-+ // MIR for `with_overflow` after LowerIntrinsics
-
- fn with_overflow(_1: i32, _2: i32) -> () {
- debug a => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:22: +0:23
- debug b => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:30: +0:31
- let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:38: +0:38
- let _3: (i32, bool); // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:11
- let mut _4: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:50: +1:51
- let mut _5: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:53: +1:54
- let mut _7: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:50: +2:51
- let mut _8: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:53: +2:54
- let mut _10: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+3:50: +3:51
- let mut _11: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+3:53: +3:54
- scope 1 {
- debug _x => _3; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:11
- let _6: (i32, bool); // in scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:11
- scope 2 {
- debug _y => _6; // in scope 2 at $DIR/lower_intrinsics.rs:+2:9: +2:11
- let _9: (i32, bool); // in scope 2 at $DIR/lower_intrinsics.rs:+3:9: +3:11
- scope 3 {
- debug _z => _9; // in scope 3 at $DIR/lower_intrinsics.rs:+3:9: +3:11
- }
- }
- }
-
- bb0: {
- StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:11
- StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:50: +1:51
- _4 = _1; // scope 0 at $DIR/lower_intrinsics.rs:+1:50: +1:51
- StorageLive(_5); // scope 0 at $DIR/lower_intrinsics.rs:+1:53: +1:54
- _5 = _2; // scope 0 at $DIR/lower_intrinsics.rs:+1:53: +1:54
-- _3 = add_with_overflow::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:55
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:112:14: 112:49
-- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> (i32, bool) {add_with_overflow::<i32>}, val: Value(<ZST>) }
-+ _3 = CheckedAdd(move _4, move _5); // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:55
-+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:55
- }
-
- bb1: {
- StorageDead(_5); // scope 0 at $DIR/lower_intrinsics.rs:+1:54: +1:55
- StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:54: +1:55
- StorageLive(_6); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:11
- StorageLive(_7); // scope 1 at $DIR/lower_intrinsics.rs:+2:50: +2:51
- _7 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+2:50: +2:51
- StorageLive(_8); // scope 1 at $DIR/lower_intrinsics.rs:+2:53: +2:54
- _8 = _2; // scope 1 at $DIR/lower_intrinsics.rs:+2:53: +2:54
-- _6 = sub_with_overflow::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:55
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:113:14: 113:49
-- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> (i32, bool) {sub_with_overflow::<i32>}, val: Value(<ZST>) }
-+ _6 = CheckedSub(move _7, move _8); // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:55
-+ goto -> bb2; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:55
- }
-
- bb2: {
- StorageDead(_8); // scope 1 at $DIR/lower_intrinsics.rs:+2:54: +2:55
- StorageDead(_7); // scope 1 at $DIR/lower_intrinsics.rs:+2:54: +2:55
- StorageLive(_9); // scope 2 at $DIR/lower_intrinsics.rs:+3:9: +3:11
- StorageLive(_10); // scope 2 at $DIR/lower_intrinsics.rs:+3:50: +3:51
- _10 = _1; // scope 2 at $DIR/lower_intrinsics.rs:+3:50: +3:51
- StorageLive(_11); // scope 2 at $DIR/lower_intrinsics.rs:+3:53: +3:54
- _11 = _2; // scope 2 at $DIR/lower_intrinsics.rs:+3:53: +3:54
-- _9 = mul_with_overflow::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:55
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:114:14: 114:49
-- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> (i32, bool) {mul_with_overflow::<i32>}, val: Value(<ZST>) }
-+ _9 = CheckedMul(move _10, move _11); // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:55
-+ goto -> bb3; // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:55
- }
-
- bb3: {
- StorageDead(_11); // scope 2 at $DIR/lower_intrinsics.rs:+3:54: +3:55
- StorageDead(_10); // scope 2 at $DIR/lower_intrinsics.rs:+3:54: +3:55
- _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:+0:38: +4:2
- StorageDead(_9); // scope 2 at $DIR/lower_intrinsics.rs:+4:1: +4:2
- StorageDead(_6); // scope 1 at $DIR/lower_intrinsics.rs:+4:1: +4:2
- StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:+4:1: +4:2
- return; // scope 0 at $DIR/lower_intrinsics.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..da84449aa
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,74 @@
+- // MIR for `with_overflow` before LowerIntrinsics
++ // MIR for `with_overflow` after LowerIntrinsics
+
+ fn with_overflow(_1: i32, _2: i32) -> () {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: ();
+ let _3: (i32, bool);
+ let mut _4: i32;
+ let mut _5: i32;
+ let mut _7: i32;
+ let mut _8: i32;
+ let mut _10: i32;
+ let mut _11: i32;
+ scope 1 {
+ debug _x => _3;
+ let _6: (i32, bool);
+ scope 2 {
+ debug _y => _6;
+ let _9: (i32, bool);
+ scope 3 {
+ debug _z => _9;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ _5 = _2;
+- _3 = add_with_overflow::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable];
++ _3 = CheckedAdd(move _4, move _5);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = _1;
+ StorageLive(_8);
+ _8 = _2;
+- _6 = sub_with_overflow::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable];
++ _6 = CheckedSub(move _7, move _8);
++ goto -> bb2;
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = _1;
+ StorageLive(_11);
+ _11 = _2;
+- _9 = mul_with_overflow::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable];
++ _9 = CheckedMul(move _10, move _11);
++ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_6);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..da84449aa
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,74 @@
+- // MIR for `with_overflow` before LowerIntrinsics
++ // MIR for `with_overflow` after LowerIntrinsics
+
+ fn with_overflow(_1: i32, _2: i32) -> () {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: ();
+ let _3: (i32, bool);
+ let mut _4: i32;
+ let mut _5: i32;
+ let mut _7: i32;
+ let mut _8: i32;
+ let mut _10: i32;
+ let mut _11: i32;
+ scope 1 {
+ debug _x => _3;
+ let _6: (i32, bool);
+ scope 2 {
+ debug _y => _6;
+ let _9: (i32, bool);
+ scope 3 {
+ debug _z => _9;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ _5 = _2;
+- _3 = add_with_overflow::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable];
++ _3 = CheckedAdd(move _4, move _5);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = _1;
+ StorageLive(_8);
+ _8 = _2;
+- _6 = sub_with_overflow::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable];
++ _6 = CheckedSub(move _7, move _8);
++ goto -> bb2;
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = _1;
+ StorageLive(_11);
+ _11 = _2;
+- _9 = mul_with_overflow::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable];
++ _9 = CheckedMul(move _10, move _11);
++ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_6);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff
deleted file mode 100644
index 217f27efe..000000000
--- a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff
+++ /dev/null
@@ -1,83 +0,0 @@
-- // MIR for `wrapping` before LowerIntrinsics
-+ // MIR for `wrapping` after LowerIntrinsics
-
- fn wrapping(_1: i32, _2: i32) -> () {
- debug a => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:17: +0:18
- debug b => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:25: +0:26
- let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:33: +0:33
- let _3: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:11
- let mut _4: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:45: +1:46
- let mut _5: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:48: +1:49
- let mut _7: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:45: +2:46
- let mut _8: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+2:48: +2:49
- let mut _10: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+3:45: +3:46
- let mut _11: i32; // in scope 0 at $DIR/lower_intrinsics.rs:+3:48: +3:49
- scope 1 {
- debug _x => _3; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:11
- let _6: i32; // in scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:11
- scope 2 {
- debug _y => _6; // in scope 2 at $DIR/lower_intrinsics.rs:+2:9: +2:11
- let _9: i32; // in scope 2 at $DIR/lower_intrinsics.rs:+3:9: +3:11
- scope 3 {
- debug _z => _9; // in scope 3 at $DIR/lower_intrinsics.rs:+3:9: +3:11
- }
- }
- }
-
- bb0: {
- StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:11
- StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:45: +1:46
- _4 = _1; // scope 0 at $DIR/lower_intrinsics.rs:+1:45: +1:46
- StorageLive(_5); // scope 0 at $DIR/lower_intrinsics.rs:+1:48: +1:49
- _5 = _2; // scope 0 at $DIR/lower_intrinsics.rs:+1:48: +1:49
-- _3 = std::intrinsics::wrapping_add::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:50
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:9:14: 9:44
-- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> i32 {std::intrinsics::wrapping_add::<i32>}, val: Value(<ZST>) }
-+ _3 = Add(move _4, move _5); // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:50
-+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:50
- }
-
- bb1: {
- StorageDead(_5); // scope 0 at $DIR/lower_intrinsics.rs:+1:49: +1:50
- StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:49: +1:50
- StorageLive(_6); // scope 1 at $DIR/lower_intrinsics.rs:+2:9: +2:11
- StorageLive(_7); // scope 1 at $DIR/lower_intrinsics.rs:+2:45: +2:46
- _7 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+2:45: +2:46
- StorageLive(_8); // scope 1 at $DIR/lower_intrinsics.rs:+2:48: +2:49
- _8 = _2; // scope 1 at $DIR/lower_intrinsics.rs:+2:48: +2:49
-- _6 = std::intrinsics::wrapping_sub::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:50
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:10:14: 10:44
-- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> i32 {std::intrinsics::wrapping_sub::<i32>}, val: Value(<ZST>) }
-+ _6 = Sub(move _7, move _8); // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:50
-+ goto -> bb2; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:50
- }
-
- bb2: {
- StorageDead(_8); // scope 1 at $DIR/lower_intrinsics.rs:+2:49: +2:50
- StorageDead(_7); // scope 1 at $DIR/lower_intrinsics.rs:+2:49: +2:50
- StorageLive(_9); // scope 2 at $DIR/lower_intrinsics.rs:+3:9: +3:11
- StorageLive(_10); // scope 2 at $DIR/lower_intrinsics.rs:+3:45: +3:46
- _10 = _1; // scope 2 at $DIR/lower_intrinsics.rs:+3:45: +3:46
- StorageLive(_11); // scope 2 at $DIR/lower_intrinsics.rs:+3:48: +3:49
- _11 = _2; // scope 2 at $DIR/lower_intrinsics.rs:+3:48: +3:49
-- _9 = wrapping_mul::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:50
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:11:14: 11:44
-- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> i32 {wrapping_mul::<i32>}, val: Value(<ZST>) }
-+ _9 = Mul(move _10, move _11); // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:50
-+ goto -> bb3; // scope 2 at $DIR/lower_intrinsics.rs:+3:14: +3:50
- }
-
- bb3: {
- StorageDead(_11); // scope 2 at $DIR/lower_intrinsics.rs:+3:49: +3:50
- StorageDead(_10); // scope 2 at $DIR/lower_intrinsics.rs:+3:49: +3:50
- _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:+0:33: +4:2
- StorageDead(_9); // scope 2 at $DIR/lower_intrinsics.rs:+4:1: +4:2
- StorageDead(_6); // scope 1 at $DIR/lower_intrinsics.rs:+4:1: +4:2
- StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:+4:1: +4:2
- return; // scope 0 at $DIR/lower_intrinsics.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..2acb193e0
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,74 @@
+- // MIR for `wrapping` before LowerIntrinsics
++ // MIR for `wrapping` after LowerIntrinsics
+
+ fn wrapping(_1: i32, _2: i32) -> () {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: ();
+ let _3: i32;
+ let mut _4: i32;
+ let mut _5: i32;
+ let mut _7: i32;
+ let mut _8: i32;
+ let mut _10: i32;
+ let mut _11: i32;
+ scope 1 {
+ debug _x => _3;
+ let _6: i32;
+ scope 2 {
+ debug _y => _6;
+ let _9: i32;
+ scope 3 {
+ debug _z => _9;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ _5 = _2;
+- _3 = std::intrinsics::wrapping_add::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable];
++ _3 = Add(move _4, move _5);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = _1;
+ StorageLive(_8);
+ _8 = _2;
+- _6 = std::intrinsics::wrapping_sub::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable];
++ _6 = Sub(move _7, move _8);
++ goto -> bb2;
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = _1;
+ StorageLive(_11);
+ _11 = _2;
+- _9 = wrapping_mul::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable];
++ _9 = Mul(move _10, move _11);
++ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_6);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..2acb193e0
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,74 @@
+- // MIR for `wrapping` before LowerIntrinsics
++ // MIR for `wrapping` after LowerIntrinsics
+
+ fn wrapping(_1: i32, _2: i32) -> () {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: ();
+ let _3: i32;
+ let mut _4: i32;
+ let mut _5: i32;
+ let mut _7: i32;
+ let mut _8: i32;
+ let mut _10: i32;
+ let mut _11: i32;
+ scope 1 {
+ debug _x => _3;
+ let _6: i32;
+ scope 2 {
+ debug _y => _6;
+ let _9: i32;
+ scope 3 {
+ debug _z => _9;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ _5 = _2;
+- _3 = std::intrinsics::wrapping_add::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable];
++ _3 = Add(move _4, move _5);
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = _1;
+ StorageLive(_8);
+ _8 = _2;
+- _6 = std::intrinsics::wrapping_sub::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable];
++ _6 = Sub(move _7, move _8);
++ goto -> bb2;
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = _1;
+ StorageLive(_11);
+ _11 = _2;
+- _9 = wrapping_mul::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable];
++ _9 = Mul(move _10, move _11);
++ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_6);
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff
deleted file mode 100644
index 38d99f661..000000000
--- a/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff
+++ /dev/null
@@ -1,36 +0,0 @@
-- // MIR for `write_via_move_string` before LowerIntrinsics
-+ // MIR for `write_via_move_string` after LowerIntrinsics
-
- fn write_via_move_string(_1: &mut String, _2: String) -> () {
- debug r => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:30: +0:31
- debug v => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:46: +0:47
- let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:57: +0:57
- let mut _3: *mut std::string::String; // in scope 0 at $DIR/lower_intrinsics.rs:+1:47: +1:48
- let mut _4: std::string::String; // in scope 0 at $DIR/lower_intrinsics.rs:+1:50: +1:51
- scope 1 {
- }
-
- bb0: {
- StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48
- _3 = &raw mut (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48
- StorageLive(_4); // scope 1 at $DIR/lower_intrinsics.rs:+1:50: +1:51
- _4 = move _2; // scope 1 at $DIR/lower_intrinsics.rs:+1:50: +1:51
-- _0 = write_via_move::<String>(move _3, move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:52
-- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:129:14: 129:46
-- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*mut String, String) {write_via_move::<String>}, val: Value(<ZST>) }
-+ (*_3) = move _4; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:52
-+ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:52
- }
-
- bb1: {
- StorageDead(_4); // scope 1 at $DIR/lower_intrinsics.rs:+1:51: +1:52
- StorageDead(_3); // scope 1 at $DIR/lower_intrinsics.rs:+1:51: +1:52
- goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:+2:1: +2:2
- }
-
- bb2: {
- return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-abort.diff
new file mode 100644
index 000000000..ddc8cf9a3
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-abort.diff
@@ -0,0 +1,33 @@
+- // MIR for `write_via_move_string` before LowerIntrinsics
++ // MIR for `write_via_move_string` after LowerIntrinsics
+
+ fn write_via_move_string(_1: &mut String, _2: String) -> () {
+ debug r => _1;
+ debug v => _2;
+ let mut _0: ();
+ let mut _3: *mut std::string::String;
+ let mut _4: std::string::String;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = &raw mut (*_1);
+ StorageLive(_4);
+ _4 = move _2;
+- _0 = write_via_move::<String>(move _3, move _4) -> [return: bb1, unwind unreachable];
++ (*_3) = move _4;
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ goto -> bb2;
+ }
+
+ bb2: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-unwind.diff
new file mode 100644
index 000000000..ddc8cf9a3
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.panic-unwind.diff
@@ -0,0 +1,33 @@
+- // MIR for `write_via_move_string` before LowerIntrinsics
++ // MIR for `write_via_move_string` after LowerIntrinsics
+
+ fn write_via_move_string(_1: &mut String, _2: String) -> () {
+ debug r => _1;
+ debug v => _2;
+ let mut _0: ();
+ let mut _3: *mut std::string::String;
+ let mut _4: std::string::String;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = &raw mut (*_1);
+ StorageLive(_4);
+ _4 = move _2;
+- _0 = write_via_move::<String>(move _3, move _4) -> [return: bb1, unwind unreachable];
++ (*_3) = move _4;
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ goto -> bb2;
+ }
+
+ bb2: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff
deleted file mode 100644
index 67918e62b..000000000
--- a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff
+++ /dev/null
@@ -1,63 +0,0 @@
-- // MIR for `bound` before LowerSliceLenCalls
-+ // MIR for `bound` after LowerSliceLenCalls
-
- fn bound(_1: usize, _2: &[u8]) -> u8 {
- debug index => _1; // in scope 0 at $DIR/lower_slice_len.rs:+0:14: +0:19
- debug slice => _2; // in scope 0 at $DIR/lower_slice_len.rs:+0:28: +0:33
- let mut _0: u8; // return place in scope 0 at $DIR/lower_slice_len.rs:+0:45: +0:47
- let mut _3: bool; // in scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:27
- let mut _4: usize; // in scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:13
- let mut _5: usize; // in scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27
- let mut _6: &[u8]; // in scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27
- let _7: usize; // in scope 0 at $DIR/lower_slice_len.rs:+2:15: +2:20
- let mut _8: usize; // in scope 0 at $DIR/lower_slice_len.rs:+2:9: +2:21
- let mut _9: bool; // in scope 0 at $DIR/lower_slice_len.rs:+2:9: +2:21
-
- bb0: {
- StorageLive(_3); // scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:27
- StorageLive(_4); // scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:13
- _4 = _1; // scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:13
- StorageLive(_5); // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27
- StorageLive(_6); // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27
- _6 = &(*_2); // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27
-- _5 = core::slice::<impl [u8]>::len(move _6) -> bb1; // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27
-- // mir::Constant
-- // + span: $DIR/lower_slice_len.rs:6:22: 6:25
-- // + literal: Const { ty: for<'a> fn(&'a [u8]) -> usize {core::slice::<impl [u8]>::len}, val: Value(<ZST>) }
-+ _5 = Len((*_6)); // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27
-+ goto -> bb1; // scope 0 at $DIR/lower_slice_len.rs:+1:16: +1:27
- }
-
- bb1: {
- StorageDead(_6); // scope 0 at $DIR/lower_slice_len.rs:+1:26: +1:27
- _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:27
- StorageDead(_5); // scope 0 at $DIR/lower_slice_len.rs:+1:26: +1:27
- StorageDead(_4); // scope 0 at $DIR/lower_slice_len.rs:+1:26: +1:27
- switchInt(move _3) -> [0: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:27
- }
-
- bb2: {
- StorageLive(_7); // scope 0 at $DIR/lower_slice_len.rs:+2:15: +2:20
- _7 = _1; // scope 0 at $DIR/lower_slice_len.rs:+2:15: +2:20
- _8 = Len((*_2)); // scope 0 at $DIR/lower_slice_len.rs:+2:9: +2:21
- _9 = Lt(_7, _8); // scope 0 at $DIR/lower_slice_len.rs:+2:9: +2:21
- assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb3; // scope 0 at $DIR/lower_slice_len.rs:+2:9: +2:21
- }
-
- bb3: {
- _0 = (*_2)[_7]; // scope 0 at $DIR/lower_slice_len.rs:+2:9: +2:21
- StorageDead(_7); // scope 0 at $DIR/lower_slice_len.rs:+3:5: +3:6
- goto -> bb5; // scope 0 at $DIR/lower_slice_len.rs:+1:5: +5:6
- }
-
- bb4: {
- _0 = const 42_u8; // scope 0 at $DIR/lower_slice_len.rs:+4:9: +4:11
- goto -> bb5; // scope 0 at $DIR/lower_slice_len.rs:+1:5: +5:6
- }
-
- bb5: {
- StorageDead(_3); // scope 0 at $DIR/lower_slice_len.rs:+5:5: +5:6
- return; // scope 0 at $DIR/lower_slice_len.rs:+6:2: +6:2
- }
- }
-
diff --git a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff
new file mode 100644
index 000000000..7f752ca0f
--- /dev/null
+++ b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff
@@ -0,0 +1,62 @@
+- // MIR for `bound` before LowerSliceLenCalls
++ // MIR for `bound` after LowerSliceLenCalls
+
+ fn bound(_1: usize, _2: &[u8]) -> u8 {
+ debug index => _1;
+ debug slice => _2;
+ let mut _0: u8;
+ let mut _3: bool;
+ let mut _4: usize;
+ let mut _5: usize;
+ let mut _6: &[u8];
+ let _7: usize;
+ let mut _8: usize;
+ let mut _9: bool;
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = &(*_2);
+- _5 = core::slice::<impl [u8]>::len(move _6) -> [return: bb1, unwind unreachable];
++ _5 = Len((*_6));
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_6);
+ _3 = Lt(move _4, move _5);
+ switchInt(move _3) -> [0: bb4, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_7);
+ _7 = _1;
+ _8 = Len((*_2));
+ _9 = Lt(_7, _8);
+ assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ _0 = (*_2)[_7];
+ StorageDead(_7);
+ goto -> bb5;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
+ _0 = const 42_u8;
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_3);
+ return;
+ }
+ }
+
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
new file mode 100644
index 000000000..d73b563a0
--- /dev/null
+++ b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff
@@ -0,0 +1,62 @@
+- // MIR for `bound` before LowerSliceLenCalls
++ // MIR for `bound` after LowerSliceLenCalls
+
+ fn bound(_1: usize, _2: &[u8]) -> u8 {
+ debug index => _1;
+ debug slice => _2;
+ let mut _0: u8;
+ let mut _3: bool;
+ let mut _4: usize;
+ let mut _5: usize;
+ let mut _6: &[u8];
+ let _7: usize;
+ let mut _8: usize;
+ let mut _9: bool;
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = &(*_2);
+- _5 = core::slice::<impl [u8]>::len(move _6) -> [return: bb1, unwind continue];
++ _5 = Len((*_6));
++ goto -> bb1;
+ }
+
+ bb1: {
+ StorageDead(_6);
+ _3 = Lt(move _4, move _5);
+ switchInt(move _3) -> [0: bb4, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_7);
+ _7 = _1;
+ _8 = Len((*_2));
+ _9 = Lt(_7, _8);
+ assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb3, unwind continue];
+ }
+
+ bb3: {
+ _0 = (*_2)[_7];
+ StorageDead(_7);
+ goto -> bb5;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ StorageDead(_4);
+ _0 = const 42_u8;
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_3);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/lower_slice_len.rs b/tests/mir-opt/lower_slice_len.rs
index 9c39c29fc..7b967a165 100644
--- a/tests/mir-opt/lower_slice_len.rs
+++ b/tests/mir-opt/lower_slice_len.rs
@@ -1,8 +1,10 @@
-// ignore-wasm32 compiled with panic=abort by default
// unit-test: LowerSliceLenCalls
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR lower_slice_len.bound.LowerSliceLenCalls.diff
pub fn bound(index: usize, slice: &[u8]) -> u8 {
+ // CHECK-LABEL: fn bound(
+ // CHECK-NOT: ::len(
if index < slice.len() {
slice[index]
} else {
diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff
deleted file mode 100644
index 3081e78f2..000000000
--- a/tests/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff
+++ /dev/null
@@ -1,272 +0,0 @@
-- // MIR for `complicated_match` after SimplifyCfg-initial
-+ // MIR for `complicated_match` after ElaborateDrops
-
- fn complicated_match(_1: bool, _2: (bool, bool, String)) -> i32 {
- debug cond => _1; // in scope 0 at $DIR/match_arm_scopes.rs:+0:22: +0:26
- debug items => _2; // in scope 0 at $DIR/match_arm_scopes.rs:+0:34: +0:39
- let mut _0: i32; // return place in scope 0 at $DIR/match_arm_scopes.rs:+0:66: +0:69
- let mut _3: &bool; // in scope 0 at $DIR/match_arm_scopes.rs:+1:11: +1:16
- let mut _4: &bool; // in scope 0 at $DIR/match_arm_scopes.rs:+1:11: +1:16
- let _5: bool; // in scope 0 at $DIR/match_arm_scopes.rs:+2:17: +2:18
- let _6: &bool; // in scope 0 at $DIR/match_arm_scopes.rs:+2:17: +2:18
- let _7: std::string::String; // in scope 0 at $DIR/match_arm_scopes.rs:+2:20: +2:21
- let _8: &std::string::String; // in scope 0 at $DIR/match_arm_scopes.rs:+2:20: +2:21
- let mut _9: bool; // in scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73
- let mut _10: bool; // in scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49
- let mut _11: !; // in scope 0 at $DIR/match_arm_scopes.rs:+2:52: +2:60
- let mut _12: bool; // in scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73
- let mut _13: bool; // in scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49
- let mut _14: !; // in scope 0 at $DIR/match_arm_scopes.rs:+2:52: +2:60
- let _15: bool; // in scope 0 at $DIR/match_arm_scopes.rs:+3:16: +3:17
- let _16: std::string::String; // in scope 0 at $DIR/match_arm_scopes.rs:+3:19: +3:20
- scope 1 {
- debug a => _5; // in scope 1 at $DIR/match_arm_scopes.rs:+2:17: +2:18
- debug a => _6; // in scope 1 at $DIR/match_arm_scopes.rs:+2:17: +2:18
- debug s => _7; // in scope 1 at $DIR/match_arm_scopes.rs:+2:20: +2:21
- debug s => _8; // in scope 1 at $DIR/match_arm_scopes.rs:+2:20: +2:21
- }
- scope 2 {
- debug b => _15; // in scope 2 at $DIR/match_arm_scopes.rs:+3:16: +3:17
- debug t => _16; // in scope 2 at $DIR/match_arm_scopes.rs:+3:19: +3:20
- }
-
- bb0: {
-- FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_arm_scopes.rs:+1:11: +1:16
-- switchInt((_2.0: bool)) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16
-+ switchInt((_2.0: bool)) -> [0: bb5, otherwise: bb1]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16
- }
-
- bb1: {
-- falseEdge -> [real: bb8, imaginary: bb3]; // scope 0 at $DIR/match_arm_scopes.rs:+2:9: +2:22
-+ switchInt((_2.1: bool)) -> [0: bb10, otherwise: bb2]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16
- }
-
- bb2: {
-- switchInt((_2.1: bool)) -> [0: bb3, otherwise: bb4]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16
-+ switchInt((_2.0: bool)) -> [0: bb3, otherwise: bb17]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16
- }
-
- bb3: {
-- falseEdge -> [real: bb13, imaginary: bb5]; // scope 0 at $DIR/match_arm_scopes.rs:+2:25: +2:38
-- }
--
-- bb4: {
-- switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb5]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16
-- }
--
-- bb5: {
-- falseEdge -> [real: bb20, imaginary: bb6]; // scope 0 at $DIR/match_arm_scopes.rs:+3:9: +3:21
-- }
--
-- bb6: {
- StorageLive(_15); // scope 0 at $DIR/match_arm_scopes.rs:+3:32: +3:33
- _15 = (_2.1: bool); // scope 0 at $DIR/match_arm_scopes.rs:+3:32: +3:33
- StorageLive(_16); // scope 0 at $DIR/match_arm_scopes.rs:+3:35: +3:36
- _16 = move (_2.2: std::string::String); // scope 0 at $DIR/match_arm_scopes.rs:+3:35: +3:36
-- goto -> bb19; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6
-+ goto -> bb16; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6
- }
-
-- bb7: {
-+ bb4: {
- _0 = const 1_i32; // scope 1 at $DIR/match_arm_scopes.rs:+2:77: +2:78
-- drop(_7) -> [return: bb18, unwind: bb25]; // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78
-+ drop(_7) -> [return: bb15, unwind: bb22]; // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78
- }
-
-- bb8: {
-+ bb5: {
- StorageLive(_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:17: +2:18
- _6 = &(_2.1: bool); // scope 0 at $DIR/match_arm_scopes.rs:+2:17: +2:18
- StorageLive(_8); // scope 0 at $DIR/match_arm_scopes.rs:+2:20: +2:21
- _8 = &(_2.2: std::string::String); // scope 0 at $DIR/match_arm_scopes.rs:+2:20: +2:21
-- _3 = &shallow (_2.0: bool); // scope 0 at $DIR/match_arm_scopes.rs:+1:11: +1:16
-- _4 = &shallow (_2.1: bool); // scope 0 at $DIR/match_arm_scopes.rs:+1:11: +1:16
- StorageLive(_9); // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73
- StorageLive(_10); // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49
- _10 = _1; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49
-- switchInt(move _10) -> [0: bb10, otherwise: bb9]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49
-+ switchInt(move _10) -> [0: bb7, otherwise: bb6]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49
- }
-
-- bb9: {
-+ bb6: {
- _0 = const 3_i32; // scope 0 at $DIR/match_arm_scopes.rs:+2:59: +2:60
- StorageDead(_10); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
- StorageDead(_9); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
-- goto -> bb23; // scope 0 at no-location
-+ goto -> bb20; // scope 0 at no-location
- }
-
-- bb10: {
-+ bb7: {
- _9 = (*_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:70: +2:71
-- switchInt(move _9) -> [0: bb12, otherwise: bb11]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73
-+ switchInt(move _9) -> [0: bb9, otherwise: bb8]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73
- }
-
-- bb11: {
-+ bb8: {
- StorageDead(_10); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
- StorageDead(_9); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
-- FakeRead(ForMatchGuard, _3); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
-- FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
-- FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
-- FakeRead(ForGuardBinding, _8); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
- StorageLive(_5); // scope 0 at $DIR/match_arm_scopes.rs:+2:17: +2:18
- _5 = (_2.1: bool); // scope 0 at $DIR/match_arm_scopes.rs:+2:17: +2:18
- StorageLive(_7); // scope 0 at $DIR/match_arm_scopes.rs:+2:20: +2:21
- _7 = move (_2.2: std::string::String); // scope 0 at $DIR/match_arm_scopes.rs:+2:20: +2:21
-- goto -> bb7; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6
-+ goto -> bb4; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6
- }
-
-- bb12: {
-+ bb9: {
- StorageDead(_10); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
- StorageDead(_9); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
- StorageDead(_8); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78
- StorageDead(_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78
-- falseEdge -> [real: bb2, imaginary: bb3]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73
-+ goto -> bb1; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73
- }
-
-- bb13: {
-+ bb10: {
- StorageLive(_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:26: +2:27
- _6 = &(_2.0: bool); // scope 0 at $DIR/match_arm_scopes.rs:+2:26: +2:27
- StorageLive(_8); // scope 0 at $DIR/match_arm_scopes.rs:+2:36: +2:37
- _8 = &(_2.2: std::string::String); // scope 0 at $DIR/match_arm_scopes.rs:+2:36: +2:37
-- _3 = &shallow (_2.0: bool); // scope 0 at $DIR/match_arm_scopes.rs:+1:11: +1:16
-- _4 = &shallow (_2.1: bool); // scope 0 at $DIR/match_arm_scopes.rs:+1:11: +1:16
- StorageLive(_12); // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73
- StorageLive(_13); // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49
- _13 = _1; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49
-- switchInt(move _13) -> [0: bb15, otherwise: bb14]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49
-+ switchInt(move _13) -> [0: bb12, otherwise: bb11]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49
- }
-
-- bb14: {
-+ bb11: {
- _0 = const 3_i32; // scope 0 at $DIR/match_arm_scopes.rs:+2:59: +2:60
- StorageDead(_13); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
- StorageDead(_12); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
-- goto -> bb23; // scope 0 at no-location
-+ goto -> bb20; // scope 0 at no-location
- }
-
-- bb15: {
-+ bb12: {
- _12 = (*_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:70: +2:71
-- switchInt(move _12) -> [0: bb17, otherwise: bb16]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73
-+ switchInt(move _12) -> [0: bb14, otherwise: bb13]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73
- }
-
-- bb16: {
-+ bb13: {
- StorageDead(_13); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
- StorageDead(_12); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
-- FakeRead(ForMatchGuard, _3); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
-- FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
-- FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
-- FakeRead(ForGuardBinding, _8); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
- StorageLive(_5); // scope 0 at $DIR/match_arm_scopes.rs:+2:26: +2:27
- _5 = (_2.0: bool); // scope 0 at $DIR/match_arm_scopes.rs:+2:26: +2:27
- StorageLive(_7); // scope 0 at $DIR/match_arm_scopes.rs:+2:36: +2:37
- _7 = move (_2.2: std::string::String); // scope 0 at $DIR/match_arm_scopes.rs:+2:36: +2:37
-- goto -> bb7; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6
-+ goto -> bb4; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6
- }
-
-- bb17: {
-+ bb14: {
- StorageDead(_13); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
- StorageDead(_12); // scope 0 at $DIR/match_arm_scopes.rs:+2:72: +2:73
- StorageDead(_8); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78
- StorageDead(_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78
-- falseEdge -> [real: bb4, imaginary: bb5]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73
-+ goto -> bb2; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73
- }
-
-- bb18: {
-+ bb15: {
- StorageDead(_7); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78
- StorageDead(_5); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78
- StorageDead(_8); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78
- StorageDead(_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78
-- goto -> bb22; // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78
-+ goto -> bb19; // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78
- }
-
-- bb19: {
-+ bb16: {
- _0 = const 2_i32; // scope 2 at $DIR/match_arm_scopes.rs:+3:41: +3:42
-- drop(_16) -> [return: bb21, unwind: bb25]; // scope 0 at $DIR/match_arm_scopes.rs:+3:41: +3:42
-+ drop(_16) -> [return: bb18, unwind: bb22]; // scope 0 at $DIR/match_arm_scopes.rs:+3:41: +3:42
- }
-
-- bb20: {
-+ bb17: {
- StorageLive(_15); // scope 0 at $DIR/match_arm_scopes.rs:+3:16: +3:17
- _15 = (_2.1: bool); // scope 0 at $DIR/match_arm_scopes.rs:+3:16: +3:17
- StorageLive(_16); // scope 0 at $DIR/match_arm_scopes.rs:+3:19: +3:20
- _16 = move (_2.2: std::string::String); // scope 0 at $DIR/match_arm_scopes.rs:+3:19: +3:20
-- goto -> bb19; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6
-+ goto -> bb16; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +4:6
- }
-
-- bb21: {
-+ bb18: {
- StorageDead(_16); // scope 0 at $DIR/match_arm_scopes.rs:+3:41: +3:42
- StorageDead(_15); // scope 0 at $DIR/match_arm_scopes.rs:+3:41: +3:42
-- goto -> bb22; // scope 0 at $DIR/match_arm_scopes.rs:+3:41: +3:42
-+ goto -> bb19; // scope 0 at $DIR/match_arm_scopes.rs:+3:41: +3:42
- }
-
-- bb22: {
-- drop(_2) -> [return: bb24, unwind: bb26]; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2
-+ bb19: {
-+ goto -> bb26; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2
- }
-
-- bb23: {
-+ bb20: {
- StorageDead(_8); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78
- StorageDead(_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:77: +2:78
-- drop(_2) -> [return: bb24, unwind: bb26]; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2
-+ drop(_2) -> [return: bb21, unwind: bb23]; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2
- }
-
-- bb24: {
-+ bb21: {
- return; // scope 0 at $DIR/match_arm_scopes.rs:+5:2: +5:2
- }
-
-- bb25 (cleanup): {
-- drop(_2) -> [return: bb26, unwind terminate]; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2
-+ bb22 (cleanup): {
-+ goto -> bb27; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2
- }
-
-- bb26 (cleanup): {
-+ bb23 (cleanup): {
- resume; // scope 0 at $DIR/match_arm_scopes.rs:+0:1: +5:2
-+ }
-+
-+ bb24: {
-+ goto -> bb21; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2
-+ }
-+
-+ bb25 (cleanup): {
-+ goto -> bb23; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2
-+ }
-+
-+ bb26: {
-+ goto -> bb24; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2
-+ }
-+
-+ bb27 (cleanup): {
-+ goto -> bb23; // scope 0 at $DIR/match_arm_scopes.rs:+5:1: +5:2
- }
- }
-
diff --git a/tests/mir-opt/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
new file mode 100644
index 000000000..b4bd45ba5
--- /dev/null
+++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff
@@ -0,0 +1,272 @@
+- // MIR for `complicated_match` after SimplifyCfg-initial
++ // MIR for `complicated_match` after ElaborateDrops
+
+ fn complicated_match(_1: bool, _2: (bool, bool, String)) -> i32 {
+ debug cond => _1;
+ debug items => _2;
+ let mut _0: i32;
+ let mut _3: &bool;
+ let mut _4: &bool;
+ let _5: bool;
+ let _6: &bool;
+ let _7: std::string::String;
+ let _8: &std::string::String;
+ let mut _9: bool;
+ let mut _10: bool;
+ let mut _11: !;
+ let mut _12: bool;
+ let mut _13: bool;
+ let mut _14: !;
+ let _15: bool;
+ let _16: std::string::String;
+ scope 1 {
+ debug a => _5;
+ debug a => _6;
+ debug s => _7;
+ debug s => _8;
+ }
+ scope 2 {
+ debug b => _15;
+ debug t => _16;
+ }
+
+ bb0: {
+ PlaceMention(_2);
+- switchInt((_2.0: bool)) -> [0: bb1, otherwise: bb2];
++ switchInt((_2.0: bool)) -> [0: bb5, otherwise: bb1];
+ }
+
+ bb1: {
+- falseEdge -> [real: bb8, imaginary: bb3];
++ switchInt((_2.1: bool)) -> [0: bb10, otherwise: bb2];
+ }
+
+ bb2: {
+- switchInt((_2.1: bool)) -> [0: bb3, otherwise: bb4];
++ switchInt((_2.0: bool)) -> [0: bb3, otherwise: bb17];
+ }
+
+ bb3: {
+- falseEdge -> [real: bb13, imaginary: bb5];
+- }
+-
+- bb4: {
+- switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb5];
+- }
+-
+- bb5: {
+- falseEdge -> [real: bb20, imaginary: bb6];
+- }
+-
+- bb6: {
+ StorageLive(_15);
+ _15 = (_2.1: bool);
+ StorageLive(_16);
+ _16 = move (_2.2: std::string::String);
+- goto -> bb19;
++ goto -> bb16;
+ }
+
+- bb7: {
++ bb4: {
+ _0 = const 1_i32;
+- drop(_7) -> [return: bb18, unwind: bb25];
++ drop(_7) -> [return: bb15, unwind: bb22];
+ }
+
+- bb8: {
++ bb5: {
+ StorageLive(_6);
+ _6 = &(_2.1: bool);
+ StorageLive(_8);
+ _8 = &(_2.2: std::string::String);
+- _3 = &fake (_2.0: bool);
+- _4 = &fake (_2.1: bool);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = _1;
+- switchInt(move _10) -> [0: bb10, otherwise: bb9];
++ switchInt(move _10) -> [0: bb7, otherwise: bb6];
+ }
+
+- bb9: {
++ bb6: {
+ _0 = const 3_i32;
+ StorageDead(_10);
+ StorageDead(_9);
+- goto -> bb23;
++ goto -> bb20;
+ }
+
+- bb10: {
++ bb7: {
+ _9 = (*_6);
+- switchInt(move _9) -> [0: bb12, otherwise: bb11];
++ switchInt(move _9) -> [0: bb9, otherwise: bb8];
+ }
+
+- bb11: {
++ bb8: {
+ StorageDead(_10);
+ StorageDead(_9);
+- FakeRead(ForMatchGuard, _3);
+- FakeRead(ForMatchGuard, _4);
+- FakeRead(ForGuardBinding, _6);
+- FakeRead(ForGuardBinding, _8);
+ StorageLive(_5);
+ _5 = (_2.1: bool);
+ StorageLive(_7);
+ _7 = move (_2.2: std::string::String);
+- goto -> bb7;
++ goto -> bb4;
+ }
+
+- bb12: {
++ bb9: {
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+- falseEdge -> [real: bb2, imaginary: bb3];
++ goto -> bb1;
+ }
+
+- bb13: {
++ bb10: {
+ StorageLive(_6);
+ _6 = &(_2.0: bool);
+ StorageLive(_8);
+ _8 = &(_2.2: std::string::String);
+- _3 = &fake (_2.0: bool);
+- _4 = &fake (_2.1: bool);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = _1;
+- switchInt(move _13) -> [0: bb15, otherwise: bb14];
++ switchInt(move _13) -> [0: bb12, otherwise: bb11];
+ }
+
+- bb14: {
++ bb11: {
+ _0 = const 3_i32;
+ StorageDead(_13);
+ StorageDead(_12);
+- goto -> bb23;
++ goto -> bb20;
+ }
+
+- bb15: {
++ bb12: {
+ _12 = (*_6);
+- switchInt(move _12) -> [0: bb17, otherwise: bb16];
++ switchInt(move _12) -> [0: bb14, otherwise: bb13];
+ }
+
+- bb16: {
++ bb13: {
+ StorageDead(_13);
+ StorageDead(_12);
+- FakeRead(ForMatchGuard, _3);
+- FakeRead(ForMatchGuard, _4);
+- FakeRead(ForGuardBinding, _6);
+- FakeRead(ForGuardBinding, _8);
+ StorageLive(_5);
+ _5 = (_2.0: bool);
+ StorageLive(_7);
+ _7 = move (_2.2: std::string::String);
+- goto -> bb7;
++ goto -> bb4;
+ }
+
+- bb17: {
++ bb14: {
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_8);
+ StorageDead(_6);
+- falseEdge -> [real: bb4, imaginary: bb5];
++ goto -> bb2;
+ }
+
+- bb18: {
++ bb15: {
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_8);
+ StorageDead(_6);
+- goto -> bb22;
++ goto -> bb19;
+ }
+
+- bb19: {
++ bb16: {
+ _0 = const 2_i32;
+- drop(_16) -> [return: bb21, unwind: bb25];
++ drop(_16) -> [return: bb18, unwind: bb22];
+ }
+
+- bb20: {
++ bb17: {
+ StorageLive(_15);
+ _15 = (_2.1: bool);
+ StorageLive(_16);
+ _16 = move (_2.2: std::string::String);
+- goto -> bb19;
++ goto -> bb16;
+ }
+
+- bb21: {
++ bb18: {
+ StorageDead(_16);
+ StorageDead(_15);
+- goto -> bb22;
++ goto -> bb19;
+ }
+
+- bb22: {
+- drop(_2) -> [return: bb24, unwind: bb26];
++ bb19: {
++ goto -> bb26;
+ }
+
+- bb23: {
++ bb20: {
+ StorageDead(_8);
+ StorageDead(_6);
+- drop(_2) -> [return: bb24, unwind: bb26];
++ drop(_2) -> [return: bb21, unwind: bb23];
+ }
+
+- bb24: {
++ bb21: {
+ return;
+ }
+
+- bb25 (cleanup): {
+- drop(_2) -> [return: bb26, unwind terminate(cleanup)];
++ bb22 (cleanup): {
++ goto -> bb27;
+ }
+
+- bb26 (cleanup): {
++ bb23 (cleanup): {
+ resume;
++ }
++
++ bb24: {
++ goto -> bb21;
++ }
++
++ bb25 (cleanup): {
++ goto -> bb23;
++ }
++
++ bb26: {
++ goto -> bb24;
++ }
++
++ bb27 (cleanup): {
++ goto -> bb23;
+ }
+ }
+
diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff
new file mode 100644
index 000000000..b4bd45ba5
--- /dev/null
+++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff
@@ -0,0 +1,272 @@
+- // MIR for `complicated_match` after SimplifyCfg-initial
++ // MIR for `complicated_match` after ElaborateDrops
+
+ fn complicated_match(_1: bool, _2: (bool, bool, String)) -> i32 {
+ debug cond => _1;
+ debug items => _2;
+ let mut _0: i32;
+ let mut _3: &bool;
+ let mut _4: &bool;
+ let _5: bool;
+ let _6: &bool;
+ let _7: std::string::String;
+ let _8: &std::string::String;
+ let mut _9: bool;
+ let mut _10: bool;
+ let mut _11: !;
+ let mut _12: bool;
+ let mut _13: bool;
+ let mut _14: !;
+ let _15: bool;
+ let _16: std::string::String;
+ scope 1 {
+ debug a => _5;
+ debug a => _6;
+ debug s => _7;
+ debug s => _8;
+ }
+ scope 2 {
+ debug b => _15;
+ debug t => _16;
+ }
+
+ bb0: {
+ PlaceMention(_2);
+- switchInt((_2.0: bool)) -> [0: bb1, otherwise: bb2];
++ switchInt((_2.0: bool)) -> [0: bb5, otherwise: bb1];
+ }
+
+ bb1: {
+- falseEdge -> [real: bb8, imaginary: bb3];
++ switchInt((_2.1: bool)) -> [0: bb10, otherwise: bb2];
+ }
+
+ bb2: {
+- switchInt((_2.1: bool)) -> [0: bb3, otherwise: bb4];
++ switchInt((_2.0: bool)) -> [0: bb3, otherwise: bb17];
+ }
+
+ bb3: {
+- falseEdge -> [real: bb13, imaginary: bb5];
+- }
+-
+- bb4: {
+- switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb5];
+- }
+-
+- bb5: {
+- falseEdge -> [real: bb20, imaginary: bb6];
+- }
+-
+- bb6: {
+ StorageLive(_15);
+ _15 = (_2.1: bool);
+ StorageLive(_16);
+ _16 = move (_2.2: std::string::String);
+- goto -> bb19;
++ goto -> bb16;
+ }
+
+- bb7: {
++ bb4: {
+ _0 = const 1_i32;
+- drop(_7) -> [return: bb18, unwind: bb25];
++ drop(_7) -> [return: bb15, unwind: bb22];
+ }
+
+- bb8: {
++ bb5: {
+ StorageLive(_6);
+ _6 = &(_2.1: bool);
+ StorageLive(_8);
+ _8 = &(_2.2: std::string::String);
+- _3 = &fake (_2.0: bool);
+- _4 = &fake (_2.1: bool);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = _1;
+- switchInt(move _10) -> [0: bb10, otherwise: bb9];
++ switchInt(move _10) -> [0: bb7, otherwise: bb6];
+ }
+
+- bb9: {
++ bb6: {
+ _0 = const 3_i32;
+ StorageDead(_10);
+ StorageDead(_9);
+- goto -> bb23;
++ goto -> bb20;
+ }
+
+- bb10: {
++ bb7: {
+ _9 = (*_6);
+- switchInt(move _9) -> [0: bb12, otherwise: bb11];
++ switchInt(move _9) -> [0: bb9, otherwise: bb8];
+ }
+
+- bb11: {
++ bb8: {
+ StorageDead(_10);
+ StorageDead(_9);
+- FakeRead(ForMatchGuard, _3);
+- FakeRead(ForMatchGuard, _4);
+- FakeRead(ForGuardBinding, _6);
+- FakeRead(ForGuardBinding, _8);
+ StorageLive(_5);
+ _5 = (_2.1: bool);
+ StorageLive(_7);
+ _7 = move (_2.2: std::string::String);
+- goto -> bb7;
++ goto -> bb4;
+ }
+
+- bb12: {
++ bb9: {
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_6);
+- falseEdge -> [real: bb2, imaginary: bb3];
++ goto -> bb1;
+ }
+
+- bb13: {
++ bb10: {
+ StorageLive(_6);
+ _6 = &(_2.0: bool);
+ StorageLive(_8);
+ _8 = &(_2.2: std::string::String);
+- _3 = &fake (_2.0: bool);
+- _4 = &fake (_2.1: bool);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = _1;
+- switchInt(move _13) -> [0: bb15, otherwise: bb14];
++ switchInt(move _13) -> [0: bb12, otherwise: bb11];
+ }
+
+- bb14: {
++ bb11: {
+ _0 = const 3_i32;
+ StorageDead(_13);
+ StorageDead(_12);
+- goto -> bb23;
++ goto -> bb20;
+ }
+
+- bb15: {
++ bb12: {
+ _12 = (*_6);
+- switchInt(move _12) -> [0: bb17, otherwise: bb16];
++ switchInt(move _12) -> [0: bb14, otherwise: bb13];
+ }
+
+- bb16: {
++ bb13: {
+ StorageDead(_13);
+ StorageDead(_12);
+- FakeRead(ForMatchGuard, _3);
+- FakeRead(ForMatchGuard, _4);
+- FakeRead(ForGuardBinding, _6);
+- FakeRead(ForGuardBinding, _8);
+ StorageLive(_5);
+ _5 = (_2.0: bool);
+ StorageLive(_7);
+ _7 = move (_2.2: std::string::String);
+- goto -> bb7;
++ goto -> bb4;
+ }
+
+- bb17: {
++ bb14: {
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_8);
+ StorageDead(_6);
+- falseEdge -> [real: bb4, imaginary: bb5];
++ goto -> bb2;
+ }
+
+- bb18: {
++ bb15: {
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_8);
+ StorageDead(_6);
+- goto -> bb22;
++ goto -> bb19;
+ }
+
+- bb19: {
++ bb16: {
+ _0 = const 2_i32;
+- drop(_16) -> [return: bb21, unwind: bb25];
++ drop(_16) -> [return: bb18, unwind: bb22];
+ }
+
+- bb20: {
++ bb17: {
+ StorageLive(_15);
+ _15 = (_2.1: bool);
+ StorageLive(_16);
+ _16 = move (_2.2: std::string::String);
+- goto -> bb19;
++ goto -> bb16;
+ }
+
+- bb21: {
++ bb18: {
+ StorageDead(_16);
+ StorageDead(_15);
+- goto -> bb22;
++ goto -> bb19;
+ }
+
+- bb22: {
+- drop(_2) -> [return: bb24, unwind: bb26];
++ bb19: {
++ goto -> bb26;
+ }
+
+- bb23: {
++ bb20: {
+ StorageDead(_8);
+ StorageDead(_6);
+- drop(_2) -> [return: bb24, unwind: bb26];
++ drop(_2) -> [return: bb21, unwind: bb23];
+ }
+
+- bb24: {
++ bb21: {
+ return;
+ }
+
+- bb25 (cleanup): {
+- drop(_2) -> [return: bb26, unwind terminate(cleanup)];
++ bb22 (cleanup): {
++ goto -> bb27;
+ }
+
+- bb26 (cleanup): {
++ bb23 (cleanup): {
+ resume;
++ }
++
++ bb24: {
++ goto -> bb21;
++ }
++
++ bb25 (cleanup): {
++ goto -> bb23;
++ }
++
++ bb26: {
++ goto -> bb24;
++ }
++
++ bb27 (cleanup): {
++ goto -> bb23;
+ }
+ }
+
diff --git a/tests/mir-opt/match_arm_scopes.rs b/tests/mir-opt/match_arm_scopes.rs
index 7b7de7788..43746e993 100644
--- a/tests/mir-opt/match_arm_scopes.rs
+++ b/tests/mir-opt/match_arm_scopes.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32-bare compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Test that StorageDead and Drops are generated properly for bindings in
// matches:
// * The MIR should only contain a single drop of `s` and `t`: at the end
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 d51dbf425..5bf78b615 100644
--- a/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir
@@ -1,106 +1,106 @@
// MIR for `main` after SimplifyCfg-initial
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/match_test.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/match_test.rs:+1:9: +1:10
- let _3: i32; // in scope 0 at $DIR/match_test.rs:+6:5: +11:6
- let mut _4: bool; // in scope 0 at $DIR/match_test.rs:+8:9: +8:16
- let mut _5: bool; // in scope 0 at $DIR/match_test.rs:+8:9: +8:16
- let mut _6: bool; // in scope 0 at $DIR/match_test.rs:+7:9: +7:14
- let mut _7: bool; // in scope 0 at $DIR/match_test.rs:+7:9: +7:14
- let mut _8: &i32; // in scope 0 at $DIR/match_test.rs:+6:11: +6:12
- let mut _9: bool; // in scope 0 at $DIR/match_test.rs:+7:18: +7:19
+ let mut _0: ();
+ let _1: i32;
+ let _3: i32;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: bool;
+ let mut _7: bool;
+ let mut _8: &i32;
+ let mut _9: bool;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/match_test.rs:+1:9: +1:10
- let _2: bool; // in scope 1 at $DIR/match_test.rs:+2:9: +2:10
+ debug x => _1;
+ let _2: bool;
scope 2 {
- debug b => _2; // in scope 2 at $DIR/match_test.rs:+2:9: +2:10
+ debug b => _2;
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/match_test.rs:+1:9: +1:10
- _1 = const 3_i32; // scope 0 at $DIR/match_test.rs:+1:13: +1:14
- FakeRead(ForLet(None), _1); // scope 0 at $DIR/match_test.rs:+1:9: +1:10
- StorageLive(_2); // scope 1 at $DIR/match_test.rs:+2:9: +2:10
- _2 = const true; // scope 1 at $DIR/match_test.rs:+2:13: +2:17
- FakeRead(ForLet(None), _2); // scope 1 at $DIR/match_test.rs:+2:9: +2:10
- StorageLive(_3); // scope 2 at $DIR/match_test.rs:+6:5: +11:6
- FakeRead(ForMatchedPlace(None), _1); // scope 2 at $DIR/match_test.rs:+6:11: +6:12
- _6 = Le(const 0_i32, _1); // scope 2 at $DIR/match_test.rs:+7:9: +7:14
- switchInt(move _6) -> [0: bb4, otherwise: bb1]; // scope 2 at $DIR/match_test.rs:+7:9: +7:14
+ StorageLive(_1);
+ _1 = const 3_i32;
+ FakeRead(ForLet(None), _1);
+ StorageLive(_2);
+ _2 = const true;
+ FakeRead(ForLet(None), _2);
+ StorageLive(_3);
+ PlaceMention(_1);
+ _6 = Le(const 0_i32, _1);
+ switchInt(move _6) -> [0: bb3, otherwise: bb8];
}
bb1: {
- _7 = Lt(_1, const 10_i32); // scope 2 at $DIR/match_test.rs:+7:9: +7:14
- switchInt(move _7) -> [0: bb4, otherwise: bb2]; // scope 2 at $DIR/match_test.rs:+7:9: +7:14
+ falseEdge -> [real: bb9, imaginary: bb4];
}
bb2: {
- falseEdge -> [real: bb9, imaginary: bb6]; // scope 2 at $DIR/match_test.rs:+7:9: +7:14
+ _3 = const 3_i32;
+ goto -> bb14;
}
bb3: {
- _3 = const 3_i32; // scope 2 at $DIR/match_test.rs:+10:14: +10:15
- goto -> bb14; // scope 2 at $DIR/match_test.rs:+10:14: +10:15
+ _4 = Le(const 10_i32, _1);
+ switchInt(move _4) -> [0: bb5, otherwise: bb7];
}
bb4: {
- _4 = Le(const 10_i32, _1); // scope 2 at $DIR/match_test.rs:+8:9: +8:16
- switchInt(move _4) -> [0: bb7, otherwise: bb5]; // scope 2 at $DIR/match_test.rs:+8:9: +8:16
+ falseEdge -> [real: bb12, imaginary: bb6];
}
bb5: {
- _5 = Le(_1, const 20_i32); // scope 2 at $DIR/match_test.rs:+8:9: +8:16
- switchInt(move _5) -> [0: bb7, otherwise: bb6]; // scope 2 at $DIR/match_test.rs:+8:9: +8:16
+ switchInt(_1) -> [4294967295: bb6, otherwise: bb2];
}
bb6: {
- falseEdge -> [real: bb12, imaginary: bb8]; // scope 2 at $DIR/match_test.rs:+8:9: +8:16
+ falseEdge -> [real: bb13, imaginary: bb2];
}
bb7: {
- switchInt(_1) -> [4294967295: bb8, otherwise: bb3]; // scope 2 at $DIR/match_test.rs:+6:5: +6:12
+ _5 = Le(_1, const 20_i32);
+ switchInt(move _5) -> [0: bb5, otherwise: bb4];
}
bb8: {
- falseEdge -> [real: bb13, imaginary: bb3]; // scope 2 at $DIR/match_test.rs:+9:9: +9:11
+ _7 = Lt(_1, const 10_i32);
+ switchInt(move _7) -> [0: bb3, otherwise: bb1];
}
bb9: {
- _8 = &shallow _1; // scope 2 at $DIR/match_test.rs:+6:11: +6:12
- StorageLive(_9); // scope 2 at $DIR/match_test.rs:+7:18: +7:19
- _9 = _2; // scope 2 at $DIR/match_test.rs:+7:18: +7:19
- switchInt(move _9) -> [0: bb11, otherwise: bb10]; // scope 2 at $DIR/match_test.rs:+7:18: +7:19
+ _8 = &fake _1;
+ StorageLive(_9);
+ _9 = _2;
+ switchInt(move _9) -> [0: bb11, otherwise: bb10];
}
bb10: {
- StorageDead(_9); // scope 2 at $DIR/match_test.rs:+7:18: +7:19
- FakeRead(ForMatchGuard, _8); // scope 2 at $DIR/match_test.rs:+7:18: +7:19
- _3 = const 0_i32; // scope 2 at $DIR/match_test.rs:+7:23: +7:24
- goto -> bb14; // scope 2 at $DIR/match_test.rs:+7:23: +7:24
+ StorageDead(_9);
+ FakeRead(ForMatchGuard, _8);
+ _3 = const 0_i32;
+ goto -> bb14;
}
bb11: {
- StorageDead(_9); // scope 2 at $DIR/match_test.rs:+7:18: +7:19
- falseEdge -> [real: bb3, imaginary: bb6]; // scope 2 at $DIR/match_test.rs:+7:18: +7:19
+ StorageDead(_9);
+ falseEdge -> [real: bb2, imaginary: bb4];
}
bb12: {
- _3 = const 1_i32; // scope 2 at $DIR/match_test.rs:+8:20: +8:21
- goto -> bb14; // scope 2 at $DIR/match_test.rs:+8:20: +8:21
+ _3 = const 1_i32;
+ goto -> bb14;
}
bb13: {
- _3 = const 2_i32; // scope 2 at $DIR/match_test.rs:+9:15: +9:16
- goto -> bb14; // scope 2 at $DIR/match_test.rs:+9:15: +9:16
+ _3 = const 2_i32;
+ goto -> bb14;
}
bb14: {
- StorageDead(_3); // scope 2 at $DIR/match_test.rs:+11:6: +11:7
- _0 = const (); // scope 0 at $DIR/match_test.rs:+0:11: +12:2
- StorageDead(_2); // scope 1 at $DIR/match_test.rs:+12:1: +12:2
- StorageDead(_1); // scope 0 at $DIR/match_test.rs:+12:1: +12:2
- return; // scope 0 at $DIR/match_test.rs:+12:2: +12:2
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/match_test.rs b/tests/mir-opt/match_test.rs
index 3a2107790..e465289e4 100644
--- a/tests/mir-opt/match_test.rs
+++ b/tests/mir-opt/match_test.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Make sure redundant testing paths in `match` expressions are sorted out.
#![feature(exclusive_range_pattern)]
diff --git a/tests/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.diff
index 92f8d4e14..65da13eec 100644
--- a/tests/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.diff
+++ b/tests/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.diff
@@ -2,83 +2,83 @@
+ // MIR for `bar` after MatchBranchSimplification
fn bar(_1: i32) -> (bool, bool, bool, bool) {
- debug i => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:+0:8: +0:9
- let mut _0: (bool, bool, bool, bool); // return place in scope 0 at $DIR/matches_reduce_branches.rs:+0:19: +0:43
- let _2: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+1:9: +1:10
- let _6: (); // in scope 0 at $DIR/matches_reduce_branches.rs:+6:5: +21:6
- let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+23:6: +23:7
- let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+23:9: +23:10
- let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+23:12: +23:13
- let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+23:15: +23:16
-+ let mut _11: i32; // in scope 0 at $DIR/matches_reduce_branches.rs:+6:5: +6:12
+ debug i => _1;
+ let mut _0: (bool, bool, bool, bool);
+ let _2: bool;
+ let _6: ();
+ let mut _7: bool;
+ let mut _8: bool;
+ let mut _9: bool;
+ let mut _10: bool;
++ let mut _11: i32;
scope 1 {
- debug a => _2; // in scope 1 at $DIR/matches_reduce_branches.rs:+1:9: +1:10
- let _3: bool; // in scope 1 at $DIR/matches_reduce_branches.rs:+2:9: +2:10
+ debug a => _2;
+ let _3: bool;
scope 2 {
- debug b => _3; // in scope 2 at $DIR/matches_reduce_branches.rs:+2:9: +2:10
- let _4: bool; // in scope 2 at $DIR/matches_reduce_branches.rs:+3:9: +3:10
+ debug b => _3;
+ let _4: bool;
scope 3 {
- debug c => _4; // in scope 3 at $DIR/matches_reduce_branches.rs:+3:9: +3:10
- let _5: bool; // in scope 3 at $DIR/matches_reduce_branches.rs:+4:9: +4:10
+ debug c => _4;
+ let _5: bool;
scope 4 {
- debug d => _5; // in scope 4 at $DIR/matches_reduce_branches.rs:+4:9: +4:10
+ debug d => _5;
}
}
}
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:+1:9: +1:10
- StorageLive(_3); // scope 1 at $DIR/matches_reduce_branches.rs:+2:9: +2:10
- StorageLive(_4); // scope 2 at $DIR/matches_reduce_branches.rs:+3:9: +3:10
- StorageLive(_5); // scope 3 at $DIR/matches_reduce_branches.rs:+4:9: +4:10
- StorageLive(_6); // scope 4 at $DIR/matches_reduce_branches.rs:+6:5: +21:6
-- switchInt(_1) -> [7: bb2, otherwise: bb1]; // scope 4 at $DIR/matches_reduce_branches.rs:+6:5: +6:12
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+- switchInt(_1) -> [7: bb2, otherwise: bb1];
- }
-
- bb1: {
-- _2 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:+15:13: +15:21
-- _3 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:+16:13: +16:22
-- _4 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:+17:13: +17:22
-- _5 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:+18:13: +18:21
-- _6 = (); // scope 4 at $DIR/matches_reduce_branches.rs:+19:13: +19:15
-- goto -> bb3; // scope 4 at $DIR/matches_reduce_branches.rs:+19:13: +19:15
+- _2 = const true;
+- _3 = const false;
++ StorageLive(_11);
++ _11 = _1;
++ _2 = Ne(_11, const 7_i32);
++ _3 = Eq(_11, const 7_i32);
+ _4 = const false;
+ _5 = const true;
+ _6 = ();
+- goto -> bb3;
- }
-
- bb2: {
-- _2 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:+8:13: +8:22
-- _3 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:+9:13: +9:21
-+ StorageLive(_11); // scope 4 at $DIR/matches_reduce_branches.rs:+6:5: +6:12
-+ _11 = _1; // scope 4 at $DIR/matches_reduce_branches.rs:+6:5: +6:12
-+ _2 = Ne(_11, const 7_i32); // scope 4 at $DIR/matches_reduce_branches.rs:+8:13: +8:22
-+ _3 = Eq(_11, const 7_i32); // scope 4 at $DIR/matches_reduce_branches.rs:+9:13: +9:21
- _4 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:+10:13: +10:22
- _5 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:+11:13: +11:21
- _6 = (); // scope 4 at $DIR/matches_reduce_branches.rs:+12:13: +12:15
-- goto -> bb3; // scope 4 at $DIR/matches_reduce_branches.rs:+12:13: +12:15
+- _2 = const false;
+- _3 = const true;
+- _4 = const false;
+- _5 = const true;
+- _6 = ();
+- goto -> bb3;
- }
-
- bb3: {
-+ StorageDead(_11); // scope 4 at $DIR/matches_reduce_branches.rs:+6:5: +6:12
- StorageDead(_6); // scope 4 at $DIR/matches_reduce_branches.rs:+21:6: +21:7
- StorageLive(_7); // scope 4 at $DIR/matches_reduce_branches.rs:+23:6: +23:7
- _7 = _2; // scope 4 at $DIR/matches_reduce_branches.rs:+23:6: +23:7
- StorageLive(_8); // scope 4 at $DIR/matches_reduce_branches.rs:+23:9: +23:10
- _8 = _3; // scope 4 at $DIR/matches_reduce_branches.rs:+23:9: +23:10
- StorageLive(_9); // scope 4 at $DIR/matches_reduce_branches.rs:+23:12: +23:13
- _9 = _4; // scope 4 at $DIR/matches_reduce_branches.rs:+23:12: +23:13
- StorageLive(_10); // scope 4 at $DIR/matches_reduce_branches.rs:+23:15: +23:16
- _10 = _5; // scope 4 at $DIR/matches_reduce_branches.rs:+23:15: +23:16
- _0 = (move _7, move _8, move _9, move _10); // scope 4 at $DIR/matches_reduce_branches.rs:+23:5: +23:17
- StorageDead(_10); // scope 4 at $DIR/matches_reduce_branches.rs:+23:16: +23:17
- StorageDead(_9); // scope 4 at $DIR/matches_reduce_branches.rs:+23:16: +23:17
- StorageDead(_8); // scope 4 at $DIR/matches_reduce_branches.rs:+23:16: +23:17
- StorageDead(_7); // scope 4 at $DIR/matches_reduce_branches.rs:+23:16: +23:17
- StorageDead(_5); // scope 3 at $DIR/matches_reduce_branches.rs:+24:1: +24:2
- StorageDead(_4); // scope 2 at $DIR/matches_reduce_branches.rs:+24:1: +24:2
- StorageDead(_3); // scope 1 at $DIR/matches_reduce_branches.rs:+24:1: +24:2
- StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:+24:1: +24:2
- return; // scope 0 at $DIR/matches_reduce_branches.rs:+24:2: +24:2
++ StorageDead(_11);
+ StorageDead(_6);
+ StorageLive(_7);
+ _7 = _2;
+ StorageLive(_8);
+ _8 = _3;
+ StorageLive(_9);
+ _9 = _4;
+ StorageLive(_10);
+ _10 = _5;
+ _0 = (move _7, move _8, move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff
index 0580f7334..052e2e126 100644
--- a/tests/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff
+++ b/tests/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff
@@ -2,54 +2,52 @@
+ // MIR for `foo` after MatchBranchSimplification
fn foo(_1: Option<()>) -> () {
- debug bar => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:+0:8: +0:11
- let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:+0:25: +0:25
- let mut _2: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _3: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:+1:22: +1:26
-+ let mut _4: isize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+ debug bar => _1;
+ let mut _0: ();
+ let mut _2: bool;
+ let mut _3: isize;
++ let mut _4: isize;
bb0: {
- StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _3 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:+1:17: +1:20
-- switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-+ StorageLive(_4); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-+ _4 = move _3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-+ _2 = Eq(_4, const 0_isize); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-+ StorageDead(_4); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-+ switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+ StorageLive(_2);
+ _3 = discriminant(_1);
+- switchInt(move _3) -> [0: bb2, otherwise: bb1];
++ StorageLive(_4);
++ _4 = move _3;
++ _2 = Eq(_4, const 0_isize);
++ StorageDead(_4);
++ switchInt(move _2) -> [0: bb2, otherwise: bb1];
}
bb1: {
-- _2 = const false; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+- _2 = const false;
++ _0 = ();
+ goto -> bb3;
+ }
+
+ bb2: {
+- _2 = const true;
++ _0 = const ();
+ goto -> bb3;
+ }
+
+ bb3: {
+- switchInt(move _2) -> [0: bb5, otherwise: bb4];
- }
-
-- bb2: {
-- _2 = const true; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+- bb4: {
+- _0 = ();
+- goto -> bb6;
- }
-
-- bb3: {
-- switchInt(move _2) -> [0: bb5, otherwise: bb4]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+- bb5: {
+- _0 = const ();
+- goto -> bb6;
- }
-
-- bb4: {
- _0 = (); // scope 0 at $DIR/matches_reduce_branches.rs:+2:9: +2:11
-- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:+1:5: +3:6
-+ goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:+1:5: +3:6
- }
-
-- bb5: {
-+ bb2: {
- _0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:+3:6: +3:6
-- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:+1:5: +3:6
-+ goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:+1:5: +3:6
- }
-
- bb6: {
-+ bb3: {
- StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:+3:5: +3:6
- return; // scope 0 at $DIR/matches_reduce_branches.rs:+4:2: +4:2
+ StorageDead(_2);
+ return;
}
}
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 20e8ef2f7..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
@@ -2,112 +2,114 @@
+ // MIR for `match_nested_if` after MatchBranchSimplification
fn match_nested_if() -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/matches_reduce_branches.rs:+0:25: +0:29
- let _1: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+1:9: +1:12
- let mut _2: (); // in scope 0 at $DIR/matches_reduce_branches.rs:+1:21: +1:23
- let mut _3: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10
- let mut _4: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76
- let mut _5: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52
- let mut _6: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28
-+ let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28
-+ let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52
-+ let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76
-+ let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10
+ let mut _0: bool;
+ let _1: bool;
+ let mut _2: ();
+ let mut _3: bool;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: bool;
++ let mut _7: bool;
++ let mut _8: bool;
++ let mut _9: bool;
++ let mut _10: bool;
scope 1 {
- debug val => _1; // in scope 1 at $DIR/matches_reduce_branches.rs:+1:9: +1:12
+ debug val => _1;
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/matches_reduce_branches.rs:+1:9: +1:12
- StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:+1:21: +1:23
- _2 = (); // scope 0 at $DIR/matches_reduce_branches.rs:+1:21: +1:23
- StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10
- StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76
- StorageLive(_5); // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52
- StorageLive(_6); // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28
- _6 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28
-- switchInt(move _6) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = ();
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = const true;
+- switchInt(move _6) -> [0: bb2, otherwise: bb1];
- }
-
- bb1: {
-- _5 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:+2:31: +2:35
-- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52
+- _5 = const true;
+- goto -> bb3;
- }
-
- bb2: {
-- _5 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:+2:45: +2:50
-- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52
+- _5 = const false;
+- goto -> bb3;
- }
-
- bb3: {
-+ StorageLive(_7); // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28
-+ _7 = move _6; // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28
-+ _5 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:+2:45: +2:50
-+ StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28
- StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:+2:51: +2:52
-- switchInt(move _5) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52
+- switchInt(move _5) -> [0: bb5, otherwise: bb4];
- }
-
- bb4: {
-- _4 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:+2:55: +2:59
-- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76
++ StorageLive(_7);
++ _7 = move _6;
++ _5 = Ne(_7, const false);
++ StorageDead(_7);
++ StorageLive(_8);
++ _8 = move _5;
+ StorageDead(_6);
+- _4 = const true;
+- goto -> bb6;
- }
-
- bb5: {
-- _4 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:+2:69: +2:74
-- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76
+- StorageDead(_6);
+- _4 = const false;
+- goto -> bb6;
- }
-
- bb6: {
-+ StorageLive(_8); // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52
-+ _8 = move _5; // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52
-+ _4 = Ne(_8, const false); // scope 0 at $DIR/matches_reduce_branches.rs:+2:69: +2:74
-+ StorageDead(_8); // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52
- StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:+2:75: +2:76
-- switchInt(move _4) -> [0: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76
+- switchInt(move _4) -> [0: bb8, otherwise: bb7];
- }
-
- bb7: {
-- _3 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:+3:13: +3:17
-- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10
++ _4 = Ne(_8, const false);
++ StorageDead(_8);
++ StorageLive(_9);
++ _9 = move _4;
+ StorageDead(_5);
+- _3 = const true;
+- goto -> bb9;
- }
-
- bb8: {
-- _3 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:+5:13: +5:18
-- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10
+- StorageDead(_5);
+- _3 = const false;
+- goto -> bb9;
- }
-
- bb9: {
-- switchInt(move _3) -> [0: bb11, otherwise: bb10]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10
+- switchInt(move _3) -> [0: bb11, otherwise: bb10];
- }
-
- bb10: {
-+ StorageLive(_9); // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76
-+ _9 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76
-+ _3 = Ne(_9, const false); // scope 0 at $DIR/matches_reduce_branches.rs:+5:13: +5:18
-+ StorageDead(_9); // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76
-+ StorageLive(_10); // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10
-+ _10 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10
- StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:+6:9: +6:10
- StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:+6:9: +6:10
-- _1 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:+8:13: +8:17
-- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:+8:13: +8:17
++ _3 = Ne(_9, const false);
++ StorageDead(_9);
++ StorageLive(_10);
++ _10 = move _3;
+ StorageDead(_4);
+ StorageDead(_3);
+- _1 = const true;
+- goto -> bb12;
- }
-
- bb11: {
-- StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:+6:9: +6:10
-- StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:+6:9: +6:10
-- _1 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:+10:14: +10:19
-- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:+10:14: +10:19
+- StorageDead(_4);
+- StorageDead(_3);
+- _1 = const false;
+- goto -> bb12;
- }
-
- bb12: {
-+ _1 = Ne(_10, const false); // scope 0 at $DIR/matches_reduce_branches.rs:+10:14: +10:19
-+ StorageDead(_10); // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10
- StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:+11:6: +11:7
- _0 = _1; // scope 1 at $DIR/matches_reduce_branches.rs:+12:5: +12:8
- StorageDead(_1); // scope 0 at $DIR/matches_reduce_branches.rs:+13:1: +13:2
- return; // scope 0 at $DIR/matches_reduce_branches.rs:+13:2: +13:2
++ _1 = Ne(_10, const false);
++ StorageDead(_10);
+ StorageDead(_2);
+ _0 = _1;
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/matches_reduce_branches.rs b/tests/mir-opt/matches_reduce_branches.rs
index a81d5f7b4..13db79734 100644
--- a/tests/mir-opt/matches_reduce_branches.rs
+++ b/tests/mir-opt/matches_reduce_branches.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: MatchBranchSimplification
diff --git a/tests/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff b/tests/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff
index 3766d99a4..fec585563 100644
--- a/tests/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff
+++ b/tests/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff
@@ -2,31 +2,31 @@
+ // MIR for `exhaustive_match` after MatchBranchSimplification
fn exhaustive_match(_1: E) -> u8 {
- debug e => _1; // in scope 0 at $DIR/matches_u8.rs:+0:25: +0:26
- let mut _0: u8; // return place in scope 0 at $DIR/matches_u8.rs:+0:34: +0:36
- let mut _2: isize; // in scope 0 at $DIR/matches_u8.rs:+2:9: +2:13
+ debug e => _1;
+ let mut _0: u8;
+ let mut _2: isize;
bb0: {
- _2 = discriminant(_1); // scope 0 at $DIR/matches_u8.rs:+1:11: +1:12
- switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/matches_u8.rs:+1:5: +1:12
+ _2 = discriminant(_1);
+ switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2];
}
bb1: {
- _0 = const 1_u8; // scope 0 at $DIR/matches_u8.rs:+3:17: +3:18
- goto -> bb4; // scope 0 at $DIR/matches_u8.rs:+3:17: +3:18
+ _0 = const 1_u8;
+ goto -> bb4;
}
bb2: {
- unreachable; // scope 0 at $DIR/matches_u8.rs:+1:11: +1:12
+ unreachable;
}
bb3: {
- _0 = const 0_u8; // scope 0 at $DIR/matches_u8.rs:+2:17: +2:18
- goto -> bb4; // scope 0 at $DIR/matches_u8.rs:+2:17: +2:18
+ _0 = const 0_u8;
+ goto -> bb4;
}
bb4: {
- return; // scope 0 at $DIR/matches_u8.rs:+5:2: +5:2
+ return;
}
}
diff --git a/tests/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff b/tests/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff
index b5146cd53..94d3ce6c9 100644
--- a/tests/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff
+++ b/tests/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff
@@ -2,31 +2,31 @@
+ // MIR for `exhaustive_match_i8` after MatchBranchSimplification
fn exhaustive_match_i8(_1: E) -> i8 {
- debug e => _1; // in scope 0 at $DIR/matches_u8.rs:+0:28: +0:29
- let mut _0: i8; // return place in scope 0 at $DIR/matches_u8.rs:+0:37: +0:39
- let mut _2: isize; // in scope 0 at $DIR/matches_u8.rs:+2:9: +2:13
+ debug e => _1;
+ let mut _0: i8;
+ let mut _2: isize;
bb0: {
- _2 = discriminant(_1); // scope 0 at $DIR/matches_u8.rs:+1:11: +1:12
- switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/matches_u8.rs:+1:5: +1:12
+ _2 = discriminant(_1);
+ switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2];
}
bb1: {
- _0 = const 1_i8; // scope 0 at $DIR/matches_u8.rs:+3:17: +3:18
- goto -> bb4; // scope 0 at $DIR/matches_u8.rs:+3:17: +3:18
+ _0 = const 1_i8;
+ goto -> bb4;
}
bb2: {
- unreachable; // scope 0 at $DIR/matches_u8.rs:+1:11: +1:12
+ unreachable;
}
bb3: {
- _0 = const 0_i8; // scope 0 at $DIR/matches_u8.rs:+2:17: +2:18
- goto -> bb4; // scope 0 at $DIR/matches_u8.rs:+2:17: +2:18
+ _0 = const 0_i8;
+ goto -> bb4;
}
bb4: {
- return; // scope 0 at $DIR/matches_u8.rs:+5:2: +5:2
+ return;
}
}
diff --git a/tests/mir-opt/matches_u8.rs b/tests/mir-opt/matches_u8.rs
index 422c3a95e..47c4ffee0 100644
--- a/tests/mir-opt/matches_u8.rs
+++ b/tests/mir-opt/matches_u8.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: MatchBranchSimplification
diff --git a/tests/mir-opt/multiple_return_terminators.rs b/tests/mir-opt/multiple_return_terminators.rs
index a2b902d14..f33243ecf 100644
--- a/tests/mir-opt/multiple_return_terminators.rs
+++ b/tests/mir-opt/multiple_return_terminators.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z mir-opt-level=4
// EMIT_MIR multiple_return_terminators.test.MultipleReturnTerminators.diff
diff --git a/tests/mir-opt/multiple_return_terminators.test.MultipleReturnTerminators.diff b/tests/mir-opt/multiple_return_terminators.test.MultipleReturnTerminators.diff
index 48a11c950..e28809f38 100644
--- a/tests/mir-opt/multiple_return_terminators.test.MultipleReturnTerminators.diff
+++ b/tests/mir-opt/multiple_return_terminators.test.MultipleReturnTerminators.diff
@@ -2,11 +2,11 @@
+ // MIR for `test` after MultipleReturnTerminators
fn test(_1: bool) -> () {
- debug x => _1; // in scope 0 at $DIR/multiple_return_terminators.rs:+0:9: +0:10
- let mut _0: (); // return place in scope 0 at $DIR/multiple_return_terminators.rs:+0:18: +0:18
+ debug x => _1;
+ let mut _0: ();
bb0: {
- return; // scope 0 at $DIR/multiple_return_terminators.rs:+6:2: +6:2
+ return;
}
}
diff --git a/tests/mir-opt/nll/named_lifetimes_basic.rs b/tests/mir-opt/nll/named_lifetimes_basic.rs
index 843716033..5a9312de2 100644
--- a/tests/mir-opt/nll/named_lifetimes_basic.rs
+++ b/tests/mir-opt/nll/named_lifetimes_basic.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Basic test for named lifetime translation. Check that we
// instantiate the types that appear in function arguments with
// suitable variables and that we setup the outlives relationship
diff --git a/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir b/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir
index be5baf6ee..49f0a4329 100644
--- a/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir
+++ b/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir
@@ -24,24 +24,24 @@
| '?2 live at {bb0[0..=1]}
| '?3 live at {bb0[0..=1]}
| '?4 live at {bb0[0..=1]}
-| '?1: '?5 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:26: 12:27) ($DIR/named_lifetimes_basic.rs:12:26: 12:27 (#0)
-| '?1: '?7 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:54: 12:55) ($DIR/named_lifetimes_basic.rs:12:54: 12:55 (#0)
-| '?2: '?6 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:42: 12:43) ($DIR/named_lifetimes_basic.rs:12:42: 12:43 (#0)
-| '?3: '?8 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:66: 12:67) ($DIR/named_lifetimes_basic.rs:12:66: 12:67 (#0)
-| '?5: '?1 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:26: 12:27) ($DIR/named_lifetimes_basic.rs:12:26: 12:27 (#0)
-| '?6: '?2 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:42: 12:43) ($DIR/named_lifetimes_basic.rs:12:42: 12:43 (#0)
-| '?7: '?1 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:54: 12:55) ($DIR/named_lifetimes_basic.rs:12:54: 12:55 (#0)
-| '?8: '?3 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:66: 12:67) ($DIR/named_lifetimes_basic.rs:12:66: 12:67 (#0)
+| '?1: '?5 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:26: 13:27) ($DIR/named_lifetimes_basic.rs:13:26: 13:27 (#0)
+| '?1: '?7 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:54: 13:55) ($DIR/named_lifetimes_basic.rs:13:54: 13:55 (#0)
+| '?2: '?6 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:42: 13:43) ($DIR/named_lifetimes_basic.rs:13:42: 13:43 (#0)
+| '?3: '?8 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:66: 13:67) ($DIR/named_lifetimes_basic.rs:13:66: 13:67 (#0)
+| '?5: '?1 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:26: 13:27) ($DIR/named_lifetimes_basic.rs:13:26: 13:27 (#0)
+| '?6: '?2 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:42: 13:43) ($DIR/named_lifetimes_basic.rs:13:42: 13:43 (#0)
+| '?7: '?1 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:54: 13:55) ($DIR/named_lifetimes_basic.rs:13:54: 13:55 (#0)
+| '?8: '?3 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:66: 13:67) ($DIR/named_lifetimes_basic.rs:13:66: 13:67 (#0)
|
fn use_x(_1: &'?5 mut i32, _2: &'?6 u32, _3: &'?7 u32, _4: &'?8 u32) -> bool {
- debug w => _1; // in scope 0 at $DIR/named_lifetimes_basic.rs:+0:26: +0:27
- debug x => _2; // in scope 0 at $DIR/named_lifetimes_basic.rs:+0:42: +0:43
- debug y => _3; // in scope 0 at $DIR/named_lifetimes_basic.rs:+0:54: +0:55
- debug z => _4; // in scope 0 at $DIR/named_lifetimes_basic.rs:+0:66: +0:67
- let mut _0: bool; // return place in scope 0 at $DIR/named_lifetimes_basic.rs:+0:81: +0:85
+ debug w => _1;
+ debug x => _2;
+ debug y => _3;
+ debug z => _4;
+ let mut _0: bool;
bb0: {
- _0 = const ConstValue(Scalar(0x01): bool); // bb0[0]: scope 0 at $DIR/named_lifetimes_basic.rs:+0:88: +0:92
- return; // bb0[1]: scope 0 at $DIR/named_lifetimes_basic.rs:+0:94: +0:94
+ _0 = const ConstValue(Scalar(0x01): bool);
+ return;
}
}
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 c425f3cd5..ad456600b 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
@@ -17,95 +17,89 @@
| '?2 live at {bb1[0]}
| '?3 live at {bb1[1..=3]}
| '?4 live at {bb1[4..=7], bb2[0..=2]}
-| '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:18:13: 18:18 (#0)
-| '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:19:13: 19:14 (#0)
+| '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:19:13: 19:18 (#0)
+| '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:20:13: 20:14 (#0)
|
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/region_subtyping_basic.rs:+0:11: +0:11
- let mut _1: [usize; Const { ty: usize, kind: Leaf(0x00000003) }]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
- let _3: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:16: +2:17
- let mut _4: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
- let mut _5: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
- let mut _7: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+4:8: +4:12
- let _8: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+5:9: +5:18
- let mut _9: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+5:15: +5:17
- let _10: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+7:9: +7:18
+ let mut _0: ();
+ let mut _1: [usize; ValTree(Leaf(0x00000003): usize)];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ let mut _7: bool;
+ let _8: bool;
+ let mut _9: usize;
+ let _10: bool;
scope 1 {
- debug v => _1; // in scope 1 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
- let _2: &'?3 usize; // in scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
+ debug v => _1;
+ let _2: &'?3 usize;
scope 2 {
- debug p => _2; // in scope 2 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
- let _6: &'?4 usize; // in scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
+ debug p => _2;
+ let _6: &'?4 usize;
scope 3 {
- debug q => _6; // in scope 3 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
+ debug q => _6;
}
}
}
bb0: {
- StorageLive(_1); // bb0[0]: scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
- _1 = [const ConstValue(Scalar(0x00000001): usize), const ConstValue(Scalar(0x00000002): usize), const ConstValue(Scalar(0x00000003): usize)]; // bb0[1]: scope 0 at $DIR/region_subtyping_basic.rs:+1:17: +1:26
- FakeRead(ForLet(None), _1); // bb0[2]: scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
- StorageLive(_2); // bb0[3]: scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
- StorageLive(_3); // bb0[4]: scope 1 at $DIR/region_subtyping_basic.rs:+2:16: +2:17
- _3 = const ConstValue(Scalar(0x00000000): usize); // bb0[5]: scope 1 at $DIR/region_subtyping_basic.rs:+2:16: +2:17
- _4 = Len(_1); // bb0[6]: scope 1 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
- _5 = Lt(_3, _4); // bb0[7]: scope 1 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind: bb7]; // bb0[8]: scope 1 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
+ StorageLive(_1);
+ _1 = [const ConstValue(Scalar(0x00000001): usize), const ConstValue(Scalar(0x00000002): usize), const ConstValue(Scalar(0x00000003): usize)];
+ FakeRead(ForLet(None), _1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = const ConstValue(Scalar(0x00000000): usize);
+ _4 = Len(_1);
+ _5 = Lt(_3, _4);
+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind: bb7];
}
bb1: {
- _2 = &'?2 _1[_3]; // bb1[0]: scope 1 at $DIR/region_subtyping_basic.rs:+2:13: +2:18
- FakeRead(ForLet(None), _2); // bb1[1]: scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
- StorageLive(_6); // bb1[2]: scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
- _6 = _2; // bb1[3]: scope 2 at $DIR/region_subtyping_basic.rs:+3:13: +3:14
- FakeRead(ForLet(None), _6); // bb1[4]: scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
- StorageLive(_7); // bb1[5]: scope 3 at $DIR/region_subtyping_basic.rs:+4:8: +4:12
- _7 = const ConstValue(Scalar(0x01): bool); // bb1[6]: scope 3 at $DIR/region_subtyping_basic.rs:+4:8: +4:12
- switchInt(move _7) -> [0: bb4, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region_subtyping_basic.rs:+4:8: +4:12
+ _2 = &'?2 _1[_3];
+ FakeRead(ForLet(None), _2);
+ StorageLive(_6);
+ _6 = _2;
+ FakeRead(ForLet(None), _6);
+ StorageLive(_7);
+ _7 = const ConstValue(Scalar(0x01): bool);
+ switchInt(move _7) -> [0: bb4, otherwise: bb2];
}
bb2: {
- StorageLive(_8); // bb2[0]: scope 3 at $DIR/region_subtyping_basic.rs:+5:9: +5:18
- StorageLive(_9); // bb2[1]: scope 3 at $DIR/region_subtyping_basic.rs:+5:15: +5:17
- _9 = (*_6); // bb2[2]: scope 3 at $DIR/region_subtyping_basic.rs:+5:15: +5:17
- _8 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(move _9) -> [return: bb3, unwind: bb7]; // bb2[3]: scope 3 at $DIR/region_subtyping_basic.rs:+5:9: +5:18
- // mir::Constant
- // + span: $DIR/region_subtyping_basic.rs:21:9: 21:14
- // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(<ZST>) }
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = (*_6);
+ _8 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(move _9) -> [return: bb3, unwind: bb7];
}
bb3: {
- StorageDead(_9); // bb3[0]: scope 3 at $DIR/region_subtyping_basic.rs:+5:17: +5:18
- StorageDead(_8); // bb3[1]: scope 3 at $DIR/region_subtyping_basic.rs:+5:18: +5:19
- _0 = const ConstValue(ZeroSized: ()); // bb3[2]: scope 3 at $DIR/region_subtyping_basic.rs:+4:13: +6:6
- goto -> bb6; // bb3[3]: scope 3 at $DIR/region_subtyping_basic.rs:+4:5: +8:6
+ StorageDead(_9);
+ StorageDead(_8);
+ _0 = const ConstValue(ZeroSized: ());
+ goto -> bb6;
}
bb4: {
- StorageLive(_10); // bb4[0]: scope 3 at $DIR/region_subtyping_basic.rs:+7:9: +7:18
- _10 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(const ConstValue(Scalar(0x00000016): usize)) -> [return: bb5, unwind: bb7]; // bb4[1]: scope 3 at $DIR/region_subtyping_basic.rs:+7:9: +7:18
- // mir::Constant
- // + span: $DIR/region_subtyping_basic.rs:23:9: 23:14
- // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(<ZST>) }
+ StorageLive(_10);
+ _10 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(const ConstValue(Scalar(0x00000016): usize)) -> [return: bb5, unwind: bb7];
}
bb5: {
- StorageDead(_10); // bb5[0]: scope 3 at $DIR/region_subtyping_basic.rs:+7:18: +7:19
- _0 = const ConstValue(ZeroSized: ()); // bb5[1]: scope 3 at $DIR/region_subtyping_basic.rs:+6:12: +8:6
- goto -> bb6; // bb5[2]: scope 3 at $DIR/region_subtyping_basic.rs:+4:5: +8:6
+ StorageDead(_10);
+ _0 = const ConstValue(ZeroSized: ());
+ goto -> bb6;
}
bb6: {
- StorageDead(_7); // bb6[0]: scope 3 at $DIR/region_subtyping_basic.rs:+8:5: +8:6
- StorageDead(_6); // bb6[1]: scope 2 at $DIR/region_subtyping_basic.rs:+9:1: +9:2
- StorageDead(_3); // bb6[2]: scope 1 at $DIR/region_subtyping_basic.rs:+9:1: +9:2
- StorageDead(_2); // bb6[3]: scope 1 at $DIR/region_subtyping_basic.rs:+9:1: +9:2
- StorageDead(_1); // bb6[4]: scope 0 at $DIR/region_subtyping_basic.rs:+9:1: +9:2
- return; // bb6[5]: scope 0 at $DIR/region_subtyping_basic.rs:+9:2: +9:2
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
bb7 (cleanup): {
- resume; // bb7[0]: scope 0 at $DIR/region_subtyping_basic.rs:+0:1: +9:2
+ resume;
}
}
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 22ad24f8d..a15d47cd6 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
@@ -17,95 +17,89 @@
| '?2 live at {bb1[0]}
| '?3 live at {bb1[1..=3]}
| '?4 live at {bb1[4..=7], bb2[0..=2]}
-| '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:18:13: 18:18 (#0)
-| '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:19:13: 19:14 (#0)
+| '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:19:13: 19:18 (#0)
+| '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:20:13: 20:14 (#0)
|
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/region_subtyping_basic.rs:+0:11: +0:11
- let mut _1: [usize; Const { ty: usize, kind: Leaf(0x0000000000000003) }]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
- let _3: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:16: +2:17
- let mut _4: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
- let mut _5: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
- let mut _7: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+4:8: +4:12
- let _8: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+5:9: +5:18
- let mut _9: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+5:15: +5:17
- let _10: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+7:9: +7:18
+ let mut _0: ();
+ let mut _1: [usize; ValTree(Leaf(0x0000000000000003): usize)];
+ let _3: usize;
+ let mut _4: usize;
+ let mut _5: bool;
+ let mut _7: bool;
+ let _8: bool;
+ let mut _9: usize;
+ let _10: bool;
scope 1 {
- debug v => _1; // in scope 1 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
- let _2: &'?3 usize; // in scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
+ debug v => _1;
+ let _2: &'?3 usize;
scope 2 {
- debug p => _2; // in scope 2 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
- let _6: &'?4 usize; // in scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
+ debug p => _2;
+ let _6: &'?4 usize;
scope 3 {
- debug q => _6; // in scope 3 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
+ debug q => _6;
}
}
}
bb0: {
- StorageLive(_1); // bb0[0]: scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
- _1 = [const ConstValue(Scalar(0x0000000000000001): usize), const ConstValue(Scalar(0x0000000000000002): usize), const ConstValue(Scalar(0x0000000000000003): usize)]; // bb0[1]: scope 0 at $DIR/region_subtyping_basic.rs:+1:17: +1:26
- FakeRead(ForLet(None), _1); // bb0[2]: scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
- StorageLive(_2); // bb0[3]: scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
- StorageLive(_3); // bb0[4]: scope 1 at $DIR/region_subtyping_basic.rs:+2:16: +2:17
- _3 = const ConstValue(Scalar(0x0000000000000000): usize); // bb0[5]: scope 1 at $DIR/region_subtyping_basic.rs:+2:16: +2:17
- _4 = Len(_1); // bb0[6]: scope 1 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
- _5 = Lt(_3, _4); // bb0[7]: scope 1 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind: bb7]; // bb0[8]: scope 1 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
+ StorageLive(_1);
+ _1 = [const ConstValue(Scalar(0x0000000000000001): usize), const ConstValue(Scalar(0x0000000000000002): usize), const ConstValue(Scalar(0x0000000000000003): usize)];
+ FakeRead(ForLet(None), _1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = const ConstValue(Scalar(0x0000000000000000): usize);
+ _4 = Len(_1);
+ _5 = Lt(_3, _4);
+ assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind: bb7];
}
bb1: {
- _2 = &'?2 _1[_3]; // bb1[0]: scope 1 at $DIR/region_subtyping_basic.rs:+2:13: +2:18
- FakeRead(ForLet(None), _2); // bb1[1]: scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
- StorageLive(_6); // bb1[2]: scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
- _6 = _2; // bb1[3]: scope 2 at $DIR/region_subtyping_basic.rs:+3:13: +3:14
- FakeRead(ForLet(None), _6); // bb1[4]: scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
- StorageLive(_7); // bb1[5]: scope 3 at $DIR/region_subtyping_basic.rs:+4:8: +4:12
- _7 = const ConstValue(Scalar(0x01): bool); // bb1[6]: scope 3 at $DIR/region_subtyping_basic.rs:+4:8: +4:12
- switchInt(move _7) -> [0: bb4, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region_subtyping_basic.rs:+4:8: +4:12
+ _2 = &'?2 _1[_3];
+ FakeRead(ForLet(None), _2);
+ StorageLive(_6);
+ _6 = _2;
+ FakeRead(ForLet(None), _6);
+ StorageLive(_7);
+ _7 = const ConstValue(Scalar(0x01): bool);
+ switchInt(move _7) -> [0: bb4, otherwise: bb2];
}
bb2: {
- StorageLive(_8); // bb2[0]: scope 3 at $DIR/region_subtyping_basic.rs:+5:9: +5:18
- StorageLive(_9); // bb2[1]: scope 3 at $DIR/region_subtyping_basic.rs:+5:15: +5:17
- _9 = (*_6); // bb2[2]: scope 3 at $DIR/region_subtyping_basic.rs:+5:15: +5:17
- _8 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(move _9) -> [return: bb3, unwind: bb7]; // bb2[3]: scope 3 at $DIR/region_subtyping_basic.rs:+5:9: +5:18
- // mir::Constant
- // + span: $DIR/region_subtyping_basic.rs:21:9: 21:14
- // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(<ZST>) }
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = (*_6);
+ _8 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(move _9) -> [return: bb3, unwind: bb7];
}
bb3: {
- StorageDead(_9); // bb3[0]: scope 3 at $DIR/region_subtyping_basic.rs:+5:17: +5:18
- StorageDead(_8); // bb3[1]: scope 3 at $DIR/region_subtyping_basic.rs:+5:18: +5:19
- _0 = const ConstValue(ZeroSized: ()); // bb3[2]: scope 3 at $DIR/region_subtyping_basic.rs:+4:13: +6:6
- goto -> bb6; // bb3[3]: scope 3 at $DIR/region_subtyping_basic.rs:+4:5: +8:6
+ StorageDead(_9);
+ StorageDead(_8);
+ _0 = const ConstValue(ZeroSized: ());
+ goto -> bb6;
}
bb4: {
- StorageLive(_10); // bb4[0]: scope 3 at $DIR/region_subtyping_basic.rs:+7:9: +7:18
- _10 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(const ConstValue(Scalar(0x0000000000000016): usize)) -> [return: bb5, unwind: bb7]; // bb4[1]: scope 3 at $DIR/region_subtyping_basic.rs:+7:9: +7:18
- // mir::Constant
- // + span: $DIR/region_subtyping_basic.rs:23:9: 23:14
- // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(<ZST>) }
+ StorageLive(_10);
+ _10 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(const ConstValue(Scalar(0x0000000000000016): usize)) -> [return: bb5, unwind: bb7];
}
bb5: {
- StorageDead(_10); // bb5[0]: scope 3 at $DIR/region_subtyping_basic.rs:+7:18: +7:19
- _0 = const ConstValue(ZeroSized: ()); // bb5[1]: scope 3 at $DIR/region_subtyping_basic.rs:+6:12: +8:6
- goto -> bb6; // bb5[2]: scope 3 at $DIR/region_subtyping_basic.rs:+4:5: +8:6
+ StorageDead(_10);
+ _0 = const ConstValue(ZeroSized: ());
+ goto -> bb6;
}
bb6: {
- StorageDead(_7); // bb6[0]: scope 3 at $DIR/region_subtyping_basic.rs:+8:5: +8:6
- StorageDead(_6); // bb6[1]: scope 2 at $DIR/region_subtyping_basic.rs:+9:1: +9:2
- StorageDead(_3); // bb6[2]: scope 1 at $DIR/region_subtyping_basic.rs:+9:1: +9:2
- StorageDead(_2); // bb6[3]: scope 1 at $DIR/region_subtyping_basic.rs:+9:1: +9:2
- StorageDead(_1); // bb6[4]: scope 0 at $DIR/region_subtyping_basic.rs:+9:1: +9:2
- return; // bb6[5]: scope 0 at $DIR/region_subtyping_basic.rs:+9:2: +9:2
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
bb7 (cleanup): {
- resume; // bb7[0]: scope 0 at $DIR/region_subtyping_basic.rs:+0:1: +9:2
+ resume;
}
}
diff --git a/tests/mir-opt/nll/region_subtyping_basic.rs b/tests/mir-opt/nll/region_subtyping_basic.rs
index 64332f302..83f756acd 100644
--- a/tests/mir-opt/nll/region_subtyping_basic.rs
+++ b/tests/mir-opt/nll/region_subtyping_basic.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Basic test for liveness constraints: the region (`R1`) that appears
// in the type of `p` includes the points after `&v[0]` up to (but not
// including) the call to `use_x`. The `else` branch is not included.
diff --git a/tests/mir-opt/no_drop_for_inactive_variant.rs b/tests/mir-opt/no_drop_for_inactive_variant.rs
index 34e2b1a13..dd20e4a54 100644
--- a/tests/mir-opt/no_drop_for_inactive_variant.rs
+++ b/tests/mir-opt/no_drop_for_inactive_variant.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32-bare compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Ensure that there are no drop terminators in `unwrap<T>` (except the one along the cleanup
// path).
diff --git a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir
deleted file mode 100644
index 69327b7af..000000000
--- a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir
+++ /dev/null
@@ -1,49 +0,0 @@
-// MIR for `unwrap` after SimplifyCfg-elaborate-drops
-
-fn unwrap(_1: Option<T>) -> T {
- debug opt => _1; // in scope 0 at $DIR/no_drop_for_inactive_variant.rs:+0:14: +0:17
- let mut _0: T; // return place in scope 0 at $DIR/no_drop_for_inactive_variant.rs:+0:33: +0:34
- let mut _2: isize; // in scope 0 at $DIR/no_drop_for_inactive_variant.rs:+2:9: +2:16
- let _3: T; // in scope 0 at $DIR/no_drop_for_inactive_variant.rs:+2:14: +2:15
- let mut _4: !; // in scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL
- let mut _5: isize; // in scope 0 at $DIR/no_drop_for_inactive_variant.rs:+5:1: +5:2
- let mut _6: isize; // in scope 0 at $DIR/no_drop_for_inactive_variant.rs:+5:1: +5:2
- let mut _7: isize; // in scope 0 at $DIR/no_drop_for_inactive_variant.rs:+5:1: +5:2
- scope 1 {
- debug x => _3; // in scope 1 at $DIR/no_drop_for_inactive_variant.rs:+2:14: +2:15
- }
-
- bb0: {
- _2 = discriminant(_1); // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+1:11: +1:14
- switchInt(move _2) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+1:5: +1:14
- }
-
- bb1: {
- StorageLive(_4); // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL
- _4 = begin_panic::<&str>(const "explicit panic") -> bb4; // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/std/src/panic.rs:LL:COL
- // + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value(<ZST>) }
- // mir::Constant
- // + span: $SRC_DIR/std/src/panic.rs:LL:COL
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- }
-
- bb2: {
- unreachable; // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+1:11: +1:14
- }
-
- bb3: {
- StorageLive(_3); // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+2:14: +2:15
- _3 = move ((_1 as Some).0: T); // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+2:14: +2:15
- _0 = move _3; // scope 1 at $DIR/no_drop_for_inactive_variant.rs:+2:20: +2:21
- StorageDead(_3); // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+2:20: +2:21
- _5 = discriminant(_1); // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+5:1: +5:2
- return; // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+5:2: +5:2
- }
-
- bb4 (cleanup): {
- _7 = discriminant(_1); // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+5:1: +5:2
- resume; // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+0:1: +5:2
- }
-}
diff --git a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-abort.mir
new file mode 100644
index 000000000..086955236
--- /dev/null
+++ b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-abort.mir
@@ -0,0 +1,38 @@
+// MIR for `unwrap` after SimplifyCfg-elaborate-drops
+
+fn unwrap(_1: Option<T>) -> T {
+ debug opt => _1;
+ let mut _0: T;
+ let mut _2: isize;
+ let _3: T;
+ let mut _4: !;
+ let mut _5: isize;
+ let mut _6: isize;
+ let mut _7: isize;
+ scope 1 {
+ debug x => _3;
+ }
+
+ bb0: {
+ _2 = discriminant(_1);
+ switchInt(move _2) -> [0: bb1, 1: bb3, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_4);
+ _4 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_3);
+ _3 = move ((_1 as Some).0: T);
+ _0 = move _3;
+ StorageDead(_3);
+ _5 = discriminant(_1);
+ return;
+ }
+}
diff --git a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
new file mode 100644
index 000000000..6276d8548
--- /dev/null
+++ b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -0,0 +1,43 @@
+// MIR for `unwrap` after SimplifyCfg-elaborate-drops
+
+fn unwrap(_1: Option<T>) -> T {
+ debug opt => _1;
+ let mut _0: T;
+ let mut _2: isize;
+ let _3: T;
+ let mut _4: !;
+ let mut _5: isize;
+ let mut _6: isize;
+ let mut _7: isize;
+ scope 1 {
+ debug x => _3;
+ }
+
+ bb0: {
+ _2 = discriminant(_1);
+ switchInt(move _2) -> [0: bb1, 1: bb3, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_4);
+ _4 = begin_panic::<&str>(const "explicit panic") -> bb4;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_3);
+ _3 = move ((_1 as Some).0: T);
+ _0 = move _3;
+ StorageDead(_3);
+ _5 = discriminant(_1);
+ return;
+ }
+
+ bb4 (cleanup): {
+ _7 = discriminant(_1);
+ resume;
+ }
+}
diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.mir
deleted file mode 100644
index 950f8758e..000000000
--- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.mir
+++ /dev/null
@@ -1,49 +0,0 @@
-// MIR for `main` before ElaborateDrops
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/no_spurious_drop_after_call.rs:+0:11: +0:11
- let _1: (); // in scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:5: +1:35
- let mut _2: std::string::String; // in scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:34
- let mut _3: &str; // in scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:34
- let _4: &str; // in scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:22
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:5: +1:35
- StorageLive(_2); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:34
- StorageLive(_3); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:34
- StorageLive(_4); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:22
- _4 = const ""; // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:22
- // mir::Constant
- // + span: $DIR/no_spurious_drop_after_call.rs:9:20: 9:22
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _3 = &(*_4); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:34
- _2 = <str as ToString>::to_string(move _3) -> bb1; // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:20: +1:34
- // mir::Constant
- // + span: $DIR/no_spurious_drop_after_call.rs:9:23: 9:32
- // + literal: Const { ty: for<'a> fn(&'a str) -> String {<str as ToString>::to_string}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_3); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:33: +1:34
- _1 = std::mem::drop::<String>(move _2) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:5: +1:35
- // mir::Constant
- // + span: $DIR/no_spurious_drop_after_call.rs:9:5: 9:19
- // + literal: Const { ty: fn(String) {std::mem::drop::<String>}, val: Value(<ZST>) }
- }
-
- bb2: {
- StorageDead(_2); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:34: +1:35
- StorageDead(_4); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:35: +1:36
- StorageDead(_1); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:35: +1:36
- _0 = const (); // scope 0 at $DIR/no_spurious_drop_after_call.rs:+0:11: +2:2
- return; // scope 0 at $DIR/no_spurious_drop_after_call.rs:+2:2: +2:2
- }
-
- bb3 (cleanup): {
- drop(_2) -> [return: bb4, unwind terminate]; // scope 0 at $DIR/no_spurious_drop_after_call.rs:+1:34: +1:35
- }
-
- bb4 (cleanup): {
- resume; // scope 0 at $DIR/no_spurious_drop_after_call.rs:+0:1: +2:2
- }
-}
diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir
new file mode 100644
index 000000000..99a7a6b61
--- /dev/null
+++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir
@@ -0,0 +1,40 @@
+// MIR for `main` before ElaborateDrops
+
+fn main() -> () {
+ let mut _0: ();
+ let _1: ();
+ let mut _2: std::string::String;
+ let mut _3: &str;
+ let _4: &str;
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = const "";
+ _3 = &(*_4);
+ _2 = <str as ToString>::to_string(move _3) -> [return: bb1, unwind: bb4];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ _1 = std::mem::drop::<String>(move _2) -> [return: bb2, unwind: bb3];
+ }
+
+ bb2: {
+ StorageDead(_2);
+ StorageDead(_4);
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
+
+ bb3 (cleanup): {
+ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
+ }
+
+ bb4 (cleanup): {
+ resume;
+ }
+}
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
new file mode 100644
index 000000000..7364b329e
--- /dev/null
+++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir
@@ -0,0 +1,40 @@
+// MIR for `main` before ElaborateDrops
+
+fn main() -> () {
+ let mut _0: ();
+ let _1: ();
+ let mut _2: std::string::String;
+ let mut _3: &str;
+ let _4: &str;
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = const "";
+ _3 = &(*_4);
+ _2 = <str as ToString>::to_string(move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ _1 = std::mem::drop::<String>(move _2) -> [return: bb2, unwind: bb3];
+ }
+
+ bb2: {
+ StorageDead(_2);
+ StorageDead(_4);
+ StorageDead(_1);
+ _0 = const ();
+ return;
+ }
+
+ bb3 (cleanup): {
+ drop(_2) -> [return: bb4, unwind terminate(cleanup)];
+ }
+
+ bb4 (cleanup): {
+ resume;
+ }
+}
diff --git a/tests/mir-opt/no_spurious_drop_after_call.rs b/tests/mir-opt/no_spurious_drop_after_call.rs
index bb5bb9aa4..cd7b8fb79 100644
--- a/tests/mir-opt/no_spurious_drop_after_call.rs
+++ b/tests/mir-opt/no_spurious_drop_after_call.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32-bare compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Test that after the call to `std::mem::drop` we do not generate a
// MIR drop of the argument. (We used to have a `DROP(_2)` in the code
diff --git a/tests/mir-opt/not_equal_false.opt.InstSimplify.diff b/tests/mir-opt/not_equal_false.opt.InstSimplify.diff
deleted file mode 100644
index 8e7776a0b..000000000
--- a/tests/mir-opt/not_equal_false.opt.InstSimplify.diff
+++ /dev/null
@@ -1,35 +0,0 @@
-- // MIR for `opt` before InstSimplify
-+ // MIR for `opt` after InstSimplify
-
- fn opt(_1: bool) -> u32 {
- debug x => _1; // in scope 0 at $DIR/not_equal_false.rs:+0:8: +0:9
- let mut _0: u32; // return place in scope 0 at $DIR/not_equal_false.rs:+0:20: +0:23
- let mut _2: bool; // in scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18
- let mut _3: bool; // in scope 0 at $DIR/not_equal_false.rs:+1:8: +1:9
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18
- StorageLive(_3); // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:9
- _3 = _1; // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:9
-- _2 = Ne(move _3, const false); // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18
-+ _2 = move _3; // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18
- StorageDead(_3); // scope 0 at $DIR/not_equal_false.rs:+1:17: +1:18
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18
- }
-
- bb1: {
- _0 = const 0_u32; // scope 0 at $DIR/not_equal_false.rs:+1:21: +1:22
- goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:+1:5: +1:35
- }
-
- bb2: {
- _0 = const 1_u32; // scope 0 at $DIR/not_equal_false.rs:+1:32: +1:33
- goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:+1:5: +1:35
- }
-
- bb3: {
- StorageDead(_2); // scope 0 at $DIR/not_equal_false.rs:+1:34: +1:35
- return; // scope 0 at $DIR/not_equal_false.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/not_equal_false.rs b/tests/mir-opt/not_equal_false.rs
deleted file mode 100644
index e05607329..000000000
--- a/tests/mir-opt/not_equal_false.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// unit-test: InstSimplify
-// EMIT_MIR not_equal_false.opt.InstSimplify.diff
-
-fn opt(x: bool) -> u32 {
- if x != false { 0 } else { 1 }
-}
-
-fn main() {
- opt(false);
-}
diff --git a/tests/mir-opt/nrvo_miscompile_111005.rs b/tests/mir-opt/nrvo_miscompile_111005.rs
index a9f391b79..aff037ae4 100644
--- a/tests/mir-opt/nrvo_miscompile_111005.rs
+++ b/tests/mir-opt/nrvo_miscompile_111005.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// This is a miscompilation, #111005 to track
// unit-test: RenameReturnPlace
diff --git a/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff b/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff
index a0acb6e7e..260b472da 100644
--- a/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff
+++ b/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff
@@ -2,17 +2,16 @@
+ // MIR for `wrong` after RenameReturnPlace
fn wrong(_1: char) -> char {
-- let mut _0: char; // return place in scope 0 at $DIR/nrvo_miscompile_111005.rs:+0:28: +0:32
-+ let mut _0: char; // return place in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _2: char; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: char;
+ let mut _2: char;
bb0: {
-- _2 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-- _0 = _2; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+3:9: +3:19
-- _2 = const 'b'; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+4:9: +4:19
-+ _0 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-+ _0 = const 'b'; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+4:9: +4:19
- return; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+5:9: +5:17
+- _2 = _1;
+- _0 = _2;
+- _2 = const 'b';
++ _0 = _1;
++ _0 = const 'b';
+ return;
}
}
diff --git a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.diff b/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.diff
deleted file mode 100644
index 61a16065b..000000000
--- a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.diff
+++ /dev/null
@@ -1,43 +0,0 @@
-- // MIR for `nrvo` before RenameReturnPlace
-+ // MIR for `nrvo` after RenameReturnPlace
-
- fn nrvo(_1: for<'a> fn(&'a mut [u8; 1024])) -> [u8; 1024] {
- debug init => _1; // in scope 0 at $DIR/nrvo_simple.rs:+0:9: +0:13
-- let mut _0: [u8; 1024]; // return place in scope 0 at $DIR/nrvo_simple.rs:+0:39: +0:49
-+ let mut _0: [u8; 1024]; // return place in scope 0 at $DIR/nrvo_simple.rs:+1:9: +1:16
- let mut _2: [u8; 1024]; // in scope 0 at $DIR/nrvo_simple.rs:+1:9: +1:16
- let _3: (); // in scope 0 at $DIR/nrvo_simple.rs:+2:5: +2:19
- let mut _4: for<'a> fn(&'a mut [u8; 1024]); // in scope 0 at $DIR/nrvo_simple.rs:+2:5: +2:9
- let mut _5: &mut [u8; 1024]; // in scope 0 at $DIR/nrvo_simple.rs:+2:10: +2:18
- let mut _6: &mut [u8; 1024]; // in scope 0 at $DIR/nrvo_simple.rs:+2:10: +2:18
- scope 1 {
-- debug buf => _2; // in scope 1 at $DIR/nrvo_simple.rs:+1:9: +1:16
-+ debug buf => _0; // in scope 1 at $DIR/nrvo_simple.rs:+1:9: +1:16
- }
-
- bb0: {
-- StorageLive(_2); // scope 0 at $DIR/nrvo_simple.rs:+1:9: +1:16
-- _2 = [const 0_u8; 1024]; // scope 0 at $DIR/nrvo_simple.rs:+1:19: +1:28
-+ _0 = [const 0_u8; 1024]; // scope 0 at $DIR/nrvo_simple.rs:+1:19: +1:28
- StorageLive(_3); // scope 1 at $DIR/nrvo_simple.rs:+2:5: +2:19
- StorageLive(_4); // scope 1 at $DIR/nrvo_simple.rs:+2:5: +2:9
- _4 = _1; // scope 1 at $DIR/nrvo_simple.rs:+2:5: +2:9
- StorageLive(_5); // scope 1 at $DIR/nrvo_simple.rs:+2:10: +2:18
- StorageLive(_6); // scope 1 at $DIR/nrvo_simple.rs:+2:10: +2:18
-- _6 = &mut _2; // scope 1 at $DIR/nrvo_simple.rs:+2:10: +2:18
-+ _6 = &mut _0; // scope 1 at $DIR/nrvo_simple.rs:+2:10: +2:18
- _5 = &mut (*_6); // scope 1 at $DIR/nrvo_simple.rs:+2:10: +2:18
- _3 = move _4(move _5) -> bb1; // scope 1 at $DIR/nrvo_simple.rs:+2:5: +2:19
- }
-
- bb1: {
- StorageDead(_5); // scope 1 at $DIR/nrvo_simple.rs:+2:18: +2:19
- StorageDead(_4); // scope 1 at $DIR/nrvo_simple.rs:+2:18: +2:19
- StorageDead(_6); // scope 1 at $DIR/nrvo_simple.rs:+2:19: +2:20
- StorageDead(_3); // scope 1 at $DIR/nrvo_simple.rs:+2:19: +2:20
-- _0 = _2; // scope 1 at $DIR/nrvo_simple.rs:+3:5: +3:8
-- StorageDead(_2); // scope 0 at $DIR/nrvo_simple.rs:+4:1: +4:2
- return; // scope 0 at $DIR/nrvo_simple.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-abort.diff b/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-abort.diff
new file mode 100644
index 000000000..f7bc5559a
--- /dev/null
+++ b/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-abort.diff
@@ -0,0 +1,42 @@
+- // MIR for `nrvo` before RenameReturnPlace
++ // MIR for `nrvo` after RenameReturnPlace
+
+ fn nrvo(_1: for<'a> fn(&'a mut [u8; 1024])) -> [u8; 1024] {
+ debug init => _1;
+ let mut _0: [u8; 1024];
+ let mut _2: [u8; 1024];
+ let _3: ();
+ let mut _4: for<'a> fn(&'a mut [u8; 1024]);
+ let mut _5: &mut [u8; 1024];
+ let mut _6: &mut [u8; 1024];
+ scope 1 {
+- debug buf => _2;
++ debug buf => _0;
+ }
+
+ bb0: {
+- StorageLive(_2);
+- _2 = [const 0_u8; 1024];
++ _0 = [const 0_u8; 1024];
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = &mut _2;
++ _6 = &mut _0;
+ _5 = &mut (*_6);
+ _3 = move _4(move _5) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_6);
+ StorageDead(_3);
+- _0 = _2;
+- StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff b/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff
new file mode 100644
index 000000000..3df8e567f
--- /dev/null
+++ b/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff
@@ -0,0 +1,42 @@
+- // MIR for `nrvo` before RenameReturnPlace
++ // MIR for `nrvo` after RenameReturnPlace
+
+ fn nrvo(_1: for<'a> fn(&'a mut [u8; 1024])) -> [u8; 1024] {
+ debug init => _1;
+ let mut _0: [u8; 1024];
+ let mut _2: [u8; 1024];
+ let _3: ();
+ let mut _4: for<'a> fn(&'a mut [u8; 1024]);
+ let mut _5: &mut [u8; 1024];
+ let mut _6: &mut [u8; 1024];
+ scope 1 {
+- debug buf => _2;
++ debug buf => _0;
+ }
+
+ bb0: {
+- StorageLive(_2);
+- _2 = [const 0_u8; 1024];
++ _0 = [const 0_u8; 1024];
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = &mut _2;
++ _6 = &mut _0;
+ _5 = &mut (*_6);
+ _3 = move _4(move _5) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_6);
+ StorageDead(_3);
+- _0 = _2;
+- StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/nrvo_simple.rs b/tests/mir-opt/nrvo_simple.rs
index 525dfe426..5b403c560 100644
--- a/tests/mir-opt/nrvo_simple.rs
+++ b/tests/mir-opt/nrvo_simple.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: RenameReturnPlace
// EMIT_MIR nrvo_simple.nrvo.RenameReturnPlace.diff
diff --git a/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir
deleted file mode 100644
index 81b96e3b6..000000000
--- a/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir
+++ /dev/null
@@ -1,55 +0,0 @@
-// MIR for `main` after SimplifyCfg-elaborate-drops
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/packed_struct_drop_aligned.rs:+0:11: +0:11
- let mut _1: Packed; // in scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:9: +1:14
- let mut _2: Aligned; // in scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:24: +1:42
- let mut _3: Droppy; // in scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:32: +1:41
- let mut _4: Aligned; // in scope 0 at $DIR/packed_struct_drop_aligned.rs:+2:11: +2:29
- let mut _5: Droppy; // in scope 0 at $DIR/packed_struct_drop_aligned.rs:+2:19: +2:28
- let mut _6: Aligned; // in scope 0 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/packed_struct_drop_aligned.rs:+1:9: +1:14
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:9: +1:14
- StorageLive(_2); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:24: +1:42
- StorageLive(_3); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:32: +1:41
- _3 = Droppy(const 0_usize); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:32: +1:41
- _2 = Aligned(move _3); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:24: +1:42
- StorageDead(_3); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:41: +1:42
- _1 = Packed(move _2); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:17: +1:43
- StorageDead(_2); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+1:42: +1:43
- StorageLive(_4); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:11: +2:29
- StorageLive(_5); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:19: +2:28
- _5 = Droppy(const 0_usize); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:19: +2:28
- _4 = Aligned(move _5); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:11: +2:29
- StorageDead(_5); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:28: +2:29
- StorageLive(_6); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8
- _6 = move (_1.0: Aligned); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8
- drop(_6) -> [return: bb4, unwind: bb1]; // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8
- }
-
- bb1 (cleanup): {
- (_1.0: Aligned) = move _4; // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8
- drop(_1) -> [return: bb3, unwind terminate]; // scope 0 at $DIR/packed_struct_drop_aligned.rs:+3:1: +3:2
- }
-
- bb2: {
- StorageDead(_1); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+3:1: +3:2
- return; // scope 0 at $DIR/packed_struct_drop_aligned.rs:+3:2: +3:2
- }
-
- bb3 (cleanup): {
- resume; // scope 0 at $DIR/packed_struct_drop_aligned.rs:+0:1: +3:2
- }
-
- bb4: {
- StorageDead(_6); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8
- (_1.0: Aligned) = move _4; // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:5: +2:8
- StorageDead(_4); // scope 1 at $DIR/packed_struct_drop_aligned.rs:+2:28: +2:29
- _0 = const (); // scope 0 at $DIR/packed_struct_drop_aligned.rs:+0:11: +3:2
- drop(_1) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/packed_struct_drop_aligned.rs:+3:1: +3:2
- }
-}
diff --git a/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir
new file mode 100644
index 000000000..089adff0c
--- /dev/null
+++ b/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir
@@ -0,0 +1,46 @@
+// MIR for `main` after SimplifyCfg-elaborate-drops
+
+fn main() -> () {
+ let mut _0: ();
+ let mut _1: Packed;
+ let mut _2: Aligned;
+ let mut _3: Droppy;
+ let mut _4: Aligned;
+ let mut _5: Droppy;
+ let mut _6: Aligned;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = Droppy(const 0_usize);
+ _2 = Aligned(move _3);
+ StorageDead(_3);
+ _1 = Packed(move _2);
+ StorageDead(_2);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = Droppy(const 0_usize);
+ _4 = Aligned(move _5);
+ StorageDead(_5);
+ StorageLive(_6);
+ _6 = move (_1.0: Aligned);
+ drop(_6) -> [return: bb2, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb2: {
+ StorageDead(_6);
+ (_1.0: Aligned) = move _4;
+ StorageDead(_4);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind unreachable];
+ }
+}
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
new file mode 100644
index 000000000..0ef191804
--- /dev/null
+++ b/tests/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -0,0 +1,55 @@
+// MIR for `main` after SimplifyCfg-elaborate-drops
+
+fn main() -> () {
+ let mut _0: ();
+ let mut _1: Packed;
+ let mut _2: Aligned;
+ let mut _3: Droppy;
+ let mut _4: Aligned;
+ let mut _5: Droppy;
+ let mut _6: Aligned;
+ scope 1 {
+ debug x => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = Droppy(const 0_usize);
+ _2 = Aligned(move _3);
+ StorageDead(_3);
+ _1 = Packed(move _2);
+ StorageDead(_2);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = Droppy(const 0_usize);
+ _4 = Aligned(move _5);
+ StorageDead(_5);
+ StorageLive(_6);
+ _6 = move (_1.0: Aligned);
+ drop(_6) -> [return: bb4, unwind: bb1];
+ }
+
+ bb1 (cleanup): {
+ (_1.0: Aligned) = move _4;
+ drop(_1) -> [return: bb3, unwind terminate(cleanup)];
+ }
+
+ bb2: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb3 (cleanup): {
+ resume;
+ }
+
+ bb4: {
+ StorageDead(_6);
+ (_1.0: Aligned) = move _4;
+ StorageDead(_4);
+ _0 = const ();
+ drop(_1) -> [return: bb2, unwind: bb3];
+ }
+}
diff --git a/tests/mir-opt/packed_struct_drop_aligned.rs b/tests/mir-opt/packed_struct_drop_aligned.rs
index cb6524260..079c4e68f 100644
--- a/tests/mir-opt/packed_struct_drop_aligned.rs
+++ b/tests/mir-opt/packed_struct_drop_aligned.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32-bare compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir
diff --git a/tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir
new file mode 100644
index 000000000..99ca659c6
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir
@@ -0,0 +1,84 @@
+// MIR for `bitand` after PreCodegen
+
+fn bitand(_1: &Blueprint, _2: &Blueprint) -> bool {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: bool;
+ let mut _3: u32;
+ let mut _4: u32;
+ let mut _5: bool;
+ let mut _6: u32;
+ let mut _7: u32;
+ let mut _8: bool;
+ let mut _9: bool;
+ let mut _10: u32;
+ let mut _11: u32;
+ let mut _12: bool;
+ let mut _13: bool;
+ let mut _14: u32;
+ let mut _15: u32;
+ let mut _16: bool;
+ let mut _17: bool;
+ let mut _18: u32;
+ let mut _19: u32;
+ let mut _20: bool;
+
+ bb0: {
+ StorageLive(_17);
+ StorageLive(_13);
+ StorageLive(_9);
+ StorageLive(_5);
+ StorageLive(_3);
+ _3 = ((*_1).0: u32);
+ StorageLive(_4);
+ _4 = ((*_2).0: u32);
+ _5 = Eq(move _3, move _4);
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageLive(_8);
+ StorageLive(_6);
+ _6 = ((*_1).1: u32);
+ StorageLive(_7);
+ _7 = ((*_2).1: u32);
+ _8 = Eq(move _6, move _7);
+ StorageDead(_7);
+ StorageDead(_6);
+ _9 = BitAnd(move _5, move _8);
+ StorageDead(_8);
+ StorageDead(_5);
+ StorageLive(_12);
+ StorageLive(_10);
+ _10 = ((*_1).2: u32);
+ StorageLive(_11);
+ _11 = ((*_2).2: u32);
+ _12 = Eq(move _10, move _11);
+ StorageDead(_11);
+ StorageDead(_10);
+ _13 = BitAnd(move _9, move _12);
+ StorageDead(_12);
+ StorageDead(_9);
+ StorageLive(_16);
+ StorageLive(_14);
+ _14 = ((*_1).3: u32);
+ StorageLive(_15);
+ _15 = ((*_2).3: u32);
+ _16 = Eq(move _14, move _15);
+ StorageDead(_15);
+ StorageDead(_14);
+ _17 = BitAnd(move _13, move _16);
+ StorageDead(_16);
+ StorageDead(_13);
+ 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 = BitAnd(move _17, move _20);
+ StorageDead(_20);
+ StorageDead(_17);
+ return;
+ }
+}
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
new file mode 100644
index 000000000..838e30fa3
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir
@@ -0,0 +1,117 @@
+// MIR for `naive` after PreCodegen
+
+fn naive(_1: &Blueprint, _2: &Blueprint) -> bool {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: bool;
+ let mut _3: u32;
+ let mut _4: u32;
+ let mut _5: bool;
+ let mut _6: u32;
+ let mut _7: u32;
+ let mut _8: bool;
+ let mut _9: u32;
+ let mut _10: u32;
+ let mut _11: bool;
+ let mut _12: u32;
+ let mut _13: u32;
+ let mut _14: bool;
+ let mut _15: u32;
+ let mut _16: u32;
+
+ bb0: {
+ StorageLive(_5);
+ StorageLive(_3);
+ _3 = ((*_1).0: u32);
+ StorageLive(_4);
+ _4 = ((*_2).0: u32);
+ _5 = Eq(move _3, move _4);
+ switchInt(move _5) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ goto -> bb8;
+ }
+
+ bb2: {
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageLive(_8);
+ 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(_7);
+ StorageDead(_6);
+ goto -> bb8;
+ }
+
+ bb4: {
+ 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: {
+ StorageDead(_10);
+ StorageDead(_9);
+ goto -> bb8;
+ }
+
+ bb6: {
+ 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: {
+ StorageDead(_13);
+ StorageDead(_12);
+ goto -> bb8;
+ }
+
+ bb8: {
+ _0 = const false;
+ goto -> bb10;
+ }
+
+ bb9: {
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageLive(_15);
+ _15 = ((*_1).4: u32);
+ StorageLive(_16);
+ _16 = ((*_2).4: u32);
+ _0 = Eq(move _15, move _16);
+ StorageDead(_16);
+ StorageDead(_15);
+ goto -> bb10;
+ }
+
+ bb10: {
+ 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
new file mode 100644
index 000000000..8452fa12f
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir
@@ -0,0 +1,136 @@
+// MIR for `returning` after PreCodegen
+
+fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
+ debug a => _1;
+ debug b => _2;
+ let mut _0: bool;
+ let mut _3: u32;
+ let mut _4: u32;
+ let mut _5: bool;
+ let mut _6: u32;
+ let mut _7: u32;
+ let mut _8: bool;
+ let mut _9: u32;
+ let mut _10: u32;
+ let mut _11: bool;
+ let mut _12: u32;
+ let mut _13: u32;
+ let mut _14: bool;
+ let mut _15: u32;
+ let mut _16: u32;
+ let mut _17: bool;
+
+ bb0: {
+ StorageLive(_5);
+ StorageLive(_3);
+ _3 = ((*_1).0: u32);
+ StorageLive(_4);
+ _4 = ((*_2).0: u32);
+ _5 = Ne(move _3, move _4);
+ switchInt(move _5) -> [0: bb1, otherwise: bb10];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_5);
+ StorageLive(_8);
+ StorageLive(_6);
+ _6 = ((*_1).1: u32);
+ StorageLive(_7);
+ _7 = ((*_2).1: u32);
+ _8 = Ne(move _6, move _7);
+ switchInt(move _8) -> [0: bb2, otherwise: bb9];
+ }
+
+ bb2: {
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_8);
+ StorageLive(_11);
+ StorageLive(_9);
+ _9 = ((*_1).2: u32);
+ StorageLive(_10);
+ _10 = ((*_2).2: u32);
+ _11 = Ne(move _9, move _10);
+ switchInt(move _11) -> [0: bb3, otherwise: bb8];
+ }
+
+ bb3: {
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_11);
+ StorageLive(_14);
+ StorageLive(_12);
+ _12 = ((*_1).3: u32);
+ StorageLive(_13);
+ _13 = ((*_2).3: u32);
+ _14 = Ne(move _12, move _13);
+ switchInt(move _14) -> [0: bb4, otherwise: bb7];
+ }
+
+ bb4: {
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_14);
+ StorageLive(_17);
+ StorageLive(_15);
+ _15 = ((*_1).4: u32);
+ StorageLive(_16);
+ _16 = ((*_2).4: u32);
+ _17 = Ne(move _15, move _16);
+ 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;
+ }
+
+ bb11: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/chained_comparison.rs b/tests/mir-opt/pre-codegen/chained_comparison.rs
new file mode 100644
index 000000000..d1d400af2
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/chained_comparison.rs
@@ -0,0 +1,51 @@
+// skip-filecheck
+// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
+
+#![crate_type = "lib"]
+
+pub struct Blueprint {
+ pub fuel_tank_size: u32,
+ pub payload: u32,
+ pub wheel_diameter: u32,
+ pub wheel_width: u32,
+ pub storage: u32,
+}
+
+pub fn naive(a: &Blueprint, b: &Blueprint) -> bool {
+ (a.fuel_tank_size == b.fuel_tank_size)
+ && (a.payload == b.payload)
+ && (a.wheel_diameter == b.wheel_diameter)
+ && (a.wheel_width == b.wheel_width)
+ && (a.storage == b.storage)
+}
+
+pub fn bitand(a: &Blueprint, b: &Blueprint) -> bool {
+ (a.fuel_tank_size == b.fuel_tank_size)
+ & (a.payload == b.payload)
+ & (a.wheel_diameter == b.wheel_diameter)
+ & (a.wheel_width == b.wheel_width)
+ & (a.storage == b.storage)
+}
+
+pub fn returning(a: &Blueprint, b: &Blueprint) -> bool {
+ if a.fuel_tank_size != b.fuel_tank_size {
+ return false;
+ }
+ if a.payload != b.payload {
+ return false;
+ }
+ if a.wheel_diameter != b.wheel_diameter {
+ return false;
+ }
+ if a.wheel_width != b.wheel_width {
+ return false;
+ }
+ if a.storage != b.storage {
+ return false;
+ }
+ true
+}
+
+// EMIT_MIR chained_comparison.naive.PreCodegen.after.mir
+// EMIT_MIR chained_comparison.bitand.PreCodegen.after.mir
+// EMIT_MIR chained_comparison.returning.PreCodegen.after.mir
diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir
new file mode 100644
index 000000000..8304cb45b
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir
@@ -0,0 +1,68 @@
+// MIR for `checked_shl` after PreCodegen
+
+fn checked_shl(_1: u32, _2: u32) -> Option<u32> {
+ debug x => _1;
+ debug rhs => _2;
+ let mut _0: std::option::Option<u32>;
+ scope 1 (inlined core::num::<impl u32>::checked_shl) {
+ debug self => _1;
+ debug rhs => _2;
+ let mut _6: bool;
+ scope 2 {
+ debug a => _4;
+ debug b => _5;
+ }
+ scope 3 (inlined core::num::<impl u32>::overflowing_shl) {
+ debug self => _1;
+ debug rhs => _2;
+ let mut _4: u32;
+ let mut _5: bool;
+ scope 4 (inlined core::num::<impl u32>::wrapping_shl) {
+ debug self => _1;
+ debug rhs => _2;
+ let mut _3: u32;
+ scope 5 {
+ scope 6 (inlined core::num::<impl u32>::unchecked_shl) {
+ debug self => _1;
+ debug rhs => _3;
+ scope 7 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_3);
+ _3 = BitAnd(_2, const 31_u32);
+ _4 = ShlUnchecked(_1, _3);
+ StorageDead(_3);
+ _5 = Ge(_2, const _);
+ StorageLive(_6);
+ _6 = unlikely(move _5) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ switchInt(move _6) -> [0: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ _0 = Option::<u32>::Some(_4);
+ goto -> bb4;
+ }
+
+ bb3: {
+ _0 = Option::<u32>::None;
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/checked_ops.rs b/tests/mir-opt/pre-codegen/checked_ops.rs
new file mode 100644
index 000000000..d386219f4
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/checked_ops.rs
@@ -0,0 +1,17 @@
+// skip-filecheck
+// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
+// needs-unwind
+// only-x86_64
+
+#![crate_type = "lib"]
+#![feature(step_trait)]
+
+// EMIT_MIR checked_ops.step_forward.PreCodegen.after.mir
+pub fn step_forward(x: u32, n: usize) -> u32 {
+ std::iter::Step::forward(x, n)
+}
+
+// EMIT_MIR checked_ops.checked_shl.PreCodegen.after.mir
+pub fn checked_shl(x: u32, rhs: u32) -> Option<u32> {
+ x.checked_shl(rhs)
+}
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
new file mode 100644
index 000000000..cf7feef00
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
@@ -0,0 +1,69 @@
+// MIR for `step_forward` after PreCodegen
+
+fn step_forward(_1: u32, _2: usize) -> u32 {
+ debug x => _1;
+ debug n => _2;
+ let mut _0: u32;
+ scope 1 (inlined <u32 as Step>::forward) {
+ debug start => _1;
+ debug n => _2;
+ let _3: std::option::Option<u32>;
+ let mut _4: &std::option::Option<u32>;
+ let mut _7: bool;
+ let mut _8: u32;
+ scope 2 {
+ }
+ scope 3 (inlined Option::<u32>::is_none) {
+ debug self => _4;
+ let mut _6: bool;
+ scope 4 (inlined Option::<u32>::is_some) {
+ debug self => _4;
+ let mut _5: isize;
+ }
+ }
+ scope 5 (inlined core::num::<impl u32>::wrapping_add) {
+ debug self => _1;
+ debug rhs => _8;
+ }
+ }
+
+ bb0: {
+ StorageLive(_7);
+ StorageLive(_4);
+ StorageLive(_3);
+ _3 = <u32 as Step>::forward_checked(_1, _2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ _4 = &_3;
+ StorageLive(_6);
+ StorageLive(_5);
+ _5 = discriminant(_3);
+ _6 = Eq(_5, const 1_isize);
+ StorageDead(_5);
+ _7 = Not(move _6);
+ StorageDead(_6);
+ switchInt(move _7) -> [0: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ StorageDead(_3);
+ StorageDead(_4);
+ goto -> bb4;
+ }
+
+ bb3: {
+ StorageDead(_3);
+ StorageDead(_4);
+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_7);
+ StorageLive(_8);
+ _8 = _2 as u32 (IntToInt);
+ _0 = Add(_1, _8);
+ StorageDead(_8);
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs b/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs
index d8af6b14d..b1a00d293 100644
--- a/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs
+++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=0
// ignore-debug: standard library debug assertions add a panic that breaks this optimization
diff --git a/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir
index 0e885cf94..0114309db 100644
--- a/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir
@@ -1,27 +1,22 @@
// MIR for `ub_if_b` after PreCodegen
fn ub_if_b(_1: Thing) -> Thing {
- debug t => _1; // in scope 0 at $DIR/duplicate_switch_targets.rs:+0:23: +0:24
- let mut _0: Thing; // return place in scope 0 at $DIR/duplicate_switch_targets.rs:+0:36: +0:41
- let mut _2: isize; // in scope 0 at $DIR/duplicate_switch_targets.rs:+2:9: +2:17
- scope 1 (inlined unreachable_unchecked) { // at $DIR/duplicate_switch_targets.rs:15:21: 15:55
+ debug t => _1;
+ let mut _0: Thing;
+ let mut _2: isize;
+ let mut _3: bool;
+ scope 1 (inlined unreachable_unchecked) {
scope 2 {
- scope 3 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ scope 3 (inlined unreachable_unchecked::runtime) {
}
}
}
bb0: {
- _2 = discriminant(_1); // scope 0 at $DIR/duplicate_switch_targets.rs:+1:11: +1:12
- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/duplicate_switch_targets.rs:+1:5: +1:12
- }
-
- bb1: {
- unreachable; // scope 2 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- }
-
- bb2: {
- _0 = move _1; // scope 0 at $DIR/duplicate_switch_targets.rs:+2:21: +2:22
- return; // scope 0 at $DIR/duplicate_switch_targets.rs:+5:2: +5:2
+ _2 = discriminant(_1);
+ _3 = Eq(_2, const 0_isize);
+ assume(move _3);
+ _0 = move _1;
+ return;
}
}
diff --git a/tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir
index 76e1fea2f..174fb2c0c 100644
--- a/tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir
@@ -1,26 +1,19 @@
// MIR for `f_u64` after PreCodegen
fn f_u64() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/intrinsics.rs:+0:16: +0:16
- let mut _1: u64; // in scope 0 at $DIR/intrinsics.rs:+1:5: +1:21
- scope 1 (inlined f_dispatch::<u64>) { // at $DIR/intrinsics.rs:19:5: 19:21
- debug t => const 0_u64; // in scope 1 at $DIR/intrinsics.rs:23:22: 23:23
- let _2: (); // in scope 1 at $DIR/intrinsics.rs:27:9: 27:21
- scope 2 (inlined std::mem::size_of::<u64>) { // at $DIR/intrinsics.rs:24:8: 24:32
+ let mut _0: ();
+ scope 1 (inlined f_dispatch::<u64>) {
+ debug t => const 0_u64;
+ let _1: ();
+ scope 2 (inlined std::mem::size_of::<u64>) {
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/intrinsics.rs:+1:5: +1:21
- _1 = const 0_u64; // scope 0 at $DIR/intrinsics.rs:+1:5: +1:21
- _2 = f_non_zst::<u64>(move _1) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/intrinsics.rs:27:9: 27:21
- // mir::Constant
- // + span: $DIR/intrinsics.rs:27:9: 27:18
- // + literal: Const { ty: fn(u64) {f_non_zst::<u64>}, val: Value(<ZST>) }
+ _1 = f_non_zst::<u64>(const 0_u64) -> [return: bb1, unwind unreachable];
}
bb1: {
- StorageDead(_1); // scope 0 at $DIR/intrinsics.rs:+1:5: +1:21
- return; // scope 0 at $DIR/intrinsics.rs:+2:2: +2:2
+ return;
}
}
diff --git a/tests/mir-opt/pre-codegen/intrinsics.f_unit.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/intrinsics.f_unit.PreCodegen.after.mir
index 3d416de34..578cb2d70 100644
--- a/tests/mir-opt/pre-codegen/intrinsics.f_unit.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/intrinsics.f_unit.PreCodegen.after.mir
@@ -1,22 +1,19 @@
// MIR for `f_unit` after PreCodegen
fn f_unit() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/intrinsics.rs:+0:17: +0:17
- scope 1 (inlined f_dispatch::<()>) { // at $DIR/intrinsics.rs:13:5: 13:19
- debug t => const (); // in scope 1 at $DIR/intrinsics.rs:23:22: 23:23
- let _1: (); // in scope 1 at $DIR/intrinsics.rs:25:9: 25:17
- scope 2 (inlined std::mem::size_of::<()>) { // at $DIR/intrinsics.rs:24:8: 24:32
+ let mut _0: ();
+ scope 1 (inlined f_dispatch::<()>) {
+ debug t => const ();
+ let _1: ();
+ scope 2 (inlined std::mem::size_of::<()>) {
}
}
bb0: {
- _1 = f_zst::<()>(const ()) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/intrinsics.rs:25:9: 25:17
- // mir::Constant
- // + span: $DIR/intrinsics.rs:25:9: 25:14
- // + literal: Const { ty: fn(()) {f_zst::<()>}, val: Value(<ZST>) }
+ _1 = f_zst::<()>(const ()) -> [return: bb1, unwind unreachable];
}
bb1: {
- return; // scope 0 at $DIR/intrinsics.rs:+2:2: +2:2
+ return;
}
}
diff --git a/tests/mir-opt/pre-codegen/intrinsics.rs b/tests/mir-opt/pre-codegen/intrinsics.rs
index ecdb656cb..565bd89e5 100644
--- a/tests/mir-opt/pre-codegen/intrinsics.rs
+++ b/tests/mir-opt/pre-codegen/intrinsics.rs
@@ -1,6 +1,6 @@
+// skip-filecheck
// 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/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff
new file mode 100644
index 000000000..d5628dc7a
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff
@@ -0,0 +1,123 @@
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::alloc::Layout;
+ let mut _2: std::option::Option<std::alloc::Layout>;
+ let mut _3: *mut u8;
+ let mut _4: *mut [u8];
+ let mut _5: std::ptr::NonNull<[u8]>;
+ let mut _6: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>;
+ let mut _7: &std::alloc::Global;
+ let mut _8: std::alloc::Layout;
+ scope 1 {
+ debug layout => _1;
+ let mut _9: &std::alloc::Global;
+ scope 2 {
+ debug ptr => _3;
+ }
+ scope 5 (inlined <std::alloc::Global as Allocator>::allocate) {
+ debug self => _9;
+ debug layout => _1;
+ }
+ scope 6 (inlined #[track_caller] Result::<NonNull<[u8]>, std::alloc::AllocError>::unwrap) {
+ debug self => _6;
+ let mut _12: isize;
+ let _13: std::alloc::AllocError;
+ let mut _14: !;
+ let _15: &str;
+ let mut _16: &dyn std::fmt::Debug;
+ let mut _17: &std::alloc::AllocError;
+ scope 7 {
+ debug t => _5;
+ }
+ scope 8 {
+ debug e => const std::alloc::AllocError;
+ }
+ }
+ scope 9 (inlined NonNull::<[u8]>::as_ptr) {
+ debug self => _5;
+ let mut _18: *const [u8];
+ }
+ }
+ scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
+ debug self => _2;
+ let mut _10: isize;
+ let mut _11: !;
+ scope 4 {
+ debug val => _1;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+- _2 = Option::<Layout>::None;
++ _2 = const Option::<Layout>::None;
+ StorageLive(_10);
+ _10 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb1, 1: bb3, otherwise: bb2];
+ }
+
+ bb1: {
+ _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+- _1 = move ((_2 as Some).0: std::alloc::Layout);
++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }};
+ StorageDead(_10);
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _9 = const _;
+- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb4, unwind unreachable];
++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}, const false) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageLive(_12);
+ StorageLive(_15);
+ _12 = discriminant(_6);
+ switchInt(move _12) -> [0: bb6, 1: bb5, otherwise: bb2];
+ }
+
+ bb5: {
+ _15 = const "called `Result::unwrap()` on an `Err` value";
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = &_13;
+ _16 = move _17 as &dyn std::fmt::Debug (PointerCoercion(Unsize));
+ StorageDead(_17);
+ _14 = result::unwrap_failed(move _15, move _16) -> unwind unreachable;
+ }
+
+ bb6: {
+ _5 = move ((_6 as Ok).0: std::ptr::NonNull<[u8]>);
+ StorageDead(_15);
+ StorageDead(_12);
+ StorageDead(_6);
+ StorageLive(_18);
+ _18 = (_5.0: *const [u8]);
+ _4 = move _18 as *mut [u8] (PtrToPtr);
+ StorageDead(_18);
+ StorageDead(_5);
+ _3 = move _4 as *mut u8 (PtrToPtr);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 00 00 00 00 __ __ __ __ │ ....░░░░
++ }
++
++ ALLOC1 (size: 0, align: 1) {}
+
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff
new file mode 100644
index 000000000..d28059458
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff
@@ -0,0 +1,92 @@
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::alloc::Layout;
+ let mut _2: std::option::Option<std::alloc::Layout>;
+ let mut _3: *mut u8;
+ let mut _4: *mut [u8];
+ let mut _5: std::ptr::NonNull<[u8]>;
+ let mut _6: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>;
+ let mut _7: &std::alloc::Global;
+ let mut _8: std::alloc::Layout;
+ scope 1 {
+ debug layout => _1;
+ let mut _9: &std::alloc::Global;
+ scope 2 {
+ debug ptr => _3;
+ }
+ scope 5 (inlined <std::alloc::Global as Allocator>::allocate) {
+ debug self => _9;
+ debug layout => _1;
+ }
+ scope 6 (inlined NonNull::<[u8]>::as_ptr) {
+ debug self => _5;
+ let mut _12: *const [u8];
+ }
+ }
+ scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
+ debug self => _2;
+ let mut _10: isize;
+ let mut _11: !;
+ scope 4 {
+ debug val => _1;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+- _2 = Option::<Layout>::None;
++ _2 = const Option::<Layout>::None;
+ StorageLive(_10);
+ _10 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb2, 1: bb4, otherwise: bb3];
+ }
+
+ bb1: {
+ StorageDead(_6);
+ StorageLive(_12);
+ _12 = (_5.0: *const [u8]);
+ _4 = move _12 as *mut [u8] (PtrToPtr);
+ StorageDead(_12);
+ StorageDead(_5);
+ _3 = move _4 as *mut u8 (PtrToPtr);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+
+ bb2: {
+ _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+- _1 = move ((_2 as Some).0: std::alloc::Layout);
++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }};
+ StorageDead(_10);
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _9 = const _;
+- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb5, unwind continue];
++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}, const false) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ _5 = Result::<NonNull<[u8]>, std::alloc::AllocError>::unwrap(move _6) -> [return: bb1, unwind continue];
+ }
+ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 00 00 00 00 __ __ __ __ │ ....░░░░
++ }
++
++ ALLOC1 (size: 0, align: 1) {}
+
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff
new file mode 100644
index 000000000..d139fc73e
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff
@@ -0,0 +1,123 @@
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::alloc::Layout;
+ let mut _2: std::option::Option<std::alloc::Layout>;
+ let mut _3: *mut u8;
+ let mut _4: *mut [u8];
+ let mut _5: std::ptr::NonNull<[u8]>;
+ let mut _6: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>;
+ let mut _7: &std::alloc::Global;
+ let mut _8: std::alloc::Layout;
+ scope 1 {
+ debug layout => _1;
+ let mut _9: &std::alloc::Global;
+ scope 2 {
+ debug ptr => _3;
+ }
+ scope 5 (inlined <std::alloc::Global as Allocator>::allocate) {
+ debug self => _9;
+ debug layout => _1;
+ }
+ scope 6 (inlined #[track_caller] Result::<NonNull<[u8]>, std::alloc::AllocError>::unwrap) {
+ debug self => _6;
+ let mut _12: isize;
+ let _13: std::alloc::AllocError;
+ let mut _14: !;
+ let _15: &str;
+ let mut _16: &dyn std::fmt::Debug;
+ let mut _17: &std::alloc::AllocError;
+ scope 7 {
+ debug t => _5;
+ }
+ scope 8 {
+ debug e => const std::alloc::AllocError;
+ }
+ }
+ scope 9 (inlined NonNull::<[u8]>::as_ptr) {
+ debug self => _5;
+ let mut _18: *const [u8];
+ }
+ }
+ scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
+ debug self => _2;
+ let mut _10: isize;
+ let mut _11: !;
+ scope 4 {
+ debug val => _1;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+- _2 = Option::<Layout>::None;
++ _2 = const Option::<Layout>::None;
+ StorageLive(_10);
+ _10 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb1, 1: bb3, otherwise: bb2];
+ }
+
+ bb1: {
+ _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+- _1 = move ((_2 as Some).0: std::alloc::Layout);
++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }};
+ StorageDead(_10);
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _9 = const _;
+- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb4, unwind unreachable];
++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}, const false) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageLive(_12);
+ StorageLive(_15);
+ _12 = discriminant(_6);
+ switchInt(move _12) -> [0: bb6, 1: bb5, otherwise: bb2];
+ }
+
+ bb5: {
+ _15 = const "called `Result::unwrap()` on an `Err` value";
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = &_13;
+ _16 = move _17 as &dyn std::fmt::Debug (PointerCoercion(Unsize));
+ StorageDead(_17);
+ _14 = result::unwrap_failed(move _15, move _16) -> unwind unreachable;
+ }
+
+ bb6: {
+ _5 = move ((_6 as Ok).0: std::ptr::NonNull<[u8]>);
+ StorageDead(_15);
+ StorageDead(_12);
+ StorageDead(_6);
+ StorageLive(_18);
+ _18 = (_5.0: *const [u8]);
+ _4 = move _18 as *mut [u8] (PtrToPtr);
+ StorageDead(_18);
+ StorageDead(_5);
+ _3 = move _4 as *mut u8 (PtrToPtr);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
++
++ ALLOC0 (size: 16, align: 8) {
++ 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░
++ }
++
++ ALLOC1 (size: 0, align: 1) {}
+
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff
new file mode 100644
index 000000000..63db9553b
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff
@@ -0,0 +1,92 @@
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::alloc::Layout;
+ let mut _2: std::option::Option<std::alloc::Layout>;
+ let mut _3: *mut u8;
+ let mut _4: *mut [u8];
+ let mut _5: std::ptr::NonNull<[u8]>;
+ let mut _6: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>;
+ let mut _7: &std::alloc::Global;
+ let mut _8: std::alloc::Layout;
+ scope 1 {
+ debug layout => _1;
+ let mut _9: &std::alloc::Global;
+ scope 2 {
+ debug ptr => _3;
+ }
+ scope 5 (inlined <std::alloc::Global as Allocator>::allocate) {
+ debug self => _9;
+ debug layout => _1;
+ }
+ scope 6 (inlined NonNull::<[u8]>::as_ptr) {
+ debug self => _5;
+ let mut _12: *const [u8];
+ }
+ }
+ scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
+ debug self => _2;
+ let mut _10: isize;
+ let mut _11: !;
+ scope 4 {
+ debug val => _1;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+- _2 = Option::<Layout>::None;
++ _2 = const Option::<Layout>::None;
+ StorageLive(_10);
+ _10 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb2, 1: bb4, otherwise: bb3];
+ }
+
+ bb1: {
+ StorageDead(_6);
+ StorageLive(_12);
+ _12 = (_5.0: *const [u8]);
+ _4 = move _12 as *mut [u8] (PtrToPtr);
+ StorageDead(_12);
+ StorageDead(_5);
+ _3 = move _4 as *mut u8 (PtrToPtr);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+
+ bb2: {
+ _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+- _1 = move ((_2 as Some).0: std::alloc::Layout);
++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }};
+ StorageDead(_10);
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _9 = const _;
+- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb5, unwind continue];
++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}, const false) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ _5 = Result::<NonNull<[u8]>, std::alloc::AllocError>::unwrap(move _6) -> [return: bb1, unwind continue];
+ }
+ }
++
++ ALLOC0 (size: 16, align: 8) {
++ 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░
++ }
++
++ ALLOC1 (size: 0, align: 1) {}
+
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs
new file mode 100644
index 000000000..c92424f29
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs
@@ -0,0 +1,15 @@
+// Verify that we do not ICE when printing an invalid constant.
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
+#![feature(allocator_api)]
+
+use std::alloc::{Allocator, Global, Layout};
+
+// EMIT_MIR issue_117368_print_invalid_constant.main.GVN.diff
+fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug layout => const Layout
+ let layout: Layout = None.unwrap();
+ let ptr: *mut u8 = Global.allocate(layout).unwrap().as_ptr() as _;
+}
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
new file mode 100644
index 000000000..8dbb68899
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
@@ -0,0 +1,87 @@
+// MIR for `filter_mapped` after PreCodegen
+
+fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> () {
+ debug iter => _1;
+ debug f => _2;
+ let mut _0: ();
+ let mut _3: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
+ let mut _4: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
+ let mut _5: &mut std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
+ let mut _8: std::option::Option<U>;
+ let mut _9: isize;
+ let _11: ();
+ scope 1 {
+ debug iter => _4;
+ let _10: U;
+ scope 2 {
+ debug x => _10;
+ }
+ scope 4 (inlined <FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>> as Iterator>::next) {
+ debug self => _5;
+ let mut _6: &mut impl Iterator<Item = T>;
+ let mut _7: &mut impl Fn(T) -> Option<U>;
+ }
+ }
+ scope 3 (inlined <FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>> as IntoIterator>::into_iter) {
+ debug self => _3;
+ }
+
+ bb0: {
+ _3 = <impl Iterator<Item = T> as Iterator>::filter_map::<U, impl Fn(T) -> Option<U>>(move _1, move _2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageLive(_4);
+ _4 = move _3;
+ goto -> bb2;
+ }
+
+ bb2: {
+ StorageLive(_8);
+ _5 = &mut _4;
+ StorageLive(_6);
+ _6 = &mut (_4.0: impl Iterator<Item = T>);
+ StorageLive(_7);
+ _7 = &mut (_4.1: impl Fn(T) -> Option<U>);
+ _8 = <impl Iterator<Item = T> as Iterator>::find_map::<U, &mut impl Fn(T) -> Option<U>>(move _6, move _7) -> [return: bb3, unwind: bb9];
+ }
+
+ bb3: {
+ StorageDead(_7);
+ StorageDead(_6);
+ _9 = discriminant(_8);
+ switchInt(move _9) -> [0: bb4, 1: bb6, otherwise: bb8];
+ }
+
+ bb4: {
+ StorageDead(_8);
+ drop(_4) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_4);
+ return;
+ }
+
+ bb6: {
+ _10 = move ((_8 as Some).0: U);
+ _11 = opaque::<U>(move _10) -> [return: bb7, unwind: bb9];
+ }
+
+ bb7: {
+ StorageDead(_8);
+ goto -> bb2;
+ }
+
+ bb8: {
+ unreachable;
+ }
+
+ bb9 (cleanup): {
+ drop(_4) -> [return: bb10, unwind terminate(cleanup)];
+ }
+
+ bb10 (cleanup): {
+ resume;
+ }
+}
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
new file mode 100644
index 000000000..73a3be7f3
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
@@ -0,0 +1,120 @@
+// MIR for `int_range` after PreCodegen
+
+fn int_range(_1: usize, _2: usize) -> () {
+ debug start => _1;
+ debug end => _2;
+ let mut _0: ();
+ let mut _3: std::ops::Range<usize>;
+ let mut _4: std::ops::Range<usize>;
+ let mut _5: &mut std::ops::Range<usize>;
+ let mut _11: std::option::Option<usize>;
+ let mut _14: isize;
+ let _16: ();
+ scope 1 {
+ debug iter => _4;
+ let _15: usize;
+ scope 2 {
+ debug i => _15;
+ }
+ scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
+ debug self => _5;
+ scope 5 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
+ debug self => _5;
+ let mut _6: &usize;
+ let mut _7: &usize;
+ let mut _10: bool;
+ let _12: usize;
+ let mut _13: usize;
+ scope 6 {
+ debug old => _12;
+ scope 7 {
+ }
+ }
+ scope 8 (inlined std::cmp::impls::<impl PartialOrd for usize>::lt) {
+ debug self => _6;
+ debug other => _7;
+ let mut _8: usize;
+ let mut _9: usize;
+ }
+ }
+ }
+ }
+ scope 3 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) {
+ debug self => _3;
+ }
+
+ bb0: {
+ _3 = std::ops::Range::<usize> { start: _1, end: _2 };
+ StorageLive(_4);
+ _4 = move _3;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageLive(_11);
+ _5 = &mut _4;
+ StorageLive(_12);
+ StorageLive(_10);
+ StorageLive(_6);
+ _6 = &(_4.0: usize);
+ StorageLive(_7);
+ _7 = &(_4.1: usize);
+ StorageLive(_8);
+ _8 = (_4.0: usize);
+ StorageLive(_9);
+ _9 = (_4.1: usize);
+ _10 = Lt(move _8, move _9);
+ StorageDead(_9);
+ StorageDead(_8);
+ switchInt(move _10) -> [0: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ StorageDead(_7);
+ StorageDead(_6);
+ _11 = Option::<usize>::None;
+ goto -> bb5;
+ }
+
+ bb3: {
+ StorageDead(_7);
+ StorageDead(_6);
+ _12 = (_4.0: usize);
+ StorageLive(_13);
+ _13 = <usize as Step>::forward_unchecked(_12, const 1_usize) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ (_4.0: usize) = move _13;
+ StorageDead(_13);
+ _11 = Option::<usize>::Some(_12);
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_10);
+ StorageDead(_12);
+ _14 = discriminant(_11);
+ switchInt(move _14) -> [0: bb6, 1: bb7, otherwise: bb9];
+ }
+
+ bb6: {
+ StorageDead(_11);
+ StorageDead(_4);
+ return;
+ }
+
+ bb7: {
+ _15 = ((_11 as Some).0: usize);
+ _16 = opaque::<usize>(move _15) -> [return: bb8, unwind continue];
+ }
+
+ bb8: {
+ StorageDead(_11);
+ goto -> bb1;
+ }
+
+ bb9: {
+ unreachable;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
new file mode 100644
index 000000000..30bdc1310
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
@@ -0,0 +1,78 @@
+// MIR for `mapped` after PreCodegen
+
+fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
+ debug iter => _1;
+ debug f => _2;
+ let mut _0: ();
+ let mut _3: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
+ let mut _4: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
+ let mut _5: &mut std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
+ let mut _6: std::option::Option<U>;
+ let mut _7: isize;
+ let _9: ();
+ scope 1 {
+ debug iter => _4;
+ let _8: U;
+ scope 2 {
+ debug x => _8;
+ }
+ }
+ scope 3 (inlined <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as IntoIterator>::into_iter) {
+ debug self => _3;
+ }
+
+ bb0: {
+ _3 = <impl Iterator<Item = T> as Iterator>::map::<U, impl Fn(T) -> U>(move _1, move _2) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageLive(_4);
+ _4 = move _3;
+ goto -> bb2;
+ }
+
+ bb2: {
+ StorageLive(_6);
+ StorageLive(_5);
+ _5 = &mut _4;
+ _6 = <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as Iterator>::next(move _5) -> [return: bb3, unwind: bb9];
+ }
+
+ bb3: {
+ StorageDead(_5);
+ _7 = discriminant(_6);
+ switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb8];
+ }
+
+ bb4: {
+ StorageDead(_6);
+ drop(_4) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_4);
+ return;
+ }
+
+ bb6: {
+ _8 = move ((_6 as Some).0: U);
+ _9 = opaque::<U>(move _8) -> [return: bb7, unwind: bb9];
+ }
+
+ bb7: {
+ StorageDead(_6);
+ goto -> bb2;
+ }
+
+ bb8: {
+ unreachable;
+ }
+
+ bb9 (cleanup): {
+ drop(_4) -> [return: bb10, unwind terminate(cleanup)];
+ }
+
+ bb10 (cleanup): {
+ resume;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/loops.rs b/tests/mir-opt/pre-codegen/loops.rs
new file mode 100644
index 000000000..7f9c26f4f
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/loops.rs
@@ -0,0 +1,37 @@
+// skip-filecheck
+// compile-flags: -O -Zmir-opt-level=2 -g
+// needs-unwind
+
+#![crate_type = "lib"]
+
+pub fn int_range(start: usize, end: usize) {
+ for i in start..end {
+ opaque(i)
+ }
+}
+
+pub fn mapped<T, U>(iter: impl Iterator<Item = T>, f: impl Fn(T) -> U) {
+ for x in iter.map(f) {
+ opaque(x)
+ }
+}
+
+pub fn filter_mapped<T, U>(iter: impl Iterator<Item = T>, f: impl Fn(T) -> Option<U>) {
+ for x in iter.filter_map(f) {
+ opaque(x)
+ }
+}
+
+pub fn vec_move(mut v: Vec<impl Sized>) {
+ for x in v {
+ opaque(x)
+ }
+}
+
+#[inline(never)]
+fn opaque(_: impl Sized) {}
+
+// EMIT_MIR loops.int_range.PreCodegen.after.mir
+// EMIT_MIR loops.mapped.PreCodegen.after.mir
+// EMIT_MIR loops.filter_mapped.PreCodegen.after.mir
+// EMIT_MIR loops.vec_move.PreCodegen.after.mir
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
new file mode 100644
index 000000000..cb29473d7
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir
@@ -0,0 +1,76 @@
+// MIR for `vec_move` after PreCodegen
+
+fn vec_move(_1: Vec<impl Sized>) -> () {
+ debug v => _1;
+ let mut _0: ();
+ let mut _2: std::vec::IntoIter<impl Sized>;
+ let mut _3: std::vec::IntoIter<impl Sized>;
+ let mut _4: &mut std::vec::IntoIter<impl Sized>;
+ let mut _5: std::option::Option<impl Sized>;
+ let mut _6: isize;
+ let _8: ();
+ scope 1 {
+ debug iter => _3;
+ let _7: impl Sized;
+ scope 2 {
+ debug x => _7;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ _2 = <Vec<impl Sized> as IntoIterator>::into_iter(move _1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageLive(_3);
+ _3 = move _2;
+ goto -> bb2;
+ }
+
+ bb2: {
+ StorageLive(_5);
+ StorageLive(_4);
+ _4 = &mut _3;
+ _5 = <std::vec::IntoIter<impl Sized> as Iterator>::next(move _4) -> [return: bb3, unwind: bb9];
+ }
+
+ bb3: {
+ StorageDead(_4);
+ _6 = discriminant(_5);
+ switchInt(move _6) -> [0: bb4, 1: bb6, otherwise: bb8];
+ }
+
+ bb4: {
+ StorageDead(_5);
+ drop(_3) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_3);
+ StorageDead(_2);
+ return;
+ }
+
+ bb6: {
+ _7 = move ((_5 as Some).0: impl Sized);
+ _8 = opaque::<impl Sized>(move _7) -> [return: bb7, unwind: bb9];
+ }
+
+ bb7: {
+ StorageDead(_5);
+ goto -> bb2;
+ }
+
+ bb8: {
+ unreachable;
+ }
+
+ bb9 (cleanup): {
+ drop(_3) -> [return: bb10, unwind terminate(cleanup)];
+ }
+
+ bb10 (cleanup): {
+ resume;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir
index 1d2387102..3ca24e152 100644
--- a/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir
@@ -1,16 +1,16 @@
// MIR for `manual_replace` after PreCodegen
fn manual_replace(_1: &mut u32, _2: u32) -> u32 {
- debug r => _1; // in scope 0 at $DIR/mem_replace.rs:+0:23: +0:24
- debug v => _2; // in scope 0 at $DIR/mem_replace.rs:+0:36: +0:37
- let mut _0: u32; // return place in scope 0 at $DIR/mem_replace.rs:+0:47: +0:50
+ debug r => _1;
+ debug v => _2;
+ let mut _0: u32;
scope 1 {
- debug temp => _0; // in scope 1 at $DIR/mem_replace.rs:+1:9: +1:13
+ debug temp => _0;
}
bb0: {
- _0 = (*_1); // scope 0 at $DIR/mem_replace.rs:+1:16: +1:18
- (*_1) = _2; // scope 1 at $DIR/mem_replace.rs:+2:5: +2:11
- return; // scope 0 at $DIR/mem_replace.rs:+4:2: +4:2
+ _0 = (*_1);
+ (*_1) = _2;
+ return;
}
}
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 50e0538c1..713d6cc55 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
@@ -1,34 +1,52 @@
// MIR for `mem_replace` after PreCodegen
fn mem_replace(_1: &mut u32, _2: u32) -> u32 {
- debug r => _1; // in scope 0 at $DIR/mem_replace.rs:+0:20: +0:21
- debug v => _2; // in scope 0 at $DIR/mem_replace.rs:+0:33: +0:34
- let mut _0: u32; // return place in scope 0 at $DIR/mem_replace.rs:+0:44: +0:47
- scope 1 (inlined std::mem::replace::<u32>) { // at $DIR/mem_replace.rs:16:5: 16:28
- debug dest => _1; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- debug src => _2; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- let mut _3: *const u32; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- let mut _4: *mut u32; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ debug r => _1;
+ debug v => _2;
+ let mut _0: u32;
+ scope 1 (inlined std::mem::replace::<u32>) {
+ debug dest => _1;
+ debug src => _2;
scope 2 {
scope 3 {
- debug result => _0; // in scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- scope 7 (inlined std::ptr::write::<u32>) { // at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- debug dst => _4; // in scope 7 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- debug src => _2; // in scope 7 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- let mut _6: *mut u32; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- scope 8 {
- scope 9 (inlined std::ptr::write::runtime::<u32>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- debug dst => _6; // in scope 9 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- }
+ debug result => _0;
+ scope 16 (inlined std::ptr::write::<u32>) {
+ debug dst => _1;
+ debug src => _2;
+ scope 17 {
}
}
}
- scope 4 (inlined std::ptr::read::<u32>) { // at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- debug src => _3; // in scope 4 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- let mut _5: *const u32; // in scope 4 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ scope 4 (inlined std::ptr::read::<u32>) {
+ debug src => _1;
scope 5 {
- scope 6 (inlined std::ptr::read::runtime::<u32>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- debug src => _5; // in scope 6 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ 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 std::ptr::const_ptr::<impl *const u32>::is_null) {
+ debug self => _1;
+ let mut _3: *const u8;
+ scope 9 {
+ scope 10 (inlined std::ptr::const_ptr::<impl *const T>::is_null::runtime_impl) {
+ debug ptr => _3;
+ scope 11 (inlined std::ptr::const_ptr::<impl *const u8>::addr) {
+ debug self => _3;
+ scope 12 {
+ scope 13 (inlined std::ptr::const_ptr::<impl *const u8>::cast::<()>) {
+ debug self => _3;
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 14 (inlined std::ptr::const_ptr::<impl *const u32>::is_aligned) {
+ debug self => _1;
+ scope 15 (inlined align_of::<u32>) {
+ }
+ }
+ }
}
}
}
@@ -36,18 +54,10 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 {
}
bb0: {
- StorageLive(_3); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- _3 = &raw const (*_1); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- StorageLive(_5); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- _0 = (*_3); // scope 5 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- StorageDead(_5); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- StorageDead(_3); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- StorageLive(_4); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- _4 = &raw mut (*_1); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- StorageLive(_6); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- (*_4) = _2; // scope 8 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- StorageDead(_6); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- StorageDead(_4); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- return; // scope 0 at $DIR/mem_replace.rs:+2:2: +2:2
+ 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..18c4653d4 100644
--- a/tests/mir-opt/pre-codegen/mem_replace.rs
+++ b/tests/mir-opt/pre-codegen/mem_replace.rs
@@ -1,6 +1,7 @@
+// skip-filecheck
// 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.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.diff
deleted file mode 100644
index 691aa01a5..000000000
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.diff
+++ /dev/null
@@ -1,59 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
- let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
- let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
- let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- let mut _9: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 2 {
- debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- scope 3 {
- debug z => _9; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
-- _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
-- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
-+ _2 = const (4_i32, false); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
-+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
- }
-
- bb1: {
-- _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
-+ _1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
- StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
- _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
- StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
- _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
- _6 = const 6_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
-- _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
-- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
-+ _7 = const true; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
-+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- }
-
- bb2: {
-- _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
-+ _3 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35
- StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35
- _9 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
- StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff
new file mode 100644
index 000000000..bddd961c9
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff
@@ -0,0 +1,63 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _2: (i32, bool);
+ let mut _4: [i32; 6];
+ let _5: usize;
+ let mut _6: usize;
+ let mut _7: bool;
+ let mut _9: u32;
+ scope 1 {
+ debug x => _1;
+ let _3: i32;
+ scope 2 {
+ debug y => _3;
+ let _8: u32;
+ scope 3 {
+ debug z => _9;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _2 = CheckedAdd(const 2_i32, const 2_i32);
+- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable];
++ _2 = const (4_i32, false);
++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = move (_2.0: i32);
++ _1 = const 4_i32;
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32];
+ StorageLive(_5);
+ _5 = const 3_usize;
+ _6 = const 6_usize;
+- _7 = Lt(_5, _6);
+- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable];
++ _7 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- _3 = _4[_5];
++ _3 = const 3_i32;
+ StorageDead(_5);
+ StorageDead(_4);
+ _9 = const 42_u32;
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (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
new file mode 100644
index 000000000..297ebd79f
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
@@ -0,0 +1,63 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _2: (i32, bool);
+ let mut _4: [i32; 6];
+ let _5: usize;
+ let mut _6: usize;
+ let mut _7: bool;
+ let mut _9: u32;
+ scope 1 {
+ debug x => _1;
+ let _3: i32;
+ scope 2 {
+ debug y => _3;
+ let _8: u32;
+ scope 3 {
+ debug z => _9;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _2 = CheckedAdd(const 2_i32, const 2_i32);
+- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue];
++ _2 = const (4_i32, false);
++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = move (_2.0: i32);
++ _1 = const 4_i32;
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32];
+ StorageLive(_5);
+ _5 = const 3_usize;
+ _6 = const 6_usize;
+- _7 = Lt(_5, _6);
+- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue];
++ _7 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind continue];
+ }
+
+ bb2: {
+- _3 = _4[_5];
++ _3 = const 3_i32;
+ StorageDead(_5);
+ StorageDead(_4);
+ _9 = const 42_u32;
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 04 00 00 00 00 __ __ __ │ .....░░░
+ }
+
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.diff
deleted file mode 100644
index 691aa01a5..000000000
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.diff
+++ /dev/null
@@ -1,59 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
- let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
- let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
- let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- let mut _9: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 2 {
- debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- scope 3 {
- debug z => _9; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
-- _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
-- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
-+ _2 = const (4_i32, false); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
-+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
- }
-
- bb1: {
-- _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
-+ _1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
- StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
- _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
- StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
- _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
- _6 = const 6_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
-- _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
-- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
-+ _7 = const true; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
-+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- }
-
- bb2: {
-- _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
-+ _3 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35
- StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35
- _9 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
- StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff
new file mode 100644
index 000000000..bddd961c9
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff
@@ -0,0 +1,63 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _2: (i32, bool);
+ let mut _4: [i32; 6];
+ let _5: usize;
+ let mut _6: usize;
+ let mut _7: bool;
+ let mut _9: u32;
+ scope 1 {
+ debug x => _1;
+ let _3: i32;
+ scope 2 {
+ debug y => _3;
+ let _8: u32;
+ scope 3 {
+ debug z => _9;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _2 = CheckedAdd(const 2_i32, const 2_i32);
+- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable];
++ _2 = const (4_i32, false);
++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- _1 = move (_2.0: i32);
++ _1 = const 4_i32;
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32];
+ StorageLive(_5);
+ _5 = const 3_usize;
+ _6 = const 6_usize;
+- _7 = Lt(_5, _6);
+- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable];
++ _7 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind unreachable];
+ }
+
+ bb2: {
+- _3 = _4[_5];
++ _3 = const 3_i32;
+ StorageDead(_5);
+ StorageDead(_4);
+ _9 = const 42_u32;
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (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
new file mode 100644
index 000000000..297ebd79f
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
@@ -0,0 +1,63 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _2: (i32, bool);
+ let mut _4: [i32; 6];
+ let _5: usize;
+ let mut _6: usize;
+ let mut _7: bool;
+ let mut _9: u32;
+ scope 1 {
+ debug x => _1;
+ let _3: i32;
+ scope 2 {
+ debug y => _3;
+ let _8: u32;
+ scope 3 {
+ debug z => _9;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _2 = CheckedAdd(const 2_i32, const 2_i32);
+- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue];
++ _2 = const (4_i32, false);
++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+- _1 = move (_2.0: i32);
++ _1 = const 4_i32;
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32];
+ StorageLive(_5);
+ _5 = const 3_usize;
+ _6 = const 6_usize;
+- _7 = Lt(_5, _6);
+- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue];
++ _7 = const true;
++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind continue];
+ }
+
+ bb2: {
+- _3 = _4[_5];
++ _3 = const 3_i32;
+ StorageDead(_5);
+ StorageDead(_4);
+ _9 = const 42_u32;
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 04 00 00 00 00 __ __ __ │ .....░░░
+ }
+
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.mir
deleted file mode 100644
index 7886bf19e..000000000
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.mir
+++ /dev/null
@@ -1,18 +0,0 @@
-// MIR for `main` after PreCodegen
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
- scope 1 {
- debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- scope 2 {
- debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 3 {
- debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
- return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
- }
-}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.panic-abort.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.panic-abort.mir
new file mode 100644
index 000000000..681dadff3
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.panic-abort.mir
@@ -0,0 +1,18 @@
+// MIR for `main` after PreCodegen
+
+fn main() -> () {
+ let mut _0: ();
+ scope 1 {
+ debug x => const 4_i32;
+ scope 2 {
+ debug y => const 3_i32;
+ scope 3 {
+ debug z => const 42_u32;
+ }
+ }
+ }
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.panic-unwind.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.panic-unwind.mir
new file mode 100644
index 000000000..681dadff3
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.panic-unwind.mir
@@ -0,0 +1,18 @@
+// MIR for `main` after PreCodegen
+
+fn main() -> () {
+ let mut _0: ();
+ scope 1 {
+ debug x => const 4_i32;
+ scope 2 {
+ debug y => const 3_i32;
+ scope 3 {
+ debug z => const 42_u32;
+ }
+ }
+ }
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.mir
deleted file mode 100644
index 7886bf19e..000000000
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.mir
+++ /dev/null
@@ -1,18 +0,0 @@
-// MIR for `main` after PreCodegen
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
- scope 1 {
- debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- scope 2 {
- debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 3 {
- debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
- return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
- }
-}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-abort.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-abort.mir
new file mode 100644
index 000000000..681dadff3
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-abort.mir
@@ -0,0 +1,18 @@
+// MIR for `main` after PreCodegen
+
+fn main() -> () {
+ let mut _0: ();
+ scope 1 {
+ debug x => const 4_i32;
+ scope 2 {
+ debug y => const 3_i32;
+ scope 3 {
+ debug z => const 42_u32;
+ }
+ }
+ }
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-unwind.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-unwind.mir
new file mode 100644
index 000000000..681dadff3
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.panic-unwind.mir
@@ -0,0 +1,18 @@
+// MIR for `main` after PreCodegen
+
+fn main() -> () {
+ let mut _0: ();
+ scope 1 {
+ debug x => const 4_i32;
+ scope 2 {
+ debug y => const 3_i32;
+ scope 3 {
+ debug z => const 42_u32;
+ }
+ }
+ }
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff
deleted file mode 100644
index 98cd020da..000000000
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff
+++ /dev/null
@@ -1,71 +0,0 @@
-- // MIR for `main` before ScalarReplacementOfAggregates
-+ // MIR for `main` after ScalarReplacementOfAggregates
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
- let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
- let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
- let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ let mut _10: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ let mut _11: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 2 {
- debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- scope 3 {
- debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
- }
-
- bb1: {
- _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
- StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
- _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
- StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
- _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
- _6 = Len(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- }
-
- bb2: {
- _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35
- StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35
- StorageLive(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
-- StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-- _9 = Point { x: const 12_u32, y: const 42_u32 }; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-- _8 = (_9.1: u32); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38
-- StorageDead(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39
-+ StorageLive(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ StorageLive(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ _10 = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ _11 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ _8 = _11; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38
-+ StorageDead(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39
-+ StorageDead(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39
-+ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39
- nop; // scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +4:2
- StorageDead(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff
new file mode 100644
index 000000000..6e681b4f9
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff
@@ -0,0 +1,71 @@
+- // MIR for `main` before ScalarReplacementOfAggregates
++ // MIR for `main` after ScalarReplacementOfAggregates
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _2: (i32, bool);
+ let mut _4: [i32; 6];
+ let _5: usize;
+ let mut _6: usize;
+ let mut _7: bool;
+ let mut _9: Point;
++ let mut _10: u32;
++ let mut _11: u32;
+ scope 1 {
+ debug x => _1;
+ let _3: i32;
+ scope 2 {
+ debug y => _3;
+ let _8: u32;
+ scope 3 {
+ debug z => _8;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _2 = CheckedAdd(const 2_i32, const 2_i32);
+ assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _1 = move (_2.0: i32);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32];
+ StorageLive(_5);
+ _5 = const 3_usize;
+ _6 = Len(_4);
+ _7 = Lt(_5, _6);
+ assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ _3 = _4[_5];
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_8);
+- StorageLive(_9);
+- _9 = Point { x: const 12_u32, y: const 42_u32 };
+- _8 = (_9.1: u32);
+- StorageDead(_9);
++ StorageLive(_10);
++ StorageLive(_11);
++ nop;
++ _10 = const 12_u32;
++ _11 = const 42_u32;
++ nop;
++ _8 = _11;
++ StorageDead(_10);
++ StorageDead(_11);
++ nop;
+ nop;
+ StorageDead(_8);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff
new file mode 100644
index 000000000..e987969d3
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff
@@ -0,0 +1,71 @@
+- // MIR for `main` before ScalarReplacementOfAggregates
++ // MIR for `main` after ScalarReplacementOfAggregates
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _2: (i32, bool);
+ let mut _4: [i32; 6];
+ let _5: usize;
+ let mut _6: usize;
+ let mut _7: bool;
+ let mut _9: Point;
++ let mut _10: u32;
++ let mut _11: u32;
+ scope 1 {
+ debug x => _1;
+ let _3: i32;
+ scope 2 {
+ debug y => _3;
+ let _8: u32;
+ scope 3 {
+ debug z => _8;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _2 = CheckedAdd(const 2_i32, const 2_i32);
+ assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+ _1 = move (_2.0: i32);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32];
+ StorageLive(_5);
+ _5 = const 3_usize;
+ _6 = Len(_4);
+ _7 = Lt(_5, _6);
+ assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue];
+ }
+
+ bb2: {
+ _3 = _4[_5];
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_8);
+- StorageLive(_9);
+- _9 = Point { x: const 12_u32, y: const 42_u32 };
+- _8 = (_9.1: u32);
+- StorageDead(_9);
++ StorageLive(_10);
++ StorageLive(_11);
++ nop;
++ _10 = const 12_u32;
++ _11 = const 42_u32;
++ nop;
++ _8 = _11;
++ StorageDead(_10);
++ StorageDead(_11);
++ nop;
+ nop;
+ StorageDead(_8);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff
deleted file mode 100644
index 98cd020da..000000000
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff
+++ /dev/null
@@ -1,71 +0,0 @@
-- // MIR for `main` before ScalarReplacementOfAggregates
-+ // MIR for `main` after ScalarReplacementOfAggregates
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
- let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
- let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
- let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ let mut _10: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ let mut _11: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 2 {
- debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- scope 3 {
- debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
- }
-
- bb1: {
- _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18
- StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
- _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31
- StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
- _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33
- _6 = Len(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- }
-
- bb2: {
- _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34
- StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35
- StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35
- StorageLive(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
-- StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-- _9 = Point { x: const 12_u32, y: const 42_u32 }; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-- _8 = (_9.1: u32); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38
-- StorageDead(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39
-+ StorageLive(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ StorageLive(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ _10 = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ _11 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
-+ _8 = _11; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38
-+ StorageDead(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39
-+ StorageDead(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39
-+ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39
- nop; // scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +4:2
- StorageDead(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff
new file mode 100644
index 000000000..6e681b4f9
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff
@@ -0,0 +1,71 @@
+- // MIR for `main` before ScalarReplacementOfAggregates
++ // MIR for `main` after ScalarReplacementOfAggregates
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _2: (i32, bool);
+ let mut _4: [i32; 6];
+ let _5: usize;
+ let mut _6: usize;
+ let mut _7: bool;
+ let mut _9: Point;
++ let mut _10: u32;
++ let mut _11: u32;
+ scope 1 {
+ debug x => _1;
+ let _3: i32;
+ scope 2 {
+ debug y => _3;
+ let _8: u32;
+ scope 3 {
+ debug z => _8;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _2 = CheckedAdd(const 2_i32, const 2_i32);
+ assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _1 = move (_2.0: i32);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32];
+ StorageLive(_5);
+ _5 = const 3_usize;
+ _6 = Len(_4);
+ _7 = Lt(_5, _6);
+ assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ _3 = _4[_5];
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_8);
+- StorageLive(_9);
+- _9 = Point { x: const 12_u32, y: const 42_u32 };
+- _8 = (_9.1: u32);
+- StorageDead(_9);
++ StorageLive(_10);
++ StorageLive(_11);
++ nop;
++ _10 = const 12_u32;
++ _11 = const 42_u32;
++ nop;
++ _8 = _11;
++ StorageDead(_10);
++ StorageDead(_11);
++ nop;
+ nop;
+ StorageDead(_8);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff
new file mode 100644
index 000000000..e987969d3
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff
@@ -0,0 +1,71 @@
+- // MIR for `main` before ScalarReplacementOfAggregates
++ // MIR for `main` after ScalarReplacementOfAggregates
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _2: (i32, bool);
+ let mut _4: [i32; 6];
+ let _5: usize;
+ let mut _6: usize;
+ let mut _7: bool;
+ let mut _9: Point;
++ let mut _10: u32;
++ let mut _11: u32;
+ scope 1 {
+ debug x => _1;
+ let _3: i32;
+ scope 2 {
+ debug y => _3;
+ let _8: u32;
+ scope 3 {
+ debug z => _8;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _2 = CheckedAdd(const 2_i32, const 2_i32);
+ assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+ _1 = move (_2.0: i32);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32];
+ StorageLive(_5);
+ _5 = const 3_usize;
+ _6 = Len(_4);
+ _7 = Lt(_5, _6);
+ assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue];
+ }
+
+ bb2: {
+ _3 = _4[_5];
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageLive(_8);
+- StorageLive(_9);
+- _9 = Point { x: const 12_u32, y: const 42_u32 };
+- _8 = (_9.1: u32);
+- StorageDead(_9);
++ StorageLive(_10);
++ StorageLive(_11);
++ nop;
++ _10 = const 12_u32;
++ _11 = const 42_u32;
++ nop;
++ _8 = _11;
++ StorageDead(_10);
++ StorageDead(_11);
++ nop;
+ nop;
+ StorageDead(_8);
+ StorageDead(_3);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir
deleted file mode 100644
index 5bea94c7f..000000000
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir
+++ /dev/null
@@ -1,18 +0,0 @@
-// MIR for `main` after SimplifyLocals-final
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
- scope 1 {
- debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- scope 2 {
- debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 3 {
- debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
- return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
- }
-}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-abort.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-abort.mir
new file mode 100644
index 000000000..425b95db3
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-abort.mir
@@ -0,0 +1,18 @@
+// MIR for `main` after SimplifyLocals-final
+
+fn main() -> () {
+ let mut _0: ();
+ scope 1 {
+ debug x => const 4_i32;
+ scope 2 {
+ debug y => const 3_i32;
+ scope 3 {
+ debug z => const 42_u32;
+ }
+ }
+ }
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-unwind.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-unwind.mir
new file mode 100644
index 000000000..425b95db3
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.panic-unwind.mir
@@ -0,0 +1,18 @@
+// MIR for `main` after SimplifyLocals-final
+
+fn main() -> () {
+ let mut _0: ();
+ scope 1 {
+ debug x => const 4_i32;
+ scope 2 {
+ debug y => const 3_i32;
+ scope 3 {
+ debug z => const 42_u32;
+ }
+ }
+ }
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir
deleted file mode 100644
index 5bea94c7f..000000000
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir
+++ /dev/null
@@ -1,18 +0,0 @@
-// MIR for `main` after SimplifyLocals-final
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
- scope 1 {
- debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- scope 2 {
- debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 3 {
- debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
- return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
- }
-}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-abort.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-abort.mir
new file mode 100644
index 000000000..425b95db3
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-abort.mir
@@ -0,0 +1,18 @@
+// MIR for `main` after SimplifyLocals-final
+
+fn main() -> () {
+ let mut _0: ();
+ scope 1 {
+ debug x => const 4_i32;
+ scope 2 {
+ debug y => const 3_i32;
+ scope 3 {
+ debug z => const 42_u32;
+ }
+ }
+ }
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-unwind.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-unwind.mir
new file mode 100644
index 000000000..425b95db3
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.panic-unwind.mir
@@ -0,0 +1,18 @@
+// MIR for `main` after SimplifyLocals-final
+
+fn main() -> () {
+ let mut _0: ();
+ scope 1 {
+ debug x => const 4_i32;
+ scope 2 {
+ debug y => const 3_i32;
+ scope 3 {
+ debug z => const 42_u32;
+ }
+ }
+ }
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
index bb32cd3af..bb089ea44 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -C overflow-checks=on
struct Point {
diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir
deleted file mode 100644
index 343a4a5a6..000000000
--- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir
+++ /dev/null
@@ -1,91 +0,0 @@
-// MIR for `forward_loop` after PreCodegen
-
-fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
- debug start => _1; // in scope 0 at $DIR/range_iter.rs:+0:21: +0:26
- debug end => _2; // in scope 0 at $DIR/range_iter.rs:+0:33: +0:36
- debug f => _3; // in scope 0 at $DIR/range_iter.rs:+0:43: +0:44
- let mut _0: (); // return place in scope 0 at $DIR/range_iter.rs:+0:60: +0:60
- let mut _4: std::ops::Range<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24
- let mut _5: std::ops::Range<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24
- let _6: (); // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24
- let mut _7: std::option::Option<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24
- let mut _8: &mut std::ops::Range<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24
- let mut _9: isize; // in scope 0 at $DIR/range_iter.rs:+1:5: +3:6
- let mut _11: &impl Fn(u32); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:10
- let mut _12: (u32,); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:13
- scope 1 {
- debug iter => _5; // in scope 1 at $DIR/range_iter.rs:+1:14: +1:24
- let _10: u32; // in scope 1 at $DIR/range_iter.rs:+1:9: +1:10
- scope 2 {
- debug x => _10; // in scope 2 at $DIR/range_iter.rs:+1:9: +1:10
- }
- scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) { // at $DIR/range_iter.rs:21:14: 21:24
- debug self => _8; // in scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL
- }
- }
- scope 3 (inlined <std::ops::Range<u32> as IntoIterator>::into_iter) { // at $DIR/range_iter.rs:21:14: 21:24
- debug self => _4; // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
- }
-
- bb0: {
- _4 = std::ops::Range::<u32> { start: _1, end: _2 }; // scope 0 at $DIR/range_iter.rs:+1:14: +1:24
- StorageLive(_5); // scope 0 at $DIR/range_iter.rs:+1:14: +1:24
- _5 = move _4; // scope 0 at $DIR/range_iter.rs:+1:14: +1:24
- goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6
- }
-
- bb1: {
- StorageLive(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:24
- _8 = &mut _5; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24
- _7 = <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next(_8) -> [return: bb9, unwind: bb7]; // scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
- // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range<u32>) -> Option<<std::ops::Range<u32> as iter::range::RangeIteratorImpl>::Item> {<std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next}, val: Value(<ZST>) }
- }
-
- bb2: {
- _10 = ((_7 as Some).0: u32); // scope 1 at $DIR/range_iter.rs:+1:9: +1:10
- StorageLive(_11); // scope 2 at $DIR/range_iter.rs:+2:9: +2:10
- _11 = &_3; // scope 2 at $DIR/range_iter.rs:+2:9: +2:10
- StorageLive(_12); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13
- _12 = (_10,); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13
- _6 = <impl Fn(u32) as Fn<(u32,)>>::call(move _11, move _12) -> [return: bb5, unwind: bb7]; // scope 2 at $DIR/range_iter.rs:+2:9: +2:13
- // mir::Constant
- // + span: $DIR/range_iter.rs:22:9: 22:10
- // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(u32), (u32,)) -> <impl Fn(u32) as FnOnce<(u32,)>>::Output {<impl Fn(u32) as Fn<(u32,)>>::call}, val: Value(<ZST>) }
- }
-
- bb3: {
- unreachable; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24
- }
-
- bb4: {
- StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6
- StorageDead(_5); // scope 0 at $DIR/range_iter.rs:+3:5: +3:6
- drop(_3) -> bb6; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2
- }
-
- bb5: {
- StorageDead(_12); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13
- StorageDead(_11); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13
- StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6
- goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6
- }
-
- bb6: {
- return; // scope 0 at $DIR/range_iter.rs:+4:2: +4:2
- }
-
- bb7 (cleanup): {
- drop(_3) -> [return: bb8, unwind terminate]; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2
- }
-
- bb8 (cleanup): {
- resume; // scope 0 at $DIR/range_iter.rs:+0:1: +4:2
- }
-
- bb9: {
- _9 = discriminant(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:24
- switchInt(move _9) -> [0: bb4, 1: bb2, otherwise: bb3]; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24
- }
-}
diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..cd734b10f
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,133 @@
+// MIR for `forward_loop` after PreCodegen
+
+fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
+ debug start => _1;
+ debug end => _2;
+ debug f => _3;
+ let mut _0: ();
+ let mut _4: std::ops::Range<u32>;
+ let mut _5: std::ops::Range<u32>;
+ let mut _6: &mut std::ops::Range<u32>;
+ let mut _12: std::option::Option<u32>;
+ let mut _15: isize;
+ let mut _17: &impl Fn(u32);
+ let mut _18: (u32,);
+ let _19: ();
+ scope 1 {
+ debug iter => _5;
+ let _16: u32;
+ scope 2 {
+ debug x => _16;
+ }
+ scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) {
+ debug self => _6;
+ scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
+ debug self => _6;
+ let mut _7: &u32;
+ let mut _8: &u32;
+ let mut _11: bool;
+ let _13: u32;
+ let mut _14: u32;
+ scope 6 {
+ debug old => _13;
+ scope 7 {
+ }
+ }
+ scope 8 (inlined std::cmp::impls::<impl PartialOrd for u32>::lt) {
+ debug self => _7;
+ debug other => _8;
+ let mut _9: u32;
+ let mut _10: u32;
+ }
+ }
+ }
+ }
+ scope 3 (inlined <std::ops::Range<u32> as IntoIterator>::into_iter) {
+ debug self => _4;
+ }
+
+ bb0: {
+ _4 = std::ops::Range::<u32> { start: _1, end: _2 };
+ StorageLive(_5);
+ _5 = move _4;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageLive(_12);
+ _6 = &mut _5;
+ StorageLive(_13);
+ StorageLive(_11);
+ StorageLive(_7);
+ _7 = &(_5.0: u32);
+ StorageLive(_8);
+ _8 = &(_5.1: u32);
+ StorageLive(_9);
+ _9 = (_5.0: u32);
+ StorageLive(_10);
+ _10 = (_5.1: u32);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<u32>::None;
+ goto -> bb5;
+ }
+
+ bb3: {
+ StorageDead(_8);
+ StorageDead(_7);
+ _13 = (_5.0: u32);
+ StorageLive(_14);
+ _14 = <u32 as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ (_5.0: u32) = move _14;
+ StorageDead(_14);
+ _12 = Option::<u32>::Some(_13);
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10];
+ }
+
+ bb6: {
+ StorageDead(_12);
+ StorageDead(_5);
+ drop(_3) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ return;
+ }
+
+ bb8: {
+ _16 = ((_12 as Some).0: u32);
+ StorageLive(_17);
+ _17 = &_3;
+ StorageLive(_18);
+ _18 = (_16,);
+ _19 = <impl Fn(u32) as Fn<(u32,)>>::call(move _17, move _18) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ StorageDead(_18);
+ StorageDead(_17);
+ StorageDead(_12);
+ goto -> bb1;
+ }
+
+ bb10: {
+ 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
new file mode 100644
index 000000000..3342da545
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,141 @@
+// MIR for `forward_loop` after PreCodegen
+
+fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
+ debug start => _1;
+ debug end => _2;
+ debug f => _3;
+ let mut _0: ();
+ let mut _4: std::ops::Range<u32>;
+ let mut _5: std::ops::Range<u32>;
+ let mut _6: &mut std::ops::Range<u32>;
+ let mut _12: std::option::Option<u32>;
+ let mut _15: isize;
+ let mut _17: &impl Fn(u32);
+ let mut _18: (u32,);
+ let _19: ();
+ scope 1 {
+ debug iter => _5;
+ let _16: u32;
+ scope 2 {
+ debug x => _16;
+ }
+ scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) {
+ debug self => _6;
+ scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
+ debug self => _6;
+ let mut _7: &u32;
+ let mut _8: &u32;
+ let mut _11: bool;
+ let _13: u32;
+ let mut _14: u32;
+ scope 6 {
+ debug old => _13;
+ scope 7 {
+ }
+ }
+ scope 8 (inlined std::cmp::impls::<impl PartialOrd for u32>::lt) {
+ debug self => _7;
+ debug other => _8;
+ let mut _9: u32;
+ let mut _10: u32;
+ }
+ }
+ }
+ }
+ scope 3 (inlined <std::ops::Range<u32> as IntoIterator>::into_iter) {
+ debug self => _4;
+ }
+
+ bb0: {
+ _4 = std::ops::Range::<u32> { start: _1, end: _2 };
+ StorageLive(_5);
+ _5 = move _4;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageLive(_12);
+ _6 = &mut _5;
+ StorageLive(_13);
+ StorageLive(_11);
+ StorageLive(_7);
+ _7 = &(_5.0: u32);
+ StorageLive(_8);
+ _8 = &(_5.1: u32);
+ StorageLive(_9);
+ _9 = (_5.0: u32);
+ StorageLive(_10);
+ _10 = (_5.1: u32);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<u32>::None;
+ goto -> bb5;
+ }
+
+ bb3: {
+ StorageDead(_8);
+ StorageDead(_7);
+ _13 = (_5.0: u32);
+ StorageLive(_14);
+ _14 = <u32 as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind: bb11];
+ }
+
+ bb4: {
+ (_5.0: u32) = move _14;
+ StorageDead(_14);
+ _12 = Option::<u32>::Some(_13);
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10];
+ }
+
+ bb6: {
+ StorageDead(_12);
+ StorageDead(_5);
+ drop(_3) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ return;
+ }
+
+ bb8: {
+ _16 = ((_12 as Some).0: u32);
+ StorageLive(_17);
+ _17 = &_3;
+ StorageLive(_18);
+ _18 = (_16,);
+ _19 = <impl Fn(u32) as Fn<(u32,)>>::call(move _17, move _18) -> [return: bb9, unwind: bb11];
+ }
+
+ bb9: {
+ StorageDead(_18);
+ StorageDead(_17);
+ StorageDead(_12);
+ goto -> bb1;
+ }
+
+ bb10: {
+ unreachable;
+ }
+
+ bb11 (cleanup): {
+ drop(_3) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
+ bb12 (cleanup): {
+ resume;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir
deleted file mode 100644
index f45eabba2..000000000
--- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir
+++ /dev/null
@@ -1,95 +0,0 @@
-// MIR for `inclusive_loop` after PreCodegen
-
-fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
- debug start => _1; // in scope 0 at $DIR/range_iter.rs:+0:23: +0:28
- debug end => _2; // in scope 0 at $DIR/range_iter.rs:+0:35: +0:38
- debug f => _3; // in scope 0 at $DIR/range_iter.rs:+0:45: +0:46
- let mut _0: (); // return place in scope 0 at $DIR/range_iter.rs:+0:62: +0:62
- let mut _4: std::ops::RangeInclusive<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25
- let mut _5: std::ops::RangeInclusive<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25
- let _6: (); // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25
- let mut _7: std::option::Option<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25
- let mut _8: &mut std::ops::RangeInclusive<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25
- let mut _9: isize; // in scope 0 at $DIR/range_iter.rs:+1:5: +3:6
- let mut _11: &impl Fn(u32); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:10
- let mut _12: (u32,); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:13
- scope 1 {
- debug iter => _5; // in scope 1 at $DIR/range_iter.rs:+1:14: +1:25
- let _10: u32; // in scope 1 at $DIR/range_iter.rs:+1:9: +1:10
- scope 2 {
- debug x => _10; // in scope 2 at $DIR/range_iter.rs:+1:9: +1:10
- }
- scope 5 (inlined iter::range::<impl Iterator for RangeInclusive<u32>>::next) { // at $DIR/range_iter.rs:28:14: 28:25
- debug self => _8; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
- }
- }
- scope 3 (inlined RangeInclusive::<u32>::new) { // at $DIR/range_iter.rs:28:14: 28:25
- debug start => _1; // in scope 3 at $SRC_DIR/core/src/ops/range.rs:LL:COL
- debug end => _2; // in scope 3 at $SRC_DIR/core/src/ops/range.rs:LL:COL
- }
- scope 4 (inlined <RangeInclusive<u32> as IntoIterator>::into_iter) { // at $DIR/range_iter.rs:28:14: 28:25
- debug self => _4; // in scope 4 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
- }
-
- bb0: {
- _4 = RangeInclusive::<u32> { start: _1, end: _2, exhausted: const false }; // scope 3 at $SRC_DIR/core/src/ops/range.rs:LL:COL
- StorageLive(_5); // scope 0 at $DIR/range_iter.rs:+1:14: +1:25
- _5 = move _4; // scope 0 at $DIR/range_iter.rs:+1:14: +1:25
- goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6
- }
-
- bb1: {
- StorageLive(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:25
- _8 = &mut _5; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25
- _7 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(_8) -> [return: bb9, unwind: bb7]; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
- // + literal: Const { ty: for<'a> fn(&'a mut RangeInclusive<u32>) -> Option<<RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::Item> {<RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next}, val: Value(<ZST>) }
- }
-
- bb2: {
- _10 = ((_7 as Some).0: u32); // scope 1 at $DIR/range_iter.rs:+1:9: +1:10
- StorageLive(_11); // scope 2 at $DIR/range_iter.rs:+2:9: +2:10
- _11 = &_3; // scope 2 at $DIR/range_iter.rs:+2:9: +2:10
- StorageLive(_12); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13
- _12 = (_10,); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13
- _6 = <impl Fn(u32) as Fn<(u32,)>>::call(move _11, move _12) -> [return: bb5, unwind: bb7]; // scope 2 at $DIR/range_iter.rs:+2:9: +2:13
- // mir::Constant
- // + span: $DIR/range_iter.rs:29:9: 29:10
- // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(u32), (u32,)) -> <impl Fn(u32) as FnOnce<(u32,)>>::Output {<impl Fn(u32) as Fn<(u32,)>>::call}, val: Value(<ZST>) }
- }
-
- bb3: {
- unreachable; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25
- }
-
- bb4: {
- StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6
- StorageDead(_5); // scope 0 at $DIR/range_iter.rs:+3:5: +3:6
- drop(_3) -> bb6; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2
- }
-
- bb5: {
- StorageDead(_12); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13
- StorageDead(_11); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13
- StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6
- goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6
- }
-
- bb6: {
- return; // scope 0 at $DIR/range_iter.rs:+4:2: +4:2
- }
-
- bb7 (cleanup): {
- drop(_3) -> [return: bb8, unwind terminate]; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2
- }
-
- bb8 (cleanup): {
- resume; // scope 0 at $DIR/range_iter.rs:+0:1: +4:2
- }
-
- bb9: {
- _9 = discriminant(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:25
- switchInt(move _9) -> [0: bb4, 1: bb2, otherwise: bb3]; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25
- }
-}
diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..1b23e4213
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,83 @@
+// MIR for `inclusive_loop` after PreCodegen
+
+fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
+ debug start => _1;
+ debug end => _2;
+ debug f => _3;
+ let mut _0: ();
+ let mut _4: std::ops::RangeInclusive<u32>;
+ let mut _5: std::ops::RangeInclusive<u32>;
+ let mut _6: &mut std::ops::RangeInclusive<u32>;
+ let mut _7: std::option::Option<u32>;
+ let mut _8: isize;
+ let mut _10: &impl Fn(u32);
+ let mut _11: (u32,);
+ let _12: ();
+ scope 1 {
+ debug iter => _5;
+ let _9: u32;
+ scope 2 {
+ debug x => _9;
+ }
+ scope 5 (inlined iter::range::<impl Iterator for RangeInclusive<u32>>::next) {
+ debug self => _6;
+ }
+ }
+ scope 3 (inlined RangeInclusive::<u32>::new) {
+ debug start => _1;
+ debug end => _2;
+ }
+ scope 4 (inlined <RangeInclusive<u32> as IntoIterator>::into_iter) {
+ debug self => _4;
+ }
+
+ bb0: {
+ _4 = RangeInclusive::<u32> { start: _1, end: _2, exhausted: const false };
+ StorageLive(_5);
+ _5 = move _4;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageLive(_7);
+ StorageLive(_6);
+ _6 = &mut _5;
+ _7 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _6) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ _8 = discriminant(_7);
+ switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb7];
+ }
+
+ bb3: {
+ StorageDead(_7);
+ StorageDead(_5);
+ drop(_3) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ return;
+ }
+
+ bb5: {
+ _9 = ((_7 as Some).0: u32);
+ StorageLive(_10);
+ _10 = &_3;
+ StorageLive(_11);
+ _11 = (_9,);
+ _12 = <impl Fn(u32) as Fn<(u32,)>>::call(move _10, move _11) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_7);
+ goto -> bb1;
+ }
+
+ bb7: {
+ unreachable;
+ }
+}
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
new file mode 100644
index 000000000..a677e8b43
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,91 @@
+// MIR for `inclusive_loop` after PreCodegen
+
+fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
+ debug start => _1;
+ debug end => _2;
+ debug f => _3;
+ let mut _0: ();
+ let mut _4: std::ops::RangeInclusive<u32>;
+ let mut _5: std::ops::RangeInclusive<u32>;
+ let mut _6: &mut std::ops::RangeInclusive<u32>;
+ let mut _7: std::option::Option<u32>;
+ let mut _8: isize;
+ let mut _10: &impl Fn(u32);
+ let mut _11: (u32,);
+ let _12: ();
+ scope 1 {
+ debug iter => _5;
+ let _9: u32;
+ scope 2 {
+ debug x => _9;
+ }
+ scope 5 (inlined iter::range::<impl Iterator for RangeInclusive<u32>>::next) {
+ debug self => _6;
+ }
+ }
+ scope 3 (inlined RangeInclusive::<u32>::new) {
+ debug start => _1;
+ debug end => _2;
+ }
+ scope 4 (inlined <RangeInclusive<u32> as IntoIterator>::into_iter) {
+ debug self => _4;
+ }
+
+ bb0: {
+ _4 = RangeInclusive::<u32> { start: _1, end: _2, exhausted: const false };
+ StorageLive(_5);
+ _5 = move _4;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageLive(_7);
+ StorageLive(_6);
+ _6 = &mut _5;
+ _7 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _6) -> [return: bb2, unwind: bb8];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ _8 = discriminant(_7);
+ switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb7];
+ }
+
+ bb3: {
+ StorageDead(_7);
+ StorageDead(_5);
+ drop(_3) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ return;
+ }
+
+ bb5: {
+ _9 = ((_7 as Some).0: u32);
+ StorageLive(_10);
+ _10 = &_3;
+ StorageLive(_11);
+ _11 = (_9,);
+ _12 = <impl Fn(u32) as Fn<(u32,)>>::call(move _10, move _11) -> [return: bb6, unwind: bb8];
+ }
+
+ bb6: {
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_7);
+ goto -> bb1;
+ }
+
+ bb7: {
+ unreachable;
+ }
+
+ bb8 (cleanup): {
+ drop(_3) -> [return: bb9, unwind terminate(cleanup)];
+ }
+
+ bb9 (cleanup): {
+ resume;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.mir
deleted file mode 100644
index d013b1b94..000000000
--- a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.mir
+++ /dev/null
@@ -1,20 +0,0 @@
-// MIR for `range_inclusive_iter_next` after PreCodegen
-
-fn range_inclusive_iter_next(_1: &mut RangeInclusive<u32>) -> Option<u32> {
- debug it => _1; // in scope 0 at $DIR/range_iter.rs:+0:34: +0:36
- let mut _0: std::option::Option<u32>; // return place in scope 0 at $DIR/range_iter.rs:+0:67: +0:78
- scope 1 (inlined iter::range::<impl Iterator for RangeInclusive<u32>>::next) { // at $DIR/range_iter.rs:16:8: 16:14
- debug self => _1; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
- }
-
- bb0: {
- _0 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(_1) -> bb1; // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
- // + literal: Const { ty: for<'a> fn(&'a mut RangeInclusive<u32>) -> Option<<RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::Item> {<RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next}, val: Value(<ZST>) }
- }
-
- bb1: {
- return; // scope 0 at $DIR/range_iter.rs:+2:2: +2:2
- }
-}
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..b0f475b4d
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,17 @@
+// MIR for `range_inclusive_iter_next` after PreCodegen
+
+fn range_inclusive_iter_next(_1: &mut RangeInclusive<u32>) -> Option<u32> {
+ debug it => _1;
+ let mut _0: std::option::Option<u32>;
+ scope 1 (inlined iter::range::<impl Iterator for RangeInclusive<u32>>::next) {
+ debug self => _1;
+ }
+
+ bb0: {
+ _0 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 000000000..663ec229f
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,17 @@
+// MIR for `range_inclusive_iter_next` after PreCodegen
+
+fn range_inclusive_iter_next(_1: &mut RangeInclusive<u32>) -> Option<u32> {
+ debug it => _1;
+ let mut _0: std::option::Option<u32>;
+ scope 1 (inlined iter::range::<impl Iterator for RangeInclusive<u32>>::next) {
+ debug self => _1;
+ }
+
+ bb0: {
+ _0 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.mir
deleted file mode 100644
index cae46e2b0..000000000
--- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.mir
+++ /dev/null
@@ -1,20 +0,0 @@
-// MIR for `range_iter_next` after PreCodegen
-
-fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
- debug it => _1; // in scope 0 at $DIR/range_iter.rs:+0:24: +0:26
- let mut _0: std::option::Option<u32>; // return place in scope 0 at $DIR/range_iter.rs:+0:48: +0:59
- scope 1 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) { // at $DIR/range_iter.rs:11:8: 11:14
- debug self => _1; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
- }
-
- bb0: {
- _0 = <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next(_1) -> bb1; // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
- // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range<u32>) -> Option<<std::ops::Range<u32> as iter::range::RangeIteratorImpl>::Item> {<std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next}, val: Value(<ZST>) }
- }
-
- bb1: {
- return; // scope 0 at $DIR/range_iter.rs:+2:2: +2:2
- }
-}
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..6ed3d73b1
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,73 @@
+// MIR for `range_iter_next` after PreCodegen
+
+fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
+ debug it => _1;
+ let mut _0: std::option::Option<u32>;
+ scope 1 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) {
+ debug self => _1;
+ scope 2 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
+ debug self => _1;
+ let mut _2: &u32;
+ let mut _3: &u32;
+ let mut _6: bool;
+ let _7: u32;
+ let mut _8: u32;
+ scope 3 {
+ debug old => _7;
+ scope 4 {
+ }
+ }
+ scope 5 (inlined std::cmp::impls::<impl PartialOrd for u32>::lt) {
+ debug self => _2;
+ debug other => _3;
+ let mut _4: u32;
+ let mut _5: u32;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_7);
+ StorageLive(_6);
+ StorageLive(_2);
+ _2 = &((*_1).0: u32);
+ StorageLive(_3);
+ _3 = &((*_1).1: u32);
+ StorageLive(_4);
+ _4 = ((*_1).0: u32);
+ StorageLive(_5);
+ _5 = ((*_1).1: u32);
+ _6 = Lt(move _4, move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ switchInt(move _6) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = Option::<u32>::None;
+ goto -> bb4;
+ }
+
+ bb2: {
+ StorageDead(_3);
+ StorageDead(_2);
+ _7 = ((*_1).0: u32);
+ StorageLive(_8);
+ _8 = <u32 as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ ((*_1).0: u32) = move _8;
+ StorageDead(_8);
+ _0 = Option::<u32>::Some(_7);
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageDead(_6);
+ StorageDead(_7);
+ return;
+ }
+}
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
new file mode 100644
index 000000000..a030647de
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,73 @@
+// MIR for `range_iter_next` after PreCodegen
+
+fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
+ debug it => _1;
+ let mut _0: std::option::Option<u32>;
+ scope 1 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) {
+ debug self => _1;
+ scope 2 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
+ debug self => _1;
+ let mut _2: &u32;
+ let mut _3: &u32;
+ let mut _6: bool;
+ let _7: u32;
+ let mut _8: u32;
+ scope 3 {
+ debug old => _7;
+ scope 4 {
+ }
+ }
+ scope 5 (inlined std::cmp::impls::<impl PartialOrd for u32>::lt) {
+ debug self => _2;
+ debug other => _3;
+ let mut _4: u32;
+ let mut _5: u32;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_7);
+ StorageLive(_6);
+ StorageLive(_2);
+ _2 = &((*_1).0: u32);
+ StorageLive(_3);
+ _3 = &((*_1).1: u32);
+ StorageLive(_4);
+ _4 = ((*_1).0: u32);
+ StorageLive(_5);
+ _5 = ((*_1).1: u32);
+ _6 = Lt(move _4, move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ switchInt(move _6) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = Option::<u32>::None;
+ goto -> bb4;
+ }
+
+ bb2: {
+ StorageDead(_3);
+ StorageDead(_2);
+ _7 = ((*_1).0: u32);
+ StorageLive(_8);
+ _8 = <u32 as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ ((*_1).0: u32) = move _8;
+ StorageDead(_8);
+ _0 = Option::<u32>::Some(_7);
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageDead(_6);
+ StorageDead(_7);
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/range_iter.rs b/tests/mir-opt/pre-codegen/range_iter.rs
index fe21d4dfd..80b1a5b2f 100644
--- a/tests/mir-opt/pre-codegen/range_iter.rs
+++ b/tests/mir-opt/pre-codegen/range_iter.rs
@@ -1,6 +1,7 @@
+// skip-filecheck
// 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 986ab3588..af5d385a9 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
@@ -1,56 +1,48 @@
// MIR for `ezmap` after PreCodegen
fn ezmap(_1: Option<i32>) -> Option<i32> {
- debug x => _1; // in scope 0 at $DIR/simple_option_map.rs:+0:14: +0:15
- let mut _0: std::option::Option<i32>; // return place in scope 0 at $DIR/simple_option_map.rs:+0:33: +0:44
- let mut _6: i32; // in scope 0 at $DIR/simple_option_map.rs:11:25: 11:29
- scope 1 (inlined map::<i32, i32, [closure@$DIR/simple_option_map.rs:18:12: 18:15]>) { // at $DIR/simple_option_map.rs:18:5: 18:22
- debug slf => _1; // in scope 1 at $DIR/simple_option_map.rs:6:17: 6:20
- debug f => const ZeroSized: [closure@$DIR/simple_option_map.rs:18:12: 18:15]; // in scope 1 at $DIR/simple_option_map.rs:6:33: 6:34
- let mut _2: isize; // in scope 1 at $DIR/simple_option_map.rs:11:9: 11:16
- let _3: i32; // in scope 1 at $DIR/simple_option_map.rs:11:14: 11:15
- let mut _4: i32; // in scope 1 at $DIR/simple_option_map.rs:11:25: 11:29
- let mut _5: (i32,); // in scope 1 at $DIR/simple_option_map.rs:11:25: 11:29
+ 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}>) {
+ debug slf => _1;
+ debug f => const ZeroSized: {closure@$DIR/simple_option_map.rs:18:12: 18:15};
+ let mut _2: isize;
+ let _3: i32;
+ let mut _4: i32;
scope 2 {
- debug x => _3; // in scope 2 at $DIR/simple_option_map.rs:11:14: 11:15
- scope 3 (inlined ezmap::{closure#0}) { // at $DIR/simple_option_map.rs:11:25: 11:29
- debug n => _6; // in scope 3 at $DIR/simple_option_map.rs:+1:13: +1:14
+ debug x => _3;
+ scope 3 (inlined ezmap::{closure#0}) {
+ debug n => _3;
}
}
}
bb0: {
- StorageLive(_3); // scope 0 at $DIR/simple_option_map.rs:+1:5: +1:22
- _2 = discriminant(_1); // scope 1 at $DIR/simple_option_map.rs:10:11: 10:14
- switchInt(move _2) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 1 at $DIR/simple_option_map.rs:10:5: 10:14
+ StorageLive(_2);
+ _2 = discriminant(_1);
+ switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4];
}
bb1: {
- _0 = Option::<i32>::None; // scope 1 at $DIR/simple_option_map.rs:12:17: 12:21
- goto -> bb4; // scope 1 at $DIR/simple_option_map.rs:12:17: 12:21
+ _0 = Option::<i32>::None;
+ goto -> bb3;
}
bb2: {
- unreachable; // scope 1 at $DIR/simple_option_map.rs:10:11: 10:14
+ _3 = ((_1 as Some).0: i32);
+ StorageLive(_4);
+ _4 = Add(_3, const 1_i32);
+ _0 = Option::<i32>::Some(move _4);
+ StorageDead(_4);
+ goto -> bb3;
}
bb3: {
- _3 = ((_1 as Some).0: i32); // scope 1 at $DIR/simple_option_map.rs:11:14: 11:15
- StorageLive(_4); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29
- StorageLive(_5); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29
- _5 = (move _3,); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29
- StorageLive(_6); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29
- _6 = move (_5.0: i32); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29
- _4 = Add(_6, const 1_i32); // scope 3 at $DIR/simple_option_map.rs:+1:16: +1:21
- StorageDead(_6); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29
- StorageDead(_5); // scope 2 at $DIR/simple_option_map.rs:11:28: 11:29
- _0 = Option::<i32>::Some(move _4); // scope 2 at $DIR/simple_option_map.rs:11:20: 11:30
- StorageDead(_4); // scope 2 at $DIR/simple_option_map.rs:11:29: 11:30
- goto -> bb4; // scope 1 at $DIR/simple_option_map.rs:14:1: 14:2
+ StorageDead(_2);
+ return;
}
bb4: {
- StorageDead(_3); // scope 0 at $DIR/simple_option_map.rs:+1:5: +1:22
- return; // scope 0 at $DIR/simple_option_map.rs:+2:2: +2:2
+ unreachable;
}
}
diff --git a/tests/mir-opt/pre-codegen/simple_option_map.rs b/tests/mir-opt/pre-codegen/simple_option_map.rs
index fb3da68e4..35f9ab3e1 100644
--- a/tests/mir-opt/pre-codegen/simple_option_map.rs
+++ b/tests/mir-opt/pre-codegen/simple_option_map.rs
@@ -1,6 +1,6 @@
+// skip-filecheck
// 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.rs b/tests/mir-opt/pre-codegen/slice_filter.rs
new file mode 100644
index 000000000..483e58766
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_filter.rs
@@ -0,0 +1,16 @@
+// skip-filecheck
+// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
+// ignore-debug: standard library debug assertions add a panic that breaks this optimization
+
+#![crate_type = "lib"]
+
+pub fn variant_a(input: &[(usize, usize, usize, usize)]) -> usize {
+ input.iter().filter(|(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count()
+}
+
+pub fn variant_b(input: &[(usize, usize, usize, usize)]) -> usize {
+ input.iter().filter(|&&(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count()
+}
+
+// EMIT_MIR slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
+// EMIT_MIR slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
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
new file mode 100644
index 000000000..05f16cdac
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
@@ -0,0 +1,243 @@
+// MIR for `variant_a::{closure#0}` after PreCodegen
+
+fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2: &&(usize, usize, usize, usize)) -> bool {
+ let mut _0: bool;
+ let mut _3: &(usize, usize, usize, usize);
+ let _4: &usize;
+ let mut _5: &(usize, usize, usize, usize);
+ let _6: &usize;
+ let mut _7: &(usize, usize, usize, usize);
+ let _8: &usize;
+ let mut _9: &(usize, usize, usize, usize);
+ let _10: &usize;
+ let mut _11: &&usize;
+ let _12: &usize;
+ let mut _13: &&usize;
+ let mut _18: bool;
+ let mut _19: &&usize;
+ let _20: &usize;
+ let mut _21: &&usize;
+ let mut _26: bool;
+ let mut _27: &&usize;
+ let _28: &usize;
+ let mut _29: &&usize;
+ let mut _34: bool;
+ let mut _35: &&usize;
+ let _36: &usize;
+ let mut _37: &&usize;
+ scope 1 {
+ debug a => _4;
+ debug b => _6;
+ debug c => _8;
+ debug d => _10;
+ scope 2 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) {
+ debug self => _11;
+ debug other => _13;
+ let mut _14: &usize;
+ let mut _15: &usize;
+ scope 3 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) {
+ debug self => _14;
+ debug other => _15;
+ let mut _16: usize;
+ let mut _17: usize;
+ }
+ }
+ scope 4 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) {
+ debug self => _19;
+ debug other => _21;
+ let mut _22: &usize;
+ let mut _23: &usize;
+ scope 5 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) {
+ debug self => _22;
+ debug other => _23;
+ let mut _24: usize;
+ let mut _25: usize;
+ }
+ }
+ scope 6 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) {
+ debug self => _27;
+ debug other => _29;
+ let mut _30: &usize;
+ let mut _31: &usize;
+ scope 7 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) {
+ debug self => _30;
+ debug other => _31;
+ let mut _32: usize;
+ let mut _33: usize;
+ }
+ }
+ scope 8 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) {
+ debug self => _35;
+ debug other => _37;
+ let mut _38: &usize;
+ let mut _39: &usize;
+ scope 9 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) {
+ debug self => _38;
+ debug other => _39;
+ let mut _40: usize;
+ let mut _41: usize;
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_4);
+ _3 = deref_copy (*_2);
+ _4 = &((*_3).0: usize);
+ StorageLive(_6);
+ _5 = deref_copy (*_2);
+ _6 = &((*_5).1: usize);
+ StorageLive(_8);
+ _7 = deref_copy (*_2);
+ _8 = &((*_7).2: usize);
+ StorageLive(_10);
+ _9 = deref_copy (*_2);
+ _10 = &((*_9).3: usize);
+ StorageLive(_18);
+ StorageLive(_11);
+ _11 = &_4;
+ StorageLive(_13);
+ StorageLive(_12);
+ _12 = _8;
+ _13 = &_12;
+ StorageLive(_14);
+ StorageLive(_15);
+ _14 = deref_copy _4;
+ _15 = deref_copy _12;
+ StorageLive(_16);
+ _16 = (*_14);
+ StorageLive(_17);
+ _17 = (*_15);
+ _18 = Le(move _16, move _17);
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageDead(_15);
+ StorageDead(_14);
+ switchInt(move _18) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageDead(_12);
+ StorageDead(_13);
+ StorageDead(_11);
+ goto -> bb4;
+ }
+
+ bb2: {
+ StorageDead(_12);
+ StorageDead(_13);
+ StorageDead(_11);
+ StorageLive(_26);
+ StorageLive(_19);
+ _19 = &_10;
+ StorageLive(_21);
+ StorageLive(_20);
+ _20 = _6;
+ _21 = &_20;
+ StorageLive(_22);
+ StorageLive(_23);
+ _22 = deref_copy _10;
+ _23 = deref_copy _20;
+ StorageLive(_24);
+ _24 = (*_22);
+ StorageLive(_25);
+ _25 = (*_23);
+ _26 = Le(move _24, move _25);
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageDead(_22);
+ switchInt(move _26) -> [0: bb3, otherwise: bb8];
+ }
+
+ bb3: {
+ StorageDead(_20);
+ StorageDead(_21);
+ StorageDead(_19);
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageLive(_34);
+ StorageLive(_27);
+ _27 = &_8;
+ StorageLive(_29);
+ StorageLive(_28);
+ _28 = _4;
+ _29 = &_28;
+ StorageLive(_30);
+ StorageLive(_31);
+ _30 = deref_copy _8;
+ _31 = deref_copy _28;
+ StorageLive(_32);
+ _32 = (*_30);
+ StorageLive(_33);
+ _33 = (*_31);
+ _34 = Le(move _32, move _33);
+ StorageDead(_33);
+ StorageDead(_32);
+ StorageDead(_31);
+ StorageDead(_30);
+ switchInt(move _34) -> [0: bb5, otherwise: bb6];
+ }
+
+ bb5: {
+ StorageDead(_28);
+ StorageDead(_29);
+ StorageDead(_27);
+ _0 = const false;
+ goto -> bb7;
+ }
+
+ bb6: {
+ StorageDead(_28);
+ StorageDead(_29);
+ StorageDead(_27);
+ StorageLive(_35);
+ _35 = &_6;
+ StorageLive(_37);
+ StorageLive(_36);
+ _36 = _10;
+ _37 = &_36;
+ StorageLive(_38);
+ StorageLive(_39);
+ _38 = deref_copy _6;
+ _39 = deref_copy _36;
+ StorageLive(_40);
+ _40 = (*_38);
+ StorageLive(_41);
+ _41 = (*_39);
+ _0 = Le(move _40, move _41);
+ StorageDead(_41);
+ StorageDead(_40);
+ StorageDead(_39);
+ StorageDead(_38);
+ StorageDead(_36);
+ StorageDead(_37);
+ StorageDead(_35);
+ goto -> bb7;
+ }
+
+ bb7: {
+ StorageDead(_34);
+ goto -> bb9;
+ }
+
+ bb8: {
+ StorageDead(_20);
+ StorageDead(_21);
+ StorageDead(_19);
+ _0 = const true;
+ goto -> bb9;
+ }
+
+ bb9: {
+ StorageDead(_26);
+ StorageDead(_18);
+ StorageDead(_10);
+ StorageDead(_8);
+ StorageDead(_6);
+ StorageDead(_4);
+ return;
+ }
+}
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
new file mode 100644
index 000000000..e2ed1d101
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
@@ -0,0 +1,74 @@
+// MIR for `variant_b::{closure#0}` after PreCodegen
+
+fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:12:25: 12:41}, _2: &&(usize, usize, usize, usize)) -> bool {
+ let mut _0: bool;
+ let mut _3: &(usize, usize, usize, usize);
+ let _4: usize;
+ let mut _5: &(usize, usize, usize, usize);
+ let _6: usize;
+ let mut _7: &(usize, usize, usize, usize);
+ let _8: usize;
+ let mut _9: &(usize, usize, usize, usize);
+ let _10: usize;
+ let mut _11: bool;
+ let mut _12: bool;
+ let mut _13: bool;
+ scope 1 {
+ debug a => _4;
+ debug b => _6;
+ debug c => _8;
+ debug d => _10;
+ }
+
+ bb0: {
+ _3 = deref_copy (*_2);
+ _4 = ((*_3).0: usize);
+ _5 = deref_copy (*_2);
+ _6 = ((*_5).1: usize);
+ _7 = deref_copy (*_2);
+ _8 = ((*_7).2: usize);
+ _9 = deref_copy (*_2);
+ _10 = ((*_9).3: usize);
+ StorageLive(_11);
+ _11 = Le(_4, _8);
+ switchInt(move _11) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageLive(_12);
+ _12 = Le(_10, _6);
+ switchInt(move _12) -> [0: bb2, otherwise: bb6];
+ }
+
+ bb2: {
+ StorageLive(_13);
+ _13 = Le(_8, _4);
+ switchInt(move _13) -> [0: bb3, otherwise: bb4];
+ }
+
+ bb3: {
+ _0 = const false;
+ goto -> bb5;
+ }
+
+ bb4: {
+ _0 = Le(_6, _10);
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_13);
+ goto -> bb7;
+ }
+
+ bb6: {
+ _0 = const true;
+ goto -> bb7;
+ }
+
+ bb7: {
+ 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 44b456276..5225fc5c6 100644
--- a/tests/mir-opt/pre-codegen/slice_index.rs
+++ b/tests/mir-opt/pre-codegen/slice_index.rs
@@ -1,6 +1,8 @@
+// skip-filecheck
// 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.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir
deleted file mode 100644
index 715a1e3fc..000000000
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir
+++ /dev/null
@@ -1,105 +0,0 @@
-// MIR for `slice_get_mut_usize` after PreCodegen
-
-fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
- debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:28: +0:33
- debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:47: +0:52
- let mut _0: std::option::Option<&mut u32>; // return place in scope 0 at $DIR/slice_index.rs:+0:64: +0:80
- scope 1 (inlined core::slice::<impl [u32]>::get_mut::<usize>) { // at $DIR/slice_index.rs:16:11: 16:25
- debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- scope 2 (inlined <usize as SliceIndex<[u32]>>::get_mut) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- debug self => _2; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- debug slice => _1; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let mut _3: bool; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let mut _4: usize; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let mut _5: &[u32]; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let mut _6: &mut u32; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let mut _7: *mut u32; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let mut _8: *mut [u32]; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- scope 3 {
- scope 4 (inlined <usize as SliceIndex<[u32]>>::get_unchecked_mut) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
- debug self => _2; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- debug slice => _8; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let mut _9: *mut u32; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let mut _10: usize; // in scope 4 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- let mut _11: *mut [u32]; // in scope 4 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- scope 5 {
- debug this => _2; // in scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- scope 6 {
- scope 7 (inlined <usize as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- debug this => _10; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- debug slice => _11; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
- debug self => _11; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- let mut _12: *const [u32]; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- scope 9 (inlined std::ptr::metadata::<[u32]>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- debug ptr => _12; // in scope 9 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- scope 10 {
- }
- }
- }
- }
- scope 11 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
- debug self => _8; // in scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- }
- scope 12 (inlined ptr::mut_ptr::<impl *mut u32>::add) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
- debug self => _9; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- debug count => _2; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- scope 13 {
- }
- }
- }
- }
- }
- }
- }
- }
-
- bb0: {
- StorageLive(_6); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageLive(_3); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageLive(_4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageLive(_5); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- _5 = &(*_1); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- _4 = Len((*_5)); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageDead(_5); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- _3 = Lt(_2, move _4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageDead(_4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- }
-
- bb1: {
- StorageLive(_7); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageLive(_8); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- _8 = &raw mut (*_1); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageLive(_10); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageLive(_11); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageLive(_12); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageLive(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- _9 = _8 as *mut u32 (PtrToPtr); // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- _7 = Offset(_9, _2); // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- StorageDead(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageDead(_12); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageDead(_11); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageDead(_10); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageDead(_8); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- _6 = &mut (*_7); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- _0 = Option::<&mut u32>::Some(_6); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageDead(_7); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- goto -> bb3; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- }
-
- bb2: {
- _0 = const Option::<&mut u32>::None; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- // mir::Constant
- // + span: no-location
- // + literal: Const { ty: Option<&mut u32>, val: Value(Scalar(0x0000000000000000)) }
- goto -> bb3; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- }
-
- bb3: {
- StorageDead(_3); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageDead(_6); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2
- }
-}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..e4d9060d4
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,92 @@
+// MIR for `slice_get_mut_usize` after PreCodegen
+
+fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
+ debug slice => _1;
+ debug index => _2;
+ let mut _0: std::option::Option<&mut u32>;
+ scope 1 (inlined core::slice::<impl [u32]>::get_mut::<usize>) {
+ debug self => _1;
+ debug index => _2;
+ scope 2 (inlined <usize as SliceIndex<[u32]>>::get_mut) {
+ debug self => _2;
+ debug slice => _1;
+ let mut _3: usize;
+ let mut _4: bool;
+ let mut _5: *mut [u32];
+ let mut _7: *mut u32;
+ let mut _8: &mut u32;
+ scope 3 {
+ scope 4 (inlined <usize as SliceIndex<[u32]>>::get_unchecked_mut) {
+ debug self => _2;
+ debug slice => _5;
+ let mut _6: *mut u32;
+ let mut _9: &[&str];
+ scope 5 {
+ scope 10 (inlined std::ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
+ debug self => _5;
+ }
+ scope 11 (inlined std::ptr::mut_ptr::<impl *mut u32>::add) {
+ debug self => _6;
+ debug count => _2;
+ scope 12 {
+ }
+ }
+ }
+ scope 6 (inlined std::ptr::mut_ptr::<impl *mut [u32]>::len) {
+ debug self => _5;
+ let mut _10: *const [u32];
+ scope 7 (inlined std::ptr::metadata::<[u32]>) {
+ debug ptr => _10;
+ scope 8 {
+ }
+ }
+ }
+ scope 9 (inlined Arguments::<'_>::new_const) {
+ debug pieces => _9;
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_7);
+ StorageLive(_4);
+ StorageLive(_3);
+ _3 = Len((*_1));
+ _4 = Lt(_2, move _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);
+ StorageLive(_9);
+ StorageLive(_10);
+ StorageLive(_6);
+ _6 = _5 as *mut u32 (PtrToPtr);
+ _7 = Offset(_6, _2);
+ StorageDead(_6);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_5);
+ _8 = &mut (*_7);
+ _0 = Option::<&mut u32>::Some(move _8);
+ StorageDead(_8);
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_4);
+ StorageDead(_7);
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 000000000..e4d9060d4
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,92 @@
+// MIR for `slice_get_mut_usize` after PreCodegen
+
+fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
+ debug slice => _1;
+ debug index => _2;
+ let mut _0: std::option::Option<&mut u32>;
+ scope 1 (inlined core::slice::<impl [u32]>::get_mut::<usize>) {
+ debug self => _1;
+ debug index => _2;
+ scope 2 (inlined <usize as SliceIndex<[u32]>>::get_mut) {
+ debug self => _2;
+ debug slice => _1;
+ let mut _3: usize;
+ let mut _4: bool;
+ let mut _5: *mut [u32];
+ let mut _7: *mut u32;
+ let mut _8: &mut u32;
+ scope 3 {
+ scope 4 (inlined <usize as SliceIndex<[u32]>>::get_unchecked_mut) {
+ debug self => _2;
+ debug slice => _5;
+ let mut _6: *mut u32;
+ let mut _9: &[&str];
+ scope 5 {
+ scope 10 (inlined std::ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
+ debug self => _5;
+ }
+ scope 11 (inlined std::ptr::mut_ptr::<impl *mut u32>::add) {
+ debug self => _6;
+ debug count => _2;
+ scope 12 {
+ }
+ }
+ }
+ scope 6 (inlined std::ptr::mut_ptr::<impl *mut [u32]>::len) {
+ debug self => _5;
+ let mut _10: *const [u32];
+ scope 7 (inlined std::ptr::metadata::<[u32]>) {
+ debug ptr => _10;
+ scope 8 {
+ }
+ }
+ }
+ scope 9 (inlined Arguments::<'_>::new_const) {
+ debug pieces => _9;
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_7);
+ StorageLive(_4);
+ StorageLive(_3);
+ _3 = Len((*_1));
+ _4 = Lt(_2, move _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);
+ StorageLive(_9);
+ StorageLive(_10);
+ StorageLive(_6);
+ _6 = _5 as *mut u32 (PtrToPtr);
+ _7 = Offset(_6, _2);
+ StorageDead(_6);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_5);
+ _8 = &mut (*_7);
+ _0 = Option::<&mut u32>::Some(move _8);
+ StorageDead(_8);
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_4);
+ StorageDead(_7);
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir
deleted file mode 100644
index 7a10b929e..000000000
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir
+++ /dev/null
@@ -1,134 +0,0 @@
-// MIR for `slice_get_unchecked_mut_range` after PreCodegen
-
-fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> &mut [u32] {
- debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:45: +0:50
- debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:64: +0:69
- let mut _0: &mut [u32]; // return place in scope 0 at $DIR/slice_index.rs:+0:88: +0:98
- scope 1 (inlined core::slice::<impl [u32]>::get_unchecked_mut::<std::ops::Range<usize>>) { // at $DIR/slice_index.rs:26:11: 26:35
- debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- let mut _3: *mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- let mut _4: *mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- scope 2 {
- scope 3 (inlined <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked_mut) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- debug self => _2; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- debug slice => _4; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let _5: std::ops::Range<usize>; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let mut _7: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let mut _8: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let mut _9: *mut u32; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let mut _10: *mut u32; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let mut _11: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let mut _12: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let mut _13: std::ops::Range<usize>; // in scope 3 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- let mut _14: *mut [u32]; // in scope 3 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- scope 4 {
- debug this => _5; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- scope 5 {
- let _6: usize; // in scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- scope 6 {
- debug new_len => _6; // in scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- scope 11 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
- debug self => _4; // in scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- }
- scope 12 (inlined ptr::mut_ptr::<impl *mut u32>::add) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
- debug self => _10; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- debug count => _11; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- scope 13 {
- }
- }
- scope 14 (inlined slice_from_raw_parts_mut::<u32>) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
- debug data => _9; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- debug len => _12; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- let mut _16: *mut (); // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- scope 15 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- debug self => _9; // in scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- }
- scope 16 (inlined std::ptr::from_raw_parts_mut::<[u32]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- debug data_address => _16; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- debug metadata => _12; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- let mut _17: std::ptr::metadata::PtrRepr<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- let mut _18: std::ptr::metadata::PtrComponents<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- let mut _19: *const (); // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- scope 17 {
- }
- }
- }
- }
- scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- debug this => _13; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- debug slice => _14; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
- debug self => _14; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- let mut _15: *const [u32]; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- scope 9 (inlined std::ptr::metadata::<[u32]>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- debug ptr => _15; // in scope 9 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- scope 10 {
- }
- }
- }
- }
- }
- }
- }
- }
- }
-
- bb0: {
- StorageLive(_3); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageLive(_4); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- _4 = &raw mut (*_1); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageLive(_5); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageLive(_13); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageLive(_14); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageLive(_15); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageLive(_6); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageLive(_7); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- _7 = (_2.1: usize); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageLive(_8); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- _8 = (_2.0: usize); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- _6 = unchecked_sub::<usize>(move _7, move _8) -> [return: bb1, unwind unreachable]; // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/slice/index.rs:LL:COL
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize, usize) -> usize {unchecked_sub::<usize>}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_8); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageDead(_7); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageLive(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageLive(_10); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- _10 = _4 as *mut u32 (PtrToPtr); // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- StorageLive(_11); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- _11 = (_2.0: usize); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- _9 = Offset(_10, _11); // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- StorageDead(_11); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageDead(_10); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageLive(_12); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- _12 = _6; // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageLive(_16); // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- _16 = _9 as *mut () (PtrToPtr); // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- StorageLive(_17); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- StorageLive(_18); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- StorageLive(_19); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- _19 = _16 as *const () (Pointer(MutToConstPointer)); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- _18 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _19, metadata: _12 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- StorageDead(_19); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- _17 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _18 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- StorageDead(_18); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- _3 = (_17.1: *mut [u32]); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- StorageDead(_17); // scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
- StorageDead(_16); // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- StorageDead(_12); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageDead(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageDead(_6); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageDead(_15); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageDead(_14); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageDead(_13); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageDead(_5); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageDead(_4); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- _0 = &mut (*_3); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageDead(_3); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2
- }
-}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..0d95f81c3
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,106 @@
+// MIR for `slice_get_unchecked_mut_range` after PreCodegen
+
+fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> &mut [u32] {
+ debug slice => _1;
+ debug index => _2;
+ let mut _0: &mut [u32];
+ let mut _3: 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: 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: 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 mut _14: &[&str];
+ scope 4 {
+ let _6: usize;
+ scope 5 {
+ debug new_len => _6;
+ scope 10 (inlined std::ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
+ debug self => _5;
+ }
+ scope 11 (inlined std::ptr::mut_ptr::<impl *mut u32>::add) {
+ debug self => _7;
+ debug count => _3;
+ scope 12 {
+ }
+ }
+ scope 13 (inlined slice_from_raw_parts_mut::<u32>) {
+ debug data => _8;
+ debug len => _6;
+ let mut _9: *mut ();
+ scope 14 (inlined std::ptr::mut_ptr::<impl *mut u32>::cast::<()>) {
+ debug self => _8;
+ }
+ scope 15 (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 16 {
+ }
+ }
+ }
+ }
+ }
+ scope 6 (inlined std::ptr::mut_ptr::<impl *mut [u32]>::len) {
+ debug self => _5;
+ let mut _15: *const [u32];
+ scope 7 (inlined std::ptr::metadata::<[u32]>) {
+ debug ptr => _15;
+ scope 8 {
+ }
+ }
+ }
+ scope 9 (inlined Arguments::<'_>::new_const) {
+ debug pieces => _14;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ _3 = move (_2.0: usize);
+ _4 = move (_2.1: usize);
+ StorageLive(_5);
+ _5 = &raw mut (*_1);
+ StorageLive(_14);
+ StorageLive(_6);
+ StorageLive(_15);
+ _6 = SubUnchecked(_4, _3);
+ StorageLive(_8);
+ StorageLive(_7);
+ _7 = _5 as *mut u32 (PtrToPtr);
+ _8 = Offset(_7, _3);
+ StorageDead(_7);
+ StorageLive(_9);
+ _9 = _8 as *mut () (PtrToPtr);
+ StorageLive(_12);
+ StorageLive(_11);
+ StorageLive(_10);
+ _10 = _9 as *const () (PointerCoercion(MutToConstPointer));
+ _11 = std::ptr::metadata::PtrComponents::<[u32]> { data_address: move _10, metadata: _6 };
+ StorageDead(_10);
+ _12 = std::ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _11 };
+ StorageDead(_11);
+ _13 = (_12.1: *mut [u32]);
+ StorageDead(_12);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_15);
+ StorageDead(_6);
+ StorageDead(_14);
+ 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
new file mode 100644
index 000000000..0d95f81c3
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,106 @@
+// MIR for `slice_get_unchecked_mut_range` after PreCodegen
+
+fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> &mut [u32] {
+ debug slice => _1;
+ debug index => _2;
+ let mut _0: &mut [u32];
+ let mut _3: 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: 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: 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 mut _14: &[&str];
+ scope 4 {
+ let _6: usize;
+ scope 5 {
+ debug new_len => _6;
+ scope 10 (inlined std::ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) {
+ debug self => _5;
+ }
+ scope 11 (inlined std::ptr::mut_ptr::<impl *mut u32>::add) {
+ debug self => _7;
+ debug count => _3;
+ scope 12 {
+ }
+ }
+ scope 13 (inlined slice_from_raw_parts_mut::<u32>) {
+ debug data => _8;
+ debug len => _6;
+ let mut _9: *mut ();
+ scope 14 (inlined std::ptr::mut_ptr::<impl *mut u32>::cast::<()>) {
+ debug self => _8;
+ }
+ scope 15 (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 16 {
+ }
+ }
+ }
+ }
+ }
+ scope 6 (inlined std::ptr::mut_ptr::<impl *mut [u32]>::len) {
+ debug self => _5;
+ let mut _15: *const [u32];
+ scope 7 (inlined std::ptr::metadata::<[u32]>) {
+ debug ptr => _15;
+ scope 8 {
+ }
+ }
+ }
+ scope 9 (inlined Arguments::<'_>::new_const) {
+ debug pieces => _14;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ _3 = move (_2.0: usize);
+ _4 = move (_2.1: usize);
+ StorageLive(_5);
+ _5 = &raw mut (*_1);
+ StorageLive(_14);
+ StorageLive(_6);
+ StorageLive(_15);
+ _6 = SubUnchecked(_4, _3);
+ StorageLive(_8);
+ StorageLive(_7);
+ _7 = _5 as *mut u32 (PtrToPtr);
+ _8 = Offset(_7, _3);
+ StorageDead(_7);
+ StorageLive(_9);
+ _9 = _8 as *mut () (PtrToPtr);
+ StorageLive(_12);
+ StorageLive(_11);
+ StorageLive(_10);
+ _10 = _9 as *const () (PointerCoercion(MutToConstPointer));
+ _11 = std::ptr::metadata::PtrComponents::<[u32]> { data_address: move _10, metadata: _6 };
+ StorageDead(_10);
+ _12 = std::ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _11 };
+ StorageDead(_11);
+ _13 = (_12.1: *mut [u32]);
+ StorageDead(_12);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_15);
+ StorageDead(_6);
+ StorageDead(_14);
+ StorageDead(_5);
+ _0 = &mut (*_13);
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir
deleted file mode 100644
index dcf79a4a4..000000000
--- a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir
+++ /dev/null
@@ -1,26 +0,0 @@
-// MIR for `slice_index_range` after PreCodegen
-
-fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] {
- debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:26: +0:31
- debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:41: +0:46
- let mut _0: &[u32]; // return place in scope 0 at $DIR/slice_index.rs:+0:65: +0:71
- scope 1 (inlined #[track_caller] core::slice::index::<impl Index<std::ops::Range<usize>> for [u32]>::index) { // at $DIR/slice_index.rs:21:6: 21:18
- debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- let _3: &[u32]; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- }
-
- bb0: {
- StorageLive(_3); // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- _3 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, _1) -> bb1; // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/slice/index.rs:LL:COL
- // + literal: Const { ty: for<'a> fn(std::ops::Range<usize>, &'a [u32]) -> &'a <std::ops::Range<usize> as SliceIndex<[u32]>>::Output {<std::ops::Range<usize> as SliceIndex<[u32]>>::index}, val: Value(<ZST>) }
- }
-
- bb1: {
- _0 = _3; // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- StorageDead(_3); // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL
- return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2
- }
-}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..d97c96ac8
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,19 @@
+// MIR for `slice_index_range` after PreCodegen
+
+fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] {
+ debug slice => _1;
+ debug index => _2;
+ let mut _0: &[u32];
+ scope 1 (inlined #[track_caller] core::slice::index::<impl Index<std::ops::Range<usize>> for [u32]>::index) {
+ debug self => _1;
+ debug index => _2;
+ }
+
+ bb0: {
+ _0 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 000000000..4a976002f
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,19 @@
+// MIR for `slice_index_range` after PreCodegen
+
+fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] {
+ debug slice => _1;
+ debug index => _2;
+ let mut _0: &[u32];
+ scope 1 (inlined #[track_caller] core::slice::index::<impl Index<std::ops::Range<usize>> for [u32]>::index) {
+ debug self => _1;
+ debug index => _2;
+ }
+
+ bb0: {
+ _0 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.mir
deleted file mode 100644
index 6cc0ee057..000000000
--- a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.mir
+++ /dev/null
@@ -1,20 +0,0 @@
-// MIR for `slice_index_usize` after PreCodegen
-
-fn slice_index_usize(_1: &[u32], _2: usize) -> u32 {
- debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:26: +0:31
- debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:41: +0:46
- let mut _0: u32; // return place in scope 0 at $DIR/slice_index.rs:+0:58: +0:61
- let mut _3: usize; // in scope 0 at $DIR/slice_index.rs:+1:5: +1:17
- let mut _4: bool; // in scope 0 at $DIR/slice_index.rs:+1:5: +1:17
-
- bb0: {
- _3 = Len((*_1)); // scope 0 at $DIR/slice_index.rs:+1:5: +1:17
- _4 = Lt(_2, _3); // scope 0 at $DIR/slice_index.rs:+1:5: +1:17
- assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, _2) -> bb1; // scope 0 at $DIR/slice_index.rs:+1:5: +1:17
- }
-
- bb1: {
- _0 = (*_1)[_2]; // scope 0 at $DIR/slice_index.rs:+1:5: +1:17
- return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2
- }
-}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..210f9d6a1
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,20 @@
+// MIR for `slice_index_usize` after PreCodegen
+
+fn slice_index_usize(_1: &[u32], _2: usize) -> u32 {
+ debug slice => _1;
+ debug index => _2;
+ let mut _0: u32;
+ let mut _3: usize;
+ let mut _4: bool;
+
+ bb0: {
+ _3 = Len((*_1));
+ _4 = Lt(_2, _3);
+ assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, _2) -> [success: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _0 = (*_1)[_2];
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 000000000..d576520a8
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,20 @@
+// MIR for `slice_index_usize` after PreCodegen
+
+fn slice_index_usize(_1: &[u32], _2: usize) -> u32 {
+ debug slice => _1;
+ debug index => _2;
+ let mut _0: u32;
+ let mut _3: usize;
+ let mut _4: bool;
+
+ bb0: {
+ _3 = Len((*_1));
+ _4 = Lt(_2, _3);
+ assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, _2) -> [success: bb1, unwind continue];
+ }
+
+ bb1: {
+ _0 = (*_1)[_2];
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..c58b630a0
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,196 @@
+// MIR for `enumerated_loop` after PreCodegen
+
+fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
+ debug slice => _1;
+ debug f => _2;
+ let mut _0: ();
+ let mut _13: std::slice::Iter<'_, T>;
+ let mut _14: std::iter::Enumerate<std::slice::Iter<'_, T>>;
+ let mut _15: std::iter::Enumerate<std::slice::Iter<'_, T>>;
+ let mut _16: &mut std::iter::Enumerate<std::slice::Iter<'_, T>>;
+ let mut _17: std::option::Option<(usize, &T)>;
+ let mut _18: isize;
+ let mut _21: &impl Fn(usize, &T);
+ let mut _22: (usize, &T);
+ let _23: ();
+ scope 1 {
+ debug iter => _15;
+ let _19: usize;
+ let _20: &T;
+ scope 2 {
+ debug i => _19;
+ debug x => _20;
+ }
+ }
+ scope 3 (inlined core::slice::<impl [T]>::iter) {
+ debug self => _1;
+ scope 4 (inlined std::slice::Iter::<'_, T>::new) {
+ debug slice => _1;
+ let _4: *const T;
+ let mut _5: bool;
+ let mut _6: usize;
+ let mut _8: usize;
+ let mut _9: *mut T;
+ let mut _11: std::ptr::NonNull<T>;
+ let mut _12: *const T;
+ scope 5 {
+ debug ptr => _4;
+ scope 6 {
+ let _7: *const T;
+ scope 7 {
+ debug end_or_len => _7;
+ scope 13 (inlined NonNull::<T>::new_unchecked) {
+ debug ptr => _9;
+ let mut _10: *const T;
+ scope 14 {
+ scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) {
+ debug ptr => _9;
+ scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null) {
+ debug self => _9;
+ let mut _24: *mut u8;
+ scope 17 {
+ scope 18 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _24;
+ scope 19 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _24;
+ scope 20 {
+ scope 21 (inlined std::ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _24;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 9 (inlined invalid::<T>) {
+ debug addr => _8;
+ scope 10 {
+ }
+ }
+ scope 11 (inlined std::ptr::const_ptr::<impl *const T>::add) {
+ debug self => _4;
+ debug count => _6;
+ scope 12 {
+ }
+ }
+ }
+ }
+ scope 8 (inlined core::slice::<impl [T]>::as_ptr) {
+ debug self => _1;
+ let mut _3: *const [T];
+ }
+ }
+ }
+ scope 22 (inlined <std::slice::Iter<'_, T> as Iterator>::enumerate) {
+ debug self => _13;
+ scope 23 (inlined Enumerate::<std::slice::Iter<'_, T>>::new) {
+ debug iter => _13;
+ }
+ }
+ scope 24 (inlined <Enumerate<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) {
+ debug self => _14;
+ }
+
+ bb0: {
+ StorageLive(_13);
+ StorageLive(_4);
+ StorageLive(_3);
+ _3 = &raw const (*_1);
+ _4 = move _3 as *const T (PtrToPtr);
+ StorageDead(_3);
+ StorageLive(_7);
+ StorageLive(_5);
+ _5 = const _;
+ switchInt(move _5) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = Len((*_1));
+ _7 = Offset(_4, _6);
+ StorageDead(_6);
+ goto -> bb3;
+ }
+
+ bb2: {
+ StorageLive(_8);
+ _8 = Len((*_1));
+ _7 = _8 as *const T (Transmute);
+ StorageDead(_8);
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_5);
+ StorageLive(_11);
+ StorageLive(_9);
+ _9 = _4 as *mut T (PtrToPtr);
+ StorageLive(_10);
+ StorageLive(_24);
+ _10 = _9 as *const T (PointerCoercion(MutToConstPointer));
+ _11 = NonNull::<T> { pointer: _10 };
+ StorageDead(_24);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageLive(_12);
+ _12 = _7;
+ _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_7);
+ StorageDead(_4);
+ _14 = Enumerate::<std::slice::Iter<'_, T>> { iter: move _13, count: const 0_usize };
+ StorageDead(_13);
+ StorageLive(_15);
+ _15 = move _14;
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageLive(_17);
+ StorageLive(_16);
+ _16 = &mut _15;
+ _17 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(move _16) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_16);
+ _18 = discriminant(_17);
+ switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
+ }
+
+ bb6: {
+ StorageDead(_17);
+ StorageDead(_15);
+ drop(_2) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ return;
+ }
+
+ bb8: {
+ _19 = (((_17 as Some).0: (usize, &T)).0: usize);
+ _20 = (((_17 as Some).0: (usize, &T)).1: &T);
+ StorageLive(_21);
+ _21 = &_2;
+ StorageLive(_22);
+ _22 = (_19, _20);
+ _23 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _21, move _22) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ StorageDead(_22);
+ StorageDead(_21);
+ StorageDead(_17);
+ goto -> bb4;
+ }
+
+ bb10: {
+ unreachable;
+ }
+}
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
new file mode 100644
index 000000000..1a805f0fd
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,204 @@
+// MIR for `enumerated_loop` after PreCodegen
+
+fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
+ debug slice => _1;
+ debug f => _2;
+ let mut _0: ();
+ let mut _13: std::slice::Iter<'_, T>;
+ let mut _14: std::iter::Enumerate<std::slice::Iter<'_, T>>;
+ let mut _15: std::iter::Enumerate<std::slice::Iter<'_, T>>;
+ let mut _16: &mut std::iter::Enumerate<std::slice::Iter<'_, T>>;
+ let mut _17: std::option::Option<(usize, &T)>;
+ let mut _18: isize;
+ let mut _21: &impl Fn(usize, &T);
+ let mut _22: (usize, &T);
+ let _23: ();
+ scope 1 {
+ debug iter => _15;
+ let _19: usize;
+ let _20: &T;
+ scope 2 {
+ debug i => _19;
+ debug x => _20;
+ }
+ }
+ scope 3 (inlined core::slice::<impl [T]>::iter) {
+ debug self => _1;
+ scope 4 (inlined std::slice::Iter::<'_, T>::new) {
+ debug slice => _1;
+ let _4: *const T;
+ let mut _5: bool;
+ let mut _6: usize;
+ let mut _8: usize;
+ let mut _9: *mut T;
+ let mut _11: std::ptr::NonNull<T>;
+ let mut _12: *const T;
+ scope 5 {
+ debug ptr => _4;
+ scope 6 {
+ let _7: *const T;
+ scope 7 {
+ debug end_or_len => _7;
+ scope 13 (inlined NonNull::<T>::new_unchecked) {
+ debug ptr => _9;
+ let mut _10: *const T;
+ scope 14 {
+ scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) {
+ debug ptr => _9;
+ scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null) {
+ debug self => _9;
+ let mut _24: *mut u8;
+ scope 17 {
+ scope 18 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _24;
+ scope 19 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _24;
+ scope 20 {
+ scope 21 (inlined std::ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _24;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 9 (inlined invalid::<T>) {
+ debug addr => _8;
+ scope 10 {
+ }
+ }
+ scope 11 (inlined std::ptr::const_ptr::<impl *const T>::add) {
+ debug self => _4;
+ debug count => _6;
+ scope 12 {
+ }
+ }
+ }
+ }
+ scope 8 (inlined core::slice::<impl [T]>::as_ptr) {
+ debug self => _1;
+ let mut _3: *const [T];
+ }
+ }
+ }
+ scope 22 (inlined <std::slice::Iter<'_, T> as Iterator>::enumerate) {
+ debug self => _13;
+ scope 23 (inlined Enumerate::<std::slice::Iter<'_, T>>::new) {
+ debug iter => _13;
+ }
+ }
+ scope 24 (inlined <Enumerate<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) {
+ debug self => _14;
+ }
+
+ bb0: {
+ StorageLive(_13);
+ StorageLive(_4);
+ StorageLive(_3);
+ _3 = &raw const (*_1);
+ _4 = move _3 as *const T (PtrToPtr);
+ StorageDead(_3);
+ StorageLive(_7);
+ StorageLive(_5);
+ _5 = const _;
+ switchInt(move _5) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = Len((*_1));
+ _7 = Offset(_4, _6);
+ StorageDead(_6);
+ goto -> bb3;
+ }
+
+ bb2: {
+ StorageLive(_8);
+ _8 = Len((*_1));
+ _7 = _8 as *const T (Transmute);
+ StorageDead(_8);
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_5);
+ StorageLive(_11);
+ StorageLive(_9);
+ _9 = _4 as *mut T (PtrToPtr);
+ StorageLive(_10);
+ StorageLive(_24);
+ _10 = _9 as *const T (PointerCoercion(MutToConstPointer));
+ _11 = NonNull::<T> { pointer: _10 };
+ StorageDead(_24);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageLive(_12);
+ _12 = _7;
+ _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_7);
+ StorageDead(_4);
+ _14 = Enumerate::<std::slice::Iter<'_, T>> { iter: move _13, count: const 0_usize };
+ StorageDead(_13);
+ StorageLive(_15);
+ _15 = move _14;
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageLive(_17);
+ StorageLive(_16);
+ _16 = &mut _15;
+ _17 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(move _16) -> [return: bb5, unwind: bb11];
+ }
+
+ bb5: {
+ StorageDead(_16);
+ _18 = discriminant(_17);
+ switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
+ }
+
+ bb6: {
+ StorageDead(_17);
+ StorageDead(_15);
+ drop(_2) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ return;
+ }
+
+ bb8: {
+ _19 = (((_17 as Some).0: (usize, &T)).0: usize);
+ _20 = (((_17 as Some).0: (usize, &T)).1: &T);
+ StorageLive(_21);
+ _21 = &_2;
+ StorageLive(_22);
+ _22 = (_19, _20);
+ _23 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _21, move _22) -> [return: bb9, unwind: bb11];
+ }
+
+ bb9: {
+ StorageDead(_22);
+ StorageDead(_21);
+ StorageDead(_17);
+ goto -> bb4;
+ }
+
+ bb10: {
+ unreachable;
+ }
+
+ bb11 (cleanup): {
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
+ bb12 (cleanup): {
+ resume;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir
deleted file mode 100644
index 0da7e5536..000000000
--- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir
+++ /dev/null
@@ -1,203 +0,0 @@
-// MIR for `forward_loop` after PreCodegen
-
-fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
- debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:28: +0:33
- debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:44: +0:45
- let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:60: +0:60
- let mut _3: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
- let mut _4: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
- let _5: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
- let mut _6: std::option::Option<&T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
- let mut _7: &mut std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
- let mut _8: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6
- let mut _10: &impl Fn(&T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10
- let mut _11: (&T,); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:13
- scope 1 {
- debug iter => _4; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
- let _9: &T; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10
- scope 2 {
- debug x => _9; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10
- }
- }
- scope 3 (inlined core::slice::<impl [T]>::iter) { // at $DIR/slice_iter.rs:28:20: 28:26
- debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- let _12: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- let mut _14: bool; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- let mut _15: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- let mut _16: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- let mut _17: std::ptr::NonNull<T>; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- let mut _18: *mut T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- let mut _19: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- scope 5 {
- debug ptr => _12; // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- scope 6 {
- let _13: *const T; // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- scope 7 {
- debug end => _13; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- scope 13 (inlined NonNull::<T>::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- debug ptr => _18; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
- let mut _21: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
- let mut _22: *mut T; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- scope 14 {
- scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- debug ptr => _22; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
- debug self => _22; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- let mut _23: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- scope 17 {
- scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- debug ptr => _23; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- debug self => _23; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- scope 20 {
- scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- debug self => _23; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- scope 9 (inlined invalid::<T>) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- debug addr => _15; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- scope 10 {
- }
- }
- scope 11 (inlined ptr::const_ptr::<impl *const T>::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- debug self => _12; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
- debug count => _16; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
- scope 12 {
- }
- }
- }
- }
- scope 8 (inlined core::slice::<impl [T]>::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- debug self => _1; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- let mut _20: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- }
- }
- }
- scope 22 (inlined <std::slice::Iter<'_, T> as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:28:14: 28:26
- debug self => _3; // in scope 22 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
- }
-
- bb0: {
- StorageLive(_12); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageLive(_20); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- _20 = &raw const (*_1); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- _12 = move _20 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageDead(_20); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageLive(_13); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageLive(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _14 = const _; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- switchInt(move _14) -> [0: bb11, otherwise: bb10]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- }
-
- bb1: {
- StorageLive(_6); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
- _7 = &mut _4; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
- _6 = <std::slice::Iter<'_, T> as Iterator>::next(_7) -> [return: bb2, unwind: bb8]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
- // mir::Constant
- // + span: $DIR/slice_iter.rs:28:14: 28:26
- // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option<<std::slice::Iter<'_, T> as Iterator>::Item> {<std::slice::Iter<'_, T> as Iterator>::next}, val: Value(<ZST>) }
- }
-
- bb2: {
- _8 = discriminant(_6); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
- switchInt(move _8) -> [0: bb5, 1: bb3, otherwise: bb4]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
- }
-
- bb3: {
- _9 = ((_6 as Some).0: &T); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10
- StorageLive(_10); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10
- _10 = &_2; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10
- StorageLive(_11); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
- _11 = (_9,); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
- _5 = <impl Fn(&T) as Fn<(&T,)>>::call(move _10, move _11) -> [return: bb6, unwind: bb8]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
- // mir::Constant
- // + span: $DIR/slice_iter.rs:29:9: 29:10
- // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(&T), (&T,)) -> <impl Fn(&T) as FnOnce<(&T,)>>::Output {<impl Fn(&T) as Fn<(&T,)>>::call}, val: Value(<ZST>) }
- }
-
- bb4: {
- unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
- }
-
- bb5: {
- StorageDead(_6); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6
- StorageDead(_4); // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6
- drop(_2) -> bb7; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2
- }
-
- bb6: {
- StorageDead(_11); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13
- StorageDead(_10); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13
- StorageDead(_6); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6
- goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6
- }
-
- bb7: {
- return; // scope 0 at $DIR/slice_iter.rs:+4:2: +4:2
- }
-
- bb8 (cleanup): {
- drop(_2) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2
- }
-
- bb9 (cleanup): {
- resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +4:2
- }
-
- bb10: {
- StorageLive(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _15 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _13 = _15 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- StorageDead(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- goto -> bb12; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- }
-
- bb11: {
- StorageLive(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _16 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _13 = Offset(_12, _16); // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
- StorageDead(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- goto -> bb12; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- }
-
- bb12: {
- StorageDead(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageLive(_17); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageLive(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _18 = _12 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageLive(_21); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageLive(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageLive(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _21 = _18 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
- _17 = NonNull::<T> { pointer: _21 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
- StorageDead(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageDead(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageDead(_21); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageDead(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageLive(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _19 = _13; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _3 = std::slice::Iter::<'_, T> { ptr: move _17, end: move _19, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- // mir::Constant
- // + span: no-location
- // + literal: Const { ty: PhantomData<&T>, val: Value(<ZST>) }
- // adt
- // + user_ty: UserType(1)
- StorageDead(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageDead(_17); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageDead(_13); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageDead(_12); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageLive(_4); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
- _4 = move _3; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
- goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6
- }
-}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..09075eed6
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,183 @@
+// MIR for `forward_loop` after PreCodegen
+
+fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
+ debug slice => _1;
+ debug f => _2;
+ let mut _0: ();
+ let mut _13: std::slice::Iter<'_, T>;
+ let mut _14: std::slice::Iter<'_, T>;
+ let mut _15: &mut std::slice::Iter<'_, T>;
+ let mut _16: std::option::Option<&T>;
+ let mut _17: isize;
+ let mut _19: &impl Fn(&T);
+ let mut _20: (&T,);
+ let _21: ();
+ scope 1 {
+ debug iter => _14;
+ let _18: &T;
+ scope 2 {
+ debug x => _18;
+ }
+ }
+ scope 3 (inlined core::slice::<impl [T]>::iter) {
+ debug self => _1;
+ scope 4 (inlined std::slice::Iter::<'_, T>::new) {
+ debug slice => _1;
+ let _4: *const T;
+ let mut _5: bool;
+ let mut _6: usize;
+ let mut _8: usize;
+ let mut _9: *mut T;
+ let mut _11: std::ptr::NonNull<T>;
+ let mut _12: *const T;
+ scope 5 {
+ debug ptr => _4;
+ scope 6 {
+ let _7: *const T;
+ scope 7 {
+ debug end_or_len => _7;
+ scope 13 (inlined NonNull::<T>::new_unchecked) {
+ debug ptr => _9;
+ let mut _10: *const T;
+ scope 14 {
+ scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) {
+ debug ptr => _9;
+ scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null) {
+ debug self => _9;
+ let mut _22: *mut u8;
+ scope 17 {
+ scope 18 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _22;
+ scope 19 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _22;
+ scope 20 {
+ scope 21 (inlined std::ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _22;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 9 (inlined invalid::<T>) {
+ debug addr => _8;
+ scope 10 {
+ }
+ }
+ scope 11 (inlined std::ptr::const_ptr::<impl *const T>::add) {
+ debug self => _4;
+ debug count => _6;
+ scope 12 {
+ }
+ }
+ }
+ }
+ scope 8 (inlined core::slice::<impl [T]>::as_ptr) {
+ debug self => _1;
+ let mut _3: *const [T];
+ }
+ }
+ }
+ scope 22 (inlined <std::slice::Iter<'_, T> as IntoIterator>::into_iter) {
+ debug self => _13;
+ }
+
+ bb0: {
+ StorageLive(_4);
+ StorageLive(_3);
+ _3 = &raw const (*_1);
+ _4 = move _3 as *const T (PtrToPtr);
+ StorageDead(_3);
+ StorageLive(_7);
+ StorageLive(_5);
+ _5 = const _;
+ switchInt(move _5) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = Len((*_1));
+ _7 = Offset(_4, _6);
+ StorageDead(_6);
+ goto -> bb3;
+ }
+
+ bb2: {
+ StorageLive(_8);
+ _8 = Len((*_1));
+ _7 = _8 as *const T (Transmute);
+ StorageDead(_8);
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_5);
+ StorageLive(_11);
+ StorageLive(_9);
+ _9 = _4 as *mut T (PtrToPtr);
+ StorageLive(_10);
+ StorageLive(_22);
+ _10 = _9 as *const T (PointerCoercion(MutToConstPointer));
+ _11 = NonNull::<T> { pointer: _10 };
+ StorageDead(_22);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageLive(_12);
+ _12 = _7;
+ _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_7);
+ StorageDead(_4);
+ StorageLive(_14);
+ _14 = move _13;
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageLive(_16);
+ StorageLive(_15);
+ _15 = &mut _14;
+ _16 = <std::slice::Iter<'_, T> as Iterator>::next(move _15) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_15);
+ _17 = discriminant(_16);
+ switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10];
+ }
+
+ bb6: {
+ StorageDead(_16);
+ StorageDead(_14);
+ drop(_2) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ return;
+ }
+
+ bb8: {
+ _18 = ((_16 as Some).0: &T);
+ StorageLive(_19);
+ _19 = &_2;
+ StorageLive(_20);
+ _20 = (_18,);
+ _21 = <impl Fn(&T) as Fn<(&T,)>>::call(move _19, move _20) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ StorageDead(_20);
+ StorageDead(_19);
+ StorageDead(_16);
+ goto -> bb4;
+ }
+
+ bb10: {
+ unreachable;
+ }
+}
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
new file mode 100644
index 000000000..47b847464
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,191 @@
+// MIR for `forward_loop` after PreCodegen
+
+fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
+ debug slice => _1;
+ debug f => _2;
+ let mut _0: ();
+ let mut _13: std::slice::Iter<'_, T>;
+ let mut _14: std::slice::Iter<'_, T>;
+ let mut _15: &mut std::slice::Iter<'_, T>;
+ let mut _16: std::option::Option<&T>;
+ let mut _17: isize;
+ let mut _19: &impl Fn(&T);
+ let mut _20: (&T,);
+ let _21: ();
+ scope 1 {
+ debug iter => _14;
+ let _18: &T;
+ scope 2 {
+ debug x => _18;
+ }
+ }
+ scope 3 (inlined core::slice::<impl [T]>::iter) {
+ debug self => _1;
+ scope 4 (inlined std::slice::Iter::<'_, T>::new) {
+ debug slice => _1;
+ let _4: *const T;
+ let mut _5: bool;
+ let mut _6: usize;
+ let mut _8: usize;
+ let mut _9: *mut T;
+ let mut _11: std::ptr::NonNull<T>;
+ let mut _12: *const T;
+ scope 5 {
+ debug ptr => _4;
+ scope 6 {
+ let _7: *const T;
+ scope 7 {
+ debug end_or_len => _7;
+ scope 13 (inlined NonNull::<T>::new_unchecked) {
+ debug ptr => _9;
+ let mut _10: *const T;
+ scope 14 {
+ scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) {
+ debug ptr => _9;
+ scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null) {
+ debug self => _9;
+ let mut _22: *mut u8;
+ scope 17 {
+ scope 18 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _22;
+ scope 19 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _22;
+ scope 20 {
+ scope 21 (inlined std::ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _22;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 9 (inlined invalid::<T>) {
+ debug addr => _8;
+ scope 10 {
+ }
+ }
+ scope 11 (inlined std::ptr::const_ptr::<impl *const T>::add) {
+ debug self => _4;
+ debug count => _6;
+ scope 12 {
+ }
+ }
+ }
+ }
+ scope 8 (inlined core::slice::<impl [T]>::as_ptr) {
+ debug self => _1;
+ let mut _3: *const [T];
+ }
+ }
+ }
+ scope 22 (inlined <std::slice::Iter<'_, T> as IntoIterator>::into_iter) {
+ debug self => _13;
+ }
+
+ bb0: {
+ StorageLive(_4);
+ StorageLive(_3);
+ _3 = &raw const (*_1);
+ _4 = move _3 as *const T (PtrToPtr);
+ StorageDead(_3);
+ StorageLive(_7);
+ StorageLive(_5);
+ _5 = const _;
+ switchInt(move _5) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = Len((*_1));
+ _7 = Offset(_4, _6);
+ StorageDead(_6);
+ goto -> bb3;
+ }
+
+ bb2: {
+ StorageLive(_8);
+ _8 = Len((*_1));
+ _7 = _8 as *const T (Transmute);
+ StorageDead(_8);
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_5);
+ StorageLive(_11);
+ StorageLive(_9);
+ _9 = _4 as *mut T (PtrToPtr);
+ StorageLive(_10);
+ StorageLive(_22);
+ _10 = _9 as *const T (PointerCoercion(MutToConstPointer));
+ _11 = NonNull::<T> { pointer: _10 };
+ StorageDead(_22);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageLive(_12);
+ _12 = _7;
+ _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_7);
+ StorageDead(_4);
+ StorageLive(_14);
+ _14 = move _13;
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageLive(_16);
+ StorageLive(_15);
+ _15 = &mut _14;
+ _16 = <std::slice::Iter<'_, T> as Iterator>::next(move _15) -> [return: bb5, unwind: bb11];
+ }
+
+ bb5: {
+ StorageDead(_15);
+ _17 = discriminant(_16);
+ switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10];
+ }
+
+ bb6: {
+ StorageDead(_16);
+ StorageDead(_14);
+ drop(_2) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ return;
+ }
+
+ bb8: {
+ _18 = ((_16 as Some).0: &T);
+ StorageLive(_19);
+ _19 = &_2;
+ StorageLive(_20);
+ _20 = (_18,);
+ _21 = <impl Fn(&T) as Fn<(&T,)>>::call(move _19, move _20) -> [return: bb9, unwind: bb11];
+ }
+
+ bb9: {
+ StorageDead(_20);
+ StorageDead(_19);
+ StorageDead(_16);
+ goto -> bb4;
+ }
+
+ bb10: {
+ unreachable;
+ }
+
+ bb11 (cleanup): {
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
+ bb12 (cleanup): {
+ resume;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..db6922968
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,149 @@
+// MIR for `range_loop` after PreCodegen
+
+fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
+ debug slice => _1;
+ debug f => _2;
+ let mut _0: ();
+ let mut _3: usize;
+ let mut _4: std::ops::Range<usize>;
+ let mut _5: std::ops::Range<usize>;
+ let mut _6: &mut std::ops::Range<usize>;
+ let mut _12: std::option::Option<usize>;
+ let mut _15: isize;
+ let mut _17: usize;
+ let mut _18: bool;
+ let mut _20: &impl Fn(usize, &T);
+ let mut _21: (usize, &T);
+ let _22: ();
+ scope 1 {
+ debug iter => _5;
+ let _16: usize;
+ scope 2 {
+ debug i => _16;
+ let _19: &T;
+ scope 3 {
+ debug x => _19;
+ }
+ }
+ scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
+ debug self => _6;
+ scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
+ debug self => _6;
+ let mut _7: &usize;
+ let mut _8: &usize;
+ let mut _11: bool;
+ let _13: usize;
+ let mut _14: usize;
+ scope 7 {
+ debug old => _13;
+ scope 8 {
+ }
+ }
+ scope 9 (inlined std::cmp::impls::<impl PartialOrd for usize>::lt) {
+ debug self => _7;
+ debug other => _8;
+ let mut _9: usize;
+ let mut _10: usize;
+ }
+ }
+ }
+ }
+ scope 4 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) {
+ debug self => _4;
+ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = Len((*_1));
+ _4 = std::ops::Range::<usize> { start: const 0_usize, end: move _3 };
+ StorageDead(_3);
+ StorageLive(_5);
+ _5 = move _4;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageLive(_12);
+ _6 = &mut _5;
+ StorageLive(_13);
+ StorageLive(_11);
+ StorageLive(_7);
+ _7 = &(_5.0: usize);
+ StorageLive(_8);
+ _8 = &(_5.1: usize);
+ StorageLive(_9);
+ _9 = (_5.0: usize);
+ StorageLive(_10);
+ _10 = (_5.1: usize);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<usize>::None;
+ goto -> bb5;
+ }
+
+ bb3: {
+ StorageDead(_8);
+ StorageDead(_7);
+ _13 = (_5.0: usize);
+ StorageLive(_14);
+ _14 = <usize as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ (_5.0: usize) = move _14;
+ StorageDead(_14);
+ _12 = Option::<usize>::Some(_13);
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11];
+ }
+
+ bb6: {
+ StorageDead(_12);
+ StorageDead(_5);
+ drop(_2) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ return;
+ }
+
+ bb8: {
+ _16 = ((_12 as Some).0: usize);
+ _17 = Len((*_1));
+ _18 = Lt(_16, _17);
+ assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ _19 = &(*_1)[_16];
+ StorageLive(_20);
+ _20 = &_2;
+ StorageLive(_21);
+ _21 = (_16, _19);
+ _22 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _20, move _21) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_12);
+ goto -> bb1;
+ }
+
+ bb11: {
+ 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
new file mode 100644
index 000000000..81d1832ee
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,157 @@
+// MIR for `range_loop` after PreCodegen
+
+fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
+ debug slice => _1;
+ debug f => _2;
+ let mut _0: ();
+ let mut _3: usize;
+ let mut _4: std::ops::Range<usize>;
+ let mut _5: std::ops::Range<usize>;
+ let mut _6: &mut std::ops::Range<usize>;
+ let mut _12: std::option::Option<usize>;
+ let mut _15: isize;
+ let mut _17: usize;
+ let mut _18: bool;
+ let mut _20: &impl Fn(usize, &T);
+ let mut _21: (usize, &T);
+ let _22: ();
+ scope 1 {
+ debug iter => _5;
+ let _16: usize;
+ scope 2 {
+ debug i => _16;
+ let _19: &T;
+ scope 3 {
+ debug x => _19;
+ }
+ }
+ scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
+ debug self => _6;
+ scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
+ debug self => _6;
+ let mut _7: &usize;
+ let mut _8: &usize;
+ let mut _11: bool;
+ let _13: usize;
+ let mut _14: usize;
+ scope 7 {
+ debug old => _13;
+ scope 8 {
+ }
+ }
+ scope 9 (inlined std::cmp::impls::<impl PartialOrd for usize>::lt) {
+ debug self => _7;
+ debug other => _8;
+ let mut _9: usize;
+ let mut _10: usize;
+ }
+ }
+ }
+ }
+ scope 4 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) {
+ debug self => _4;
+ }
+
+ bb0: {
+ StorageLive(_3);
+ _3 = Len((*_1));
+ _4 = std::ops::Range::<usize> { start: const 0_usize, end: move _3 };
+ StorageDead(_3);
+ StorageLive(_5);
+ _5 = move _4;
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageLive(_12);
+ _6 = &mut _5;
+ StorageLive(_13);
+ StorageLive(_11);
+ StorageLive(_7);
+ _7 = &(_5.0: usize);
+ StorageLive(_8);
+ _8 = &(_5.1: usize);
+ StorageLive(_9);
+ _9 = (_5.0: usize);
+ StorageLive(_10);
+ _10 = (_5.1: usize);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<usize>::None;
+ goto -> bb5;
+ }
+
+ bb3: {
+ StorageDead(_8);
+ StorageDead(_7);
+ _13 = (_5.0: usize);
+ StorageLive(_14);
+ _14 = <usize as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind: bb12];
+ }
+
+ bb4: {
+ (_5.0: usize) = move _14;
+ StorageDead(_14);
+ _12 = Option::<usize>::Some(_13);
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11];
+ }
+
+ bb6: {
+ StorageDead(_12);
+ StorageDead(_5);
+ drop(_2) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ return;
+ }
+
+ bb8: {
+ _16 = ((_12 as Some).0: usize);
+ _17 = Len((*_1));
+ _18 = Lt(_16, _17);
+ assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb9, unwind: bb12];
+ }
+
+ bb9: {
+ _19 = &(*_1)[_16];
+ StorageLive(_20);
+ _20 = &_2;
+ StorageLive(_21);
+ _21 = (_16, _19);
+ _22 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _20, move _21) -> [return: bb10, unwind: bb12];
+ }
+
+ bb10: {
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_12);
+ goto -> bb1;
+ }
+
+ bb11: {
+ unreachable;
+ }
+
+ bb12 (cleanup): {
+ drop(_2) -> [return: bb13, unwind terminate(cleanup)];
+ }
+
+ bb13 (cleanup): {
+ resume;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir
deleted file mode 100644
index 45b41b54c..000000000
--- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir
+++ /dev/null
@@ -1,220 +0,0 @@
-// MIR for `reverse_loop` after PreCodegen
-
-fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
- debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:28: +0:33
- debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:44: +0:45
- let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:60: +0:60
- let mut _3: std::iter::Rev<std::slice::Iter<'_, T>>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
- let mut _4: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
- let mut _5: std::iter::Rev<std::slice::Iter<'_, T>>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
- let _6: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
- let mut _7: std::option::Option<&T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
- let mut _8: &mut std::iter::Rev<std::slice::Iter<'_, T>>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
- let mut _9: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6
- let mut _11: &impl Fn(&T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10
- let mut _12: (&T,); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:13
- scope 1 {
- debug iter => _5; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
- let _10: &T; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10
- scope 2 {
- debug x => _10; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10
- }
- scope 25 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) { // at $DIR/slice_iter.rs:35:14: 35:32
- debug self => _8; // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
- let mut _25: &mut std::slice::Iter<'_, T>; // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
- }
- }
- scope 3 (inlined core::slice::<impl [T]>::iter) { // at $DIR/slice_iter.rs:35:20: 35:26
- debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- let _13: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- let mut _15: bool; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- let mut _16: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- let mut _17: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- let mut _18: std::ptr::NonNull<T>; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- let mut _19: *mut T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- let mut _20: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- scope 5 {
- debug ptr => _13; // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- scope 6 {
- let _14: *const T; // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- scope 7 {
- debug end => _14; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- scope 13 (inlined NonNull::<T>::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- debug ptr => _19; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
- let mut _22: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
- let mut _23: *mut T; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- scope 14 {
- scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- debug ptr => _23; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
- scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
- debug self => _23; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- let mut _24: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- scope 17 {
- scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- debug ptr => _24; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- debug self => _24; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- scope 20 {
- scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- debug self => _24; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- scope 9 (inlined invalid::<T>) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- debug addr => _16; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- scope 10 {
- }
- }
- scope 11 (inlined ptr::const_ptr::<impl *const T>::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- debug self => _13; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
- debug count => _17; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
- scope 12 {
- }
- }
- }
- }
- scope 8 (inlined core::slice::<impl [T]>::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- debug self => _1; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- let mut _21: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- }
- }
- }
- scope 22 (inlined <std::slice::Iter<'_, T> as Iterator>::rev) { // at $DIR/slice_iter.rs:35:27: 35:32
- debug self => _4; // in scope 22 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
- scope 23 (inlined Rev::<std::slice::Iter<'_, T>>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
- debug iter => _4; // in scope 23 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
- }
- }
- scope 24 (inlined <Rev<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:35:14: 35:32
- debug self => _3; // in scope 24 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
- }
-
- bb0: {
- StorageLive(_4); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
- StorageLive(_13); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageLive(_21); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- _21 = &raw const (*_1); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- _13 = move _21 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageDead(_21); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- StorageLive(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageLive(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _15 = const _; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- switchInt(move _15) -> [0: bb10, otherwise: bb9]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- }
-
- bb1: {
- StorageLive(_7); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
- _8 = &mut _5; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
- StorageLive(_25); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
- _25 = &mut ((*_8).0: std::slice::Iter<'_, T>); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
- _7 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _25) -> [return: bb12, unwind: bb7]; // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
- // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option<<std::slice::Iter<'_, T> as Iterator>::Item> {<std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back}, val: Value(<ZST>) }
- }
-
- bb2: {
- _10 = ((_7 as Some).0: &T); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10
- StorageLive(_11); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10
- _11 = &_2; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10
- StorageLive(_12); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
- _12 = (_10,); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
- _6 = <impl Fn(&T) as Fn<(&T,)>>::call(move _11, move _12) -> [return: bb5, unwind: bb7]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
- // mir::Constant
- // + span: $DIR/slice_iter.rs:36:9: 36:10
- // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(&T), (&T,)) -> <impl Fn(&T) as FnOnce<(&T,)>>::Output {<impl Fn(&T) as Fn<(&T,)>>::call}, val: Value(<ZST>) }
- }
-
- bb3: {
- unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
- }
-
- bb4: {
- StorageDead(_7); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6
- StorageDead(_5); // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6
- drop(_2) -> bb6; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2
- }
-
- bb5: {
- StorageDead(_12); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13
- StorageDead(_11); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13
- StorageDead(_7); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6
- goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6
- }
-
- bb6: {
- return; // scope 0 at $DIR/slice_iter.rs:+4:2: +4:2
- }
-
- bb7 (cleanup): {
- drop(_2) -> [return: bb8, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2
- }
-
- bb8 (cleanup): {
- resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +4:2
- }
-
- bb9: {
- StorageLive(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _16 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _14 = _16 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- StorageDead(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- goto -> bb11; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- }
-
- bb10: {
- StorageLive(_17); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _17 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _14 = Offset(_13, _17); // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
- StorageDead(_17); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- goto -> bb11; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- }
-
- bb11: {
- StorageDead(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageLive(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageLive(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _19 = _13 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageLive(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageLive(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageLive(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _22 = _19 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
- _18 = NonNull::<T> { pointer: _22 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
- StorageDead(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageDead(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageDead(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageDead(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageLive(_20); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _20 = _14; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- _4 = std::slice::Iter::<'_, T> { ptr: move _18, end: move _20, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- // mir::Constant
- // + span: no-location
- // + literal: Const { ty: PhantomData<&T>, val: Value(<ZST>) }
- // adt
- // + user_ty: UserType(1)
- StorageDead(_20); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageDead(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageDead(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
- StorageDead(_13); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
- _3 = Rev::<std::slice::Iter<'_, T>> { iter: move _4 }; // scope 23 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
- StorageDead(_4); // scope 0 at $DIR/slice_iter.rs:+1:31: +1:32
- StorageLive(_5); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
- _5 = move _3; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
- goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6
- }
-
- bb12: {
- StorageDead(_25); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
- _9 = discriminant(_7); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
- switchInt(move _9) -> [0: bb4, 1: bb2, otherwise: bb3]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
- }
-}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..5ed7ca5e2
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,198 @@
+// MIR for `reverse_loop` after PreCodegen
+
+fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
+ debug slice => _1;
+ debug f => _2;
+ let mut _0: ();
+ let mut _13: std::slice::Iter<'_, T>;
+ let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>;
+ let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>;
+ let mut _16: &mut std::iter::Rev<std::slice::Iter<'_, T>>;
+ let mut _18: std::option::Option<&T>;
+ let mut _19: isize;
+ let mut _21: &impl Fn(&T);
+ let mut _22: (&T,);
+ let _23: ();
+ scope 1 {
+ debug iter => _15;
+ let _20: &T;
+ scope 2 {
+ debug x => _20;
+ }
+ scope 25 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) {
+ debug self => _16;
+ let mut _17: &mut std::slice::Iter<'_, T>;
+ }
+ }
+ scope 3 (inlined core::slice::<impl [T]>::iter) {
+ debug self => _1;
+ scope 4 (inlined std::slice::Iter::<'_, T>::new) {
+ debug slice => _1;
+ let _4: *const T;
+ let mut _5: bool;
+ let mut _6: usize;
+ let mut _8: usize;
+ let mut _9: *mut T;
+ let mut _11: std::ptr::NonNull<T>;
+ let mut _12: *const T;
+ scope 5 {
+ debug ptr => _4;
+ scope 6 {
+ let _7: *const T;
+ scope 7 {
+ debug end_or_len => _7;
+ scope 13 (inlined NonNull::<T>::new_unchecked) {
+ debug ptr => _9;
+ let mut _10: *const T;
+ scope 14 {
+ scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) {
+ debug ptr => _9;
+ scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null) {
+ debug self => _9;
+ let mut _24: *mut u8;
+ scope 17 {
+ scope 18 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _24;
+ scope 19 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _24;
+ scope 20 {
+ scope 21 (inlined std::ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _24;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 9 (inlined invalid::<T>) {
+ debug addr => _8;
+ scope 10 {
+ }
+ }
+ scope 11 (inlined std::ptr::const_ptr::<impl *const T>::add) {
+ debug self => _4;
+ debug count => _6;
+ scope 12 {
+ }
+ }
+ }
+ }
+ scope 8 (inlined core::slice::<impl [T]>::as_ptr) {
+ debug self => _1;
+ let mut _3: *const [T];
+ }
+ }
+ }
+ scope 22 (inlined <std::slice::Iter<'_, T> as Iterator>::rev) {
+ debug self => _13;
+ scope 23 (inlined Rev::<std::slice::Iter<'_, T>>::new) {
+ debug iter => _13;
+ }
+ }
+ scope 24 (inlined <Rev<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) {
+ debug self => _14;
+ }
+
+ bb0: {
+ StorageLive(_13);
+ StorageLive(_4);
+ StorageLive(_3);
+ _3 = &raw const (*_1);
+ _4 = move _3 as *const T (PtrToPtr);
+ StorageDead(_3);
+ StorageLive(_7);
+ StorageLive(_5);
+ _5 = const _;
+ switchInt(move _5) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = Len((*_1));
+ _7 = Offset(_4, _6);
+ StorageDead(_6);
+ goto -> bb3;
+ }
+
+ bb2: {
+ StorageLive(_8);
+ _8 = Len((*_1));
+ _7 = _8 as *const T (Transmute);
+ StorageDead(_8);
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_5);
+ StorageLive(_11);
+ StorageLive(_9);
+ _9 = _4 as *mut T (PtrToPtr);
+ StorageLive(_10);
+ StorageLive(_24);
+ _10 = _9 as *const T (PointerCoercion(MutToConstPointer));
+ _11 = NonNull::<T> { pointer: _10 };
+ StorageDead(_24);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageLive(_12);
+ _12 = _7;
+ _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_7);
+ StorageDead(_4);
+ _14 = Rev::<std::slice::Iter<'_, T>> { iter: move _13 };
+ StorageDead(_13);
+ StorageLive(_15);
+ _15 = move _14;
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageLive(_18);
+ _16 = &mut _15;
+ StorageLive(_17);
+ _17 = &mut (_15.0: std::slice::Iter<'_, T>);
+ _18 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_17);
+ _19 = discriminant(_18);
+ switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10];
+ }
+
+ bb6: {
+ StorageDead(_18);
+ StorageDead(_15);
+ drop(_2) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ return;
+ }
+
+ bb8: {
+ _20 = ((_18 as Some).0: &T);
+ StorageLive(_21);
+ _21 = &_2;
+ StorageLive(_22);
+ _22 = (_20,);
+ _23 = <impl Fn(&T) as Fn<(&T,)>>::call(move _21, move _22) -> [return: bb9, unwind unreachable];
+ }
+
+ bb9: {
+ StorageDead(_22);
+ StorageDead(_21);
+ StorageDead(_18);
+ goto -> bb4;
+ }
+
+ bb10: {
+ unreachable;
+ }
+}
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
new file mode 100644
index 000000000..bbb979d23
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,206 @@
+// MIR for `reverse_loop` after PreCodegen
+
+fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
+ debug slice => _1;
+ debug f => _2;
+ let mut _0: ();
+ let mut _13: std::slice::Iter<'_, T>;
+ let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>;
+ let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>;
+ let mut _16: &mut std::iter::Rev<std::slice::Iter<'_, T>>;
+ let mut _18: std::option::Option<&T>;
+ let mut _19: isize;
+ let mut _21: &impl Fn(&T);
+ let mut _22: (&T,);
+ let _23: ();
+ scope 1 {
+ debug iter => _15;
+ let _20: &T;
+ scope 2 {
+ debug x => _20;
+ }
+ scope 25 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) {
+ debug self => _16;
+ let mut _17: &mut std::slice::Iter<'_, T>;
+ }
+ }
+ scope 3 (inlined core::slice::<impl [T]>::iter) {
+ debug self => _1;
+ scope 4 (inlined std::slice::Iter::<'_, T>::new) {
+ debug slice => _1;
+ let _4: *const T;
+ let mut _5: bool;
+ let mut _6: usize;
+ let mut _8: usize;
+ let mut _9: *mut T;
+ let mut _11: std::ptr::NonNull<T>;
+ let mut _12: *const T;
+ scope 5 {
+ debug ptr => _4;
+ scope 6 {
+ let _7: *const T;
+ scope 7 {
+ debug end_or_len => _7;
+ scope 13 (inlined NonNull::<T>::new_unchecked) {
+ debug ptr => _9;
+ let mut _10: *const T;
+ scope 14 {
+ scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) {
+ debug ptr => _9;
+ scope 16 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null) {
+ debug self => _9;
+ let mut _24: *mut u8;
+ scope 17 {
+ scope 18 (inlined std::ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) {
+ debug ptr => _24;
+ scope 19 (inlined std::ptr::mut_ptr::<impl *mut u8>::addr) {
+ debug self => _24;
+ scope 20 {
+ scope 21 (inlined std::ptr::mut_ptr::<impl *mut u8>::cast::<()>) {
+ debug self => _24;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 9 (inlined invalid::<T>) {
+ debug addr => _8;
+ scope 10 {
+ }
+ }
+ scope 11 (inlined std::ptr::const_ptr::<impl *const T>::add) {
+ debug self => _4;
+ debug count => _6;
+ scope 12 {
+ }
+ }
+ }
+ }
+ scope 8 (inlined core::slice::<impl [T]>::as_ptr) {
+ debug self => _1;
+ let mut _3: *const [T];
+ }
+ }
+ }
+ scope 22 (inlined <std::slice::Iter<'_, T> as Iterator>::rev) {
+ debug self => _13;
+ scope 23 (inlined Rev::<std::slice::Iter<'_, T>>::new) {
+ debug iter => _13;
+ }
+ }
+ scope 24 (inlined <Rev<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) {
+ debug self => _14;
+ }
+
+ bb0: {
+ StorageLive(_13);
+ StorageLive(_4);
+ StorageLive(_3);
+ _3 = &raw const (*_1);
+ _4 = move _3 as *const T (PtrToPtr);
+ StorageDead(_3);
+ StorageLive(_7);
+ StorageLive(_5);
+ _5 = const _;
+ switchInt(move _5) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = Len((*_1));
+ _7 = Offset(_4, _6);
+ StorageDead(_6);
+ goto -> bb3;
+ }
+
+ bb2: {
+ StorageLive(_8);
+ _8 = Len((*_1));
+ _7 = _8 as *const T (Transmute);
+ StorageDead(_8);
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_5);
+ StorageLive(_11);
+ StorageLive(_9);
+ _9 = _4 as *mut T (PtrToPtr);
+ StorageLive(_10);
+ StorageLive(_24);
+ _10 = _9 as *const T (PointerCoercion(MutToConstPointer));
+ _11 = NonNull::<T> { pointer: _10 };
+ StorageDead(_24);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageLive(_12);
+ _12 = _7;
+ _13 = std::slice::Iter::<'_, T> { ptr: move _11, end_or_len: move _12, _marker: const ZeroSized: PhantomData<&T> };
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_7);
+ StorageDead(_4);
+ _14 = Rev::<std::slice::Iter<'_, T>> { iter: move _13 };
+ StorageDead(_13);
+ StorageLive(_15);
+ _15 = move _14;
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageLive(_18);
+ _16 = &mut _15;
+ StorageLive(_17);
+ _17 = &mut (_15.0: std::slice::Iter<'_, T>);
+ _18 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind: bb11];
+ }
+
+ bb5: {
+ StorageDead(_17);
+ _19 = discriminant(_18);
+ switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10];
+ }
+
+ bb6: {
+ StorageDead(_18);
+ StorageDead(_15);
+ drop(_2) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ return;
+ }
+
+ bb8: {
+ _20 = ((_18 as Some).0: &T);
+ StorageLive(_21);
+ _21 = &_2;
+ StorageLive(_22);
+ _22 = (_20,);
+ _23 = <impl Fn(&T) as Fn<(&T,)>>::call(move _21, move _22) -> [return: bb9, unwind: bb11];
+ }
+
+ bb9: {
+ StorageDead(_22);
+ StorageDead(_21);
+ StorageDead(_18);
+ goto -> bb4;
+ }
+
+ bb10: {
+ unreachable;
+ }
+
+ bb11 (cleanup): {
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
+ bb12 (cleanup): {
+ resume;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.rs b/tests/mir-opt/pre-codegen/slice_iter.rs
index ca423ca55..10a5c3070 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.rs
+++ b/tests/mir-opt/pre-codegen/slice_iter.rs
@@ -1,6 +1,8 @@
+// skip-filecheck
// 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"]
@@ -36,3 +38,18 @@ pub fn reverse_loop<'a, T>(slice: &'a [T], f: impl Fn(&T)) {
f(x)
}
}
+
+// EMIT_MIR slice_iter.enumerated_loop.PreCodegen.after.mir
+pub fn enumerated_loop<'a, T>(slice: &'a [T], f: impl Fn(usize, &T)) {
+ for (i, x) in slice.iter().enumerate() {
+ f(i, x)
+ }
+}
+
+// EMIT_MIR slice_iter.range_loop.PreCodegen.after.mir
+pub fn range_loop<'a, T>(slice: &'a [T], f: impl Fn(usize, &T)) {
+ for i in 0..slice.len() {
+ let x = &slice[i];
+ f(i, x)
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir
deleted file mode 100644
index a1431d473..000000000
--- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir
+++ /dev/null
@@ -1,17 +0,0 @@
-// MIR for `slice_iter_mut_next_back` after PreCodegen
-
-fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut T> {
- debug it => _1; // in scope 0 at $DIR/slice_iter.rs:+0:40: +0:42
- let mut _0: std::option::Option<&mut T>; // return place in scope 0 at $DIR/slice_iter.rs:+0:80: +0:97
-
- bb0: {
- _0 = <std::slice::IterMut<'_, T> as DoubleEndedIterator>::next_back(_1) -> bb1; // scope 0 at $DIR/slice_iter.rs:+1:5: +1:19
- // mir::Constant
- // + span: $DIR/slice_iter.rs:23:8: 23:17
- // + literal: Const { ty: for<'a> fn(&'a mut std::slice::IterMut<'_, T>) -> Option<<std::slice::IterMut<'_, T> as Iterator>::Item> {<std::slice::IterMut<'_, T> as DoubleEndedIterator>::next_back}, val: Value(<ZST>) }
- }
-
- bb1: {
- return; // scope 0 at $DIR/slice_iter.rs:+2:2: +2:2
- }
-}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..78f96bf41
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,14 @@
+// MIR for `slice_iter_mut_next_back` after PreCodegen
+
+fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut T> {
+ debug it => _1;
+ let mut _0: std::option::Option<&mut T>;
+
+ bb0: {
+ _0 = <std::slice::IterMut<'_, T> as DoubleEndedIterator>::next_back(move _1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 000000000..dfe5e206f
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,14 @@
+// MIR for `slice_iter_mut_next_back` after PreCodegen
+
+fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut T> {
+ debug it => _1;
+ let mut _0: std::option::Option<&mut T>;
+
+ bb0: {
+ _0 = <std::slice::IterMut<'_, T> as DoubleEndedIterator>::next_back(move _1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.mir
deleted file mode 100644
index d2a963cad..000000000
--- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.mir
+++ /dev/null
@@ -1,17 +0,0 @@
-// MIR for `slice_iter_next` after PreCodegen
-
-fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> {
- debug it => _1; // in scope 0 at $DIR/slice_iter.rs:+0:31: +0:33
- let mut _0: std::option::Option<&T>; // return place in scope 0 at $DIR/slice_iter.rs:+0:68: +0:81
-
- bb0: {
- _0 = <std::slice::Iter<'_, T> as Iterator>::next(_1) -> bb1; // scope 0 at $DIR/slice_iter.rs:+1:5: +1:14
- // mir::Constant
- // + span: $DIR/slice_iter.rs:18:8: 18:12
- // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option<<std::slice::Iter<'_, T> as Iterator>::Item> {<std::slice::Iter<'_, T> as Iterator>::next}, val: Value(<ZST>) }
- }
-
- bb1: {
- return; // scope 0 at $DIR/slice_iter.rs:+2:2: +2:2
- }
-}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..8edac638c
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,14 @@
+// MIR for `slice_iter_next` after PreCodegen
+
+fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> {
+ debug it => _1;
+ let mut _0: std::option::Option<&T>;
+
+ bb0: {
+ _0 = <std::slice::Iter<'_, T> as Iterator>::next(move _1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 000000000..fdde07173
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,14 @@
+// MIR for `slice_iter_next` after PreCodegen
+
+fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> {
+ debug it => _1;
+ let mut _0: std::option::Option<&T>;
+
+ bb0: {
+ _0 = <std::slice::Iter<'_, T> as Iterator>::next(move _1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ return;
+ }
+}
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
new file mode 100644
index 000000000..485dc9179
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,18 @@
+// 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
+ scope 1 (inlined inner) { // at $DIR/spans.rs:11:5: 11:14
+ debug x => _2; // in scope 1 at $DIR/spans.rs:14:14: 14:15
+ }
+
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13
+ _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13
+ _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7
+ StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14
+ return; // scope 0 at $DIR/spans.rs:12:2: 12:2
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 000000000..485dc9179
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,18 @@
+// 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
+ scope 1 (inlined inner) { // at $DIR/spans.rs:11:5: 11:14
+ debug x => _2; // in scope 1 at $DIR/spans.rs:14:14: 14:15
+ }
+
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13
+ _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13
+ _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7
+ StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14
+ return; // scope 0 at $DIR/spans.rs:12:2: 12:2
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/spans.rs b/tests/mir-opt/pre-codegen/spans.rs
new file mode 100644
index 000000000..aa36648ce
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/spans.rs
@@ -0,0 +1,16 @@
+// skip-filecheck
+// Test that the comments we emit in MIR opts are accurate.
+//
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// compile-flags: -Zmir-include-spans
+
+#![crate_type = "lib"]
+
+// EMIT_MIR spans.outer.PreCodegen.after.mir
+pub fn outer(v: u8) -> u8 {
+ inner(&v)
+}
+
+pub fn inner(x: &u8) -> u8 {
+ *x
+}
diff --git a/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir
index 53971b4cf..0bf4a2670 100644
--- a/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir
@@ -1,70 +1,70 @@
// MIR for `new` after PreCodegen
fn new(_1: Result<T, E>) -> Result<T, E> {
- debug x => _1; // in scope 0 at $DIR/try_identity.rs:+0:14: +0:15
- let mut _0: std::result::Result<T, E>; // return place in scope 0 at $DIR/try_identity.rs:+0:34: +0:46
- let mut _2: std::ops::ControlFlow<E, T>; // in scope 0 at $DIR/try_identity.rs:+2:15: +7:10
- let mut _3: isize; // in scope 0 at $DIR/try_identity.rs:+4:17: +4:22
- let _4: T; // in scope 0 at $DIR/try_identity.rs:+4:20: +4:21
- let _5: E; // in scope 0 at $DIR/try_identity.rs:+5:21: +5:22
- let mut _6: isize; // in scope 0 at $DIR/try_identity.rs:+8:13: +8:37
- let _7: T; // in scope 0 at $DIR/try_identity.rs:+8:35: +8:36
- let _8: E; // in scope 0 at $DIR/try_identity.rs:+9:32: +9:33
+ debug x => _1;
+ let mut _0: std::result::Result<T, E>;
+ let mut _2: isize;
+ let _3: T;
+ let mut _4: std::ops::ControlFlow<E, T>;
+ let _5: E;
+ let mut _6: isize;
+ let _7: T;
+ let _8: E;
scope 1 {
- debug v => _4; // in scope 1 at $DIR/try_identity.rs:+4:20: +4:21
+ debug v => _3;
}
scope 2 {
- debug e => _5; // in scope 2 at $DIR/try_identity.rs:+5:21: +5:22
+ debug e => _5;
}
scope 3 {
- debug v => _7; // in scope 3 at $DIR/try_identity.rs:+8:35: +8:36
+ debug v => _7;
}
scope 4 {
- debug e => _8; // in scope 4 at $DIR/try_identity.rs:+9:32: +9:33
+ debug e => _8;
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/try_identity.rs:+2:15: +7:10
- _3 = discriminant(_1); // scope 0 at $DIR/try_identity.rs:+3:19: +3:20
- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity.rs:+3:13: +3:20
+ StorageLive(_4);
+ _2 = discriminant(_1);
+ switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb7];
}
bb1: {
- _5 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity.rs:+5:21: +5:22
- _2 = ControlFlow::<E, T>::Break(move _5); // scope 2 at $DIR/try_identity.rs:+5:27: +5:48
- goto -> bb4; // scope 0 at $DIR/try_identity.rs:+5:47: +5:48
+ _3 = move ((_1 as Ok).0: T);
+ _4 = ControlFlow::<E, T>::Continue(move _3);
+ goto -> bb3;
}
bb2: {
- unreachable; // scope 0 at $DIR/try_identity.rs:+3:19: +3:20
+ _5 = move ((_1 as Err).0: E);
+ _4 = ControlFlow::<E, T>::Break(move _5);
+ goto -> bb3;
}
bb3: {
- _4 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity.rs:+4:20: +4:21
- _2 = ControlFlow::<E, T>::Continue(move _4); // scope 1 at $DIR/try_identity.rs:+4:26: +4:50
- goto -> bb4; // scope 0 at $DIR/try_identity.rs:+4:49: +4:50
+ _6 = discriminant(_4);
+ switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb7];
}
bb4: {
- _6 = discriminant(_2); // scope 0 at $DIR/try_identity.rs:+2:15: +7:10
- switchInt(move _6) -> [0: bb6, 1: bb5, otherwise: bb2]; // scope 0 at $DIR/try_identity.rs:+2:9: +7:10
+ _7 = move ((_4 as Continue).0: T);
+ _0 = Result::<T, E>::Ok(move _7);
+ StorageDead(_4);
+ goto -> bb6;
}
bb5: {
- _8 = move ((_2 as Break).0: E); // scope 0 at $DIR/try_identity.rs:+9:32: +9:33
- _0 = Result::<T, E>::Err(move _8); // scope 4 at $DIR/try_identity.rs:+9:45: +9:51
- StorageDead(_2); // scope 0 at $DIR/try_identity.rs:+12:1: +12:2
- goto -> bb7; // scope 0 at $DIR/try_identity.rs:+12:1: +12:2
+ _8 = move ((_4 as Break).0: E);
+ _0 = Result::<T, E>::Err(move _8);
+ StorageDead(_4);
+ goto -> bb6;
}
bb6: {
- _7 = move ((_2 as Continue).0: T); // scope 0 at $DIR/try_identity.rs:+8:35: +8:36
- _0 = Result::<T, E>::Ok(move _7); // scope 0 at $DIR/try_identity.rs:+1:5: +11:6
- StorageDead(_2); // scope 0 at $DIR/try_identity.rs:+12:1: +12:2
- goto -> bb7; // scope 0 at $DIR/try_identity.rs:+12:1: +12:2
+ return;
}
bb7: {
- return; // scope 0 at $DIR/try_identity.rs:+12:2: +12:2
+ unreachable;
}
}
diff --git a/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir
index e217d1994..7ccb8b043 100644
--- a/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir
@@ -1,40 +1,40 @@
// MIR for `old` after PreCodegen
fn old(_1: Result<T, E>) -> Result<T, E> {
- debug x => _1; // in scope 0 at $DIR/try_identity.rs:+0:14: +0:15
- let mut _0: std::result::Result<T, E>; // return place in scope 0 at $DIR/try_identity.rs:+0:34: +0:46
- let mut _2: isize; // in scope 0 at $DIR/try_identity.rs:+3:13: +3:18
- let _3: T; // in scope 0 at $DIR/try_identity.rs:+3:16: +3:17
- let _4: E; // in scope 0 at $DIR/try_identity.rs:+4:17: +4:18
+ debug x => _1;
+ let mut _0: std::result::Result<T, E>;
+ let mut _2: isize;
+ let _3: T;
+ let _4: E;
scope 1 {
- debug v => _3; // in scope 1 at $DIR/try_identity.rs:+3:16: +3:17
+ debug v => _3;
}
scope 2 {
- debug e => _4; // in scope 2 at $DIR/try_identity.rs:+4:17: +4:18
+ debug e => _4;
}
bb0: {
- _2 = discriminant(_1); // scope 0 at $DIR/try_identity.rs:+2:15: +2:16
- switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity.rs:+2:9: +2:16
+ _2 = discriminant(_1);
+ switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4];
}
bb1: {
- _4 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity.rs:+4:17: +4:18
- _0 = Result::<T, E>::Err(move _4); // scope 2 at $DIR/try_identity.rs:+4:30: +4:36
- goto -> bb4; // scope 0 at $DIR/try_identity.rs:+7:1: +7:2
+ _3 = move ((_1 as Ok).0: T);
+ _0 = Result::<T, E>::Ok(move _3);
+ goto -> bb3;
}
bb2: {
- unreachable; // scope 0 at $DIR/try_identity.rs:+2:15: +2:16
+ _4 = move ((_1 as Err).0: E);
+ _0 = Result::<T, E>::Err(move _4);
+ goto -> bb3;
}
bb3: {
- _3 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity.rs:+3:16: +3:17
- _0 = Result::<T, E>::Ok(move _3); // scope 0 at $DIR/try_identity.rs:+1:5: +6:6
- goto -> bb4; // scope 0 at $DIR/try_identity.rs:+7:1: +7:2
+ return;
}
bb4: {
- return; // scope 0 at $DIR/try_identity.rs:+7:2: +7:2
+ unreachable;
}
}
diff --git a/tests/mir-opt/pre-codegen/try_identity.rs b/tests/mir-opt/pre-codegen/try_identity.rs
index 079ecccab..b6e4eaad7 100644
--- a/tests/mir-opt/pre-codegen/try_identity.rs
+++ b/tests/mir-opt/pre-codegen/try_identity.rs
@@ -1,6 +1,6 @@
+// skip-filecheck
// 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/reference_prop.debuginfo.ReferencePropagation.diff b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff
index 07bd48fc8..1648f5dd8 100644
--- a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff
@@ -2,174 +2,161 @@
+ // MIR for `debuginfo` after ReferencePropagation
fn debuginfo() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:16: +0:16
- let _1: &mut u8; // in scope 0 at $DIR/reference_prop.rs:+3:9: +3:19
- let mut _2: u8; // in scope 0 at $DIR/reference_prop.rs:+3:27: +3:31
- let _4: debuginfo::T; // in scope 0 at $DIR/reference_prop.rs:+4:18: +4:22
- let _6: (); // in scope 0 at $DIR/reference_prop.rs:+9:5: +12:6
- let mut _7: std::option::Option<i32>; // in scope 0 at $DIR/reference_prop.rs:+9:11: +9:18
- let mut _8: isize; // in scope 0 at $DIR/reference_prop.rs:+10:9: +10:13
- let _10: (); // in scope 0 at $DIR/reference_prop.rs:+16:5: +17:6
- let mut _11: &[i32]; // in scope 0 at $DIR/reference_prop.rs:+16:82: +16:94
- let _12: &[i32]; // in scope 0 at $DIR/reference_prop.rs:+16:83: +16:94
- let mut _13: &[i32; 10]; // in scope 0 at $DIR/reference_prop.rs:+16:83: +16:90
- let _14: [i32; 10]; // in scope 0 at $DIR/reference_prop.rs:+16:83: +16:90
- let mut _15: std::ops::RangeFull; // in scope 0 at $DIR/reference_prop.rs:+16:91: +16:93
- let mut _16: usize; // in scope 0 at $DIR/reference_prop.rs:+16:12: +16:79
- let mut _17: usize; // in scope 0 at $DIR/reference_prop.rs:+16:12: +16:79
- let mut _18: bool; // in scope 0 at $DIR/reference_prop.rs:+16:12: +16:79
- let _23: &&mut u8; // in scope 0 at $DIR/reference_prop.rs:+19:28: +19:40
- let _24: &mut u8; // in scope 0 at $DIR/reference_prop.rs:+19:29: +19:40
- let mut _25: debuginfo::T; // in scope 0 at $DIR/reference_prop.rs:+19:34: +19:38
+ let mut _0: ();
+ let _1: &mut u8;
+ let mut _2: u8;
+ let _4: debuginfo::T;
+ let _6: ();
+ let mut _7: std::option::Option<i32>;
+ let mut _8: isize;
+ let _10: ();
+ let mut _11: &[i32];
+ let _12: &[i32];
+ let mut _13: &[i32; 10];
+ let _14: [i32; 10];
+ let mut _15: std::ops::RangeFull;
+ let mut _16: usize;
+ let mut _17: usize;
+ let mut _18: bool;
+ let _23: &&mut u8;
+ let _24: &mut u8;
+ let mut _25: debuginfo::T;
scope 1 {
-- debug ref_mut_u8 => _1; // in scope 1 at $DIR/reference_prop.rs:+3:9: +3:19
-+ debug ref_mut_u8 => &_2; // in scope 1 at $DIR/reference_prop.rs:+3:9: +3:19
- let _3: &u8; // in scope 1 at $DIR/reference_prop.rs:+4:9: +4:14
- let mut _28: &debuginfo::T; // in scope 1 at $DIR/reference_prop.rs:+4:17: +4:24
+ debug ref_mut_u8 => _1;
+ let _3: &u8;
+ let mut _28: &debuginfo::T;
scope 2 {
-- debug field => _3; // in scope 2 at $DIR/reference_prop.rs:+4:9: +4:14
-+ debug field => &((*_28).0: u8); // in scope 2 at $DIR/reference_prop.rs:+4:9: +4:14
- let _5: &u8; // in scope 2 at $DIR/reference_prop.rs:+7:9: +7:17
+ debug field => _3;
+ let _5: &u8;
scope 3 {
-- debug reborrow => _5; // in scope 3 at $DIR/reference_prop.rs:+7:9: +7:17
-+ debug reborrow => &_2; // in scope 3 at $DIR/reference_prop.rs:+7:9: +7:17
- let _9: &i32; // in scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
- let _22: &&&mut u8; // in scope 3 at $DIR/reference_prop.rs:+19:9: +19:24
- let mut _27: &std::option::Option<i32>; // in scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
+- debug reborrow => _5;
++ debug reborrow => _1;
+ let _9: &i32;
+ let _22: &&&mut u8;
+ let mut _27: &std::option::Option<i32>;
scope 4 {
-- debug variant_field => _9; // in scope 4 at $DIR/reference_prop.rs:+11:14: +11:31
-+ debug variant_field => &(((*_27) as Some).0: i32); // in scope 4 at $DIR/reference_prop.rs:+11:14: +11:31
+ debug variant_field => _9;
}
scope 5 {
-- debug constant_index => _19; // in scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
-+ debug constant_index => &(*_11)[1 of 3]; // in scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
- debug subslice => _20; // in scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
- debug constant_index_from_end => _21; // in scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
- let _19: &i32; // in scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
- let _20: &[i32]; // in scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
- let _21: &i32; // in scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
- let mut _26: &[i32; 10]; // in scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
+ debug constant_index => _19;
+ debug subslice => _20;
+ debug constant_index_from_end => _21;
+ let _19: &i32;
+ let _20: &[i32];
+ let _21: &i32;
+ let mut _26: &[i32; 10];
}
scope 6 {
-- debug multiple_borrow => _22; // in scope 6 at $DIR/reference_prop.rs:+19:9: +19:24
-+ debug multiple_borrow => &&&(_25.0: u8); // in scope 6 at $DIR/reference_prop.rs:+19:9: +19:24
+ debug multiple_borrow => _22;
}
}
}
}
bb0: {
-- StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+3:9: +3:19
- StorageLive(_2); // scope 0 at $DIR/reference_prop.rs:+3:27: +3:31
- _2 = const 5_u8; // scope 0 at $DIR/reference_prop.rs:+3:27: +3:31
-- _1 = &mut _2; // scope 0 at $DIR/reference_prop.rs:+3:22: +3:31
-- StorageLive(_3); // scope 1 at $DIR/reference_prop.rs:+4:9: +4:14
- _28 = const _; // scope 1 at $DIR/reference_prop.rs:+4:17: +4:24
- // mir::Constant
- // + span: $DIR/reference_prop.rs:535:17: 535:24
- // + literal: Const { ty: &T, val: Unevaluated(debuginfo, [], Some(promoted[2])) }
-- _3 = &((*_28).0: u8); // scope 1 at $DIR/reference_prop.rs:+4:17: +4:24
-- StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+7:9: +7:17
-- _5 = &(*_1); // scope 2 at $DIR/reference_prop.rs:+7:20: +7:32
-- StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+9:5: +12:6
- StorageLive(_7); // scope 3 at $DIR/reference_prop.rs:+9:11: +9:18
- _7 = Option::<i32>::Some(const 0_i32); // scope 3 at $DIR/reference_prop.rs:+9:11: +9:18
- _8 = discriminant(_7); // scope 3 at $DIR/reference_prop.rs:+9:11: +9:18
- switchInt(move _8) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 3 at $DIR/reference_prop.rs:+9:5: +9:18
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = const 5_u8;
+ _1 = &mut _2;
+ StorageLive(_3);
+ _28 = const _;
+ _3 = &((*_28).0: u8);
+- StorageLive(_5);
+- _5 = &(*_1);
+- StorageLive(_6);
+ StorageLive(_7);
+ _7 = Option::<i32>::Some(const 0_i32);
+ _8 = discriminant(_7);
+ switchInt(move _8) -> [0: bb3, 1: bb1, otherwise: bb2];
}
bb1: {
-- StorageLive(_9); // scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
- _27 = const _; // scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
- // mir::Constant
- // + span: $DIR/reference_prop.rs:542:14: 542:31
- // + literal: Const { ty: &Option<i32>, val: Unevaluated(debuginfo, [], Some(promoted[1])) }
-- _9 = &(((*_27) as Some).0: i32); // scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
-- _6 = const (); // scope 4 at $DIR/reference_prop.rs:+11:36: +11:38
-- StorageDead(_9); // scope 3 at $DIR/reference_prop.rs:+11:37: +11:38
- goto -> bb4; // scope 3 at $DIR/reference_prop.rs:+11:37: +11:38
+ StorageLive(_9);
+ _27 = const _;
+ _9 = &(((*_27) as Some).0: i32);
+- _6 = const ();
+ StorageDead(_9);
+ goto -> bb4;
}
bb2: {
- unreachable; // scope 3 at $DIR/reference_prop.rs:+9:11: +9:18
+ unreachable;
}
bb3: {
-- _6 = const (); // scope 3 at $DIR/reference_prop.rs:+10:17: +10:19
- goto -> bb4; // scope 3 at $DIR/reference_prop.rs:+10:17: +10:19
+- _6 = const ();
+ goto -> bb4;
}
bb4: {
- StorageDead(_7); // scope 3 at $DIR/reference_prop.rs:+12:5: +12:6
-- StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+12:5: +12:6
-- StorageLive(_10); // scope 3 at $DIR/reference_prop.rs:+16:5: +17:6
- StorageLive(_11); // scope 5 at $DIR/reference_prop.rs:+16:82: +16:94
- StorageLive(_12); // scope 5 at $DIR/reference_prop.rs:+16:83: +16:94
- StorageLive(_13); // scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
- _26 = const _; // scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
- // mir::Constant
- // + span: $DIR/reference_prop.rs:547:83: 547:90
- // + literal: Const { ty: &[i32; 10], val: Unevaluated(debuginfo, [], Some(promoted[0])) }
- _13 = &(*_26); // scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
- StorageLive(_15); // scope 5 at $DIR/reference_prop.rs:+16:91: +16:93
- _15 = RangeFull; // scope 5 at $DIR/reference_prop.rs:+16:91: +16:93
- _12 = <[i32; 10] as Index<RangeFull>>::index(move _13, move _15) -> bb5; // scope 5 at $DIR/reference_prop.rs:+16:83: +16:94
- // mir::Constant
- // + span: $DIR/reference_prop.rs:547:83: 547:94
- // + literal: Const { ty: for<'a> fn(&'a [i32; 10], RangeFull) -> &'a <[i32; 10] as Index<RangeFull>>::Output {<[i32; 10] as Index<RangeFull>>::index}, val: Value(<ZST>) }
+ StorageDead(_7);
+- StorageDead(_6);
+- StorageLive(_10);
+- StorageLive(_11);
+- StorageLive(_12);
+ StorageLive(_13);
+ _26 = const _;
+ _13 = &(*_26);
+ StorageLive(_15);
+ _15 = RangeFull;
+ _12 = <[i32; 10] as Index<RangeFull>>::index(move _13, move _15) -> [return: bb5, unwind continue];
}
bb5: {
- StorageDead(_15); // scope 5 at $DIR/reference_prop.rs:+16:93: +16:94
- StorageDead(_13); // scope 5 at $DIR/reference_prop.rs:+16:93: +16:94
- _11 = &(*_12); // scope 5 at $DIR/reference_prop.rs:+16:82: +16:94
- _16 = Len((*_11)); // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
- _17 = const 3_usize; // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
- _18 = Ge(move _16, move _17); // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
- switchInt(move _18) -> [0: bb7, otherwise: bb6]; // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
+ StorageDead(_15);
+ StorageDead(_13);
+- _11 = &(*_12);
+- _16 = Len((*_11));
++ _16 = Len((*_12));
+ _17 = const 3_usize;
+ _18 = Ge(move _16, move _17);
+ switchInt(move _18) -> [0: bb7, otherwise: bb6];
}
bb6: {
-- StorageLive(_19); // scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
-- _19 = &(*_11)[1 of 3]; // scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
- StorageLive(_20); // scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
- _20 = &(*_11)[2:-1]; // scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
- StorageLive(_21); // scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
- _21 = &(*_11)[-1 of 3]; // scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
-- _10 = const (); // scope 5 at $DIR/reference_prop.rs:+16:95: +17:6
- StorageDead(_21); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
- StorageDead(_20); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
-- StorageDead(_19); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
- goto -> bb8; // scope 3 at $DIR/reference_prop.rs:+16:5: +17:6
+ StorageLive(_19);
+- _19 = &(*_11)[1 of 3];
++ _19 = &(*_12)[1 of 3];
+ StorageLive(_20);
+- _20 = &(*_11)[2:-1];
++ _20 = &(*_12)[2:-1];
+ StorageLive(_21);
+- _21 = &(*_11)[-1 of 3];
+- _10 = const ();
++ _21 = &(*_12)[-1 of 3];
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_19);
+ goto -> bb8;
}
bb7: {
-- _10 = const (); // scope 3 at $DIR/reference_prop.rs:+17:6: +17:6
- goto -> bb8; // scope 3 at $DIR/reference_prop.rs:+16:5: +17:6
+- _10 = const ();
+ goto -> bb8;
}
bb8: {
- StorageDead(_12); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
- StorageDead(_11); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
-- StorageDead(_10); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
-- StorageLive(_22); // scope 3 at $DIR/reference_prop.rs:+19:9: +19:24
-- StorageLive(_23); // scope 3 at $DIR/reference_prop.rs:+19:28: +19:40
-- StorageLive(_24); // scope 3 at $DIR/reference_prop.rs:+19:29: +19:40
- StorageLive(_25); // scope 3 at $DIR/reference_prop.rs:+19:34: +19:38
- _25 = T(const 6_u8); // scope 3 at $DIR/reference_prop.rs:+19:34: +19:38
-- _24 = &mut (_25.0: u8); // scope 3 at $DIR/reference_prop.rs:+19:29: +19:40
-- _23 = &_24; // scope 3 at $DIR/reference_prop.rs:+19:28: +19:40
-- _22 = &_23; // scope 3 at $DIR/reference_prop.rs:+19:27: +19:40
- _0 = const (); // scope 0 at $DIR/reference_prop.rs:+0:16: +20:2
- StorageDead(_25); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2
-- StorageDead(_24); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2
-- StorageDead(_23); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2
-- StorageDead(_22); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2
-- StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+20:1: +20:2
-- StorageDead(_3); // scope 1 at $DIR/reference_prop.rs:+20:1: +20:2
- StorageDead(_2); // scope 0 at $DIR/reference_prop.rs:+20:1: +20:2
-- StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+20:1: +20:2
- return; // scope 0 at $DIR/reference_prop.rs:+20:2: +20:2
+- StorageDead(_12);
+- StorageDead(_11);
+- StorageDead(_10);
+ StorageLive(_22);
+ StorageLive(_23);
+ StorageLive(_24);
+ StorageLive(_25);
+ _25 = T(const 6_u8);
+ _24 = &mut (_25.0: u8);
+ _23 = &_24;
+ _22 = &_23;
+ _0 = const ();
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageDead(_22);
+- StorageDead(_5);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff b/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff
index e158f64e9..012efa969 100644
--- a/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff
@@ -2,37 +2,34 @@
+ // MIR for `dominate_storage` after ReferencePropagation
fn dominate_storage() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:23: +0:23
- let mut _1: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _2: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _4: bool; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _5: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _6: bool; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: ();
+ let mut _1: i32;
+ let mut _2: &i32;
+ let mut _3: i32;
+ let mut _4: bool;
+ let mut _5: i32;
+ let mut _6: bool;
bb0: {
- goto -> bb1; // scope 0 at $DIR/reference_prop.rs:+8:11: +8:20
+ goto -> bb1;
}
bb1: {
- _1 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+10:13: +10:18
- _2 = &_1; // scope 0 at $DIR/reference_prop.rs:+11:13: +11:19
- goto -> bb2; // scope 0 at $DIR/reference_prop.rs:+12:13: +12:22
+ _1 = const 5_i32;
+ _2 = &_1;
+ goto -> bb2;
}
bb2: {
- _5 = (*_2); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _0 = opaque::<i32>(_5) -> bb3; // scope 0 at $DIR/reference_prop.rs:+16:13: +16:38
- // mir::Constant
- // + span: $DIR/reference_prop.rs:455:28: 455:34
- // + literal: Const { ty: fn(i32) {opaque::<i32>}, val: Value(<ZST>) }
+ _5 = (*_2);
+ _0 = opaque::<i32>(_5) -> [return: bb3, unwind continue];
}
bb3: {
- StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+19:13: +19:27
- StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+20:13: +20:27
- _6 = const true; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- switchInt(_6) -> [0: bb3, otherwise: bb1]; // scope 0 at $DIR/reference_prop.rs:+22:13: +22:47
+ StorageDead(_1);
+ StorageLive(_1);
+ _6 = const true;
+ switchInt(_6) -> [0: bb3, otherwise: bb1];
}
}
diff --git a/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff
index 38ab16ced..c6bd6c212 100644
--- a/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff
@@ -2,55 +2,46 @@
+ // MIR for `maybe_dead` after ReferencePropagation
fn maybe_dead(_1: bool) -> () {
- let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:24: +0:24
- let mut _2: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _4: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _5: &mut i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _6: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _7: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _8: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: ();
+ let mut _2: i32;
+ let mut _3: i32;
+ let mut _4: &i32;
+ let mut _5: &mut i32;
+ let mut _6: i32;
+ let mut _7: i32;
+ let mut _8: i32;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/reference_prop.rs:+7:13: +7:27
- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+8:13: +8:27
- _2 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+9:13: +9:18
- _3 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+10:13: +10:18
- _4 = &_2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _5 = &mut _3; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- (*_5) = const 7_i32; // scope 0 at $DIR/reference_prop.rs:+14:13: +14:19
-- _6 = (*_4); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
-+ _6 = _2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- switchInt(_1) -> [1: bb1, otherwise: bb2]; // scope 0 at $DIR/reference_prop.rs:+17:13: +17:46
+ StorageLive(_2);
+ StorageLive(_3);
+ _2 = const 5_i32;
+ _3 = const 5_i32;
+ _4 = &_2;
+ _5 = &mut _3;
+ (*_5) = const 7_i32;
+- _6 = (*_4);
++ _6 = _2;
+ switchInt(_1) -> [1: bb1, otherwise: bb2];
}
bb1: {
- StorageDead(_2); // scope 0 at $DIR/reference_prop.rs:+20:13: +20:27
- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+21:13: +21:27
- _0 = opaque::<i32>(_6) -> bb2; // scope 0 at $DIR/reference_prop.rs:+22:13: +22:38
- // mir::Constant
- // + span: $DIR/reference_prop.rs:489:28: 489:34
- // + literal: Const { ty: fn(i32) {opaque::<i32>}, val: Value(<ZST>) }
+ StorageDead(_2);
+ StorageDead(_3);
+ _0 = opaque::<i32>(_6) -> [return: bb2, unwind continue];
}
bb2: {
- _7 = (*_4); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _0 = opaque::<i32>(_7) -> bb3; // scope 0 at $DIR/reference_prop.rs:+27:13: +27:38
- // mir::Constant
- // + span: $DIR/reference_prop.rs:494:28: 494:34
- // + literal: Const { ty: fn(i32) {opaque::<i32>}, val: Value(<ZST>) }
+ _7 = (*_4);
+ _0 = opaque::<i32>(_7) -> [return: bb3, unwind continue];
}
bb3: {
- _8 = (*_5); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _0 = opaque::<i32>(_8) -> bb4; // scope 0 at $DIR/reference_prop.rs:+33:13: +33:43
- // mir::Constant
- // + span: $DIR/reference_prop.rs:500:33: 500:39
- // + literal: Const { ty: fn(i32) {opaque::<i32>}, val: Value(<ZST>) }
+ _8 = (*_5);
+ _0 = opaque::<i32>(_8) -> [return: bb4, unwind continue];
}
bb4: {
- return; // scope 0 at $DIR/reference_prop.rs:+36:13: +36:21
+ return;
}
}
diff --git a/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff
index 6e4517868..0fd74155a 100644
--- a/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff
@@ -2,26 +2,23 @@
+ // MIR for `multiple_storage` after ReferencePropagation
fn multiple_storage() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:23: +0:23
- let mut _1: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _2: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: ();
+ let mut _1: i32;
+ let mut _2: &i32;
+ let mut _3: i32;
bb0: {
- StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+6:13: +6:27
- _1 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+7:13: +7:18
- _2 = &_1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+9:13: +9:27
- StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+10:13: +10:27
- _3 = (*_2); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- _0 = opaque::<i32>(_3) -> bb1; // scope 0 at $DIR/reference_prop.rs:+14:13: +14:43
- // mir::Constant
- // + span: $DIR/reference_prop.rs:429:33: 429:39
- // + literal: Const { ty: fn(i32) {opaque::<i32>}, val: Value(<ZST>) }
+ StorageLive(_1);
+ _1 = const 5_i32;
+ _2 = &_1;
+ StorageDead(_1);
+ StorageLive(_1);
+ _3 = (*_2);
+ _0 = opaque::<i32>(_3) -> [return: bb1, unwind continue];
}
bb1: {
- return; // scope 0 at $DIR/reference_prop.rs:+18:13: +18:21
+ return;
}
}
diff --git a/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff
index d99e11035..747028e12 100644
--- a/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff
@@ -2,30 +2,29 @@
+ // MIR for `mut_raw_then_mut_shr` after ReferencePropagation
fn mut_raw_then_mut_shr() -> (i32, i32) {
- let mut _0: (i32, i32); // return place in scope 0 at $DIR/reference_prop.rs:+0:30: +0:40
- let mut _1: i32; // in scope 0 at $DIR/reference_prop.rs:+1:9: +1:14
- let mut _4: *mut i32; // in scope 0 at $DIR/reference_prop.rs:+3:16: +3:36
- let mut _5: &mut i32; // in scope 0 at $DIR/reference_prop.rs:+3:16: +3:26
- let _8: (); // in scope 0 at $DIR/reference_prop.rs:+7:5: +7:26
- let mut _9: i32; // in scope 0 at $DIR/reference_prop.rs:+8:6: +8:7
- let mut _10: i32; // in scope 0 at $DIR/reference_prop.rs:+8:9: +8:10
+ let mut _0: (i32, i32);
+ let mut _1: i32;
+ let mut _4: *mut i32;
+ let mut _5: &mut i32;
+ let _8: ();
+ let mut _9: i32;
+ let mut _10: i32;
scope 1 {
- debug x => _1; // in scope 1 at $DIR/reference_prop.rs:+1:9: +1:14
- let _2: &mut i32; // in scope 1 at $DIR/reference_prop.rs:+2:9: +2:13
+ debug x => _1;
+ let _2: &mut i32;
scope 2 {
-- debug xref => _2; // in scope 2 at $DIR/reference_prop.rs:+2:9: +2:13
-+ debug xref => &_1; // in scope 2 at $DIR/reference_prop.rs:+2:9: +2:13
- let _3: *mut i32; // in scope 2 at $DIR/reference_prop.rs:+3:9: +3:13
+ debug xref => _2;
+ let _3: *mut i32;
scope 3 {
-- debug xraw => _3; // in scope 3 at $DIR/reference_prop.rs:+3:9: +3:13
-+ debug xraw => &_1; // in scope 3 at $DIR/reference_prop.rs:+3:9: +3:13
- let _6: &i32; // in scope 3 at $DIR/reference_prop.rs:+4:9: +4:13
+- debug xraw => _3;
++ debug xraw => _2;
+ let _6: &i32;
scope 4 {
-- debug xshr => _6; // in scope 4 at $DIR/reference_prop.rs:+4:9: +4:13
-+ debug xshr => &_1; // in scope 4 at $DIR/reference_prop.rs:+4:9: +4:13
- let _7: i32; // in scope 4 at $DIR/reference_prop.rs:+6:9: +6:10
+- debug xshr => _6;
++ debug xshr => _2;
+ let _7: i32;
scope 5 {
- debug a => _7; // in scope 5 at $DIR/reference_prop.rs:+6:9: +6:10
+ debug a => _7;
scope 6 {
}
}
@@ -35,41 +34,41 @@
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+1:9: +1:14
- _1 = const 2_i32; // scope 0 at $DIR/reference_prop.rs:+1:17: +1:18
-- StorageLive(_2); // scope 1 at $DIR/reference_prop.rs:+2:9: +2:13
-- _2 = &mut _1; // scope 1 at $DIR/reference_prop.rs:+2:16: +2:22
-- StorageLive(_3); // scope 2 at $DIR/reference_prop.rs:+3:9: +3:13
-- StorageLive(_4); // scope 2 at $DIR/reference_prop.rs:+3:16: +3:36
-- StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+3:16: +3:26
-- _5 = &mut (*_2); // scope 2 at $DIR/reference_prop.rs:+3:16: +3:26
-- _4 = &raw mut (*_5); // scope 2 at $DIR/reference_prop.rs:+3:16: +3:26
-- _3 = _4; // scope 2 at $DIR/reference_prop.rs:+3:16: +3:36
-- StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+3:36: +3:37
-- StorageDead(_4); // scope 2 at $DIR/reference_prop.rs:+3:36: +3:37
-- StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+4:9: +4:13
-- _6 = &(*_2); // scope 3 at $DIR/reference_prop.rs:+4:16: +4:22
- StorageLive(_7); // scope 4 at $DIR/reference_prop.rs:+6:9: +6:10
-- _7 = (*_6); // scope 4 at $DIR/reference_prop.rs:+6:13: +6:18
-- StorageLive(_8); // scope 5 at $DIR/reference_prop.rs:+7:5: +7:26
-- (*_3) = const 4_i32; // scope 6 at $DIR/reference_prop.rs:+7:14: +7:23
-- _8 = const (); // scope 6 at $DIR/reference_prop.rs:+7:5: +7:26
-- StorageDead(_8); // scope 5 at $DIR/reference_prop.rs:+7:25: +7:26
-+ _7 = _1; // scope 4 at $DIR/reference_prop.rs:+6:13: +6:18
-+ _1 = const 4_i32; // scope 6 at $DIR/reference_prop.rs:+7:14: +7:23
- StorageLive(_9); // scope 5 at $DIR/reference_prop.rs:+8:6: +8:7
- _9 = _7; // scope 5 at $DIR/reference_prop.rs:+8:6: +8:7
- StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+8:9: +8:10
- _10 = _1; // scope 5 at $DIR/reference_prop.rs:+8:9: +8:10
- _0 = (move _9, move _10); // scope 5 at $DIR/reference_prop.rs:+8:5: +8:11
- StorageDead(_10); // scope 5 at $DIR/reference_prop.rs:+8:10: +8:11
- StorageDead(_9); // scope 5 at $DIR/reference_prop.rs:+8:10: +8:11
- StorageDead(_7); // scope 4 at $DIR/reference_prop.rs:+9:1: +9:2
-- StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+9:1: +9:2
-- StorageDead(_3); // scope 2 at $DIR/reference_prop.rs:+9:1: +9:2
-- StorageDead(_2); // scope 1 at $DIR/reference_prop.rs:+9:1: +9:2
- StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+9:1: +9:2
- return; // scope 0 at $DIR/reference_prop.rs:+9:2: +9:2
+ StorageLive(_1);
+ _1 = const 2_i32;
+- StorageLive(_2);
+ _2 = &mut _1;
+- StorageLive(_3);
+- StorageLive(_4);
+- StorageLive(_5);
+- _5 = &mut (*_2);
+- _4 = &raw mut (*_5);
+- _3 = _4;
+- StorageDead(_5);
+- StorageDead(_4);
+- StorageLive(_6);
+- _6 = &(*_2);
+ StorageLive(_7);
+- _7 = (*_6);
+- StorageLive(_8);
+- (*_3) = const 4_i32;
+- _8 = const ();
+- StorageDead(_8);
++ _7 = _1;
++ _1 = const 4_i32;
+ StorageLive(_9);
+ _9 = _7;
+ StorageLive(_10);
+ _10 = _1;
+ _0 = (move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_7);
+- StorageDead(_6);
+- StorageDead(_3);
+- StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff b/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff
index 75c1f8f57..371b0e468 100644
--- a/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff
@@ -2,22 +2,22 @@
+ // MIR for `read_through_raw` after ReferencePropagation
fn read_through_raw(_1: &mut usize) -> usize {
- let mut _0: usize; // return place in scope 0 at $DIR/reference_prop.rs:+0:39: +0:44
- let mut _2: &mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _3: &mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _4: *mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
- let mut _5: *mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _0: usize;
+ let mut _2: &mut usize;
+ let mut _3: &mut usize;
+ let mut _4: *mut usize;
+ let mut _5: *mut usize;
bb0: {
-- _2 = &mut (*_1); // scope 0 at $DIR/reference_prop.rs:+10:13: +10:25
-- _3 = &mut (*_2); // scope 0 at $DIR/reference_prop.rs:+11:13: +11:26
-- _4 = &raw mut (*_2); // scope 0 at $DIR/reference_prop.rs:+12:13: +12:30
-- _5 = &raw mut (*_3); // scope 0 at $DIR/reference_prop.rs:+13:13: +13:30
-- _0 = (*_4); // scope 0 at $DIR/reference_prop.rs:+15:13: +15:22
-- _0 = (*_5); // scope 0 at $DIR/reference_prop.rs:+16:13: +16:22
-+ _0 = (*_1); // scope 0 at $DIR/reference_prop.rs:+15:13: +15:22
-+ _0 = (*_1); // scope 0 at $DIR/reference_prop.rs:+16:13: +16:22
- return; // scope 0 at $DIR/reference_prop.rs:+17:13: +17:21
+- _2 = &mut (*_1);
+- _3 = &mut (*_2);
+- _4 = &raw mut (*_2);
+- _5 = &raw mut (*_3);
+- _0 = (*_4);
+- _0 = (*_5);
++ _0 = (*_1);
++ _0 = (*_1);
+ return;
}
}
diff --git a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff
index 7b31ee695..1be2ce8d0 100644
--- a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff
@@ -2,137 +2,136 @@
+ // MIR for `reference_propagation` after ReferencePropagation
fn reference_propagation(_1: &T, _2: &T) -> () {
- debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:39: +0:45
- debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:54: +0:66
- let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:75: +0:75
- let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
- let _4: usize; // in scope 0 at $DIR/reference_prop.rs:+3:13: +3:14
- let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19
- let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18
- let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
- let _10: usize; // in scope 0 at $DIR/reference_prop.rs:+11:13: +11:14
- let mut _13: &usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:16
- let _14: &usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:16
- let _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19
- let mut _17: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18
- let _18: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
- let _19: usize; // in scope 0 at $DIR/reference_prop.rs:+22:13: +22:14
- let _23: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18
- let mut _24: &&usize; // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17
- let _25: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
- let _26: usize; // in scope 0 at $DIR/reference_prop.rs:+31:13: +31:14
- let _30: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18
- let mut _31: *mut &usize; // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17
- let _32: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
- let _33: usize; // in scope 0 at $DIR/reference_prop.rs:+40:13: +40:14
- let _36: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18
- let mut _37: &usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17
- let _38: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
- let _39: usize; // in scope 0 at $DIR/reference_prop.rs:+48:13: +48:14
- let _45: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19
- let mut _46: &usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18
- let _47: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
- let _48: &T; // in scope 0 at $DIR/reference_prop.rs:+61:13: +61:14
- let _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19
- let mut _51: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18
- let _52: (); // in scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
- let _53: &T; // in scope 0 at $DIR/reference_prop.rs:+68:13: +68:14
- let mut _54: &T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:28
- let _55: &T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:28
- let _57: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19
- let mut _58: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18
- let _59: (); // in scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
- let _60: usize; // in scope 0 at $DIR/reference_prop.rs:+76:13: +76:14
- let _64: (); // in scope 0 at $DIR/reference_prop.rs:+80:9: +80:19
- let mut _65: (); // in scope 0 at $DIR/reference_prop.rs:+80:16: +80:18
- let _66: usize; // in scope 0 at $DIR/reference_prop.rs:+85:13: +85:14
- let _70: (); // in scope 0 at $DIR/reference_prop.rs:+89:9: +89:19
- let mut _71: (); // in scope 0 at $DIR/reference_prop.rs:+89:16: +89:18
+ debug single => _1;
+ debug multiple => _2;
+ let mut _0: ();
+ let _3: ();
+ let _4: usize;
+ let _7: ();
+ let mut _8: ();
+ let _9: ();
+ let _10: usize;
+ let mut _13: &usize;
+ let _14: &usize;
+ let _16: ();
+ let mut _17: ();
+ let _18: ();
+ let _19: usize;
+ let _23: ();
+ let mut _24: &&usize;
+ let _25: ();
+ let _26: usize;
+ let _30: ();
+ let mut _31: *mut &usize;
+ let _32: ();
+ let _33: usize;
+ let _36: ();
+ let mut _37: &usize;
+ let _38: ();
+ let _39: usize;
+ let _45: ();
+ let mut _46: &usize;
+ let _47: ();
+ let _48: &T;
+ let _50: ();
+ let mut _51: ();
+ let _52: ();
+ let _53: &T;
+ let mut _54: &T;
+ let _55: &T;
+ let _57: ();
+ let mut _58: ();
+ let _59: ();
+ let _60: usize;
+ let _64: ();
+ let mut _65: ();
+ let _66: usize;
+ let _70: ();
+ let mut _71: ();
scope 1 {
- debug a => _4; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:14
- let _5: &usize; // in scope 1 at $DIR/reference_prop.rs:+4:13: +4:14
+ debug a => _4;
+ let _5: &usize;
scope 2 {
-- debug b => _5; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
-+ debug b => &_4; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
- let _6: usize; // in scope 2 at $DIR/reference_prop.rs:+5:13: +5:14
+ debug b => _5;
+ let _6: usize;
scope 3 {
- debug c => _6; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
+ debug c => _6;
}
}
}
scope 4 {
- debug a => _10; // in scope 4 at $DIR/reference_prop.rs:+11:13: +11:14
- let _11: usize; // in scope 4 at $DIR/reference_prop.rs:+12:13: +12:15
+ debug a => _10;
+ let _11: usize;
scope 5 {
- debug a2 => _11; // in scope 5 at $DIR/reference_prop.rs:+12:13: +12:15
- let mut _12: &usize; // in scope 5 at $DIR/reference_prop.rs:+13:13: +13:18
+ debug a2 => _11;
+ let mut _12: &usize;
scope 6 {
- debug b => _12; // in scope 6 at $DIR/reference_prop.rs:+13:13: +13:18
- let _15: usize; // in scope 6 at $DIR/reference_prop.rs:+16:13: +16:14
+ debug b => _12;
+ let _15: usize;
scope 7 {
- debug c => _15; // in scope 7 at $DIR/reference_prop.rs:+16:13: +16:14
+ debug c => _15;
}
}
}
}
scope 8 {
- debug a => _19; // in scope 8 at $DIR/reference_prop.rs:+22:13: +22:14
- let _20: &usize; // in scope 8 at $DIR/reference_prop.rs:+23:13: +23:14
+ debug a => _19;
+ let _20: &usize;
scope 9 {
- debug b => _20; // in scope 9 at $DIR/reference_prop.rs:+23:13: +23:14
- let _21: &&usize; // in scope 9 at $DIR/reference_prop.rs:+24:13: +24:14
+ debug b => _20;
+ let _21: &&usize;
scope 10 {
- debug d => _21; // in scope 10 at $DIR/reference_prop.rs:+24:13: +24:14
- let _22: usize; // in scope 10 at $DIR/reference_prop.rs:+25:13: +25:14
+ debug d => _21;
+ let _22: usize;
scope 11 {
- debug c => _22; // in scope 11 at $DIR/reference_prop.rs:+25:13: +25:14
+ debug c => _22;
}
}
}
}
scope 12 {
- debug a => _26; // in scope 12 at $DIR/reference_prop.rs:+31:13: +31:14
- let mut _27: &usize; // in scope 12 at $DIR/reference_prop.rs:+32:13: +32:18
+ debug a => _26;
+ let mut _27: &usize;
scope 13 {
- debug b => _27; // in scope 13 at $DIR/reference_prop.rs:+32:13: +32:18
- let _28: *mut &usize; // in scope 13 at $DIR/reference_prop.rs:+33:13: +33:14
+ debug b => _27;
+ let _28: *mut &usize;
scope 14 {
- debug d => _28; // in scope 14 at $DIR/reference_prop.rs:+33:13: +33:14
- let _29: usize; // in scope 14 at $DIR/reference_prop.rs:+34:13: +34:14
+ debug d => _28;
+ let _29: usize;
scope 15 {
- debug c => _29; // in scope 15 at $DIR/reference_prop.rs:+34:13: +34:14
+ debug c => _29;
}
}
}
}
scope 16 {
- debug a => _33; // in scope 16 at $DIR/reference_prop.rs:+40:13: +40:14
- let _34: &usize; // in scope 16 at $DIR/reference_prop.rs:+41:13: +41:14
+ debug a => _33;
+ let _34: &usize;
scope 17 {
- debug b => _34; // in scope 17 at $DIR/reference_prop.rs:+41:13: +41:14
- let _35: usize; // in scope 17 at $DIR/reference_prop.rs:+42:13: +42:14
+ debug b => _34;
+ let _35: usize;
scope 18 {
- debug c => _35; // in scope 18 at $DIR/reference_prop.rs:+42:13: +42:14
+ debug c => _35;
}
}
}
scope 19 {
- debug a => _39; // in scope 19 at $DIR/reference_prop.rs:+48:13: +48:14
- let _40: &usize; // in scope 19 at $DIR/reference_prop.rs:+49:13: +49:15
+ debug a => _39;
+ let _40: &usize;
scope 20 {
- debug b1 => _40; // in scope 20 at $DIR/reference_prop.rs:+49:13: +49:15
- let _41: usize; // in scope 20 at $DIR/reference_prop.rs:+50:13: +50:14
+ debug b1 => _40;
+ let _41: usize;
scope 21 {
- debug c => _41; // in scope 21 at $DIR/reference_prop.rs:+50:13: +50:14
- let _42: &usize; // in scope 21 at $DIR/reference_prop.rs:+51:13: +51:15
+ debug c => _41;
+ let _42: &usize;
scope 22 {
- debug b2 => _42; // in scope 22 at $DIR/reference_prop.rs:+51:13: +51:15
- let _43: usize; // in scope 22 at $DIR/reference_prop.rs:+52:13: +52:15
+ debug b2 => _42;
+ let _43: usize;
scope 23 {
- debug c2 => _43; // in scope 23 at $DIR/reference_prop.rs:+52:13: +52:15
- let _44: &usize; // in scope 23 at $DIR/reference_prop.rs:+53:13: +53:15
+ debug c2 => _43;
+ let _44: &usize;
scope 24 {
- debug b3 => _44; // in scope 24 at $DIR/reference_prop.rs:+53:13: +53:15
+ debug b3 => _44;
}
}
}
@@ -140,336 +139,300 @@
}
}
scope 25 {
-- debug a => _48; // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14
-+ debug a => _1; // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14
- let _49: T; // in scope 25 at $DIR/reference_prop.rs:+62:13: +62:14
+- debug a => _48;
++ debug a => _1;
+ let _49: T;
scope 26 {
- debug b => _49; // in scope 26 at $DIR/reference_prop.rs:+62:13: +62:14
+ debug b => _49;
}
}
scope 27 {
- debug a => _53; // in scope 27 at $DIR/reference_prop.rs:+68:13: +68:14
- let _56: T; // in scope 27 at $DIR/reference_prop.rs:+70:13: +70:14
+ debug a => _53;
+ let _56: T;
scope 28 {
- debug b => _56; // in scope 28 at $DIR/reference_prop.rs:+70:13: +70:14
+ debug b => _56;
}
}
scope 29 {
- debug a => _60; // in scope 29 at $DIR/reference_prop.rs:+76:13: +76:14
- let _61: &usize; // in scope 29 at $DIR/reference_prop.rs:+77:13: +77:14
+ debug a => _60;
+ let _61: &usize;
scope 30 {
-- debug b => _61; // in scope 30 at $DIR/reference_prop.rs:+77:13: +77:14
-+ debug b => &_60; // in scope 30 at $DIR/reference_prop.rs:+77:13: +77:14
- let _62: &&usize; // in scope 30 at $DIR/reference_prop.rs:+78:13: +78:14
+ debug b => _61;
+ let _62: &&usize;
scope 31 {
-- debug d => _62; // in scope 31 at $DIR/reference_prop.rs:+78:13: +78:14
-+ debug d => &&_60; // in scope 31 at $DIR/reference_prop.rs:+78:13: +78:14
- let _63: usize; // in scope 31 at $DIR/reference_prop.rs:+79:13: +79:14
+ debug d => _62;
+ let _63: usize;
scope 32 {
- debug c => _63; // in scope 32 at $DIR/reference_prop.rs:+79:13: +79:14
+ debug c => _63;
}
}
}
}
scope 33 {
- debug a => _66; // in scope 33 at $DIR/reference_prop.rs:+85:13: +85:14
- let mut _67: &usize; // in scope 33 at $DIR/reference_prop.rs:+86:13: +86:18
+ debug a => _66;
+ let mut _67: &usize;
scope 34 {
-- debug b => _67; // in scope 34 at $DIR/reference_prop.rs:+86:13: +86:18
-+ debug b => &_66; // in scope 34 at $DIR/reference_prop.rs:+86:13: +86:18
- let _68: &mut &usize; // in scope 34 at $DIR/reference_prop.rs:+87:13: +87:14
+ debug b => _67;
+ let _68: &mut &usize;
scope 35 {
-- debug d => _68; // in scope 35 at $DIR/reference_prop.rs:+87:13: +87:14
-+ debug d => &&_66; // in scope 35 at $DIR/reference_prop.rs:+87:13: +87:14
- let _69: usize; // in scope 35 at $DIR/reference_prop.rs:+88:13: +88:14
+ debug d => _68;
+ let _69: usize;
scope 36 {
- debug c => _69; // in scope 36 at $DIR/reference_prop.rs:+88:13: +88:14
+ debug c => _69;
}
}
}
}
bb0: {
-- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
- StorageLive(_4); // scope 0 at $DIR/reference_prop.rs:+3:13: +3:14
- _4 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+3:17: +3:24
-- StorageLive(_5); // scope 1 at $DIR/reference_prop.rs:+4:13: +4:14
-- _5 = &_4; // scope 1 at $DIR/reference_prop.rs:+4:17: +4:19
- StorageLive(_6); // scope 2 at $DIR/reference_prop.rs:+5:13: +5:14
-- _6 = (*_5); // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19
-+ _6 = _4; // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19
- StorageLive(_7); // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19
- StorageLive(_8); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18
- _8 = (); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18
- _7 = opaque::<()>(move _8) -> bb1; // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:16:9: 16:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+- StorageLive(_3);
+ StorageLive(_4);
+ _4 = const 5_usize;
+ StorageLive(_5);
+ _5 = &_4;
+ StorageLive(_6);
+- _6 = (*_5);
++ _6 = _4;
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = ();
+ _7 = opaque::<()>(move _8) -> [return: bb1, unwind continue];
}
bb1: {
- StorageDead(_8); // scope 3 at $DIR/reference_prop.rs:+6:18: +6:19
- StorageDead(_7); // scope 3 at $DIR/reference_prop.rs:+6:19: +6:20
-- _3 = const (); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
- StorageDead(_6); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
-- StorageDead(_5); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6
- StorageDead(_4); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
-- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
-- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
- StorageLive(_10); // scope 0 at $DIR/reference_prop.rs:+11:13: +11:14
- _10 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+11:17: +11:24
- StorageLive(_11); // scope 4 at $DIR/reference_prop.rs:+12:13: +12:15
- _11 = const 7_usize; // scope 4 at $DIR/reference_prop.rs:+12:18: +12:25
- StorageLive(_12); // scope 5 at $DIR/reference_prop.rs:+13:13: +13:18
- _12 = &_10; // scope 5 at $DIR/reference_prop.rs:+13:21: +13:23
- StorageLive(_13); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16
-- StorageLive(_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16
-- _14 = &_11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16
-- _13 = &(*_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16
-+ _13 = &_11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16
- _12 = move _13; // scope 6 at $DIR/reference_prop.rs:+14:9: +14:16
- StorageDead(_13); // scope 6 at $DIR/reference_prop.rs:+14:15: +14:16
-- StorageDead(_14); // scope 6 at $DIR/reference_prop.rs:+14:16: +14:17
- StorageLive(_15); // scope 6 at $DIR/reference_prop.rs:+16:13: +16:14
- _15 = (*_12); // scope 6 at $DIR/reference_prop.rs:+16:17: +16:19
- StorageLive(_16); // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19
- StorageLive(_17); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18
- _17 = (); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18
- _16 = opaque::<()>(move _17) -> bb2; // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:27:9: 27:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_8);
+ StorageDead(_7);
+- _3 = const ();
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+- StorageDead(_3);
+- StorageLive(_9);
+ StorageLive(_10);
+ _10 = const 5_usize;
+ StorageLive(_11);
+ _11 = const 7_usize;
+ StorageLive(_12);
+ _12 = &_10;
+ StorageLive(_13);
+- StorageLive(_14);
+- _14 = &_11;
+- _13 = &(*_14);
++ _13 = &_11;
+ _12 = move _13;
+ StorageDead(_13);
+- StorageDead(_14);
+ StorageLive(_15);
+ _15 = (*_12);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = ();
+ _16 = opaque::<()>(move _17) -> [return: bb2, unwind continue];
}
bb2: {
- StorageDead(_17); // scope 7 at $DIR/reference_prop.rs:+17:18: +17:19
- StorageDead(_16); // scope 7 at $DIR/reference_prop.rs:+17:19: +17:20
-- _9 = const (); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
- StorageDead(_15); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6
- StorageDead(_12); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6
- StorageDead(_11); // scope 4 at $DIR/reference_prop.rs:+18:5: +18:6
- StorageDead(_10); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6
-- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6
-- StorageLive(_18); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
- StorageLive(_19); // scope 0 at $DIR/reference_prop.rs:+22:13: +22:14
- _19 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+22:17: +22:24
- StorageLive(_20); // scope 8 at $DIR/reference_prop.rs:+23:13: +23:14
- _20 = &_19; // scope 8 at $DIR/reference_prop.rs:+23:17: +23:19
- StorageLive(_21); // scope 9 at $DIR/reference_prop.rs:+24:13: +24:14
- _21 = &_20; // scope 9 at $DIR/reference_prop.rs:+24:17: +24:19
- StorageLive(_22); // scope 10 at $DIR/reference_prop.rs:+25:13: +25:14
- _22 = (*_20); // scope 10 at $DIR/reference_prop.rs:+25:17: +25:19
- StorageLive(_23); // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18
- StorageLive(_24); // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17
- _24 = _21; // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17
- _23 = opaque::<&&usize>(move _24) -> bb3; // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18
- // mir::Constant
- // + span: $DIR/reference_prop.rs:36:9: 36:15
- // + literal: Const { ty: fn(&&usize) {opaque::<&&usize>}, val: Value(<ZST>) }
+ StorageDead(_17);
+ StorageDead(_16);
+- _9 = const ();
+ StorageDead(_15);
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+- StorageDead(_9);
+- StorageLive(_18);
+ StorageLive(_19);
+ _19 = const 5_usize;
+ StorageLive(_20);
+ _20 = &_19;
+ StorageLive(_21);
+ _21 = &_20;
+ StorageLive(_22);
+ _22 = (*_20);
+ StorageLive(_23);
+ StorageLive(_24);
+ _24 = _21;
+ _23 = opaque::<&&usize>(move _24) -> [return: bb3, unwind continue];
}
bb3: {
- StorageDead(_24); // scope 11 at $DIR/reference_prop.rs:+26:17: +26:18
- StorageDead(_23); // scope 11 at $DIR/reference_prop.rs:+26:18: +26:19
-- _18 = const (); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
- StorageDead(_22); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6
- StorageDead(_21); // scope 9 at $DIR/reference_prop.rs:+27:5: +27:6
- StorageDead(_20); // scope 8 at $DIR/reference_prop.rs:+27:5: +27:6
- StorageDead(_19); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6
-- StorageDead(_18); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6
-- StorageLive(_25); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
- StorageLive(_26); // scope 0 at $DIR/reference_prop.rs:+31:13: +31:14
- _26 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+31:17: +31:24
- StorageLive(_27); // scope 12 at $DIR/reference_prop.rs:+32:13: +32:18
- _27 = &_26; // scope 12 at $DIR/reference_prop.rs:+32:21: +32:23
- StorageLive(_28); // scope 13 at $DIR/reference_prop.rs:+33:13: +33:14
- _28 = &raw mut _27; // scope 13 at $DIR/reference_prop.rs:+33:17: +33:27
- StorageLive(_29); // scope 14 at $DIR/reference_prop.rs:+34:13: +34:14
- _29 = (*_27); // scope 14 at $DIR/reference_prop.rs:+34:17: +34:19
- StorageLive(_30); // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18
- StorageLive(_31); // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17
- _31 = _28; // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17
- _30 = opaque::<*mut &usize>(move _31) -> bb4; // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18
- // mir::Constant
- // + span: $DIR/reference_prop.rs:45:9: 45:15
- // + literal: Const { ty: fn(*mut &usize) {opaque::<*mut &usize>}, val: Value(<ZST>) }
+ StorageDead(_24);
+ StorageDead(_23);
+- _18 = const ();
+ StorageDead(_22);
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_19);
+- StorageDead(_18);
+- StorageLive(_25);
+ StorageLive(_26);
+ _26 = const 5_usize;
+ StorageLive(_27);
+ _27 = &_26;
+ StorageLive(_28);
+ _28 = &raw mut _27;
+ StorageLive(_29);
+ _29 = (*_27);
+ StorageLive(_30);
+ StorageLive(_31);
+ _31 = _28;
+ _30 = opaque::<*mut &usize>(move _31) -> [return: bb4, unwind continue];
}
bb4: {
- StorageDead(_31); // scope 15 at $DIR/reference_prop.rs:+35:17: +35:18
- StorageDead(_30); // scope 15 at $DIR/reference_prop.rs:+35:18: +35:19
-- _25 = const (); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
- StorageDead(_29); // scope 14 at $DIR/reference_prop.rs:+36:5: +36:6
- StorageDead(_28); // scope 13 at $DIR/reference_prop.rs:+36:5: +36:6
- StorageDead(_27); // scope 12 at $DIR/reference_prop.rs:+36:5: +36:6
- StorageDead(_26); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6
-- StorageDead(_25); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6
-- StorageLive(_32); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
- StorageLive(_33); // scope 0 at $DIR/reference_prop.rs:+40:13: +40:14
- _33 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+40:17: +40:24
- StorageLive(_34); // scope 16 at $DIR/reference_prop.rs:+41:13: +41:14
- _34 = &_33; // scope 16 at $DIR/reference_prop.rs:+41:17: +41:19
- StorageLive(_35); // scope 17 at $DIR/reference_prop.rs:+42:13: +42:14
-- _35 = (*_34); // scope 17 at $DIR/reference_prop.rs:+42:17: +42:19
-+ _35 = _33; // scope 17 at $DIR/reference_prop.rs:+42:17: +42:19
- StorageLive(_36); // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18
- StorageLive(_37); // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17
- _37 = _34; // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17
- _36 = opaque::<&usize>(move _37) -> bb5; // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18
- // mir::Constant
- // + span: $DIR/reference_prop.rs:53:9: 53:15
- // + literal: Const { ty: fn(&usize) {opaque::<&usize>}, val: Value(<ZST>) }
+ StorageDead(_31);
+ StorageDead(_30);
+- _25 = const ();
+ StorageDead(_29);
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageDead(_26);
+- StorageDead(_25);
+- StorageLive(_32);
+ StorageLive(_33);
+ _33 = const 7_usize;
+ StorageLive(_34);
+ _34 = &_33;
+ StorageLive(_35);
+- _35 = (*_34);
++ _35 = _33;
+ StorageLive(_36);
+ StorageLive(_37);
+ _37 = _34;
+ _36 = opaque::<&usize>(move _37) -> [return: bb5, unwind continue];
}
bb5: {
- StorageDead(_37); // scope 18 at $DIR/reference_prop.rs:+43:17: +43:18
- StorageDead(_36); // scope 18 at $DIR/reference_prop.rs:+43:18: +43:19
-- _32 = const (); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
- StorageDead(_35); // scope 17 at $DIR/reference_prop.rs:+44:5: +44:6
- StorageDead(_34); // scope 16 at $DIR/reference_prop.rs:+44:5: +44:6
- StorageDead(_33); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6
-- StorageDead(_32); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6
-- StorageLive(_38); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
- StorageLive(_39); // scope 0 at $DIR/reference_prop.rs:+48:13: +48:14
- _39 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+48:17: +48:24
- StorageLive(_40); // scope 19 at $DIR/reference_prop.rs:+49:13: +49:15
- _40 = &_39; // scope 19 at $DIR/reference_prop.rs:+49:18: +49:20
- StorageLive(_41); // scope 20 at $DIR/reference_prop.rs:+50:13: +50:14
-- _41 = (*_40); // scope 20 at $DIR/reference_prop.rs:+50:17: +50:20
-+ _41 = _39; // scope 20 at $DIR/reference_prop.rs:+50:17: +50:20
- StorageLive(_42); // scope 21 at $DIR/reference_prop.rs:+51:13: +51:15
- _42 = _40; // scope 21 at $DIR/reference_prop.rs:+51:18: +51:20
- StorageLive(_43); // scope 22 at $DIR/reference_prop.rs:+52:13: +52:15
-- _43 = (*_42); // scope 22 at $DIR/reference_prop.rs:+52:18: +52:21
-+ _43 = _39; // scope 22 at $DIR/reference_prop.rs:+52:18: +52:21
- StorageLive(_44); // scope 23 at $DIR/reference_prop.rs:+53:13: +53:15
- _44 = _42; // scope 23 at $DIR/reference_prop.rs:+53:18: +53:20
- StorageLive(_45); // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19
- StorageLive(_46); // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18
- _46 = _44; // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18
- _45 = opaque::<&usize>(move _46) -> bb6; // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:66:9: 66:15
- // + literal: Const { ty: fn(&usize) {opaque::<&usize>}, val: Value(<ZST>) }
+ StorageDead(_37);
+ StorageDead(_36);
+- _32 = const ();
+ StorageDead(_35);
+ StorageDead(_34);
+ StorageDead(_33);
+- StorageDead(_32);
+- StorageLive(_38);
+ StorageLive(_39);
+ _39 = const 7_usize;
+ StorageLive(_40);
+ _40 = &_39;
+ StorageLive(_41);
+- _41 = (*_40);
++ _41 = _39;
+ StorageLive(_42);
+ _42 = _40;
+ StorageLive(_43);
+- _43 = (*_42);
++ _43 = _39;
+ StorageLive(_44);
+ _44 = _42;
+ StorageLive(_45);
+ StorageLive(_46);
+ _46 = _44;
+ _45 = opaque::<&usize>(move _46) -> [return: bb6, unwind continue];
}
bb6: {
- StorageDead(_46); // scope 24 at $DIR/reference_prop.rs:+56:18: +56:19
- StorageDead(_45); // scope 24 at $DIR/reference_prop.rs:+56:19: +56:20
-- _38 = const (); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
- StorageDead(_44); // scope 23 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_43); // scope 22 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_42); // scope 21 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_41); // scope 20 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_40); // scope 19 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_39); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
-- StorageDead(_38); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
-- StorageLive(_47); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
-- StorageLive(_48); // scope 0 at $DIR/reference_prop.rs:+61:13: +61:14
-- _48 = &(*_1); // scope 0 at $DIR/reference_prop.rs:+61:17: +61:25
- StorageLive(_49); // scope 25 at $DIR/reference_prop.rs:+62:13: +62:14
-- _49 = (*_48); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19
-+ _49 = (*_1); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19
- StorageLive(_50); // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19
- StorageLive(_51); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18
- _51 = (); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18
- _50 = opaque::<()>(move _51) -> bb7; // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:73:9: 73:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_46);
+ StorageDead(_45);
+- _38 = const ();
+ StorageDead(_44);
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageDead(_41);
+ StorageDead(_40);
+ StorageDead(_39);
+- StorageDead(_38);
+- StorageLive(_47);
+- StorageLive(_48);
+- _48 = &(*_1);
+ StorageLive(_49);
+- _49 = (*_48);
++ _49 = (*_1);
+ StorageLive(_50);
+ StorageLive(_51);
+ _51 = ();
+ _50 = opaque::<()>(move _51) -> [return: bb7, unwind continue];
}
bb7: {
- StorageDead(_51); // scope 26 at $DIR/reference_prop.rs:+63:18: +63:19
- StorageDead(_50); // scope 26 at $DIR/reference_prop.rs:+63:19: +63:20
-- _47 = const (); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
- StorageDead(_49); // scope 25 at $DIR/reference_prop.rs:+64:5: +64:6
-- StorageDead(_48); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
-- StorageDead(_47); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
-- StorageLive(_52); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
- StorageLive(_53); // scope 0 at $DIR/reference_prop.rs:+68:13: +68:14
- _53 = &(*_2); // scope 0 at $DIR/reference_prop.rs:+68:17: +68:27
- StorageLive(_54); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28
-- StorageLive(_55); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28
-- _55 = &(*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28
-- _54 = &(*_55); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28
-+ _54 = &(*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28
- _2 = move _54; // scope 27 at $DIR/reference_prop.rs:+69:9: +69:28
- StorageDead(_54); // scope 27 at $DIR/reference_prop.rs:+69:27: +69:28
-- StorageDead(_55); // scope 27 at $DIR/reference_prop.rs:+69:28: +69:29
- StorageLive(_56); // scope 27 at $DIR/reference_prop.rs:+70:13: +70:14
- _56 = (*_53); // scope 27 at $DIR/reference_prop.rs:+70:17: +70:19
- StorageLive(_57); // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19
- StorageLive(_58); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18
- _58 = (); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18
- _57 = opaque::<()>(move _58) -> bb8; // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:81:9: 81:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_51);
+ StorageDead(_50);
+- _47 = const ();
+ StorageDead(_49);
+- StorageDead(_48);
+- StorageDead(_47);
+- StorageLive(_52);
+ StorageLive(_53);
+ _53 = &(*_2);
+ StorageLive(_54);
+- StorageLive(_55);
+- _55 = &(*_1);
+- _54 = &(*_55);
++ _54 = &(*_1);
+ _2 = move _54;
+ StorageDead(_54);
+- StorageDead(_55);
+ StorageLive(_56);
+ _56 = (*_53);
+ StorageLive(_57);
+ StorageLive(_58);
+ _58 = ();
+ _57 = opaque::<()>(move _58) -> [return: bb8, unwind continue];
}
bb8: {
- StorageDead(_58); // scope 28 at $DIR/reference_prop.rs:+71:18: +71:19
- StorageDead(_57); // scope 28 at $DIR/reference_prop.rs:+71:19: +71:20
-- _52 = const (); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
- StorageDead(_56); // scope 27 at $DIR/reference_prop.rs:+72:5: +72:6
- StorageDead(_53); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6
-- StorageDead(_52); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6
-- StorageLive(_59); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
- StorageLive(_60); // scope 0 at $DIR/reference_prop.rs:+76:13: +76:14
- _60 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+76:17: +76:24
-- StorageLive(_61); // scope 29 at $DIR/reference_prop.rs:+77:13: +77:14
-- _61 = &_60; // scope 29 at $DIR/reference_prop.rs:+77:17: +77:19
-- StorageLive(_62); // scope 30 at $DIR/reference_prop.rs:+78:13: +78:14
-- _62 = &_61; // scope 30 at $DIR/reference_prop.rs:+78:17: +78:19
- StorageLive(_63); // scope 31 at $DIR/reference_prop.rs:+79:13: +79:14
-- _63 = (*_61); // scope 31 at $DIR/reference_prop.rs:+79:17: +79:19
-+ _63 = _60; // scope 31 at $DIR/reference_prop.rs:+79:17: +79:19
- StorageLive(_64); // scope 32 at $DIR/reference_prop.rs:+80:9: +80:19
- StorageLive(_65); // scope 32 at $DIR/reference_prop.rs:+80:16: +80:18
- _65 = (); // scope 32 at $DIR/reference_prop.rs:+80:16: +80:18
- _64 = opaque::<()>(move _65) -> bb9; // scope 32 at $DIR/reference_prop.rs:+80:9: +80:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:90:9: 90:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_58);
+ StorageDead(_57);
+- _52 = const ();
+ StorageDead(_56);
+ StorageDead(_53);
+- StorageDead(_52);
+- StorageLive(_59);
+ StorageLive(_60);
+ _60 = const 5_usize;
+ StorageLive(_61);
+ _61 = &_60;
+ StorageLive(_62);
+ _62 = &_61;
+ StorageLive(_63);
+ _63 = (*_61);
+ StorageLive(_64);
+ StorageLive(_65);
+ _65 = ();
+ _64 = opaque::<()>(move _65) -> [return: bb9, unwind continue];
}
bb9: {
- StorageDead(_65); // scope 32 at $DIR/reference_prop.rs:+80:18: +80:19
- StorageDead(_64); // scope 32 at $DIR/reference_prop.rs:+80:19: +80:20
-- _59 = const (); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
- StorageDead(_63); // scope 31 at $DIR/reference_prop.rs:+81:5: +81:6
-- StorageDead(_62); // scope 30 at $DIR/reference_prop.rs:+81:5: +81:6
-- StorageDead(_61); // scope 29 at $DIR/reference_prop.rs:+81:5: +81:6
- StorageDead(_60); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6
-- StorageDead(_59); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6
- StorageLive(_66); // scope 0 at $DIR/reference_prop.rs:+85:13: +85:14
- _66 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+85:17: +85:24
-- StorageLive(_67); // scope 33 at $DIR/reference_prop.rs:+86:13: +86:18
-- _67 = &_66; // scope 33 at $DIR/reference_prop.rs:+86:21: +86:23
-- StorageLive(_68); // scope 34 at $DIR/reference_prop.rs:+87:13: +87:14
-- _68 = &mut _67; // scope 34 at $DIR/reference_prop.rs:+87:17: +87:23
- StorageLive(_69); // scope 35 at $DIR/reference_prop.rs:+88:13: +88:14
-- _69 = (*_67); // scope 35 at $DIR/reference_prop.rs:+88:17: +88:19
-+ _69 = _66; // scope 35 at $DIR/reference_prop.rs:+88:17: +88:19
- StorageLive(_70); // scope 36 at $DIR/reference_prop.rs:+89:9: +89:19
- StorageLive(_71); // scope 36 at $DIR/reference_prop.rs:+89:16: +89:18
- _71 = (); // scope 36 at $DIR/reference_prop.rs:+89:16: +89:18
- _70 = opaque::<()>(move _71) -> bb10; // scope 36 at $DIR/reference_prop.rs:+89:9: +89:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:99:9: 99:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_65);
+ StorageDead(_64);
+- _59 = const ();
+ StorageDead(_63);
+ StorageDead(_62);
+ StorageDead(_61);
+ StorageDead(_60);
+- StorageDead(_59);
+ StorageLive(_66);
+ _66 = const 5_usize;
+ StorageLive(_67);
+ _67 = &_66;
+ StorageLive(_68);
+ _68 = &mut _67;
+ StorageLive(_69);
+ _69 = (*_67);
+ StorageLive(_70);
+ StorageLive(_71);
+ _71 = ();
+ _70 = opaque::<()>(move _71) -> [return: bb10, unwind continue];
}
bb10: {
- StorageDead(_71); // scope 36 at $DIR/reference_prop.rs:+89:18: +89:19
- StorageDead(_70); // scope 36 at $DIR/reference_prop.rs:+89:19: +89:20
- _0 = const (); // scope 0 at $DIR/reference_prop.rs:+84:5: +90:6
- StorageDead(_69); // scope 35 at $DIR/reference_prop.rs:+90:5: +90:6
-- StorageDead(_68); // scope 34 at $DIR/reference_prop.rs:+90:5: +90:6
-- StorageDead(_67); // scope 33 at $DIR/reference_prop.rs:+90:5: +90:6
- StorageDead(_66); // scope 0 at $DIR/reference_prop.rs:+90:5: +90:6
- return; // scope 0 at $DIR/reference_prop.rs:+91:2: +91:2
+ StorageDead(_71);
+ StorageDead(_70);
+ _0 = const ();
+ StorageDead(_69);
+ StorageDead(_68);
+ StorageDead(_67);
+ StorageDead(_66);
+ return;
}
}
diff --git a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff
index ddeb04e50..ce5ddbfdd 100644
--- a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff
@@ -2,145 +2,144 @@
+ // MIR for `reference_propagation_const_ptr` after ReferencePropagation
fn reference_propagation_const_ptr(_1: *const T, _2: *const T) -> () {
- debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:45: +0:51
- debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:63: +0:75
- let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:87: +0:87
- let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
- let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19
- let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18
- let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
- let mut _13: *const usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:26
- let _15: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19
- let mut _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18
- let _17: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
- let _22: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18
- let mut _23: &*const usize; // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17
- let _24: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
- let _29: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18
- let mut _30: *mut *const usize; // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17
- let _31: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
- let _35: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18
- let mut _36: *const usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17
- let _37: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
- let _44: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19
- let mut _45: *const usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18
- let _46: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
- let _49: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19
- let mut _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18
- let _51: (); // in scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
- let mut _53: *const T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:38
- let _55: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19
- let mut _56: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18
- let _57: (); // in scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
- let _62: (); // in scope 0 at $DIR/reference_prop.rs:+80:9: +80:19
- let mut _63: (); // in scope 0 at $DIR/reference_prop.rs:+80:16: +80:18
- let _64: (); // in scope 0 at $DIR/reference_prop.rs:+84:5: +90:6
- let _69: (); // in scope 0 at $DIR/reference_prop.rs:+89:9: +89:19
- let mut _70: (); // in scope 0 at $DIR/reference_prop.rs:+89:16: +89:18
- let _75: (); // in scope 0 at $DIR/reference_prop.rs:+98:9: +98:19
- let mut _76: (); // in scope 0 at $DIR/reference_prop.rs:+98:16: +98:18
+ debug single => _1;
+ debug multiple => _2;
+ let mut _0: ();
+ let _3: ();
+ let _7: ();
+ let mut _8: ();
+ let _9: ();
+ let mut _13: *const usize;
+ let _15: ();
+ let mut _16: ();
+ let _17: ();
+ let _22: ();
+ let mut _23: &*const usize;
+ let _24: ();
+ let _29: ();
+ let mut _30: *mut *const usize;
+ let _31: ();
+ let _35: ();
+ let mut _36: *const usize;
+ let _37: ();
+ let _44: ();
+ let mut _45: *const usize;
+ let _46: ();
+ let _49: ();
+ let mut _50: ();
+ let _51: ();
+ let mut _53: *const T;
+ let _55: ();
+ let mut _56: ();
+ let _57: ();
+ let _62: ();
+ let mut _63: ();
+ let _64: ();
+ let _69: ();
+ let mut _70: ();
+ let _75: ();
+ let mut _76: ();
scope 1 {
- let _4: usize; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:14
+ let _4: usize;
scope 2 {
- debug a => _4; // in scope 2 at $DIR/reference_prop.rs:+3:13: +3:14
- let _5: *const usize; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
+ debug a => _4;
+ let _5: *const usize;
scope 3 {
-- debug b => _5; // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14
-+ debug b => &_4; // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14
- let _6: usize; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
+ debug b => _5;
+ let _6: usize;
scope 4 {
- debug c => _6; // in scope 4 at $DIR/reference_prop.rs:+5:13: +5:14
+ debug c => _6;
}
}
}
}
scope 5 {
- let _10: usize; // in scope 5 at $DIR/reference_prop.rs:+11:13: +11:14
+ let _10: usize;
scope 6 {
- debug a => _10; // in scope 6 at $DIR/reference_prop.rs:+11:13: +11:14
- let _11: usize; // in scope 6 at $DIR/reference_prop.rs:+12:13: +12:15
+ debug a => _10;
+ let _11: usize;
scope 7 {
- debug a2 => _11; // in scope 7 at $DIR/reference_prop.rs:+12:13: +12:15
- let mut _12: *const usize; // in scope 7 at $DIR/reference_prop.rs:+13:13: +13:18
+ debug a2 => _11;
+ let mut _12: *const usize;
scope 8 {
- debug b => _12; // in scope 8 at $DIR/reference_prop.rs:+13:13: +13:18
- let _14: usize; // in scope 8 at $DIR/reference_prop.rs:+16:13: +16:14
+ debug b => _12;
+ let _14: usize;
scope 9 {
- debug c => _14; // in scope 9 at $DIR/reference_prop.rs:+16:13: +16:14
+ debug c => _14;
}
}
}
}
}
scope 10 {
- let _18: usize; // in scope 10 at $DIR/reference_prop.rs:+22:13: +22:14
+ let _18: usize;
scope 11 {
- debug a => _18; // in scope 11 at $DIR/reference_prop.rs:+22:13: +22:14
- let _19: *const usize; // in scope 11 at $DIR/reference_prop.rs:+23:13: +23:14
+ debug a => _18;
+ let _19: *const usize;
scope 12 {
- debug b => _19; // in scope 12 at $DIR/reference_prop.rs:+23:13: +23:14
- let _20: &*const usize; // in scope 12 at $DIR/reference_prop.rs:+24:13: +24:14
+ debug b => _19;
+ let _20: &*const usize;
scope 13 {
- debug d => _20; // in scope 13 at $DIR/reference_prop.rs:+24:13: +24:14
- let _21: usize; // in scope 13 at $DIR/reference_prop.rs:+25:13: +25:14
+ debug d => _20;
+ let _21: usize;
scope 14 {
- debug c => _21; // in scope 14 at $DIR/reference_prop.rs:+25:13: +25:14
+ debug c => _21;
}
}
}
}
}
scope 15 {
- let _25: usize; // in scope 15 at $DIR/reference_prop.rs:+31:13: +31:14
+ let _25: usize;
scope 16 {
- debug a => _25; // in scope 16 at $DIR/reference_prop.rs:+31:13: +31:14
- let mut _26: *const usize; // in scope 16 at $DIR/reference_prop.rs:+32:13: +32:18
+ debug a => _25;
+ let mut _26: *const usize;
scope 17 {
- debug b => _26; // in scope 17 at $DIR/reference_prop.rs:+32:13: +32:18
- let _27: *mut *const usize; // in scope 17 at $DIR/reference_prop.rs:+33:13: +33:14
+ debug b => _26;
+ let _27: *mut *const usize;
scope 18 {
- debug d => _27; // in scope 18 at $DIR/reference_prop.rs:+33:13: +33:14
- let _28: usize; // in scope 18 at $DIR/reference_prop.rs:+34:13: +34:14
+ debug d => _27;
+ let _28: usize;
scope 19 {
- debug c => _28; // in scope 19 at $DIR/reference_prop.rs:+34:13: +34:14
+ debug c => _28;
}
}
}
}
}
scope 20 {
- let _32: usize; // in scope 20 at $DIR/reference_prop.rs:+40:13: +40:14
+ let _32: usize;
scope 21 {
- debug a => _32; // in scope 21 at $DIR/reference_prop.rs:+40:13: +40:14
- let _33: *const usize; // in scope 21 at $DIR/reference_prop.rs:+41:13: +41:14
+ debug a => _32;
+ let _33: *const usize;
scope 22 {
- debug b => _33; // in scope 22 at $DIR/reference_prop.rs:+41:13: +41:14
- let _34: usize; // in scope 22 at $DIR/reference_prop.rs:+42:13: +42:14
+ debug b => _33;
+ let _34: usize;
scope 23 {
- debug c => _34; // in scope 23 at $DIR/reference_prop.rs:+42:13: +42:14
+ debug c => _34;
}
}
}
}
scope 24 {
- let _38: usize; // in scope 24 at $DIR/reference_prop.rs:+48:13: +48:14
+ let _38: usize;
scope 25 {
- debug a => _38; // in scope 25 at $DIR/reference_prop.rs:+48:13: +48:14
- let _39: *const usize; // in scope 25 at $DIR/reference_prop.rs:+49:13: +49:15
+ debug a => _38;
+ let _39: *const usize;
scope 26 {
- debug b1 => _39; // in scope 26 at $DIR/reference_prop.rs:+49:13: +49:15
- let _40: usize; // in scope 26 at $DIR/reference_prop.rs:+50:13: +50:14
+ debug b1 => _39;
+ let _40: usize;
scope 27 {
- debug c => _40; // in scope 27 at $DIR/reference_prop.rs:+50:13: +50:14
- let _41: *const usize; // in scope 27 at $DIR/reference_prop.rs:+51:13: +51:15
+ debug c => _40;
+ let _41: *const usize;
scope 28 {
- debug b2 => _41; // in scope 28 at $DIR/reference_prop.rs:+51:13: +51:15
- let _42: usize; // in scope 28 at $DIR/reference_prop.rs:+52:13: +52:15
+ debug b2 => _41;
+ let _42: usize;
scope 29 {
- debug c2 => _42; // in scope 29 at $DIR/reference_prop.rs:+52:13: +52:15
- let _43: *const usize; // in scope 29 at $DIR/reference_prop.rs:+53:13: +53:15
+ debug c2 => _42;
+ let _43: *const usize;
scope 30 {
- debug b3 => _43; // in scope 30 at $DIR/reference_prop.rs:+53:13: +53:15
+ debug b3 => _43;
}
}
}
@@ -149,81 +148,75 @@
}
}
scope 31 {
- let _47: *const T; // in scope 31 at $DIR/reference_prop.rs:+61:13: +61:14
+ let _47: *const T;
scope 32 {
-- debug a => _47; // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14
-+ debug a => _1; // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14
- let _48: T; // in scope 32 at $DIR/reference_prop.rs:+62:13: +62:14
+- debug a => _47;
++ debug a => _1;
+ let _48: T;
scope 33 {
- debug b => _48; // in scope 33 at $DIR/reference_prop.rs:+62:13: +62:14
+ debug b => _48;
}
}
}
scope 34 {
- let _52: *const T; // in scope 34 at $DIR/reference_prop.rs:+68:13: +68:14
+ let _52: *const T;
scope 35 {
- debug a => _52; // in scope 35 at $DIR/reference_prop.rs:+68:13: +68:14
- let _54: T; // in scope 35 at $DIR/reference_prop.rs:+70:13: +70:14
+ debug a => _52;
+ let _54: T;
scope 36 {
- debug b => _54; // in scope 36 at $DIR/reference_prop.rs:+70:13: +70:14
+ debug b => _54;
}
}
}
scope 37 {
- let _58: usize; // in scope 37 at $DIR/reference_prop.rs:+76:13: +76:14
+ let _58: usize;
scope 38 {
- debug a => _58; // in scope 38 at $DIR/reference_prop.rs:+76:13: +76:14
- let _59: *const usize; // in scope 38 at $DIR/reference_prop.rs:+77:13: +77:14
+ debug a => _58;
+ let _59: *const usize;
scope 39 {
-- debug b => _59; // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14
-+ debug b => &_58; // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14
- let _60: *const usize; // in scope 39 at $DIR/reference_prop.rs:+78:13: +78:14
+ debug b => _59;
+ let _60: *const usize;
scope 40 {
-- debug c => _60; // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14
-+ debug c => &_58; // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14
- let _61: usize; // in scope 40 at $DIR/reference_prop.rs:+79:13: +79:14
+ debug c => _60;
+ let _61: usize;
scope 41 {
- debug e => _61; // in scope 41 at $DIR/reference_prop.rs:+79:13: +79:14
+ debug e => _61;
}
}
}
}
}
scope 42 {
- let _65: usize; // in scope 42 at $DIR/reference_prop.rs:+85:13: +85:14
+ let _65: usize;
scope 43 {
- debug a => _65; // in scope 43 at $DIR/reference_prop.rs:+85:13: +85:14
- let _66: *const usize; // in scope 43 at $DIR/reference_prop.rs:+86:13: +86:14
+ debug a => _65;
+ let _66: *const usize;
scope 44 {
-- debug b => _66; // in scope 44 at $DIR/reference_prop.rs:+86:13: +86:14
-+ debug b => &_65; // in scope 44 at $DIR/reference_prop.rs:+86:13: +86:14
- let _67: &*const usize; // in scope 44 at $DIR/reference_prop.rs:+87:13: +87:14
+ debug b => _66;
+ let _67: &*const usize;
scope 45 {
-- debug d => _67; // in scope 45 at $DIR/reference_prop.rs:+87:13: +87:14
-+ debug d => &&_65; // in scope 45 at $DIR/reference_prop.rs:+87:13: +87:14
- let _68: usize; // in scope 45 at $DIR/reference_prop.rs:+88:13: +88:14
+ debug d => _67;
+ let _68: usize;
scope 46 {
- debug c => _68; // in scope 46 at $DIR/reference_prop.rs:+88:13: +88:14
+ debug c => _68;
}
}
}
}
}
scope 47 {
- let _71: usize; // in scope 47 at $DIR/reference_prop.rs:+94:13: +94:14
+ let _71: usize;
scope 48 {
- debug a => _71; // in scope 48 at $DIR/reference_prop.rs:+94:13: +94:14
- let mut _72: *const usize; // in scope 48 at $DIR/reference_prop.rs:+95:13: +95:18
+ debug a => _71;
+ let mut _72: *const usize;
scope 49 {
-- debug b => _72; // in scope 49 at $DIR/reference_prop.rs:+95:13: +95:18
-+ debug b => &_71; // in scope 49 at $DIR/reference_prop.rs:+95:13: +95:18
- let _73: &mut *const usize; // in scope 49 at $DIR/reference_prop.rs:+96:13: +96:14
+ debug b => _72;
+ let _73: &mut *const usize;
scope 50 {
-- debug d => _73; // in scope 50 at $DIR/reference_prop.rs:+96:13: +96:14
-+ debug d => &&_71; // in scope 50 at $DIR/reference_prop.rs:+96:13: +96:14
- let _74: usize; // in scope 50 at $DIR/reference_prop.rs:+97:13: +97:14
+ debug d => _73;
+ let _74: usize;
scope 51 {
- debug c => _74; // in scope 51 at $DIR/reference_prop.rs:+97:13: +97:14
+ debug c => _74;
}
}
}
@@ -231,306 +224,272 @@
}
bb0: {
-- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
- StorageLive(_4); // scope 1 at $DIR/reference_prop.rs:+3:13: +3:14
- _4 = const 5_usize; // scope 1 at $DIR/reference_prop.rs:+3:17: +3:24
-- StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
-- _5 = &raw const _4; // scope 2 at $DIR/reference_prop.rs:+4:17: +4:29
- StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
-- _6 = (*_5); // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19
-+ _6 = _4; // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19
- StorageLive(_7); // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19
- StorageLive(_8); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18
- _8 = (); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18
- _7 = opaque::<()>(move _8) -> bb1; // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:202:9: 202:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+- StorageLive(_3);
+ StorageLive(_4);
+ _4 = const 5_usize;
+ StorageLive(_5);
+ _5 = &raw const _4;
+ StorageLive(_6);
+- _6 = (*_5);
++ _6 = _4;
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = ();
+ _7 = opaque::<()>(move _8) -> [return: bb1, unwind continue];
}
bb1: {
- StorageDead(_8); // scope 4 at $DIR/reference_prop.rs:+6:18: +6:19
- StorageDead(_7); // scope 4 at $DIR/reference_prop.rs:+6:19: +6:20
-- _3 = const (); // scope 1 at $DIR/reference_prop.rs:+2:5: +7:6
- StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+7:5: +7:6
-- StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
- StorageDead(_4); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6
-- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
-- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
- StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+11:13: +11:14
- _10 = const 5_usize; // scope 5 at $DIR/reference_prop.rs:+11:17: +11:24
- StorageLive(_11); // scope 6 at $DIR/reference_prop.rs:+12:13: +12:15
- _11 = const 7_usize; // scope 6 at $DIR/reference_prop.rs:+12:18: +12:25
- StorageLive(_12); // scope 7 at $DIR/reference_prop.rs:+13:13: +13:18
- _12 = &raw const _10; // scope 7 at $DIR/reference_prop.rs:+13:21: +13:33
- StorageLive(_13); // scope 8 at $DIR/reference_prop.rs:+14:13: +14:26
- _13 = &raw const _11; // scope 8 at $DIR/reference_prop.rs:+14:13: +14:26
- _12 = move _13; // scope 8 at $DIR/reference_prop.rs:+14:9: +14:26
- StorageDead(_13); // scope 8 at $DIR/reference_prop.rs:+14:25: +14:26
- StorageLive(_14); // scope 8 at $DIR/reference_prop.rs:+16:13: +16:14
- _14 = (*_12); // scope 8 at $DIR/reference_prop.rs:+16:17: +16:19
- StorageLive(_15); // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19
- StorageLive(_16); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18
- _16 = (); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18
- _15 = opaque::<()>(move _16) -> bb2; // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:213:9: 213:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_8);
+ StorageDead(_7);
+- _3 = const ();
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+- StorageDead(_3);
+- StorageLive(_9);
+ StorageLive(_10);
+ _10 = const 5_usize;
+ StorageLive(_11);
+ _11 = const 7_usize;
+ StorageLive(_12);
+ _12 = &raw const _10;
+ StorageLive(_13);
+ _13 = &raw const _11;
+ _12 = move _13;
+ StorageDead(_13);
+ StorageLive(_14);
+ _14 = (*_12);
+ StorageLive(_15);
+ StorageLive(_16);
+ _16 = ();
+ _15 = opaque::<()>(move _16) -> [return: bb2, unwind continue];
}
bb2: {
- StorageDead(_16); // scope 9 at $DIR/reference_prop.rs:+17:18: +17:19
- StorageDead(_15); // scope 9 at $DIR/reference_prop.rs:+17:19: +17:20
-- _9 = const (); // scope 5 at $DIR/reference_prop.rs:+10:5: +18:6
- StorageDead(_14); // scope 8 at $DIR/reference_prop.rs:+18:5: +18:6
- StorageDead(_12); // scope 7 at $DIR/reference_prop.rs:+18:5: +18:6
- StorageDead(_11); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6
- StorageDead(_10); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6
-- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6
-- StorageLive(_17); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
- StorageLive(_18); // scope 10 at $DIR/reference_prop.rs:+22:13: +22:14
- _18 = const 5_usize; // scope 10 at $DIR/reference_prop.rs:+22:17: +22:24
- StorageLive(_19); // scope 11 at $DIR/reference_prop.rs:+23:13: +23:14
- _19 = &raw const _18; // scope 11 at $DIR/reference_prop.rs:+23:17: +23:29
- StorageLive(_20); // scope 12 at $DIR/reference_prop.rs:+24:13: +24:14
- _20 = &_19; // scope 12 at $DIR/reference_prop.rs:+24:17: +24:19
- StorageLive(_21); // scope 13 at $DIR/reference_prop.rs:+25:13: +25:14
- _21 = (*_19); // scope 13 at $DIR/reference_prop.rs:+25:17: +25:19
- StorageLive(_22); // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18
- StorageLive(_23); // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17
- _23 = _20; // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17
- _22 = opaque::<&*const usize>(move _23) -> bb3; // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18
- // mir::Constant
- // + span: $DIR/reference_prop.rs:222:9: 222:15
- // + literal: Const { ty: fn(&*const usize) {opaque::<&*const usize>}, val: Value(<ZST>) }
+ StorageDead(_16);
+ StorageDead(_15);
+- _9 = const ();
+ StorageDead(_14);
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+- StorageDead(_9);
+- StorageLive(_17);
+ StorageLive(_18);
+ _18 = const 5_usize;
+ StorageLive(_19);
+ _19 = &raw const _18;
+ StorageLive(_20);
+ _20 = &_19;
+ StorageLive(_21);
+ _21 = (*_19);
+ StorageLive(_22);
+ StorageLive(_23);
+ _23 = _20;
+ _22 = opaque::<&*const usize>(move _23) -> [return: bb3, unwind continue];
}
bb3: {
- StorageDead(_23); // scope 14 at $DIR/reference_prop.rs:+26:17: +26:18
- StorageDead(_22); // scope 14 at $DIR/reference_prop.rs:+26:18: +26:19
-- _17 = const (); // scope 10 at $DIR/reference_prop.rs:+21:5: +27:6
- StorageDead(_21); // scope 13 at $DIR/reference_prop.rs:+27:5: +27:6
- StorageDead(_20); // scope 12 at $DIR/reference_prop.rs:+27:5: +27:6
- StorageDead(_19); // scope 11 at $DIR/reference_prop.rs:+27:5: +27:6
- StorageDead(_18); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6
-- StorageDead(_17); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6
-- StorageLive(_24); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
- StorageLive(_25); // scope 15 at $DIR/reference_prop.rs:+31:13: +31:14
- _25 = const 5_usize; // scope 15 at $DIR/reference_prop.rs:+31:17: +31:24
- StorageLive(_26); // scope 16 at $DIR/reference_prop.rs:+32:13: +32:18
- _26 = &raw const _25; // scope 16 at $DIR/reference_prop.rs:+32:21: +32:33
- StorageLive(_27); // scope 17 at $DIR/reference_prop.rs:+33:13: +33:14
- _27 = &raw mut _26; // scope 17 at $DIR/reference_prop.rs:+33:17: +33:27
- StorageLive(_28); // scope 18 at $DIR/reference_prop.rs:+34:13: +34:14
- _28 = (*_26); // scope 18 at $DIR/reference_prop.rs:+34:17: +34:19
- StorageLive(_29); // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18
- StorageLive(_30); // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17
- _30 = _27; // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17
- _29 = opaque::<*mut *const usize>(move _30) -> bb4; // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18
- // mir::Constant
- // + span: $DIR/reference_prop.rs:231:9: 231:15
- // + literal: Const { ty: fn(*mut *const usize) {opaque::<*mut *const usize>}, val: Value(<ZST>) }
+ StorageDead(_23);
+ StorageDead(_22);
+- _17 = const ();
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_19);
+ StorageDead(_18);
+- StorageDead(_17);
+- StorageLive(_24);
+ StorageLive(_25);
+ _25 = const 5_usize;
+ StorageLive(_26);
+ _26 = &raw const _25;
+ StorageLive(_27);
+ _27 = &raw mut _26;
+ StorageLive(_28);
+ _28 = (*_26);
+ StorageLive(_29);
+ StorageLive(_30);
+ _30 = _27;
+ _29 = opaque::<*mut *const usize>(move _30) -> [return: bb4, unwind continue];
}
bb4: {
- StorageDead(_30); // scope 19 at $DIR/reference_prop.rs:+35:17: +35:18
- StorageDead(_29); // scope 19 at $DIR/reference_prop.rs:+35:18: +35:19
-- _24 = const (); // scope 15 at $DIR/reference_prop.rs:+30:5: +36:6
- StorageDead(_28); // scope 18 at $DIR/reference_prop.rs:+36:5: +36:6
- StorageDead(_27); // scope 17 at $DIR/reference_prop.rs:+36:5: +36:6
- StorageDead(_26); // scope 16 at $DIR/reference_prop.rs:+36:5: +36:6
- StorageDead(_25); // scope 15 at $DIR/reference_prop.rs:+36:5: +36:6
-- StorageDead(_24); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6
-- StorageLive(_31); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
- StorageLive(_32); // scope 20 at $DIR/reference_prop.rs:+40:13: +40:14
- _32 = const 7_usize; // scope 20 at $DIR/reference_prop.rs:+40:17: +40:24
- StorageLive(_33); // scope 21 at $DIR/reference_prop.rs:+41:13: +41:14
- _33 = &raw const _32; // scope 21 at $DIR/reference_prop.rs:+41:17: +41:29
- StorageLive(_34); // scope 22 at $DIR/reference_prop.rs:+42:13: +42:14
-- _34 = (*_33); // scope 22 at $DIR/reference_prop.rs:+42:17: +42:19
-+ _34 = _32; // scope 22 at $DIR/reference_prop.rs:+42:17: +42:19
- StorageLive(_35); // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18
- StorageLive(_36); // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17
- _36 = _33; // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17
- _35 = opaque::<*const usize>(move _36) -> bb5; // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18
- // mir::Constant
- // + span: $DIR/reference_prop.rs:239:9: 239:15
- // + literal: Const { ty: fn(*const usize) {opaque::<*const usize>}, val: Value(<ZST>) }
+ StorageDead(_30);
+ StorageDead(_29);
+- _24 = const ();
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageDead(_26);
+ StorageDead(_25);
+- StorageDead(_24);
+- StorageLive(_31);
+ StorageLive(_32);
+ _32 = const 7_usize;
+ StorageLive(_33);
+ _33 = &raw const _32;
+ StorageLive(_34);
+- _34 = (*_33);
++ _34 = _32;
+ StorageLive(_35);
+ StorageLive(_36);
+ _36 = _33;
+ _35 = opaque::<*const usize>(move _36) -> [return: bb5, unwind continue];
}
bb5: {
- StorageDead(_36); // scope 23 at $DIR/reference_prop.rs:+43:17: +43:18
- StorageDead(_35); // scope 23 at $DIR/reference_prop.rs:+43:18: +43:19
-- _31 = const (); // scope 20 at $DIR/reference_prop.rs:+39:5: +44:6
- StorageDead(_34); // scope 22 at $DIR/reference_prop.rs:+44:5: +44:6
- StorageDead(_33); // scope 21 at $DIR/reference_prop.rs:+44:5: +44:6
- StorageDead(_32); // scope 20 at $DIR/reference_prop.rs:+44:5: +44:6
-- StorageDead(_31); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6
-- StorageLive(_37); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
- StorageLive(_38); // scope 24 at $DIR/reference_prop.rs:+48:13: +48:14
- _38 = const 7_usize; // scope 24 at $DIR/reference_prop.rs:+48:17: +48:24
- StorageLive(_39); // scope 25 at $DIR/reference_prop.rs:+49:13: +49:15
- _39 = &raw const _38; // scope 25 at $DIR/reference_prop.rs:+49:18: +49:30
- StorageLive(_40); // scope 26 at $DIR/reference_prop.rs:+50:13: +50:14
-- _40 = (*_39); // scope 26 at $DIR/reference_prop.rs:+50:17: +50:20
-+ _40 = _38; // scope 26 at $DIR/reference_prop.rs:+50:17: +50:20
- StorageLive(_41); // scope 27 at $DIR/reference_prop.rs:+51:13: +51:15
- _41 = _39; // scope 27 at $DIR/reference_prop.rs:+51:18: +51:20
- StorageLive(_42); // scope 28 at $DIR/reference_prop.rs:+52:13: +52:15
-- _42 = (*_41); // scope 28 at $DIR/reference_prop.rs:+52:18: +52:21
-+ _42 = _38; // scope 28 at $DIR/reference_prop.rs:+52:18: +52:21
- StorageLive(_43); // scope 29 at $DIR/reference_prop.rs:+53:13: +53:15
- _43 = _41; // scope 29 at $DIR/reference_prop.rs:+53:18: +53:20
- StorageLive(_44); // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19
- StorageLive(_45); // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18
- _45 = _43; // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18
- _44 = opaque::<*const usize>(move _45) -> bb6; // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:252:9: 252:15
- // + literal: Const { ty: fn(*const usize) {opaque::<*const usize>}, val: Value(<ZST>) }
+ StorageDead(_36);
+ StorageDead(_35);
+- _31 = const ();
+ StorageDead(_34);
+ StorageDead(_33);
+ StorageDead(_32);
+- StorageDead(_31);
+- StorageLive(_37);
+ StorageLive(_38);
+ _38 = const 7_usize;
+ StorageLive(_39);
+ _39 = &raw const _38;
+ StorageLive(_40);
+- _40 = (*_39);
++ _40 = _38;
+ StorageLive(_41);
+ _41 = _39;
+ StorageLive(_42);
+- _42 = (*_41);
++ _42 = _38;
+ StorageLive(_43);
+ _43 = _41;
+ StorageLive(_44);
+ StorageLive(_45);
+ _45 = _43;
+ _44 = opaque::<*const usize>(move _45) -> [return: bb6, unwind continue];
}
bb6: {
- StorageDead(_45); // scope 30 at $DIR/reference_prop.rs:+56:18: +56:19
- StorageDead(_44); // scope 30 at $DIR/reference_prop.rs:+56:19: +56:20
-- _37 = const (); // scope 24 at $DIR/reference_prop.rs:+47:5: +57:6
- StorageDead(_43); // scope 29 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_42); // scope 28 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_41); // scope 27 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_40); // scope 26 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_39); // scope 25 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_38); // scope 24 at $DIR/reference_prop.rs:+57:5: +57:6
-- StorageDead(_37); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
-- StorageLive(_46); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
-- StorageLive(_47); // scope 31 at $DIR/reference_prop.rs:+61:13: +61:14
-- _47 = &raw const (*_1); // scope 31 at $DIR/reference_prop.rs:+61:17: +61:35
- StorageLive(_48); // scope 32 at $DIR/reference_prop.rs:+62:13: +62:14
-- _48 = (*_47); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19
-+ _48 = (*_1); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19
- StorageLive(_49); // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19
- StorageLive(_50); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18
- _50 = (); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18
- _49 = opaque::<()>(move _50) -> bb7; // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:259:9: 259:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_45);
+ StorageDead(_44);
+- _37 = const ();
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageDead(_41);
+ StorageDead(_40);
+ StorageDead(_39);
+ StorageDead(_38);
+- StorageDead(_37);
+- StorageLive(_46);
+- StorageLive(_47);
+- _47 = &raw const (*_1);
+ StorageLive(_48);
+- _48 = (*_47);
++ _48 = (*_1);
+ StorageLive(_49);
+ StorageLive(_50);
+ _50 = ();
+ _49 = opaque::<()>(move _50) -> [return: bb7, unwind continue];
}
bb7: {
- StorageDead(_50); // scope 33 at $DIR/reference_prop.rs:+63:18: +63:19
- StorageDead(_49); // scope 33 at $DIR/reference_prop.rs:+63:19: +63:20
-- _46 = const (); // scope 31 at $DIR/reference_prop.rs:+60:5: +64:6
- StorageDead(_48); // scope 32 at $DIR/reference_prop.rs:+64:5: +64:6
-- StorageDead(_47); // scope 31 at $DIR/reference_prop.rs:+64:5: +64:6
-- StorageDead(_46); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
-- StorageLive(_51); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
- StorageLive(_52); // scope 34 at $DIR/reference_prop.rs:+68:13: +68:14
- _52 = &raw const (*_2); // scope 34 at $DIR/reference_prop.rs:+68:17: +68:37
- StorageLive(_53); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:38
- _53 = &raw const (*_1); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:38
- _2 = move _53; // scope 35 at $DIR/reference_prop.rs:+69:9: +69:38
- StorageDead(_53); // scope 35 at $DIR/reference_prop.rs:+69:37: +69:38
- StorageLive(_54); // scope 35 at $DIR/reference_prop.rs:+70:13: +70:14
- _54 = (*_52); // scope 35 at $DIR/reference_prop.rs:+70:17: +70:19
- StorageLive(_55); // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19
- StorageLive(_56); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18
- _56 = (); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18
- _55 = opaque::<()>(move _56) -> bb8; // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:267:9: 267:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_50);
+ StorageDead(_49);
+- _46 = const ();
+ StorageDead(_48);
+- StorageDead(_47);
+- StorageDead(_46);
+- StorageLive(_51);
+ StorageLive(_52);
+ _52 = &raw const (*_2);
+ StorageLive(_53);
+ _53 = &raw const (*_1);
+ _2 = move _53;
+ StorageDead(_53);
+ StorageLive(_54);
+ _54 = (*_52);
+ StorageLive(_55);
+ StorageLive(_56);
+ _56 = ();
+ _55 = opaque::<()>(move _56) -> [return: bb8, unwind continue];
}
bb8: {
- StorageDead(_56); // scope 36 at $DIR/reference_prop.rs:+71:18: +71:19
- StorageDead(_55); // scope 36 at $DIR/reference_prop.rs:+71:19: +71:20
-- _51 = const (); // scope 34 at $DIR/reference_prop.rs:+67:5: +72:6
- StorageDead(_54); // scope 35 at $DIR/reference_prop.rs:+72:5: +72:6
- StorageDead(_52); // scope 34 at $DIR/reference_prop.rs:+72:5: +72:6
-- StorageDead(_51); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6
-- StorageLive(_57); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
- StorageLive(_58); // scope 37 at $DIR/reference_prop.rs:+76:13: +76:14
- _58 = const 13_usize; // scope 37 at $DIR/reference_prop.rs:+76:17: +76:25
-- StorageLive(_59); // scope 38 at $DIR/reference_prop.rs:+77:13: +77:14
-- _59 = &raw const _58; // scope 38 at $DIR/reference_prop.rs:+77:17: +77:29
-- StorageLive(_60); // scope 39 at $DIR/reference_prop.rs:+78:13: +78:14
-- _60 = &raw const (*_59); // scope 39 at $DIR/reference_prop.rs:+78:17: +78:30
- StorageLive(_61); // scope 40 at $DIR/reference_prop.rs:+79:13: +79:14
-- _61 = (*_60); // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19
-+ _61 = _58; // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19
- StorageLive(_62); // scope 41 at $DIR/reference_prop.rs:+80:9: +80:19
- StorageLive(_63); // scope 41 at $DIR/reference_prop.rs:+80:16: +80:18
- _63 = (); // scope 41 at $DIR/reference_prop.rs:+80:16: +80:18
- _62 = opaque::<()>(move _63) -> bb9; // scope 41 at $DIR/reference_prop.rs:+80:9: +80:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:276:9: 276:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_56);
+ StorageDead(_55);
+- _51 = const ();
+ StorageDead(_54);
+ StorageDead(_52);
+- StorageDead(_51);
+- StorageLive(_57);
+ StorageLive(_58);
+ _58 = const 13_usize;
+ StorageLive(_59);
+ _59 = &raw const _58;
+ StorageLive(_60);
+- _60 = &raw const (*_59);
++ _60 = &raw const _58;
+ StorageLive(_61);
+- _61 = (*_60);
++ _61 = _58;
+ StorageLive(_62);
+ StorageLive(_63);
+ _63 = ();
+ _62 = opaque::<()>(move _63) -> [return: bb9, unwind continue];
}
bb9: {
- StorageDead(_63); // scope 41 at $DIR/reference_prop.rs:+80:18: +80:19
- StorageDead(_62); // scope 41 at $DIR/reference_prop.rs:+80:19: +80:20
-- _57 = const (); // scope 37 at $DIR/reference_prop.rs:+75:5: +81:6
- StorageDead(_61); // scope 40 at $DIR/reference_prop.rs:+81:5: +81:6
-- StorageDead(_60); // scope 39 at $DIR/reference_prop.rs:+81:5: +81:6
-- StorageDead(_59); // scope 38 at $DIR/reference_prop.rs:+81:5: +81:6
- StorageDead(_58); // scope 37 at $DIR/reference_prop.rs:+81:5: +81:6
-- StorageDead(_57); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6
-- StorageLive(_64); // scope 0 at $DIR/reference_prop.rs:+84:5: +90:6
- StorageLive(_65); // scope 42 at $DIR/reference_prop.rs:+85:13: +85:14
- _65 = const 5_usize; // scope 42 at $DIR/reference_prop.rs:+85:17: +85:24
-- StorageLive(_66); // scope 43 at $DIR/reference_prop.rs:+86:13: +86:14
-- _66 = &raw const _65; // scope 43 at $DIR/reference_prop.rs:+86:17: +86:29
-- StorageLive(_67); // scope 44 at $DIR/reference_prop.rs:+87:13: +87:14
-- _67 = &_66; // scope 44 at $DIR/reference_prop.rs:+87:17: +87:19
- StorageLive(_68); // scope 45 at $DIR/reference_prop.rs:+88:13: +88:14
-- _68 = (*_66); // scope 45 at $DIR/reference_prop.rs:+88:17: +88:19
-+ _68 = _65; // scope 45 at $DIR/reference_prop.rs:+88:17: +88:19
- StorageLive(_69); // scope 46 at $DIR/reference_prop.rs:+89:9: +89:19
- StorageLive(_70); // scope 46 at $DIR/reference_prop.rs:+89:16: +89:18
- _70 = (); // scope 46 at $DIR/reference_prop.rs:+89:16: +89:18
- _69 = opaque::<()>(move _70) -> bb10; // scope 46 at $DIR/reference_prop.rs:+89:9: +89:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:285:9: 285:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_63);
+ StorageDead(_62);
+- _57 = const ();
+ StorageDead(_61);
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageDead(_58);
+- StorageDead(_57);
+- StorageLive(_64);
+ StorageLive(_65);
+ _65 = const 5_usize;
+ StorageLive(_66);
+ _66 = &raw const _65;
+ StorageLive(_67);
+ _67 = &_66;
+ StorageLive(_68);
+ _68 = (*_66);
+ StorageLive(_69);
+ StorageLive(_70);
+ _70 = ();
+ _69 = opaque::<()>(move _70) -> [return: bb10, unwind continue];
}
bb10: {
- StorageDead(_70); // scope 46 at $DIR/reference_prop.rs:+89:18: +89:19
- StorageDead(_69); // scope 46 at $DIR/reference_prop.rs:+89:19: +89:20
-- _64 = const (); // scope 42 at $DIR/reference_prop.rs:+84:5: +90:6
- StorageDead(_68); // scope 45 at $DIR/reference_prop.rs:+90:5: +90:6
-- StorageDead(_67); // scope 44 at $DIR/reference_prop.rs:+90:5: +90:6
-- StorageDead(_66); // scope 43 at $DIR/reference_prop.rs:+90:5: +90:6
- StorageDead(_65); // scope 42 at $DIR/reference_prop.rs:+90:5: +90:6
-- StorageDead(_64); // scope 0 at $DIR/reference_prop.rs:+90:5: +90:6
- StorageLive(_71); // scope 47 at $DIR/reference_prop.rs:+94:13: +94:14
- _71 = const 5_usize; // scope 47 at $DIR/reference_prop.rs:+94:17: +94:24
-- StorageLive(_72); // scope 48 at $DIR/reference_prop.rs:+95:13: +95:18
-- _72 = &raw const _71; // scope 48 at $DIR/reference_prop.rs:+95:21: +95:33
-- StorageLive(_73); // scope 49 at $DIR/reference_prop.rs:+96:13: +96:14
-- _73 = &mut _72; // scope 49 at $DIR/reference_prop.rs:+96:17: +96:23
- StorageLive(_74); // scope 50 at $DIR/reference_prop.rs:+97:13: +97:14
-- _74 = (*_72); // scope 50 at $DIR/reference_prop.rs:+97:17: +97:19
-+ _74 = _71; // scope 50 at $DIR/reference_prop.rs:+97:17: +97:19
- StorageLive(_75); // scope 51 at $DIR/reference_prop.rs:+98:9: +98:19
- StorageLive(_76); // scope 51 at $DIR/reference_prop.rs:+98:16: +98:18
- _76 = (); // scope 51 at $DIR/reference_prop.rs:+98:16: +98:18
- _75 = opaque::<()>(move _76) -> bb11; // scope 51 at $DIR/reference_prop.rs:+98:9: +98:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:294:9: 294:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_70);
+ StorageDead(_69);
+- _64 = const ();
+ StorageDead(_68);
+ StorageDead(_67);
+ StorageDead(_66);
+ StorageDead(_65);
+- StorageDead(_64);
+ StorageLive(_71);
+ _71 = const 5_usize;
+ StorageLive(_72);
+ _72 = &raw const _71;
+ StorageLive(_73);
+ _73 = &mut _72;
+ StorageLive(_74);
+ _74 = (*_72);
+ StorageLive(_75);
+ StorageLive(_76);
+ _76 = ();
+ _75 = opaque::<()>(move _76) -> [return: bb11, unwind continue];
}
bb11: {
- StorageDead(_76); // scope 51 at $DIR/reference_prop.rs:+98:18: +98:19
- StorageDead(_75); // scope 51 at $DIR/reference_prop.rs:+98:19: +98:20
- _0 = const (); // scope 47 at $DIR/reference_prop.rs:+93:5: +99:6
- StorageDead(_74); // scope 50 at $DIR/reference_prop.rs:+99:5: +99:6
-- StorageDead(_73); // scope 49 at $DIR/reference_prop.rs:+99:5: +99:6
-- StorageDead(_72); // scope 48 at $DIR/reference_prop.rs:+99:5: +99:6
- StorageDead(_71); // scope 47 at $DIR/reference_prop.rs:+99:5: +99:6
- return; // scope 0 at $DIR/reference_prop.rs:+100:2: +100:2
+ StorageDead(_76);
+ StorageDead(_75);
+ _0 = const ();
+ StorageDead(_74);
+ StorageDead(_73);
+ StorageDead(_72);
+ StorageDead(_71);
+ return;
}
}
diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff
index 8d059de5b..7c7f424bb 100644
--- a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff
@@ -2,137 +2,136 @@
+ // MIR for `reference_propagation_mut` after ReferencePropagation
fn reference_propagation_mut(_1: &mut T, _2: &mut T) -> () {
- debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:43: +0:49
- debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:62: +0:74
- let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:87: +0:87
- let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
- let mut _4: usize; // in scope 0 at $DIR/reference_prop.rs:+3:13: +3:18
- let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19
- let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18
- let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
- let mut _10: usize; // in scope 0 at $DIR/reference_prop.rs:+11:13: +11:18
- let mut _13: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:20
- let mut _14: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:20
- let _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19
- let mut _17: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18
- let _18: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
- let mut _19: usize; // in scope 0 at $DIR/reference_prop.rs:+22:13: +22:18
- let _23: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18
- let mut _24: &&mut usize; // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17
- let _25: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
- let mut _26: usize; // in scope 0 at $DIR/reference_prop.rs:+31:13: +31:18
- let _30: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18
- let mut _31: *mut &mut usize; // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17
- let _32: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
- let mut _33: usize; // in scope 0 at $DIR/reference_prop.rs:+40:13: +40:18
- let _36: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18
- let mut _37: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17
- let _38: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
- let mut _39: usize; // in scope 0 at $DIR/reference_prop.rs:+48:13: +48:18
- let _45: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19
- let mut _46: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18
- let _47: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
- let _48: &mut T; // in scope 0 at $DIR/reference_prop.rs:+61:13: +61:14
- let _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19
- let mut _51: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18
- let _52: (); // in scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
- let _53: &mut T; // in scope 0 at $DIR/reference_prop.rs:+68:13: +68:14
- let mut _54: &mut T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:32
- let mut _55: &mut T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:32
- let _57: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19
- let mut _58: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18
- let _59: (); // in scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
- let mut _60: usize; // in scope 0 at $DIR/reference_prop.rs:+76:13: +76:18
- let _64: (); // in scope 0 at $DIR/reference_prop.rs:+80:9: +80:19
- let mut _65: (); // in scope 0 at $DIR/reference_prop.rs:+80:16: +80:18
- let mut _66: usize; // in scope 0 at $DIR/reference_prop.rs:+85:13: +85:18
- let _70: (); // in scope 0 at $DIR/reference_prop.rs:+89:9: +89:19
- let mut _71: (); // in scope 0 at $DIR/reference_prop.rs:+89:16: +89:18
+ debug single => _1;
+ debug multiple => _2;
+ let mut _0: ();
+ let _3: ();
+ let mut _4: usize;
+ let _7: ();
+ let mut _8: ();
+ let _9: ();
+ let mut _10: usize;
+ let mut _13: &mut usize;
+ let mut _14: &mut usize;
+ let _16: ();
+ let mut _17: ();
+ let _18: ();
+ let mut _19: usize;
+ let _23: ();
+ let mut _24: &&mut usize;
+ let _25: ();
+ let mut _26: usize;
+ let _30: ();
+ let mut _31: *mut &mut usize;
+ let _32: ();
+ let mut _33: usize;
+ let _36: ();
+ let mut _37: &mut usize;
+ let _38: ();
+ let mut _39: usize;
+ let _45: ();
+ let mut _46: &mut usize;
+ let _47: ();
+ let _48: &mut T;
+ let _50: ();
+ let mut _51: ();
+ let _52: ();
+ let _53: &mut T;
+ let mut _54: &mut T;
+ let mut _55: &mut T;
+ let _57: ();
+ let mut _58: ();
+ let _59: ();
+ let mut _60: usize;
+ let _64: ();
+ let mut _65: ();
+ let mut _66: usize;
+ let _70: ();
+ let mut _71: ();
scope 1 {
- debug a => _4; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:18
- let _5: &mut usize; // in scope 1 at $DIR/reference_prop.rs:+4:13: +4:14
+ debug a => _4;
+ let _5: &mut usize;
scope 2 {
-- debug b => _5; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
-+ debug b => &_4; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
- let _6: usize; // in scope 2 at $DIR/reference_prop.rs:+5:13: +5:14
+ debug b => _5;
+ let _6: usize;
scope 3 {
- debug c => _6; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
+ debug c => _6;
}
}
}
scope 4 {
- debug a => _10; // in scope 4 at $DIR/reference_prop.rs:+11:13: +11:18
- let mut _11: usize; // in scope 4 at $DIR/reference_prop.rs:+12:13: +12:19
+ debug a => _10;
+ let mut _11: usize;
scope 5 {
- debug a2 => _11; // in scope 5 at $DIR/reference_prop.rs:+12:13: +12:19
- let mut _12: &mut usize; // in scope 5 at $DIR/reference_prop.rs:+13:13: +13:18
+ debug a2 => _11;
+ let mut _12: &mut usize;
scope 6 {
- debug b => _12; // in scope 6 at $DIR/reference_prop.rs:+13:13: +13:18
- let _15: usize; // in scope 6 at $DIR/reference_prop.rs:+16:13: +16:14
+ debug b => _12;
+ let _15: usize;
scope 7 {
- debug c => _15; // in scope 7 at $DIR/reference_prop.rs:+16:13: +16:14
+ debug c => _15;
}
}
}
}
scope 8 {
- debug a => _19; // in scope 8 at $DIR/reference_prop.rs:+22:13: +22:18
- let _20: &mut usize; // in scope 8 at $DIR/reference_prop.rs:+23:13: +23:14
+ debug a => _19;
+ let _20: &mut usize;
scope 9 {
- debug b => _20; // in scope 9 at $DIR/reference_prop.rs:+23:13: +23:14
- let _21: &&mut usize; // in scope 9 at $DIR/reference_prop.rs:+24:13: +24:14
+ debug b => _20;
+ let _21: &&mut usize;
scope 10 {
- debug d => _21; // in scope 10 at $DIR/reference_prop.rs:+24:13: +24:14
- let _22: usize; // in scope 10 at $DIR/reference_prop.rs:+25:13: +25:14
+ debug d => _21;
+ let _22: usize;
scope 11 {
- debug c => _22; // in scope 11 at $DIR/reference_prop.rs:+25:13: +25:14
+ debug c => _22;
}
}
}
}
scope 12 {
- debug a => _26; // in scope 12 at $DIR/reference_prop.rs:+31:13: +31:18
- let mut _27: &mut usize; // in scope 12 at $DIR/reference_prop.rs:+32:13: +32:18
+ debug a => _26;
+ let mut _27: &mut usize;
scope 13 {
- debug b => _27; // in scope 13 at $DIR/reference_prop.rs:+32:13: +32:18
- let _28: *mut &mut usize; // in scope 13 at $DIR/reference_prop.rs:+33:13: +33:14
+ debug b => _27;
+ let _28: *mut &mut usize;
scope 14 {
- debug d => _28; // in scope 14 at $DIR/reference_prop.rs:+33:13: +33:14
- let _29: usize; // in scope 14 at $DIR/reference_prop.rs:+34:13: +34:14
+ debug d => _28;
+ let _29: usize;
scope 15 {
- debug c => _29; // in scope 15 at $DIR/reference_prop.rs:+34:13: +34:14
+ debug c => _29;
}
}
}
}
scope 16 {
- debug a => _33; // in scope 16 at $DIR/reference_prop.rs:+40:13: +40:18
- let _34: &mut usize; // in scope 16 at $DIR/reference_prop.rs:+41:13: +41:14
+ debug a => _33;
+ let _34: &mut usize;
scope 17 {
- debug b => _34; // in scope 17 at $DIR/reference_prop.rs:+41:13: +41:14
- let _35: usize; // in scope 17 at $DIR/reference_prop.rs:+42:13: +42:14
+ debug b => _34;
+ let _35: usize;
scope 18 {
- debug c => _35; // in scope 18 at $DIR/reference_prop.rs:+42:13: +42:14
+ debug c => _35;
}
}
}
scope 19 {
- debug a => _39; // in scope 19 at $DIR/reference_prop.rs:+48:13: +48:18
- let _40: &mut usize; // in scope 19 at $DIR/reference_prop.rs:+49:13: +49:15
+ debug a => _39;
+ let _40: &mut usize;
scope 20 {
- debug b1 => _40; // in scope 20 at $DIR/reference_prop.rs:+49:13: +49:15
- let _41: usize; // in scope 20 at $DIR/reference_prop.rs:+50:13: +50:14
+ debug b1 => _40;
+ let _41: usize;
scope 21 {
- debug c => _41; // in scope 21 at $DIR/reference_prop.rs:+50:13: +50:14
- let _42: &mut usize; // in scope 21 at $DIR/reference_prop.rs:+51:13: +51:15
+ debug c => _41;
+ let _42: &mut usize;
scope 22 {
- debug b2 => _42; // in scope 22 at $DIR/reference_prop.rs:+51:13: +51:15
- let _43: usize; // in scope 22 at $DIR/reference_prop.rs:+52:13: +52:15
+ debug b2 => _42;
+ let _43: usize;
scope 23 {
- debug c2 => _43; // in scope 23 at $DIR/reference_prop.rs:+52:13: +52:15
- let _44: &mut usize; // in scope 23 at $DIR/reference_prop.rs:+53:13: +53:15
+ debug c2 => _43;
+ let _44: &mut usize;
scope 24 {
- debug b3 => _44; // in scope 24 at $DIR/reference_prop.rs:+53:13: +53:15
+ debug b3 => _44;
}
}
}
@@ -140,333 +139,297 @@
}
}
scope 25 {
-- debug a => _48; // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14
-+ debug a => _1; // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14
- let _49: T; // in scope 25 at $DIR/reference_prop.rs:+62:13: +62:14
+- debug a => _48;
++ debug a => _1;
+ let _49: T;
scope 26 {
- debug b => _49; // in scope 26 at $DIR/reference_prop.rs:+62:13: +62:14
+ debug b => _49;
}
}
scope 27 {
- debug a => _53; // in scope 27 at $DIR/reference_prop.rs:+68:13: +68:14
- let _56: T; // in scope 27 at $DIR/reference_prop.rs:+70:13: +70:14
+ debug a => _53;
+ let _56: T;
scope 28 {
- debug b => _56; // in scope 28 at $DIR/reference_prop.rs:+70:13: +70:14
+ debug b => _56;
}
}
scope 29 {
- debug a => _60; // in scope 29 at $DIR/reference_prop.rs:+76:13: +76:18
- let _61: &mut usize; // in scope 29 at $DIR/reference_prop.rs:+77:13: +77:14
+ debug a => _60;
+ let _61: &mut usize;
scope 30 {
-- debug b => _61; // in scope 30 at $DIR/reference_prop.rs:+77:13: +77:14
-+ debug b => &_60; // in scope 30 at $DIR/reference_prop.rs:+77:13: +77:14
- let _62: &&mut usize; // in scope 30 at $DIR/reference_prop.rs:+78:13: +78:14
+ debug b => _61;
+ let _62: &&mut usize;
scope 31 {
-- debug d => _62; // in scope 31 at $DIR/reference_prop.rs:+78:13: +78:14
-+ debug d => &&_60; // in scope 31 at $DIR/reference_prop.rs:+78:13: +78:14
- let _63: usize; // in scope 31 at $DIR/reference_prop.rs:+79:13: +79:14
+ debug d => _62;
+ let _63: usize;
scope 32 {
- debug c => _63; // in scope 32 at $DIR/reference_prop.rs:+79:13: +79:14
+ debug c => _63;
}
}
}
}
scope 33 {
- debug a => _66; // in scope 33 at $DIR/reference_prop.rs:+85:13: +85:18
- let mut _67: &mut usize; // in scope 33 at $DIR/reference_prop.rs:+86:13: +86:18
+ debug a => _66;
+ let mut _67: &mut usize;
scope 34 {
-- debug b => _67; // in scope 34 at $DIR/reference_prop.rs:+86:13: +86:18
-+ debug b => &_66; // in scope 34 at $DIR/reference_prop.rs:+86:13: +86:18
- let _68: &mut &mut usize; // in scope 34 at $DIR/reference_prop.rs:+87:13: +87:14
+ debug b => _67;
+ let _68: &mut &mut usize;
scope 35 {
-- debug d => _68; // in scope 35 at $DIR/reference_prop.rs:+87:13: +87:14
-+ debug d => &&_66; // in scope 35 at $DIR/reference_prop.rs:+87:13: +87:14
- let _69: usize; // in scope 35 at $DIR/reference_prop.rs:+88:13: +88:14
+ debug d => _68;
+ let _69: usize;
scope 36 {
- debug c => _69; // in scope 36 at $DIR/reference_prop.rs:+88:13: +88:14
+ debug c => _69;
}
}
}
}
bb0: {
-- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
- StorageLive(_4); // scope 0 at $DIR/reference_prop.rs:+3:13: +3:18
- _4 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+3:21: +3:28
-- StorageLive(_5); // scope 1 at $DIR/reference_prop.rs:+4:13: +4:14
-- _5 = &mut _4; // scope 1 at $DIR/reference_prop.rs:+4:17: +4:23
- StorageLive(_6); // scope 2 at $DIR/reference_prop.rs:+5:13: +5:14
-- _6 = (*_5); // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19
-+ _6 = _4; // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19
- StorageLive(_7); // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19
- StorageLive(_8); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18
- _8 = (); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18
- _7 = opaque::<()>(move _8) -> bb1; // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:109:9: 109:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+- StorageLive(_3);
+ StorageLive(_4);
+ _4 = const 5_usize;
+ StorageLive(_5);
+ _5 = &mut _4;
+ StorageLive(_6);
+- _6 = (*_5);
++ _6 = _4;
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = ();
+ _7 = opaque::<()>(move _8) -> [return: bb1, unwind continue];
}
bb1: {
- StorageDead(_8); // scope 3 at $DIR/reference_prop.rs:+6:18: +6:19
- StorageDead(_7); // scope 3 at $DIR/reference_prop.rs:+6:19: +6:20
-- _3 = const (); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
- StorageDead(_6); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
-- StorageDead(_5); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6
- StorageDead(_4); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
-- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
-- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
- StorageLive(_10); // scope 0 at $DIR/reference_prop.rs:+11:13: +11:18
- _10 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+11:21: +11:28
- StorageLive(_11); // scope 4 at $DIR/reference_prop.rs:+12:13: +12:19
- _11 = const 7_usize; // scope 4 at $DIR/reference_prop.rs:+12:22: +12:29
- StorageLive(_12); // scope 5 at $DIR/reference_prop.rs:+13:13: +13:18
- _12 = &mut _10; // scope 5 at $DIR/reference_prop.rs:+13:21: +13:27
- StorageLive(_13); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20
-- StorageLive(_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20
-- _14 = &mut _11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20
-- _13 = &mut (*_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20
-+ _13 = &mut _11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20
- _12 = move _13; // scope 6 at $DIR/reference_prop.rs:+14:9: +14:20
- StorageDead(_13); // scope 6 at $DIR/reference_prop.rs:+14:19: +14:20
-- StorageDead(_14); // scope 6 at $DIR/reference_prop.rs:+14:20: +14:21
- StorageLive(_15); // scope 6 at $DIR/reference_prop.rs:+16:13: +16:14
- _15 = (*_12); // scope 6 at $DIR/reference_prop.rs:+16:17: +16:19
- StorageLive(_16); // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19
- StorageLive(_17); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18
- _17 = (); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18
- _16 = opaque::<()>(move _17) -> bb2; // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:120:9: 120:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_8);
+ StorageDead(_7);
+- _3 = const ();
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+- StorageDead(_3);
+- StorageLive(_9);
+ StorageLive(_10);
+ _10 = const 5_usize;
+ StorageLive(_11);
+ _11 = const 7_usize;
+ StorageLive(_12);
+ _12 = &mut _10;
+ StorageLive(_13);
+- StorageLive(_14);
+- _14 = &mut _11;
+- _13 = &mut (*_14);
++ _13 = &mut _11;
+ _12 = move _13;
+ StorageDead(_13);
+- StorageDead(_14);
+ StorageLive(_15);
+ _15 = (*_12);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = ();
+ _16 = opaque::<()>(move _17) -> [return: bb2, unwind continue];
}
bb2: {
- StorageDead(_17); // scope 7 at $DIR/reference_prop.rs:+17:18: +17:19
- StorageDead(_16); // scope 7 at $DIR/reference_prop.rs:+17:19: +17:20
-- _9 = const (); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
- StorageDead(_15); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6
- StorageDead(_12); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6
- StorageDead(_11); // scope 4 at $DIR/reference_prop.rs:+18:5: +18:6
- StorageDead(_10); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6
-- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6
-- StorageLive(_18); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
- StorageLive(_19); // scope 0 at $DIR/reference_prop.rs:+22:13: +22:18
- _19 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+22:21: +22:28
- StorageLive(_20); // scope 8 at $DIR/reference_prop.rs:+23:13: +23:14
- _20 = &mut _19; // scope 8 at $DIR/reference_prop.rs:+23:17: +23:23
- StorageLive(_21); // scope 9 at $DIR/reference_prop.rs:+24:13: +24:14
- _21 = &_20; // scope 9 at $DIR/reference_prop.rs:+24:17: +24:19
- StorageLive(_22); // scope 10 at $DIR/reference_prop.rs:+25:13: +25:14
- _22 = (*_20); // scope 10 at $DIR/reference_prop.rs:+25:17: +25:19
- StorageLive(_23); // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18
- StorageLive(_24); // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17
- _24 = _21; // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17
- _23 = opaque::<&&mut usize>(move _24) -> bb3; // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18
- // mir::Constant
- // + span: $DIR/reference_prop.rs:129:9: 129:15
- // + literal: Const { ty: fn(&&mut usize) {opaque::<&&mut usize>}, val: Value(<ZST>) }
+ StorageDead(_17);
+ StorageDead(_16);
+- _9 = const ();
+ StorageDead(_15);
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+- StorageDead(_9);
+- StorageLive(_18);
+ StorageLive(_19);
+ _19 = const 5_usize;
+ StorageLive(_20);
+ _20 = &mut _19;
+ StorageLive(_21);
+ _21 = &_20;
+ StorageLive(_22);
+ _22 = (*_20);
+ StorageLive(_23);
+ StorageLive(_24);
+ _24 = _21;
+ _23 = opaque::<&&mut usize>(move _24) -> [return: bb3, unwind continue];
}
bb3: {
- StorageDead(_24); // scope 11 at $DIR/reference_prop.rs:+26:17: +26:18
- StorageDead(_23); // scope 11 at $DIR/reference_prop.rs:+26:18: +26:19
-- _18 = const (); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
- StorageDead(_22); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6
- StorageDead(_21); // scope 9 at $DIR/reference_prop.rs:+27:5: +27:6
- StorageDead(_20); // scope 8 at $DIR/reference_prop.rs:+27:5: +27:6
- StorageDead(_19); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6
-- StorageDead(_18); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6
-- StorageLive(_25); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
- StorageLive(_26); // scope 0 at $DIR/reference_prop.rs:+31:13: +31:18
- _26 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+31:21: +31:28
- StorageLive(_27); // scope 12 at $DIR/reference_prop.rs:+32:13: +32:18
- _27 = &mut _26; // scope 12 at $DIR/reference_prop.rs:+32:21: +32:27
- StorageLive(_28); // scope 13 at $DIR/reference_prop.rs:+33:13: +33:14
- _28 = &raw mut _27; // scope 13 at $DIR/reference_prop.rs:+33:17: +33:27
- StorageLive(_29); // scope 14 at $DIR/reference_prop.rs:+34:13: +34:14
- _29 = (*_27); // scope 14 at $DIR/reference_prop.rs:+34:17: +34:19
- StorageLive(_30); // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18
- StorageLive(_31); // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17
- _31 = _28; // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17
- _30 = opaque::<*mut &mut usize>(move _31) -> bb4; // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18
- // mir::Constant
- // + span: $DIR/reference_prop.rs:138:9: 138:15
- // + literal: Const { ty: fn(*mut &mut usize) {opaque::<*mut &mut usize>}, val: Value(<ZST>) }
+ StorageDead(_24);
+ StorageDead(_23);
+- _18 = const ();
+ StorageDead(_22);
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_19);
+- StorageDead(_18);
+- StorageLive(_25);
+ StorageLive(_26);
+ _26 = const 5_usize;
+ StorageLive(_27);
+ _27 = &mut _26;
+ StorageLive(_28);
+ _28 = &raw mut _27;
+ StorageLive(_29);
+ _29 = (*_27);
+ StorageLive(_30);
+ StorageLive(_31);
+ _31 = _28;
+ _30 = opaque::<*mut &mut usize>(move _31) -> [return: bb4, unwind continue];
}
bb4: {
- StorageDead(_31); // scope 15 at $DIR/reference_prop.rs:+35:17: +35:18
- StorageDead(_30); // scope 15 at $DIR/reference_prop.rs:+35:18: +35:19
-- _25 = const (); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
- StorageDead(_29); // scope 14 at $DIR/reference_prop.rs:+36:5: +36:6
- StorageDead(_28); // scope 13 at $DIR/reference_prop.rs:+36:5: +36:6
- StorageDead(_27); // scope 12 at $DIR/reference_prop.rs:+36:5: +36:6
- StorageDead(_26); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6
-- StorageDead(_25); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6
-- StorageLive(_32); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
- StorageLive(_33); // scope 0 at $DIR/reference_prop.rs:+40:13: +40:18
- _33 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+40:21: +40:28
- StorageLive(_34); // scope 16 at $DIR/reference_prop.rs:+41:13: +41:14
- _34 = &mut _33; // scope 16 at $DIR/reference_prop.rs:+41:17: +41:23
- StorageLive(_35); // scope 17 at $DIR/reference_prop.rs:+42:13: +42:14
- _35 = (*_34); // scope 17 at $DIR/reference_prop.rs:+42:17: +42:19
- StorageLive(_36); // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18
- StorageLive(_37); // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17
- _37 = move _34; // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17
- _36 = opaque::<&mut usize>(move _37) -> bb5; // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18
- // mir::Constant
- // + span: $DIR/reference_prop.rs:146:9: 146:15
- // + literal: Const { ty: fn(&mut usize) {opaque::<&mut usize>}, val: Value(<ZST>) }
+ StorageDead(_31);
+ StorageDead(_30);
+- _25 = const ();
+ StorageDead(_29);
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageDead(_26);
+- StorageDead(_25);
+- StorageLive(_32);
+ StorageLive(_33);
+ _33 = const 7_usize;
+ StorageLive(_34);
+ _34 = &mut _33;
+ StorageLive(_35);
+ _35 = (*_34);
+ StorageLive(_36);
+ StorageLive(_37);
+ _37 = move _34;
+ _36 = opaque::<&mut usize>(move _37) -> [return: bb5, unwind continue];
}
bb5: {
- StorageDead(_37); // scope 18 at $DIR/reference_prop.rs:+43:17: +43:18
- StorageDead(_36); // scope 18 at $DIR/reference_prop.rs:+43:18: +43:19
-- _32 = const (); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
- StorageDead(_35); // scope 17 at $DIR/reference_prop.rs:+44:5: +44:6
- StorageDead(_34); // scope 16 at $DIR/reference_prop.rs:+44:5: +44:6
- StorageDead(_33); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6
-- StorageDead(_32); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6
-- StorageLive(_38); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
- StorageLive(_39); // scope 0 at $DIR/reference_prop.rs:+48:13: +48:18
- _39 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+48:21: +48:28
- StorageLive(_40); // scope 19 at $DIR/reference_prop.rs:+49:13: +49:15
- _40 = &mut _39; // scope 19 at $DIR/reference_prop.rs:+49:18: +49:24
- StorageLive(_41); // scope 20 at $DIR/reference_prop.rs:+50:13: +50:14
- _41 = (*_40); // scope 20 at $DIR/reference_prop.rs:+50:17: +50:20
- StorageLive(_42); // scope 21 at $DIR/reference_prop.rs:+51:13: +51:15
- _42 = move _40; // scope 21 at $DIR/reference_prop.rs:+51:18: +51:20
- StorageLive(_43); // scope 22 at $DIR/reference_prop.rs:+52:13: +52:15
- _43 = (*_42); // scope 22 at $DIR/reference_prop.rs:+52:18: +52:21
- StorageLive(_44); // scope 23 at $DIR/reference_prop.rs:+53:13: +53:15
- _44 = move _42; // scope 23 at $DIR/reference_prop.rs:+53:18: +53:20
- StorageLive(_45); // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19
- StorageLive(_46); // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18
- _46 = move _44; // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18
- _45 = opaque::<&mut usize>(move _46) -> bb6; // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:159:9: 159:15
- // + literal: Const { ty: fn(&mut usize) {opaque::<&mut usize>}, val: Value(<ZST>) }
+ StorageDead(_37);
+ StorageDead(_36);
+- _32 = const ();
+ StorageDead(_35);
+ StorageDead(_34);
+ StorageDead(_33);
+- StorageDead(_32);
+- StorageLive(_38);
+ StorageLive(_39);
+ _39 = const 7_usize;
+ StorageLive(_40);
+ _40 = &mut _39;
+ StorageLive(_41);
+ _41 = (*_40);
+ StorageLive(_42);
+ _42 = move _40;
+ StorageLive(_43);
+ _43 = (*_42);
+ StorageLive(_44);
+ _44 = move _42;
+ StorageLive(_45);
+ StorageLive(_46);
+ _46 = move _44;
+ _45 = opaque::<&mut usize>(move _46) -> [return: bb6, unwind continue];
}
bb6: {
- StorageDead(_46); // scope 24 at $DIR/reference_prop.rs:+56:18: +56:19
- StorageDead(_45); // scope 24 at $DIR/reference_prop.rs:+56:19: +56:20
-- _38 = const (); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
- StorageDead(_44); // scope 23 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_43); // scope 22 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_42); // scope 21 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_41); // scope 20 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_40); // scope 19 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_39); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
-- StorageDead(_38); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
-- StorageLive(_47); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
-- StorageLive(_48); // scope 0 at $DIR/reference_prop.rs:+61:13: +61:14
-- _48 = &mut (*_1); // scope 0 at $DIR/reference_prop.rs:+61:17: +61:29
- StorageLive(_49); // scope 25 at $DIR/reference_prop.rs:+62:13: +62:14
-- _49 = (*_48); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19
-+ _49 = (*_1); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19
- StorageLive(_50); // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19
- StorageLive(_51); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18
- _51 = (); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18
- _50 = opaque::<()>(move _51) -> bb7; // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:166:9: 166:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_46);
+ StorageDead(_45);
+- _38 = const ();
+ StorageDead(_44);
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageDead(_41);
+ StorageDead(_40);
+ StorageDead(_39);
+- StorageDead(_38);
+- StorageLive(_47);
+- StorageLive(_48);
+- _48 = &mut (*_1);
+ StorageLive(_49);
+- _49 = (*_48);
++ _49 = (*_1);
+ StorageLive(_50);
+ StorageLive(_51);
+ _51 = ();
+ _50 = opaque::<()>(move _51) -> [return: bb7, unwind continue];
}
bb7: {
- StorageDead(_51); // scope 26 at $DIR/reference_prop.rs:+63:18: +63:19
- StorageDead(_50); // scope 26 at $DIR/reference_prop.rs:+63:19: +63:20
-- _47 = const (); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
- StorageDead(_49); // scope 25 at $DIR/reference_prop.rs:+64:5: +64:6
-- StorageDead(_48); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
-- StorageDead(_47); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
-- StorageLive(_52); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
- StorageLive(_53); // scope 0 at $DIR/reference_prop.rs:+68:13: +68:14
- _53 = &mut (*_2); // scope 0 at $DIR/reference_prop.rs:+68:17: +68:31
- StorageLive(_54); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32
-- StorageLive(_55); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32
-- _55 = &mut (*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32
-- _54 = &mut (*_55); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32
-+ _54 = &mut (*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32
- _2 = move _54; // scope 27 at $DIR/reference_prop.rs:+69:9: +69:32
- StorageDead(_54); // scope 27 at $DIR/reference_prop.rs:+69:31: +69:32
-- StorageDead(_55); // scope 27 at $DIR/reference_prop.rs:+69:32: +69:33
- StorageLive(_56); // scope 27 at $DIR/reference_prop.rs:+70:13: +70:14
- _56 = (*_53); // scope 27 at $DIR/reference_prop.rs:+70:17: +70:19
- StorageLive(_57); // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19
- StorageLive(_58); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18
- _58 = (); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18
- _57 = opaque::<()>(move _58) -> bb8; // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:174:9: 174:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_51);
+ StorageDead(_50);
+- _47 = const ();
+ StorageDead(_49);
+- StorageDead(_48);
+- StorageDead(_47);
+- StorageLive(_52);
+ StorageLive(_53);
+ _53 = &mut (*_2);
+ StorageLive(_54);
+- StorageLive(_55);
+- _55 = &mut (*_1);
+- _54 = &mut (*_55);
++ _54 = &mut (*_1);
+ _2 = move _54;
+ StorageDead(_54);
+- StorageDead(_55);
+ StorageLive(_56);
+ _56 = (*_53);
+ StorageLive(_57);
+ StorageLive(_58);
+ _58 = ();
+ _57 = opaque::<()>(move _58) -> [return: bb8, unwind continue];
}
bb8: {
- StorageDead(_58); // scope 28 at $DIR/reference_prop.rs:+71:18: +71:19
- StorageDead(_57); // scope 28 at $DIR/reference_prop.rs:+71:19: +71:20
-- _52 = const (); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
- StorageDead(_56); // scope 27 at $DIR/reference_prop.rs:+72:5: +72:6
- StorageDead(_53); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6
-- StorageDead(_52); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6
-- StorageLive(_59); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
- StorageLive(_60); // scope 0 at $DIR/reference_prop.rs:+76:13: +76:18
- _60 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+76:21: +76:28
-- StorageLive(_61); // scope 29 at $DIR/reference_prop.rs:+77:13: +77:14
-- _61 = &mut _60; // scope 29 at $DIR/reference_prop.rs:+77:17: +77:23
-- StorageLive(_62); // scope 30 at $DIR/reference_prop.rs:+78:13: +78:14
-- _62 = &_61; // scope 30 at $DIR/reference_prop.rs:+78:17: +78:19
- StorageLive(_63); // scope 31 at $DIR/reference_prop.rs:+79:13: +79:14
-- _63 = (*_61); // scope 31 at $DIR/reference_prop.rs:+79:17: +79:19
-+ _63 = _60; // scope 31 at $DIR/reference_prop.rs:+79:17: +79:19
- StorageLive(_64); // scope 32 at $DIR/reference_prop.rs:+80:9: +80:19
- StorageLive(_65); // scope 32 at $DIR/reference_prop.rs:+80:16: +80:18
- _65 = (); // scope 32 at $DIR/reference_prop.rs:+80:16: +80:18
- _64 = opaque::<()>(move _65) -> bb9; // scope 32 at $DIR/reference_prop.rs:+80:9: +80:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:183:9: 183:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_58);
+ StorageDead(_57);
+- _52 = const ();
+ StorageDead(_56);
+ StorageDead(_53);
+- StorageDead(_52);
+- StorageLive(_59);
+ StorageLive(_60);
+ _60 = const 5_usize;
+ StorageLive(_61);
+ _61 = &mut _60;
+ StorageLive(_62);
+ _62 = &_61;
+ StorageLive(_63);
+ _63 = (*_61);
+ StorageLive(_64);
+ StorageLive(_65);
+ _65 = ();
+ _64 = opaque::<()>(move _65) -> [return: bb9, unwind continue];
}
bb9: {
- StorageDead(_65); // scope 32 at $DIR/reference_prop.rs:+80:18: +80:19
- StorageDead(_64); // scope 32 at $DIR/reference_prop.rs:+80:19: +80:20
-- _59 = const (); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
- StorageDead(_63); // scope 31 at $DIR/reference_prop.rs:+81:5: +81:6
-- StorageDead(_62); // scope 30 at $DIR/reference_prop.rs:+81:5: +81:6
-- StorageDead(_61); // scope 29 at $DIR/reference_prop.rs:+81:5: +81:6
- StorageDead(_60); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6
-- StorageDead(_59); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6
- StorageLive(_66); // scope 0 at $DIR/reference_prop.rs:+85:13: +85:18
- _66 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+85:21: +85:28
-- StorageLive(_67); // scope 33 at $DIR/reference_prop.rs:+86:13: +86:18
-- _67 = &mut _66; // scope 33 at $DIR/reference_prop.rs:+86:21: +86:27
-- StorageLive(_68); // scope 34 at $DIR/reference_prop.rs:+87:13: +87:14
-- _68 = &mut _67; // scope 34 at $DIR/reference_prop.rs:+87:17: +87:23
- StorageLive(_69); // scope 35 at $DIR/reference_prop.rs:+88:13: +88:14
-- _69 = (*_67); // scope 35 at $DIR/reference_prop.rs:+88:17: +88:19
-+ _69 = _66; // scope 35 at $DIR/reference_prop.rs:+88:17: +88:19
- StorageLive(_70); // scope 36 at $DIR/reference_prop.rs:+89:9: +89:19
- StorageLive(_71); // scope 36 at $DIR/reference_prop.rs:+89:16: +89:18
- _71 = (); // scope 36 at $DIR/reference_prop.rs:+89:16: +89:18
- _70 = opaque::<()>(move _71) -> bb10; // scope 36 at $DIR/reference_prop.rs:+89:9: +89:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:192:9: 192:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_65);
+ StorageDead(_64);
+- _59 = const ();
+ StorageDead(_63);
+ StorageDead(_62);
+ StorageDead(_61);
+ StorageDead(_60);
+- StorageDead(_59);
+ StorageLive(_66);
+ _66 = const 5_usize;
+ StorageLive(_67);
+ _67 = &mut _66;
+ StorageLive(_68);
+ _68 = &mut _67;
+ StorageLive(_69);
+ _69 = (*_67);
+ StorageLive(_70);
+ StorageLive(_71);
+ _71 = ();
+ _70 = opaque::<()>(move _71) -> [return: bb10, unwind continue];
}
bb10: {
- StorageDead(_71); // scope 36 at $DIR/reference_prop.rs:+89:18: +89:19
- StorageDead(_70); // scope 36 at $DIR/reference_prop.rs:+89:19: +89:20
- _0 = const (); // scope 0 at $DIR/reference_prop.rs:+84:5: +90:6
- StorageDead(_69); // scope 35 at $DIR/reference_prop.rs:+90:5: +90:6
-- StorageDead(_68); // scope 34 at $DIR/reference_prop.rs:+90:5: +90:6
-- StorageDead(_67); // scope 33 at $DIR/reference_prop.rs:+90:5: +90:6
- StorageDead(_66); // scope 0 at $DIR/reference_prop.rs:+90:5: +90:6
- return; // scope 0 at $DIR/reference_prop.rs:+91:2: +91:2
+ StorageDead(_71);
+ StorageDead(_70);
+ _0 = const ();
+ StorageDead(_69);
+ StorageDead(_68);
+ StorageDead(_67);
+ StorageDead(_66);
+ return;
}
}
diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff
index c93aa52be..b6b2acc0b 100644
--- a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff
@@ -2,142 +2,141 @@
+ // MIR for `reference_propagation_mut_ptr` after ReferencePropagation
fn reference_propagation_mut_ptr(_1: *mut T, _2: *mut T) -> () {
- debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:43: +0:49
- debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:59: +0:71
- let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:81: +0:81
- let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
- let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19
- let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18
- let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
- let mut _13: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:24
- let _15: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19
- let mut _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18
- let _17: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
- let _22: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18
- let mut _23: &*mut usize; // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17
- let _24: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
- let _29: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18
- let mut _30: *mut *mut usize; // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17
- let _31: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
- let _35: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18
- let mut _36: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17
- let _37: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
- let _44: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19
- let mut _45: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18
- let _46: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
- let _49: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19
- let mut _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18
- let _51: (); // in scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
- let mut _53: *mut T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:36
- let _55: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19
- let mut _56: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18
- let _57: (); // in scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
- let _62: (); // in scope 0 at $DIR/reference_prop.rs:+80:9: +80:19
- let mut _63: (); // in scope 0 at $DIR/reference_prop.rs:+80:16: +80:18
- let _68: (); // in scope 0 at $DIR/reference_prop.rs:+89:9: +89:19
- let mut _69: (); // in scope 0 at $DIR/reference_prop.rs:+89:16: +89:18
+ debug single => _1;
+ debug multiple => _2;
+ let mut _0: ();
+ let _3: ();
+ let _7: ();
+ let mut _8: ();
+ let _9: ();
+ let mut _13: *mut usize;
+ let _15: ();
+ let mut _16: ();
+ let _17: ();
+ let _22: ();
+ let mut _23: &*mut usize;
+ let _24: ();
+ let _29: ();
+ let mut _30: *mut *mut usize;
+ let _31: ();
+ let _35: ();
+ let mut _36: *mut usize;
+ let _37: ();
+ let _44: ();
+ let mut _45: *mut usize;
+ let _46: ();
+ let _49: ();
+ let mut _50: ();
+ let _51: ();
+ let mut _53: *mut T;
+ let _55: ();
+ let mut _56: ();
+ let _57: ();
+ let _62: ();
+ let mut _63: ();
+ let _68: ();
+ let mut _69: ();
scope 1 {
- let mut _4: usize; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:18
+ let mut _4: usize;
scope 2 {
- debug a => _4; // in scope 2 at $DIR/reference_prop.rs:+3:13: +3:18
- let _5: *mut usize; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
+ debug a => _4;
+ let _5: *mut usize;
scope 3 {
-- debug b => _5; // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14
-+ debug b => &_4; // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14
- let _6: usize; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
+ debug b => _5;
+ let _6: usize;
scope 4 {
- debug c => _6; // in scope 4 at $DIR/reference_prop.rs:+5:13: +5:14
+ debug c => _6;
}
}
}
}
scope 5 {
- let mut _10: usize; // in scope 5 at $DIR/reference_prop.rs:+11:13: +11:18
+ let mut _10: usize;
scope 6 {
- debug a => _10; // in scope 6 at $DIR/reference_prop.rs:+11:13: +11:18
- let mut _11: usize; // in scope 6 at $DIR/reference_prop.rs:+12:13: +12:19
+ debug a => _10;
+ let mut _11: usize;
scope 7 {
- debug a2 => _11; // in scope 7 at $DIR/reference_prop.rs:+12:13: +12:19
- let mut _12: *mut usize; // in scope 7 at $DIR/reference_prop.rs:+13:13: +13:18
+ debug a2 => _11;
+ let mut _12: *mut usize;
scope 8 {
- debug b => _12; // in scope 8 at $DIR/reference_prop.rs:+13:13: +13:18
- let _14: usize; // in scope 8 at $DIR/reference_prop.rs:+16:13: +16:14
+ debug b => _12;
+ let _14: usize;
scope 9 {
- debug c => _14; // in scope 9 at $DIR/reference_prop.rs:+16:13: +16:14
+ debug c => _14;
}
}
}
}
}
scope 10 {
- let mut _18: usize; // in scope 10 at $DIR/reference_prop.rs:+22:13: +22:18
+ let mut _18: usize;
scope 11 {
- debug a => _18; // in scope 11 at $DIR/reference_prop.rs:+22:13: +22:18
- let _19: *mut usize; // in scope 11 at $DIR/reference_prop.rs:+23:13: +23:14
+ debug a => _18;
+ let _19: *mut usize;
scope 12 {
- debug b => _19; // in scope 12 at $DIR/reference_prop.rs:+23:13: +23:14
- let _20: &*mut usize; // in scope 12 at $DIR/reference_prop.rs:+24:13: +24:14
+ debug b => _19;
+ let _20: &*mut usize;
scope 13 {
- debug d => _20; // in scope 13 at $DIR/reference_prop.rs:+24:13: +24:14
- let _21: usize; // in scope 13 at $DIR/reference_prop.rs:+25:13: +25:14
+ debug d => _20;
+ let _21: usize;
scope 14 {
- debug c => _21; // in scope 14 at $DIR/reference_prop.rs:+25:13: +25:14
+ debug c => _21;
}
}
}
}
}
scope 15 {
- let mut _25: usize; // in scope 15 at $DIR/reference_prop.rs:+31:13: +31:18
+ let mut _25: usize;
scope 16 {
- debug a => _25; // in scope 16 at $DIR/reference_prop.rs:+31:13: +31:18
- let mut _26: *mut usize; // in scope 16 at $DIR/reference_prop.rs:+32:13: +32:18
+ debug a => _25;
+ let mut _26: *mut usize;
scope 17 {
- debug b => _26; // in scope 17 at $DIR/reference_prop.rs:+32:13: +32:18
- let _27: *mut *mut usize; // in scope 17 at $DIR/reference_prop.rs:+33:13: +33:14
+ debug b => _26;
+ let _27: *mut *mut usize;
scope 18 {
- debug d => _27; // in scope 18 at $DIR/reference_prop.rs:+33:13: +33:14
- let _28: usize; // in scope 18 at $DIR/reference_prop.rs:+34:13: +34:14
+ debug d => _27;
+ let _28: usize;
scope 19 {
- debug c => _28; // in scope 19 at $DIR/reference_prop.rs:+34:13: +34:14
+ debug c => _28;
}
}
}
}
}
scope 20 {
- let mut _32: usize; // in scope 20 at $DIR/reference_prop.rs:+40:13: +40:18
+ let mut _32: usize;
scope 21 {
- debug a => _32; // in scope 21 at $DIR/reference_prop.rs:+40:13: +40:18
- let _33: *mut usize; // in scope 21 at $DIR/reference_prop.rs:+41:13: +41:14
+ debug a => _32;
+ let _33: *mut usize;
scope 22 {
- debug b => _33; // in scope 22 at $DIR/reference_prop.rs:+41:13: +41:14
- let _34: usize; // in scope 22 at $DIR/reference_prop.rs:+42:13: +42:14
+ debug b => _33;
+ let _34: usize;
scope 23 {
- debug c => _34; // in scope 23 at $DIR/reference_prop.rs:+42:13: +42:14
+ debug c => _34;
}
}
}
}
scope 24 {
- let mut _38: usize; // in scope 24 at $DIR/reference_prop.rs:+48:13: +48:18
+ let mut _38: usize;
scope 25 {
- debug a => _38; // in scope 25 at $DIR/reference_prop.rs:+48:13: +48:18
- let _39: *mut usize; // in scope 25 at $DIR/reference_prop.rs:+49:13: +49:15
+ debug a => _38;
+ let _39: *mut usize;
scope 26 {
- debug b1 => _39; // in scope 26 at $DIR/reference_prop.rs:+49:13: +49:15
- let _40: usize; // in scope 26 at $DIR/reference_prop.rs:+50:13: +50:14
+ debug b1 => _39;
+ let _40: usize;
scope 27 {
- debug c => _40; // in scope 27 at $DIR/reference_prop.rs:+50:13: +50:14
- let _41: *mut usize; // in scope 27 at $DIR/reference_prop.rs:+51:13: +51:15
+ debug c => _40;
+ let _41: *mut usize;
scope 28 {
- debug b2 => _41; // in scope 28 at $DIR/reference_prop.rs:+51:13: +51:15
- let _42: usize; // in scope 28 at $DIR/reference_prop.rs:+52:13: +52:15
+ debug b2 => _41;
+ let _42: usize;
scope 29 {
- debug c2 => _42; // in scope 29 at $DIR/reference_prop.rs:+52:13: +52:15
- let _43: *mut usize; // in scope 29 at $DIR/reference_prop.rs:+53:13: +53:15
+ debug c2 => _42;
+ let _43: *mut usize;
scope 30 {
- debug b3 => _43; // in scope 30 at $DIR/reference_prop.rs:+53:13: +53:15
+ debug b3 => _43;
}
}
}
@@ -146,61 +145,57 @@
}
}
scope 31 {
- let _47: *mut T; // in scope 31 at $DIR/reference_prop.rs:+61:13: +61:14
+ let _47: *mut T;
scope 32 {
-- debug a => _47; // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14
-+ debug a => _1; // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14
- let _48: T; // in scope 32 at $DIR/reference_prop.rs:+62:13: +62:14
+- debug a => _47;
++ debug a => _1;
+ let _48: T;
scope 33 {
- debug b => _48; // in scope 33 at $DIR/reference_prop.rs:+62:13: +62:14
+ debug b => _48;
}
}
}
scope 34 {
- let _52: *mut T; // in scope 34 at $DIR/reference_prop.rs:+68:13: +68:14
+ let _52: *mut T;
scope 35 {
- debug a => _52; // in scope 35 at $DIR/reference_prop.rs:+68:13: +68:14
- let _54: T; // in scope 35 at $DIR/reference_prop.rs:+70:13: +70:14
+ debug a => _52;
+ let _54: T;
scope 36 {
- debug b => _54; // in scope 36 at $DIR/reference_prop.rs:+70:13: +70:14
+ debug b => _54;
}
}
}
scope 37 {
- let mut _58: usize; // in scope 37 at $DIR/reference_prop.rs:+76:13: +76:18
+ let mut _58: usize;
scope 38 {
- debug a => _58; // in scope 38 at $DIR/reference_prop.rs:+76:13: +76:18
- let _59: *mut usize; // in scope 38 at $DIR/reference_prop.rs:+77:13: +77:14
+ debug a => _58;
+ let _59: *mut usize;
scope 39 {
-- debug b => _59; // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14
-+ debug b => &_58; // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14
- let _60: &*mut usize; // in scope 39 at $DIR/reference_prop.rs:+78:13: +78:14
+ debug b => _59;
+ let _60: &*mut usize;
scope 40 {
-- debug d => _60; // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14
-+ debug d => &&_58; // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14
- let _61: usize; // in scope 40 at $DIR/reference_prop.rs:+79:13: +79:14
+ debug d => _60;
+ let _61: usize;
scope 41 {
- debug c => _61; // in scope 41 at $DIR/reference_prop.rs:+79:13: +79:14
+ debug c => _61;
}
}
}
}
}
scope 42 {
- let mut _64: usize; // in scope 42 at $DIR/reference_prop.rs:+85:13: +85:18
+ let mut _64: usize;
scope 43 {
- debug a => _64; // in scope 43 at $DIR/reference_prop.rs:+85:13: +85:18
- let mut _65: *mut usize; // in scope 43 at $DIR/reference_prop.rs:+86:13: +86:18
+ debug a => _64;
+ let mut _65: *mut usize;
scope 44 {
-- debug b => _65; // in scope 44 at $DIR/reference_prop.rs:+86:13: +86:18
-+ debug b => &_64; // in scope 44 at $DIR/reference_prop.rs:+86:13: +86:18
- let _66: &mut *mut usize; // in scope 44 at $DIR/reference_prop.rs:+87:13: +87:14
+ debug b => _65;
+ let _66: &mut *mut usize;
scope 45 {
-- debug d => _66; // in scope 45 at $DIR/reference_prop.rs:+87:13: +87:14
-+ debug d => &&_64; // in scope 45 at $DIR/reference_prop.rs:+87:13: +87:14
- let _67: usize; // in scope 45 at $DIR/reference_prop.rs:+88:13: +88:14
+ debug d => _66;
+ let _67: usize;
scope 46 {
- debug c => _67; // in scope 46 at $DIR/reference_prop.rs:+88:13: +88:14
+ debug c => _67;
}
}
}
@@ -208,275 +203,243 @@
}
bb0: {
-- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
- StorageLive(_4); // scope 1 at $DIR/reference_prop.rs:+3:13: +3:18
- _4 = const 5_usize; // scope 1 at $DIR/reference_prop.rs:+3:21: +3:28
-- StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
-- _5 = &raw mut _4; // scope 2 at $DIR/reference_prop.rs:+4:17: +4:27
- StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
-- _6 = (*_5); // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19
-+ _6 = _4; // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19
- StorageLive(_7); // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19
- StorageLive(_8); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18
- _8 = (); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18
- _7 = opaque::<()>(move _8) -> bb1; // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:304:9: 304:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+- StorageLive(_3);
+ StorageLive(_4);
+ _4 = const 5_usize;
+ StorageLive(_5);
+ _5 = &raw mut _4;
+ StorageLive(_6);
+- _6 = (*_5);
++ _6 = _4;
+ StorageLive(_7);
+ StorageLive(_8);
+ _8 = ();
+ _7 = opaque::<()>(move _8) -> [return: bb1, unwind continue];
}
bb1: {
- StorageDead(_8); // scope 4 at $DIR/reference_prop.rs:+6:18: +6:19
- StorageDead(_7); // scope 4 at $DIR/reference_prop.rs:+6:19: +6:20
-- _3 = const (); // scope 1 at $DIR/reference_prop.rs:+2:5: +7:6
- StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+7:5: +7:6
-- StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
- StorageDead(_4); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6
-- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
-- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
- StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+11:13: +11:18
- _10 = const 5_usize; // scope 5 at $DIR/reference_prop.rs:+11:21: +11:28
- StorageLive(_11); // scope 6 at $DIR/reference_prop.rs:+12:13: +12:19
- _11 = const 7_usize; // scope 6 at $DIR/reference_prop.rs:+12:22: +12:29
- StorageLive(_12); // scope 7 at $DIR/reference_prop.rs:+13:13: +13:18
- _12 = &raw mut _10; // scope 7 at $DIR/reference_prop.rs:+13:21: +13:31
- StorageLive(_13); // scope 8 at $DIR/reference_prop.rs:+14:13: +14:24
- _13 = &raw mut _11; // scope 8 at $DIR/reference_prop.rs:+14:13: +14:24
- _12 = move _13; // scope 8 at $DIR/reference_prop.rs:+14:9: +14:24
- StorageDead(_13); // scope 8 at $DIR/reference_prop.rs:+14:23: +14:24
- StorageLive(_14); // scope 8 at $DIR/reference_prop.rs:+16:13: +16:14
- _14 = (*_12); // scope 8 at $DIR/reference_prop.rs:+16:17: +16:19
- StorageLive(_15); // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19
- StorageLive(_16); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18
- _16 = (); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18
- _15 = opaque::<()>(move _16) -> bb2; // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:315:9: 315:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_8);
+ StorageDead(_7);
+- _3 = const ();
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+- StorageDead(_3);
+- StorageLive(_9);
+ StorageLive(_10);
+ _10 = const 5_usize;
+ StorageLive(_11);
+ _11 = const 7_usize;
+ StorageLive(_12);
+ _12 = &raw mut _10;
+ StorageLive(_13);
+ _13 = &raw mut _11;
+ _12 = move _13;
+ StorageDead(_13);
+ StorageLive(_14);
+ _14 = (*_12);
+ StorageLive(_15);
+ StorageLive(_16);
+ _16 = ();
+ _15 = opaque::<()>(move _16) -> [return: bb2, unwind continue];
}
bb2: {
- StorageDead(_16); // scope 9 at $DIR/reference_prop.rs:+17:18: +17:19
- StorageDead(_15); // scope 9 at $DIR/reference_prop.rs:+17:19: +17:20
-- _9 = const (); // scope 5 at $DIR/reference_prop.rs:+10:5: +18:6
- StorageDead(_14); // scope 8 at $DIR/reference_prop.rs:+18:5: +18:6
- StorageDead(_12); // scope 7 at $DIR/reference_prop.rs:+18:5: +18:6
- StorageDead(_11); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6
- StorageDead(_10); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6
-- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6
-- StorageLive(_17); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
- StorageLive(_18); // scope 10 at $DIR/reference_prop.rs:+22:13: +22:18
- _18 = const 5_usize; // scope 10 at $DIR/reference_prop.rs:+22:21: +22:28
- StorageLive(_19); // scope 11 at $DIR/reference_prop.rs:+23:13: +23:14
- _19 = &raw mut _18; // scope 11 at $DIR/reference_prop.rs:+23:17: +23:27
- StorageLive(_20); // scope 12 at $DIR/reference_prop.rs:+24:13: +24:14
- _20 = &_19; // scope 12 at $DIR/reference_prop.rs:+24:17: +24:19
- StorageLive(_21); // scope 13 at $DIR/reference_prop.rs:+25:13: +25:14
- _21 = (*_19); // scope 13 at $DIR/reference_prop.rs:+25:17: +25:19
- StorageLive(_22); // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18
- StorageLive(_23); // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17
- _23 = _20; // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17
- _22 = opaque::<&*mut usize>(move _23) -> bb3; // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18
- // mir::Constant
- // + span: $DIR/reference_prop.rs:324:9: 324:15
- // + literal: Const { ty: fn(&*mut usize) {opaque::<&*mut usize>}, val: Value(<ZST>) }
+ StorageDead(_16);
+ StorageDead(_15);
+- _9 = const ();
+ StorageDead(_14);
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+- StorageDead(_9);
+- StorageLive(_17);
+ StorageLive(_18);
+ _18 = const 5_usize;
+ StorageLive(_19);
+ _19 = &raw mut _18;
+ StorageLive(_20);
+ _20 = &_19;
+ StorageLive(_21);
+ _21 = (*_19);
+ StorageLive(_22);
+ StorageLive(_23);
+ _23 = _20;
+ _22 = opaque::<&*mut usize>(move _23) -> [return: bb3, unwind continue];
}
bb3: {
- StorageDead(_23); // scope 14 at $DIR/reference_prop.rs:+26:17: +26:18
- StorageDead(_22); // scope 14 at $DIR/reference_prop.rs:+26:18: +26:19
-- _17 = const (); // scope 10 at $DIR/reference_prop.rs:+21:5: +27:6
- StorageDead(_21); // scope 13 at $DIR/reference_prop.rs:+27:5: +27:6
- StorageDead(_20); // scope 12 at $DIR/reference_prop.rs:+27:5: +27:6
- StorageDead(_19); // scope 11 at $DIR/reference_prop.rs:+27:5: +27:6
- StorageDead(_18); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6
-- StorageDead(_17); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6
-- StorageLive(_24); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
- StorageLive(_25); // scope 15 at $DIR/reference_prop.rs:+31:13: +31:18
- _25 = const 5_usize; // scope 15 at $DIR/reference_prop.rs:+31:21: +31:28
- StorageLive(_26); // scope 16 at $DIR/reference_prop.rs:+32:13: +32:18
- _26 = &raw mut _25; // scope 16 at $DIR/reference_prop.rs:+32:21: +32:31
- StorageLive(_27); // scope 17 at $DIR/reference_prop.rs:+33:13: +33:14
- _27 = &raw mut _26; // scope 17 at $DIR/reference_prop.rs:+33:17: +33:27
- StorageLive(_28); // scope 18 at $DIR/reference_prop.rs:+34:13: +34:14
- _28 = (*_26); // scope 18 at $DIR/reference_prop.rs:+34:17: +34:19
- StorageLive(_29); // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18
- StorageLive(_30); // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17
- _30 = _27; // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17
- _29 = opaque::<*mut *mut usize>(move _30) -> bb4; // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18
- // mir::Constant
- // + span: $DIR/reference_prop.rs:333:9: 333:15
- // + literal: Const { ty: fn(*mut *mut usize) {opaque::<*mut *mut usize>}, val: Value(<ZST>) }
+ StorageDead(_23);
+ StorageDead(_22);
+- _17 = const ();
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_19);
+ StorageDead(_18);
+- StorageDead(_17);
+- StorageLive(_24);
+ StorageLive(_25);
+ _25 = const 5_usize;
+ StorageLive(_26);
+ _26 = &raw mut _25;
+ StorageLive(_27);
+ _27 = &raw mut _26;
+ StorageLive(_28);
+ _28 = (*_26);
+ StorageLive(_29);
+ StorageLive(_30);
+ _30 = _27;
+ _29 = opaque::<*mut *mut usize>(move _30) -> [return: bb4, unwind continue];
}
bb4: {
- StorageDead(_30); // scope 19 at $DIR/reference_prop.rs:+35:17: +35:18
- StorageDead(_29); // scope 19 at $DIR/reference_prop.rs:+35:18: +35:19
-- _24 = const (); // scope 15 at $DIR/reference_prop.rs:+30:5: +36:6
- StorageDead(_28); // scope 18 at $DIR/reference_prop.rs:+36:5: +36:6
- StorageDead(_27); // scope 17 at $DIR/reference_prop.rs:+36:5: +36:6
- StorageDead(_26); // scope 16 at $DIR/reference_prop.rs:+36:5: +36:6
- StorageDead(_25); // scope 15 at $DIR/reference_prop.rs:+36:5: +36:6
-- StorageDead(_24); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6
-- StorageLive(_31); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
- StorageLive(_32); // scope 20 at $DIR/reference_prop.rs:+40:13: +40:18
- _32 = const 7_usize; // scope 20 at $DIR/reference_prop.rs:+40:21: +40:28
- StorageLive(_33); // scope 21 at $DIR/reference_prop.rs:+41:13: +41:14
- _33 = &raw mut _32; // scope 21 at $DIR/reference_prop.rs:+41:17: +41:27
- StorageLive(_34); // scope 22 at $DIR/reference_prop.rs:+42:13: +42:14
- _34 = (*_33); // scope 22 at $DIR/reference_prop.rs:+42:17: +42:19
- StorageLive(_35); // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18
- StorageLive(_36); // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17
- _36 = _33; // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17
- _35 = opaque::<*mut usize>(move _36) -> bb5; // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18
- // mir::Constant
- // + span: $DIR/reference_prop.rs:341:9: 341:15
- // + literal: Const { ty: fn(*mut usize) {opaque::<*mut usize>}, val: Value(<ZST>) }
+ StorageDead(_30);
+ StorageDead(_29);
+- _24 = const ();
+ StorageDead(_28);
+ StorageDead(_27);
+ StorageDead(_26);
+ StorageDead(_25);
+- StorageDead(_24);
+- StorageLive(_31);
+ StorageLive(_32);
+ _32 = const 7_usize;
+ StorageLive(_33);
+ _33 = &raw mut _32;
+ StorageLive(_34);
+ _34 = (*_33);
+ StorageLive(_35);
+ StorageLive(_36);
+ _36 = _33;
+ _35 = opaque::<*mut usize>(move _36) -> [return: bb5, unwind continue];
}
bb5: {
- StorageDead(_36); // scope 23 at $DIR/reference_prop.rs:+43:17: +43:18
- StorageDead(_35); // scope 23 at $DIR/reference_prop.rs:+43:18: +43:19
-- _31 = const (); // scope 20 at $DIR/reference_prop.rs:+39:5: +44:6
- StorageDead(_34); // scope 22 at $DIR/reference_prop.rs:+44:5: +44:6
- StorageDead(_33); // scope 21 at $DIR/reference_prop.rs:+44:5: +44:6
- StorageDead(_32); // scope 20 at $DIR/reference_prop.rs:+44:5: +44:6
-- StorageDead(_31); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6
-- StorageLive(_37); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
- StorageLive(_38); // scope 24 at $DIR/reference_prop.rs:+48:13: +48:18
- _38 = const 7_usize; // scope 24 at $DIR/reference_prop.rs:+48:21: +48:28
- StorageLive(_39); // scope 25 at $DIR/reference_prop.rs:+49:13: +49:15
- _39 = &raw mut _38; // scope 25 at $DIR/reference_prop.rs:+49:18: +49:28
- StorageLive(_40); // scope 26 at $DIR/reference_prop.rs:+50:13: +50:14
- _40 = (*_39); // scope 26 at $DIR/reference_prop.rs:+50:17: +50:20
- StorageLive(_41); // scope 27 at $DIR/reference_prop.rs:+51:13: +51:15
- _41 = _39; // scope 27 at $DIR/reference_prop.rs:+51:18: +51:20
- StorageLive(_42); // scope 28 at $DIR/reference_prop.rs:+52:13: +52:15
- _42 = (*_41); // scope 28 at $DIR/reference_prop.rs:+52:18: +52:21
- StorageLive(_43); // scope 29 at $DIR/reference_prop.rs:+53:13: +53:15
- _43 = _41; // scope 29 at $DIR/reference_prop.rs:+53:18: +53:20
- StorageLive(_44); // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19
- StorageLive(_45); // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18
- _45 = _43; // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18
- _44 = opaque::<*mut usize>(move _45) -> bb6; // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:354:9: 354:15
- // + literal: Const { ty: fn(*mut usize) {opaque::<*mut usize>}, val: Value(<ZST>) }
+ StorageDead(_36);
+ StorageDead(_35);
+- _31 = const ();
+ StorageDead(_34);
+ StorageDead(_33);
+ StorageDead(_32);
+- StorageDead(_31);
+- StorageLive(_37);
+ StorageLive(_38);
+ _38 = const 7_usize;
+ StorageLive(_39);
+ _39 = &raw mut _38;
+ StorageLive(_40);
+ _40 = (*_39);
+ StorageLive(_41);
+ _41 = _39;
+ StorageLive(_42);
+ _42 = (*_41);
+ StorageLive(_43);
+ _43 = _41;
+ StorageLive(_44);
+ StorageLive(_45);
+ _45 = _43;
+ _44 = opaque::<*mut usize>(move _45) -> [return: bb6, unwind continue];
}
bb6: {
- StorageDead(_45); // scope 30 at $DIR/reference_prop.rs:+56:18: +56:19
- StorageDead(_44); // scope 30 at $DIR/reference_prop.rs:+56:19: +56:20
-- _37 = const (); // scope 24 at $DIR/reference_prop.rs:+47:5: +57:6
- StorageDead(_43); // scope 29 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_42); // scope 28 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_41); // scope 27 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_40); // scope 26 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_39); // scope 25 at $DIR/reference_prop.rs:+57:5: +57:6
- StorageDead(_38); // scope 24 at $DIR/reference_prop.rs:+57:5: +57:6
-- StorageDead(_37); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
-- StorageLive(_46); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
-- StorageLive(_47); // scope 31 at $DIR/reference_prop.rs:+61:13: +61:14
-- _47 = &raw mut (*_1); // scope 31 at $DIR/reference_prop.rs:+61:17: +61:33
- StorageLive(_48); // scope 32 at $DIR/reference_prop.rs:+62:13: +62:14
-- _48 = (*_47); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19
-+ _48 = (*_1); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19
- StorageLive(_49); // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19
- StorageLive(_50); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18
- _50 = (); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18
- _49 = opaque::<()>(move _50) -> bb7; // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:361:9: 361:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_45);
+ StorageDead(_44);
+- _37 = const ();
+ StorageDead(_43);
+ StorageDead(_42);
+ StorageDead(_41);
+ StorageDead(_40);
+ StorageDead(_39);
+ StorageDead(_38);
+- StorageDead(_37);
+- StorageLive(_46);
+- StorageLive(_47);
+- _47 = &raw mut (*_1);
+ StorageLive(_48);
+- _48 = (*_47);
++ _48 = (*_1);
+ StorageLive(_49);
+ StorageLive(_50);
+ _50 = ();
+ _49 = opaque::<()>(move _50) -> [return: bb7, unwind continue];
}
bb7: {
- StorageDead(_50); // scope 33 at $DIR/reference_prop.rs:+63:18: +63:19
- StorageDead(_49); // scope 33 at $DIR/reference_prop.rs:+63:19: +63:20
-- _46 = const (); // scope 31 at $DIR/reference_prop.rs:+60:5: +64:6
- StorageDead(_48); // scope 32 at $DIR/reference_prop.rs:+64:5: +64:6
-- StorageDead(_47); // scope 31 at $DIR/reference_prop.rs:+64:5: +64:6
-- StorageDead(_46); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
-- StorageLive(_51); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
- StorageLive(_52); // scope 34 at $DIR/reference_prop.rs:+68:13: +68:14
- _52 = &raw mut (*_2); // scope 34 at $DIR/reference_prop.rs:+68:17: +68:35
- StorageLive(_53); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:36
- _53 = &raw mut (*_1); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:36
- _2 = move _53; // scope 35 at $DIR/reference_prop.rs:+69:9: +69:36
- StorageDead(_53); // scope 35 at $DIR/reference_prop.rs:+69:35: +69:36
- StorageLive(_54); // scope 35 at $DIR/reference_prop.rs:+70:13: +70:14
- _54 = (*_52); // scope 35 at $DIR/reference_prop.rs:+70:17: +70:19
- StorageLive(_55); // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19
- StorageLive(_56); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18
- _56 = (); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18
- _55 = opaque::<()>(move _56) -> bb8; // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:369:9: 369:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_50);
+ StorageDead(_49);
+- _46 = const ();
+ StorageDead(_48);
+- StorageDead(_47);
+- StorageDead(_46);
+- StorageLive(_51);
+ StorageLive(_52);
+ _52 = &raw mut (*_2);
+ StorageLive(_53);
+ _53 = &raw mut (*_1);
+ _2 = move _53;
+ StorageDead(_53);
+ StorageLive(_54);
+ _54 = (*_52);
+ StorageLive(_55);
+ StorageLive(_56);
+ _56 = ();
+ _55 = opaque::<()>(move _56) -> [return: bb8, unwind continue];
}
bb8: {
- StorageDead(_56); // scope 36 at $DIR/reference_prop.rs:+71:18: +71:19
- StorageDead(_55); // scope 36 at $DIR/reference_prop.rs:+71:19: +71:20
-- _51 = const (); // scope 34 at $DIR/reference_prop.rs:+67:5: +72:6
- StorageDead(_54); // scope 35 at $DIR/reference_prop.rs:+72:5: +72:6
- StorageDead(_52); // scope 34 at $DIR/reference_prop.rs:+72:5: +72:6
-- StorageDead(_51); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6
-- StorageLive(_57); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
- StorageLive(_58); // scope 37 at $DIR/reference_prop.rs:+76:13: +76:18
- _58 = const 5_usize; // scope 37 at $DIR/reference_prop.rs:+76:21: +76:28
-- StorageLive(_59); // scope 38 at $DIR/reference_prop.rs:+77:13: +77:14
-- _59 = &raw mut _58; // scope 38 at $DIR/reference_prop.rs:+77:17: +77:27
-- StorageLive(_60); // scope 39 at $DIR/reference_prop.rs:+78:13: +78:14
-- _60 = &_59; // scope 39 at $DIR/reference_prop.rs:+78:17: +78:19
- StorageLive(_61); // scope 40 at $DIR/reference_prop.rs:+79:13: +79:14
-- _61 = (*_59); // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19
-+ _61 = _58; // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19
- StorageLive(_62); // scope 41 at $DIR/reference_prop.rs:+80:9: +80:19
- StorageLive(_63); // scope 41 at $DIR/reference_prop.rs:+80:16: +80:18
- _63 = (); // scope 41 at $DIR/reference_prop.rs:+80:16: +80:18
- _62 = opaque::<()>(move _63) -> bb9; // scope 41 at $DIR/reference_prop.rs:+80:9: +80:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:378:9: 378:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_56);
+ StorageDead(_55);
+- _51 = const ();
+ StorageDead(_54);
+ StorageDead(_52);
+- StorageDead(_51);
+- StorageLive(_57);
+ StorageLive(_58);
+ _58 = const 5_usize;
+ StorageLive(_59);
+ _59 = &raw mut _58;
+ StorageLive(_60);
+ _60 = &_59;
+ StorageLive(_61);
+ _61 = (*_59);
+ StorageLive(_62);
+ StorageLive(_63);
+ _63 = ();
+ _62 = opaque::<()>(move _63) -> [return: bb9, unwind continue];
}
bb9: {
- StorageDead(_63); // scope 41 at $DIR/reference_prop.rs:+80:18: +80:19
- StorageDead(_62); // scope 41 at $DIR/reference_prop.rs:+80:19: +80:20
-- _57 = const (); // scope 37 at $DIR/reference_prop.rs:+75:5: +81:6
- StorageDead(_61); // scope 40 at $DIR/reference_prop.rs:+81:5: +81:6
-- StorageDead(_60); // scope 39 at $DIR/reference_prop.rs:+81:5: +81:6
-- StorageDead(_59); // scope 38 at $DIR/reference_prop.rs:+81:5: +81:6
- StorageDead(_58); // scope 37 at $DIR/reference_prop.rs:+81:5: +81:6
-- StorageDead(_57); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6
- StorageLive(_64); // scope 42 at $DIR/reference_prop.rs:+85:13: +85:18
- _64 = const 5_usize; // scope 42 at $DIR/reference_prop.rs:+85:21: +85:28
-- StorageLive(_65); // scope 43 at $DIR/reference_prop.rs:+86:13: +86:18
-- _65 = &raw mut _64; // scope 43 at $DIR/reference_prop.rs:+86:21: +86:31
-- StorageLive(_66); // scope 44 at $DIR/reference_prop.rs:+87:13: +87:14
-- _66 = &mut _65; // scope 44 at $DIR/reference_prop.rs:+87:17: +87:23
- StorageLive(_67); // scope 45 at $DIR/reference_prop.rs:+88:13: +88:14
-- _67 = (*_65); // scope 45 at $DIR/reference_prop.rs:+88:17: +88:19
-+ _67 = _64; // scope 45 at $DIR/reference_prop.rs:+88:17: +88:19
- StorageLive(_68); // scope 46 at $DIR/reference_prop.rs:+89:9: +89:19
- StorageLive(_69); // scope 46 at $DIR/reference_prop.rs:+89:16: +89:18
- _69 = (); // scope 46 at $DIR/reference_prop.rs:+89:16: +89:18
- _68 = opaque::<()>(move _69) -> bb10; // scope 46 at $DIR/reference_prop.rs:+89:9: +89:19
- // mir::Constant
- // + span: $DIR/reference_prop.rs:387:9: 387:15
- // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ StorageDead(_63);
+ StorageDead(_62);
+- _57 = const ();
+ StorageDead(_61);
+ StorageDead(_60);
+ StorageDead(_59);
+ StorageDead(_58);
+- StorageDead(_57);
+ StorageLive(_64);
+ _64 = const 5_usize;
+ StorageLive(_65);
+ _65 = &raw mut _64;
+ StorageLive(_66);
+ _66 = &mut _65;
+ StorageLive(_67);
+ _67 = (*_65);
+ StorageLive(_68);
+ StorageLive(_69);
+ _69 = ();
+ _68 = opaque::<()>(move _69) -> [return: bb10, unwind continue];
}
bb10: {
- StorageDead(_69); // scope 46 at $DIR/reference_prop.rs:+89:18: +89:19
- StorageDead(_68); // scope 46 at $DIR/reference_prop.rs:+89:19: +89:20
- _0 = const (); // scope 42 at $DIR/reference_prop.rs:+84:5: +90:6
- StorageDead(_67); // scope 45 at $DIR/reference_prop.rs:+90:5: +90:6
-- StorageDead(_66); // scope 44 at $DIR/reference_prop.rs:+90:5: +90:6
-- StorageDead(_65); // scope 43 at $DIR/reference_prop.rs:+90:5: +90:6
- StorageDead(_64); // scope 42 at $DIR/reference_prop.rs:+90:5: +90:6
- return; // scope 0 at $DIR/reference_prop.rs:+91:2: +91:2
+ StorageDead(_69);
+ StorageDead(_68);
+ _0 = const ();
+ StorageDead(_67);
+ StorageDead(_66);
+ StorageDead(_65);
+ StorageDead(_64);
+ return;
}
}
diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs
index 4083b4547..1b9c8fe15 100644
--- a/tests/mir-opt/reference_prop.rs
+++ b/tests/mir-opt/reference_prop.rs
@@ -8,16 +8,31 @@
fn opaque(_: impl Sized) {}
fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
+ // CHECK-LABEL: fn reference_propagation(
+
// Propagation through a reference.
{
+ // CHECK: bb0: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &[[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+
let a = 5_usize;
let b = &a; // This borrow is only used once.
let c = *b; // This should be optimized.
opaque(()); // We use opaque to separate cases into basic blocks in the MIR.
}
- // Propagation through a two references.
+ // Propagation through two references.
{
+ // CHECK: bb1: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[a2:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &[[a]];
+ // CHECK: [[btmp:_.*]] = &[[a2]];
+ // CHECK: [[b]] = move [[btmp]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let a2 = 7_usize;
let mut b = &a;
@@ -29,6 +44,12 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
// Propagation through a borrowed reference.
{
+ // CHECK: bb2: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &[[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let b = &a;
let d = &b;
@@ -36,8 +57,14 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
opaque(d); // prevent `d` from being removed.
}
- // Propagation through a borrowed reference.
+ // Propagation through a mutably borrowed reference.
{
+ // CHECK: bb3: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &[[a]];
+ // CHECK: [[d:_.*]] = &raw mut [[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let mut b = &a;
let d = &raw mut b;
@@ -47,6 +74,11 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
// Propagation through an escaping borrow.
{
+ // CHECK: bb4: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &[[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+
let a = 7_usize;
let b = &a;
let c = *b;
@@ -55,6 +87,14 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
// Propagation through a transitively escaping borrow.
{
+ // CHECK: bb5: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b1:_.*]] = &[[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+ // CHECK: [[b2:_.*]] = [[b1]];
+ // CHECK: [[c2:_.*]] = [[a]];
+ // CHECK: [[b3:_.*]] = [[b2]];
+
let a = 7_usize;
let b1 = &a;
let c = *b1;
@@ -68,6 +108,10 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
// Propagation a reborrow of an argument.
{
+ // CHECK: bb6: {
+ // CHECK-NOT: {{_.*}} = &(*_1);
+ // CHECK: [[b:_.*]] = (*_1);
+
let a = &*single;
let b = *a; // This should be optimized as `*single`.
opaque(());
@@ -75,6 +119,12 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
// Propagation a reborrow of a mutated argument.
{
+ // CHECK: bb7: {
+ // CHECK: [[a:_.*]] = &(*_2);
+ // CHECK: [[tmp:_.*]] = &(*_1);
+ // CHECK: _2 = move [[tmp]];
+ // CHECK: [[b:_.*]] = (*[[a]]);
+
let a = &*multiple;
multiple = &*single;
let b = *a; // This should not be optimized.
@@ -83,6 +133,13 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
// Fixed-point propagation through a borrowed reference.
{
+ // CHECK: bb8: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &[[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let b = &a;
let d = &b; // first round promotes debuginfo for `d`
@@ -90,8 +147,15 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
opaque(());
}
- // Fixed-point propagation through a borrowed reference.
+ // Fixed-point propagation through a mutably borrowed reference.
{
+ // CHECK: bb9: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &[[a]];
+ // CHECK: [[d:_.*]] = &mut [[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let mut b = &a;
let d = &mut b; // first round promotes debuginfo for `d`
@@ -101,16 +165,31 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
}
fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a mut T) {
+ // CHECK-LABEL: fn reference_propagation_mut(
+
// Propagation through a reference.
{
+ // CHECK: bb0: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &mut [[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+
let mut a = 5_usize;
let b = &mut a; // This borrow is only used once.
let c = *b; // This should be optimized.
opaque(());
}
- // Propagation through a two references.
+ // Propagation through two references.
{
+ // CHECK: bb1: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[a2:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &mut [[a]];
+ // CHECK: [[btmp:_.*]] = &mut [[a2]];
+ // CHECK: [[b]] = move [[btmp]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let mut a2 = 7_usize;
let mut b = &mut a;
@@ -122,6 +201,12 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
// Propagation through a borrowed reference.
{
+ // CHECK: bb2: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &mut [[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let b = &mut a;
let d = &b;
@@ -129,8 +214,14 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
opaque(d); // prevent `d` from being removed.
}
- // Propagation through a borrowed reference.
+ // Propagation through a mutably borrowed reference.
{
+ // CHECK: bb3: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &mut [[a]];
+ // CHECK: [[d:_.*]] = &raw mut [[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let mut b = &mut a;
let d = &raw mut b;
@@ -140,6 +231,11 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
// Propagation through an escaping borrow.
{
+ // CHECK: bb4: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &mut [[a]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 7_usize;
let b = &mut a;
let c = *b;
@@ -148,6 +244,14 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
// Propagation through a transitively escaping borrow.
{
+ // CHECK: bb5: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b1:_.*]] = &mut [[a]];
+ // CHECK: [[c:_.*]] = (*[[b1]]);
+ // CHECK: [[b2:_.*]] = move [[b1]];
+ // CHECK: [[c2:_.*]] = (*[[b2]]);
+ // CHECK: [[b3:_.*]] = move [[b2]];
+
let mut a = 7_usize;
let b1 = &mut a;
let c = *b1;
@@ -161,6 +265,10 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
// Propagation a reborrow of an argument.
{
+ // CHECK: bb6: {
+ // CHECK-NOT: {{_.*}} = &(*_1);
+ // CHECK: [[b:_.*]] = (*_1);
+
let a = &mut *single;
let b = *a; // This should be optimized as `*single`.
opaque(());
@@ -168,6 +276,12 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
// Propagation a reborrow of a mutated argument.
{
+ // CHECK: bb7: {
+ // CHECK: [[a:_.*]] = &mut (*_2);
+ // CHECK: [[tmp:_.*]] = &mut (*_1);
+ // CHECK: _2 = move [[tmp]];
+ // CHECK: [[b:_.*]] = (*[[a]]);
+
let a = &mut *multiple;
multiple = &mut *single;
let b = *a; // This should not be optimized.
@@ -176,6 +290,13 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
// Fixed-point propagation through a borrowed reference.
{
+ // CHECK: bb8: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &mut [[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let b = &mut a;
let d = &b; // first round promotes debuginfo for `d`
@@ -183,8 +304,15 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
opaque(());
}
- // Fixed-point propagation through a borrowed reference.
+ // Fixed-point propagation through a mutably borrowed reference.
{
+ // CHECK: bb9: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &mut [[a]];
+ // CHECK: [[d:_.*]] = &mut [[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let mut b = &mut a;
let d = &mut b; // first round promotes debuginfo for `d`
@@ -194,16 +322,31 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
}
fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *const T) {
+ // CHECK-LABEL: fn reference_propagation_const_ptr(
+
// Propagation through a reference.
unsafe {
+ // CHECK: bb0: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+
let a = 5_usize;
let b = &raw const a; // This borrow is only used once.
let c = *b; // This should be optimized.
opaque(());
}
- // Propagation through a two references.
+ // Propagation through two references.
unsafe {
+ // CHECK: bb1: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[a2:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[btmp:_.*]] = &raw const [[a2]];
+ // CHECK: [[b]] = move [[btmp]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let a2 = 7_usize;
let mut b = &raw const a;
@@ -215,6 +358,12 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Propagation through a borrowed reference.
unsafe {
+ // CHECK: bb2: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let b = &raw const a;
let d = &b;
@@ -222,8 +371,14 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
opaque(d); // prevent `d` from being removed.
}
- // Propagation through a borrowed reference.
+ // Propagation through a mutably borrowed reference.
unsafe {
+ // CHECK: bb3: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[d:_.*]] = &raw mut [[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let mut b = &raw const a;
let d = &raw mut b;
@@ -233,6 +388,11 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Propagation through an escaping borrow.
unsafe {
+ // CHECK: bb4: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+
let a = 7_usize;
let b = &raw const a;
let c = *b;
@@ -241,6 +401,14 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Propagation through a transitively escaping borrow.
unsafe {
+ // CHECK: bb5: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b1:_.*]] = &raw const [[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+ // CHECK: [[b2:_.*]] = [[b1]];
+ // CHECK: [[c2:_.*]] = [[a]];
+ // CHECK: [[b3:_.*]] = [[b2]];
+
let a = 7_usize;
let b1 = &raw const a;
let c = *b1;
@@ -254,6 +422,10 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Propagation a reborrow of an argument.
unsafe {
+ // CHECK: bb6: {
+ // CHECK-NOT: {{_.*}} = &(*_1);
+ // CHECK: [[b:_.*]] = (*_1);
+
let a = &raw const *single;
let b = *a; // This should be optimized as `*single`.
opaque(());
@@ -261,6 +433,12 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Propagation a reborrow of a mutated argument.
unsafe {
+ // CHECK: bb7: {
+ // CHECK: [[a:_.*]] = &raw const (*_2);
+ // CHECK: [[tmp:_.*]] = &raw const (*_1);
+ // CHECK: _2 = move [[tmp]];
+ // CHECK: [[b:_.*]] = (*[[a]]);
+
let a = &raw const *multiple;
multiple = &raw const *single;
let b = *a; // This should not be optimized.
@@ -269,6 +447,12 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Propagation through a reborrow.
unsafe {
+ // CHECK: bb8: {
+ // CHECK: [[a:_.*]] = const 13_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[d:_.*]] = &raw const [[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+
let a = 13_usize;
let b = &raw const a;
let c = &raw const *b;
@@ -278,6 +462,13 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Fixed-point propagation through a borrowed reference.
unsafe {
+ // CHECK: bb9: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let b = &raw const a;
let d = &b; // first round promotes debuginfo for `d`
@@ -287,6 +478,13 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Fixed-point propagation through a borrowed reference.
unsafe {
+ // CHECK: bb10: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[d:_.*]] = &mut [[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let mut b = &raw const a;
let d = &mut b; // first round promotes debuginfo for `d`
@@ -296,16 +494,31 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
}
fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) {
+ // CHECK-LABEL: fn reference_propagation_mut_ptr(
+
// Propagation through a reference.
unsafe {
+ // CHECK: bb0: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw mut [[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+
let mut a = 5_usize;
let b = &raw mut a; // This borrow is only used once.
let c = *b; // This should be optimized.
opaque(());
}
- // Propagation through a two references.
+ // Propagation through two references.
unsafe {
+ // CHECK: bb1: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[a2:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &raw mut [[a]];
+ // CHECK: [[btmp:_.*]] = &raw mut [[a2]];
+ // CHECK: [[b]] = move [[btmp]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let mut a2 = 7_usize;
let mut b = &raw mut a;
@@ -317,6 +530,12 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
// Propagation through a borrowed reference.
unsafe {
+ // CHECK: bb2: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw mut [[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let b = &raw mut a;
let d = &b;
@@ -324,8 +543,14 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
opaque(d); // prevent `d` from being removed.
}
- // Propagation through a borrowed reference.
+ // Propagation through a mutably borrowed reference.
unsafe {
+ // CHECK: bb3: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw mut [[a]];
+ // CHECK: [[d:_.*]] = &raw mut [[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let mut b = &raw mut a;
let d = &raw mut b;
@@ -335,6 +560,11 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
// Propagation through an escaping borrow.
unsafe {
+ // CHECK: bb4: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &raw mut [[a]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 7_usize;
let b = &raw mut a;
let c = *b;
@@ -343,6 +573,14 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
// Propagation through a transitively escaping borrow.
unsafe {
+ // CHECK: bb5: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b1:_.*]] = &raw mut [[a]];
+ // CHECK: [[c:_.*]] = (*[[b1]]);
+ // CHECK: [[b2:_.*]] = [[b1]];
+ // CHECK: [[c2:_.*]] = (*[[b2]]);
+ // CHECK: [[b3:_.*]] = [[b2]];
+
let mut a = 7_usize;
let b1 = &raw mut a;
let c = *b1;
@@ -356,6 +594,10 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
// Propagation a reborrow of an argument.
unsafe {
+ // CHECK: bb6: {
+ // CHECK-NOT: {{_.*}} = &(*_1);
+ // CHECK: [[b:_.*]] = (*_1);
+
let a = &raw mut *single;
let b = *a; // This should be optimized as `*single`.
opaque(());
@@ -363,6 +605,12 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
// Propagation a reborrow of a mutated argument.
unsafe {
+ // CHECK: bb7: {
+ // CHECK: [[a:_.*]] = &raw mut (*_2);
+ // CHECK: [[tmp:_.*]] = &raw mut (*_1);
+ // CHECK: _2 = move [[tmp]];
+ // CHECK: [[b:_.*]] = (*[[a]]);
+
let a = &raw mut *multiple;
multiple = &raw mut *single;
let b = *a; // This should not be optimized.
@@ -371,6 +619,13 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
// Fixed-point propagation through a borrowed reference.
unsafe {
+ // CHECK: bb8: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw mut [[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let b = &raw mut a;
let d = &b; // first round promotes debuginfo for `d`
@@ -378,8 +633,15 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
opaque(());
}
- // Fixed-point propagation through a borrowed reference.
+ // Fixed-point propagation through a mutably borrowed reference.
unsafe {
+ // CHECK: bb9: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw mut [[a]];
+ // CHECK: [[d:_.*]] = &mut [[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let mut b = &raw mut a;
let d = &mut b; // first round promotes debuginfo for `d`
@@ -390,8 +652,13 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
fn read_through_raw(x: &mut usize) -> usize {
- use std::intrinsics::mir::*;
+ // CHECK-LABEL: read_through_raw
+ // CHECK: bb0: {
+ // CHECK-NEXT: _0 = (*_1);
+ // CHECK-NEXT: _0 = (*_1);
+ // CHECK-NEXT: return;
+ use std::intrinsics::mir::*;
mir!(
let r1: &mut usize;
let r2: &mut usize;
@@ -413,8 +680,10 @@ fn read_through_raw(x: &mut usize) -> usize {
#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
fn multiple_storage() {
- use std::intrinsics::mir::*;
+ // CHECK-LABEL: multiple_storage
+ // CHECK: _3 = (*_2);
+ use std::intrinsics::mir::*;
mir!(
let x: i32;
{
@@ -426,7 +695,7 @@ fn multiple_storage() {
// As there are multiple `StorageLive` statements for `x`, we cannot know if this `z`'s
// pointer address is the address of `x`, so do nothing.
let y = *z;
- Call(RET, retblock, opaque(y))
+ Call(RET = opaque(y), retblock, UnwindContinue())
}
retblock = {
@@ -437,8 +706,10 @@ fn multiple_storage() {
#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
fn dominate_storage() {
- use std::intrinsics::mir::*;
+ // CHECK-LABEL: dominate_storage
+ // CHECK: _5 = (*_2);
+ use std::intrinsics::mir::*;
mir!(
let x: i32;
let r: &i32;
@@ -452,7 +723,7 @@ fn dominate_storage() {
}
bb1 = {
let c = *r;
- Call(RET, bb2, opaque(c))
+ Call(RET = opaque(c), bb2, UnwindContinue())
}
bb2 = {
StorageDead(x);
@@ -465,8 +736,10 @@ fn dominate_storage() {
#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
fn maybe_dead(m: bool) {
- use std::intrinsics::mir::*;
+ // CHECK-LABEL: fn maybe_dead(
+ // CHECK: (*_5) = const 7_i32;
+ use std::intrinsics::mir::*;
mir!(
let x: i32;
let y: i32;
@@ -486,18 +759,18 @@ fn maybe_dead(m: bool) {
bb1 = {
StorageDead(x);
StorageDead(y);
- Call(RET, bb2, opaque(u))
+ Call(RET = opaque(u), bb2, UnwindContinue())
}
bb2 = {
// As `x` may be `StorageDead`, `a` may be dangling, so we do nothing.
let z = *a;
- Call(RET, bb3, opaque(z))
+ Call(RET = opaque(z), bb3, UnwindContinue())
}
bb3 = {
// As `y` may be `StorageDead`, `b` may be dangling, so we do nothing.
// This implies that we also do not substitute `b` in `bb0`.
let t = *b;
- Call(RET, retblock, opaque(t))
+ Call(RET = opaque(t), retblock, UnwindContinue())
}
retblock = {
Return()
@@ -506,6 +779,9 @@ fn maybe_dead(m: bool) {
}
fn mut_raw_then_mut_shr() -> (i32, i32) {
+ // CHECK-LABEL: fn mut_raw_then_mut_shr(
+ // CHECK-NOT: (*{{_.*}})
+
let mut x = 2;
let xref = &mut x;
let xraw = &mut *xref as *mut _;
@@ -517,6 +793,18 @@ fn mut_raw_then_mut_shr() -> (i32, i32) {
}
fn unique_with_copies() {
+ // CHECK-LABEL: fn unique_with_copies(
+ // CHECK: [[a:_.*]] = const 0_i32;
+ // CHECK: [[x:_.*]] = &raw mut [[a]];
+ // CHECK-NOT: [[a]]
+ // CHECK: [[tmp:_.*]] = (*[[x]]);
+ // CHECK-NEXT: opaque::<i32>(move [[tmp]])
+ // CHECK-NOT: [[a]]
+ // CHECK: StorageDead([[a]]);
+ // CHECK-NOT: [[a]]
+ // CHECK: [[tmp:_.*]] = (*[[x]]);
+ // CHECK-NEXT: opaque::<i32>(move [[tmp]])
+
let y = {
let mut a = 0;
let x = &raw mut a;
@@ -529,6 +817,17 @@ fn unique_with_copies() {
}
fn debuginfo() {
+ // CHECK-LABEL: fn debuginfo(
+ // FIXME: This features waits for DWARF implicit pointers in LLVM.
+ // CHECK: debug ref_mut_u8 => _{{.*}};
+ // CHECK: debug field => _{{.*}};
+ // CHECK: debug reborrow => _{{.*}};
+ // CHECK: debug variant_field => _{{.*}};
+ // CHECK: debug constant_index => _{{.*}};
+ // CHECK: debug subslice => _{{.*}};
+ // CHECK: debug constant_index_from_end => _{{.*}};
+ // CHECK: debug multiple_borrow => _{{.*}};
+
struct T(u8);
let ref_mut_u8 = &mut 5_u8;
@@ -551,6 +850,10 @@ fn debuginfo() {
}
fn many_debuginfo() {
+ // CHECK-LABEL: fn many_debuginfo(
+ // FIXME: This features waits for DWARF implicit pointers in LLVM.
+ // CHECK: debug many_borrow => _{{.*}};
+
let a = 0;
// Verify that we do not ICE on deeply nested borrows.
diff --git a/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff b/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff
index b754aff47..b4912a918 100644
--- a/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff
@@ -2,66 +2,60 @@
+ // MIR for `unique_with_copies` after ReferencePropagation
fn unique_with_copies() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:25: +0:25
- let _1: *mut i32; // in scope 0 at $DIR/reference_prop.rs:+1:9: +1:10
- let mut _2: i32; // in scope 0 at $DIR/reference_prop.rs:+2:13: +2:18
- let _4: (); // in scope 0 at $DIR/reference_prop.rs:+5:18: +5:28
- let mut _5: i32; // in scope 0 at $DIR/reference_prop.rs:+5:25: +5:27
- let _6: (); // in scope 0 at $DIR/reference_prop.rs:+9:14: +9:24
- let mut _7: i32; // in scope 0 at $DIR/reference_prop.rs:+9:21: +9:23
+ let mut _0: ();
+ let _1: *mut i32;
+ let mut _2: i32;
+ let _4: ();
+ let mut _5: i32;
+ let _6: ();
+ let mut _7: i32;
scope 1 {
-- debug y => _1; // in scope 1 at $DIR/reference_prop.rs:+1:9: +1:10
-+ debug y => _3; // in scope 1 at $DIR/reference_prop.rs:+1:9: +1:10
+- debug y => _1;
++ debug y => _3;
scope 5 {
}
}
scope 2 {
- debug a => _2; // in scope 2 at $DIR/reference_prop.rs:+2:13: +2:18
- let _3: *mut i32; // in scope 2 at $DIR/reference_prop.rs:+3:13: +3:14
+ debug a => _2;
+ let _3: *mut i32;
scope 3 {
- debug x => _3; // in scope 3 at $DIR/reference_prop.rs:+3:13: +3:14
+ debug x => _3;
scope 4 {
}
}
}
bb0: {
-- StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+1:9: +1:10
- StorageLive(_2); // scope 0 at $DIR/reference_prop.rs:+2:13: +2:18
- _2 = const 0_i32; // scope 0 at $DIR/reference_prop.rs:+2:21: +2:22
-- StorageLive(_3); // scope 2 at $DIR/reference_prop.rs:+3:13: +3:14
- _3 = &raw mut _2; // scope 2 at $DIR/reference_prop.rs:+3:17: +3:27
- StorageLive(_4); // scope 3 at $DIR/reference_prop.rs:+5:9: +5:30
- StorageLive(_5); // scope 4 at $DIR/reference_prop.rs:+5:25: +5:27
- _5 = (*_3); // scope 4 at $DIR/reference_prop.rs:+5:25: +5:27
- _4 = opaque::<i32>(move _5) -> bb1; // scope 4 at $DIR/reference_prop.rs:+5:18: +5:28
- // mir::Constant
- // + span: $DIR/reference_prop.rs:524:18: 524:24
- // + literal: Const { ty: fn(i32) {opaque::<i32>}, val: Value(<ZST>) }
+- StorageLive(_1);
+ StorageLive(_2);
+ _2 = const 0_i32;
+- StorageLive(_3);
+ _3 = &raw mut _2;
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = (*_3);
+ _4 = opaque::<i32>(move _5) -> [return: bb1, unwind continue];
}
bb1: {
- StorageDead(_5); // scope 4 at $DIR/reference_prop.rs:+5:27: +5:28
- StorageDead(_4); // scope 3 at $DIR/reference_prop.rs:+5:30: +5:31
-- _1 = _3; // scope 3 at $DIR/reference_prop.rs:+6:9: +6:10
-- StorageDead(_3); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
- StorageDead(_2); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
- StorageLive(_6); // scope 1 at $DIR/reference_prop.rs:+9:5: +9:26
- StorageLive(_7); // scope 5 at $DIR/reference_prop.rs:+9:21: +9:23
-- _7 = (*_1); // scope 5 at $DIR/reference_prop.rs:+9:21: +9:23
-+ _7 = (*_3); // scope 5 at $DIR/reference_prop.rs:+9:21: +9:23
- _6 = opaque::<i32>(move _7) -> bb2; // scope 5 at $DIR/reference_prop.rs:+9:14: +9:24
- // mir::Constant
- // + span: $DIR/reference_prop.rs:528:14: 528:20
- // + literal: Const { ty: fn(i32) {opaque::<i32>}, val: Value(<ZST>) }
+ StorageDead(_5);
+ StorageDead(_4);
+- _1 = _3;
+- StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_6);
+ StorageLive(_7);
+- _7 = (*_1);
++ _7 = (*_3);
+ _6 = opaque::<i32>(move _7) -> [return: bb2, unwind continue];
}
bb2: {
- StorageDead(_7); // scope 5 at $DIR/reference_prop.rs:+9:23: +9:24
- StorageDead(_6); // scope 1 at $DIR/reference_prop.rs:+9:26: +9:27
- _0 = const (); // scope 0 at $DIR/reference_prop.rs:+0:25: +10:2
-- StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+10:1: +10:2
- return; // scope 0 at $DIR/reference_prop.rs:+10:2: +10:2
+ StorageDead(_7);
+ StorageDead(_6);
+ _0 = const ();
+- StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.diff b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.diff
deleted file mode 100644
index 0b3da98a5..000000000
--- a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.diff
+++ /dev/null
@@ -1,74 +0,0 @@
-- // MIR for `match_guard` before CleanupPostBorrowck
-+ // MIR for `match_guard` after CleanupPostBorrowck
-
- fn match_guard(_1: Option<&&i32>, _2: bool) -> i32 {
- debug x => _1; // in scope 0 at $DIR/remove_fake_borrows.rs:+0:16: +0:17
- debug c => _2; // in scope 0 at $DIR/remove_fake_borrows.rs:+0:34: +0:35
- let mut _0: i32; // return place in scope 0 at $DIR/remove_fake_borrows.rs:+0:46: +0:49
- let mut _3: isize; // in scope 0 at $DIR/remove_fake_borrows.rs:+2:9: +2:16
- let mut _4: &std::option::Option<&&i32>; // in scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12
- let mut _5: &&i32; // in scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12
- let mut _6: &&&i32; // in scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12
- let mut _7: &i32; // in scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12
- let mut _8: bool; // in scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
-
- bb0: {
-- FakeRead(ForMatchedPlace(None), _1); // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12
-+ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12
- _3 = discriminant(_1); // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12
- switchInt(move _3) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/remove_fake_borrows.rs:+1:5: +1:12
- }
-
- bb1: {
- _0 = const 1_i32; // scope 0 at $DIR/remove_fake_borrows.rs:+3:14: +3:15
- goto -> bb7; // scope 0 at $DIR/remove_fake_borrows.rs:+3:14: +3:15
- }
-
- bb2: {
- switchInt((*(*((_1 as Some).0: &&i32)))) -> [0: bb3, otherwise: bb1]; // scope 0 at $DIR/remove_fake_borrows.rs:+1:5: +1:12
- }
-
- bb3: {
-- falseEdge -> [real: bb4, imaginary: bb1]; // scope 0 at $DIR/remove_fake_borrows.rs:+2:9: +2:16
-+ goto -> bb4; // scope 0 at $DIR/remove_fake_borrows.rs:+2:9: +2:16
- }
-
- bb4: {
-- _4 = &shallow _1; // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12
-- _5 = &shallow (*((_1 as Some).0: &&i32)); // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12
-- _6 = &shallow ((_1 as Some).0: &&i32); // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12
-- _7 = &shallow (*(*((_1 as Some).0: &&i32))); // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12
-+ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12
-+ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12
-+ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12
-+ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12
- StorageLive(_8); // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
- _8 = _2; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
- switchInt(move _8) -> [0: bb6, otherwise: bb5]; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
- }
-
- bb5: {
- StorageDead(_8); // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
-- FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
-- FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
-- FakeRead(ForMatchGuard, _6); // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
-- FakeRead(ForMatchGuard, _7); // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
-+ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
-+ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
-+ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
-+ nop; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
- _0 = const 0_i32; // scope 0 at $DIR/remove_fake_borrows.rs:+2:25: +2:26
- goto -> bb7; // scope 0 at $DIR/remove_fake_borrows.rs:+2:25: +2:26
- }
-
- bb6: {
- StorageDead(_8); // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
-- falseEdge -> [real: bb1, imaginary: bb1]; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
-+ goto -> bb1; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21
- }
-
- bb7: {
- return; // scope 0 at $DIR/remove_fake_borrows.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff
new file mode 100644
index 000000000..54da6ee65
--- /dev/null
+++ b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff
@@ -0,0 +1,73 @@
+- // MIR for `match_guard` before CleanupPostBorrowck
++ // MIR for `match_guard` after CleanupPostBorrowck
+
+ fn match_guard(_1: Option<&&i32>, _2: bool) -> i32 {
+ debug x => _1;
+ debug c => _2;
+ let mut _0: i32;
+ let mut _3: isize;
+ let mut _4: &std::option::Option<&&i32>;
+ let mut _5: &&i32;
+ let mut _6: &&&i32;
+ let mut _7: &i32;
+ let mut _8: bool;
+
+ bb0: {
+ PlaceMention(_1);
+ _3 = discriminant(_1);
+ switchInt(move _3) -> [1: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ _0 = const 1_i32;
+ goto -> bb7;
+ }
+
+ bb2: {
+ switchInt((*(*((_1 as Some).0: &&i32)))) -> [0: bb3, otherwise: bb1];
+ }
+
+ bb3: {
+- falseEdge -> [real: bb4, imaginary: bb1];
++ goto -> bb4;
+ }
+
+ bb4: {
+- _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;
++ nop;
+ StorageLive(_8);
+ _8 = _2;
+ switchInt(move _8) -> [0: bb6, otherwise: bb5];
+ }
+
+ bb5: {
+ StorageDead(_8);
+- FakeRead(ForMatchGuard, _4);
+- FakeRead(ForMatchGuard, _5);
+- FakeRead(ForMatchGuard, _6);
+- FakeRead(ForMatchGuard, _7);
++ nop;
++ nop;
++ nop;
++ nop;
+ _0 = const 0_i32;
+ goto -> bb7;
+ }
+
+ bb6: {
+ StorageDead(_8);
+- falseEdge -> [real: bb1, imaginary: bb1];
++ goto -> bb1;
+ }
+
+ bb7: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff
new file mode 100644
index 000000000..54da6ee65
--- /dev/null
+++ b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff
@@ -0,0 +1,73 @@
+- // MIR for `match_guard` before CleanupPostBorrowck
++ // MIR for `match_guard` after CleanupPostBorrowck
+
+ fn match_guard(_1: Option<&&i32>, _2: bool) -> i32 {
+ debug x => _1;
+ debug c => _2;
+ let mut _0: i32;
+ let mut _3: isize;
+ let mut _4: &std::option::Option<&&i32>;
+ let mut _5: &&i32;
+ let mut _6: &&&i32;
+ let mut _7: &i32;
+ let mut _8: bool;
+
+ bb0: {
+ PlaceMention(_1);
+ _3 = discriminant(_1);
+ switchInt(move _3) -> [1: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ _0 = const 1_i32;
+ goto -> bb7;
+ }
+
+ bb2: {
+ switchInt((*(*((_1 as Some).0: &&i32)))) -> [0: bb3, otherwise: bb1];
+ }
+
+ bb3: {
+- falseEdge -> [real: bb4, imaginary: bb1];
++ goto -> bb4;
+ }
+
+ bb4: {
+- _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;
++ nop;
+ StorageLive(_8);
+ _8 = _2;
+ switchInt(move _8) -> [0: bb6, otherwise: bb5];
+ }
+
+ bb5: {
+ StorageDead(_8);
+- FakeRead(ForMatchGuard, _4);
+- FakeRead(ForMatchGuard, _5);
+- FakeRead(ForMatchGuard, _6);
+- FakeRead(ForMatchGuard, _7);
++ nop;
++ nop;
++ nop;
++ nop;
+ _0 = const 0_i32;
+ goto -> bb7;
+ }
+
+ bb6: {
+ StorageDead(_8);
+- falseEdge -> [real: bb1, imaginary: bb1];
++ goto -> bb1;
+ }
+
+ bb7: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/remove_fake_borrows.rs b/tests/mir-opt/remove_fake_borrows.rs
index d26c6f5d7..21c7b46ee 100644
--- a/tests/mir-opt/remove_fake_borrows.rs
+++ b/tests/mir-opt/remove_fake_borrows.rs
@@ -1,6 +1,7 @@
+// skip-filecheck
// Test that the fake borrows for matches are removed after borrow checking.
-// ignore-wasm32-bare compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR remove_fake_borrows.match_guard.CleanupPostBorrowck.diff
fn match_guard(x: Option<&&i32>, c: bool) -> i32 {
diff --git a/tests/mir-opt/remove_never_const.no_codegen.PreCodegen.after.mir b/tests/mir-opt/remove_never_const.no_codegen.PreCodegen.after.mir
index 8eb0e9c8f..695bf2336 100644
--- a/tests/mir-opt/remove_never_const.no_codegen.PreCodegen.after.mir
+++ b/tests/mir-opt/remove_never_const.no_codegen.PreCodegen.after.mir
@@ -1,11 +1,11 @@
// MIR for `no_codegen` after PreCodegen
fn no_codegen() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/remove_never_const.rs:+0:20: +0:20
+ let mut _0: ();
scope 1 {
}
bb0: {
- unreachable; // scope 0 at $DIR/remove_never_const.rs:+1:13: +1:33
+ unreachable;
}
}
diff --git a/tests/mir-opt/remove_never_const.rs b/tests/mir-opt/remove_never_const.rs
index 160cc9555..c144edaff 100644
--- a/tests/mir-opt/remove_never_const.rs
+++ b/tests/mir-opt/remove_never_const.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// This was originally a regression test for #66975 - ensure that we do not generate never typed
// consts in codegen. We also have tests for this that catches the error, see
// tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs.
diff --git a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff
deleted file mode 100644
index 0e8309532..000000000
--- a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff
+++ /dev/null
@@ -1,98 +0,0 @@
-- // MIR for `main` before RemoveStorageMarkers
-+ // MIR for `main` after RemoveStorageMarkers
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/remove_storage_markers.rs:+0:11: +0:11
- let mut _1: i32; // in scope 0 at $DIR/remove_storage_markers.rs:+1:9: +1:16
- let mut _2: std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- let mut _3: std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- let mut _5: (); // in scope 0 at $DIR/remove_storage_markers.rs:+0:1: +5:2
- let _6: (); // in scope 0 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- let mut _7: std::option::Option<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- let mut _8: &mut std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- let mut _9: &mut std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- let mut _10: isize; // in scope 0 at $DIR/remove_storage_markers.rs:+2:5: +4:6
- let mut _11: !; // in scope 0 at $DIR/remove_storage_markers.rs:+2:5: +4:6
- let mut _13: i32; // in scope 0 at $DIR/remove_storage_markers.rs:+3:16: +3:17
- scope 1 {
- debug sum => _1; // in scope 1 at $DIR/remove_storage_markers.rs:+1:9: +1:16
- let mut _4: std::ops::Range<i32>; // in scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- scope 2 {
- debug iter => _4; // in scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- let _12: i32; // in scope 2 at $DIR/remove_storage_markers.rs:+2:9: +2:10
- scope 3 {
- debug i => _12; // in scope 3 at $DIR/remove_storage_markers.rs:+2:9: +2:10
- }
- }
- }
-
- bb0: {
-- StorageLive(_1); // scope 0 at $DIR/remove_storage_markers.rs:+1:9: +1:16
- _1 = const 0_i32; // scope 0 at $DIR/remove_storage_markers.rs:+1:19: +1:20
-- StorageLive(_2); // scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19
-- StorageLive(_3); // scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- _3 = std::ops::Range::<i32> { start: const 0_i32, end: const 10_i32 }; // scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- _2 = <std::ops::Range<i32> as IntoIterator>::into_iter(move _3) -> bb1; // scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- // mir::Constant
- // + span: $DIR/remove_storage_markers.rs:11:14: 11:19
- // + literal: Const { ty: fn(std::ops::Range<i32>) -> <std::ops::Range<i32> as IntoIterator>::IntoIter {<std::ops::Range<i32> as IntoIterator>::into_iter}, val: Value(<ZST>) }
- }
-
- bb1: {
-- StorageDead(_3); // scope 1 at $DIR/remove_storage_markers.rs:+2:18: +2:19
-- StorageLive(_4); // scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- _4 = move _2; // scope 1 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- goto -> bb2; // scope 2 at $DIR/remove_storage_markers.rs:+2:5: +4:6
- }
-
- bb2: {
-- StorageLive(_6); // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19
-- StorageLive(_7); // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19
-- StorageLive(_8); // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19
-- StorageLive(_9); // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- _9 = &mut _4; // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- _8 = &mut (*_9); // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- _7 = <std::ops::Range<i32> as Iterator>::next(move _8) -> bb3; // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- // mir::Constant
- // + span: $DIR/remove_storage_markers.rs:11:14: 11:19
- // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range<i32>) -> Option<<std::ops::Range<i32> as Iterator>::Item> {<std::ops::Range<i32> as Iterator>::next}, val: Value(<ZST>) }
- }
-
- bb3: {
-- StorageDead(_8); // scope 2 at $DIR/remove_storage_markers.rs:+2:18: +2:19
- _10 = discriminant(_7); // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- }
-
- bb4: {
-- StorageLive(_12); // scope 2 at $DIR/remove_storage_markers.rs:+2:9: +2:10
- _12 = ((_7 as Some).0: i32); // scope 2 at $DIR/remove_storage_markers.rs:+2:9: +2:10
-- StorageLive(_13); // scope 3 at $DIR/remove_storage_markers.rs:+3:16: +3:17
- _13 = _12; // scope 3 at $DIR/remove_storage_markers.rs:+3:16: +3:17
- _1 = Add(_1, move _13); // scope 3 at $DIR/remove_storage_markers.rs:+3:9: +3:17
-- StorageDead(_13); // scope 3 at $DIR/remove_storage_markers.rs:+3:16: +3:17
- _6 = const (); // scope 3 at $DIR/remove_storage_markers.rs:+2:20: +4:6
-- StorageDead(_12); // scope 2 at $DIR/remove_storage_markers.rs:+4:5: +4:6
-- StorageDead(_9); // scope 2 at $DIR/remove_storage_markers.rs:+4:5: +4:6
-- StorageDead(_7); // scope 2 at $DIR/remove_storage_markers.rs:+4:5: +4:6
-- StorageDead(_6); // scope 2 at $DIR/remove_storage_markers.rs:+4:5: +4:6
- _5 = const (); // scope 2 at $DIR/remove_storage_markers.rs:+2:5: +4:6
- goto -> bb2; // scope 2 at $DIR/remove_storage_markers.rs:+2:5: +4:6
- }
-
- bb5: {
- unreachable; // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19
- }
-
- bb6: {
- _0 = const (); // scope 2 at $DIR/remove_storage_markers.rs:+2:5: +4:6
-- StorageDead(_9); // scope 2 at $DIR/remove_storage_markers.rs:+4:5: +4:6
-- StorageDead(_7); // scope 2 at $DIR/remove_storage_markers.rs:+4:5: +4:6
-- StorageDead(_6); // scope 2 at $DIR/remove_storage_markers.rs:+4:5: +4:6
-- StorageDead(_4); // scope 1 at $DIR/remove_storage_markers.rs:+4:5: +4:6
-- StorageDead(_2); // scope 1 at $DIR/remove_storage_markers.rs:+4:5: +4:6
-- StorageDead(_1); // scope 0 at $DIR/remove_storage_markers.rs:+5:1: +5:2
- return; // scope 0 at $DIR/remove_storage_markers.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff
new file mode 100644
index 000000000..8804e6715
--- /dev/null
+++ b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff
@@ -0,0 +1,92 @@
+- // MIR for `main` before RemoveStorageMarkers
++ // MIR for `main` after RemoveStorageMarkers
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+ let mut _2: std::ops::Range<i32>;
+ let mut _3: std::ops::Range<i32>;
+ let mut _5: ();
+ let _6: ();
+ let mut _7: std::option::Option<i32>;
+ let mut _8: &mut std::ops::Range<i32>;
+ let mut _9: &mut std::ops::Range<i32>;
+ let mut _10: isize;
+ let mut _11: !;
+ let mut _13: i32;
+ scope 1 {
+ debug sum => _1;
+ let mut _4: std::ops::Range<i32>;
+ scope 2 {
+ debug iter => _4;
+ let _12: i32;
+ scope 3 {
+ debug i => _12;
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
+ _1 = const 0_i32;
+- StorageLive(_2);
+- StorageLive(_3);
+ _3 = std::ops::Range::<i32> { start: const 0_i32, end: const 10_i32 };
+ _2 = <std::ops::Range<i32> as IntoIterator>::into_iter(move _3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+- StorageDead(_3);
+- StorageLive(_4);
+ _4 = move _2;
+ goto -> bb2;
+ }
+
+ bb2: {
+- StorageLive(_6);
+- StorageLive(_7);
+- StorageLive(_8);
+- StorageLive(_9);
+ _9 = &mut _4;
+ _8 = &mut (*_9);
+ _7 = <std::ops::Range<i32> as Iterator>::next(move _8) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+- StorageDead(_8);
+ _10 = discriminant(_7);
+ switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5];
+ }
+
+ bb4: {
+- StorageLive(_12);
+ _12 = ((_7 as Some).0: i32);
+- StorageLive(_13);
+ _13 = _12;
+ _1 = Add(_1, move _13);
+- StorageDead(_13);
+ _6 = const ();
+- StorageDead(_12);
+- StorageDead(_9);
+- StorageDead(_7);
+- StorageDead(_6);
+ _5 = const ();
+ goto -> bb2;
+ }
+
+ bb5: {
+ unreachable;
+ }
+
+ bb6: {
+ _0 = const ();
+- StorageDead(_9);
+- StorageDead(_7);
+- StorageDead(_6);
+- StorageDead(_4);
+- StorageDead(_2);
+- StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-unwind.diff b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-unwind.diff
new file mode 100644
index 000000000..faaebc300
--- /dev/null
+++ b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-unwind.diff
@@ -0,0 +1,92 @@
+- // MIR for `main` before RemoveStorageMarkers
++ // MIR for `main` after RemoveStorageMarkers
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+ let mut _2: std::ops::Range<i32>;
+ let mut _3: std::ops::Range<i32>;
+ let mut _5: ();
+ let _6: ();
+ let mut _7: std::option::Option<i32>;
+ let mut _8: &mut std::ops::Range<i32>;
+ let mut _9: &mut std::ops::Range<i32>;
+ let mut _10: isize;
+ let mut _11: !;
+ let mut _13: i32;
+ scope 1 {
+ debug sum => _1;
+ let mut _4: std::ops::Range<i32>;
+ scope 2 {
+ debug iter => _4;
+ let _12: i32;
+ scope 3 {
+ debug i => _12;
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
+ _1 = const 0_i32;
+- StorageLive(_2);
+- StorageLive(_3);
+ _3 = std::ops::Range::<i32> { start: const 0_i32, end: const 10_i32 };
+ _2 = <std::ops::Range<i32> as IntoIterator>::into_iter(move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- StorageDead(_3);
+- StorageLive(_4);
+ _4 = move _2;
+ goto -> bb2;
+ }
+
+ bb2: {
+- StorageLive(_6);
+- StorageLive(_7);
+- StorageLive(_8);
+- StorageLive(_9);
+ _9 = &mut _4;
+ _8 = &mut (*_9);
+ _7 = <std::ops::Range<i32> as Iterator>::next(move _8) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+- StorageDead(_8);
+ _10 = discriminant(_7);
+ switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5];
+ }
+
+ bb4: {
+- StorageLive(_12);
+ _12 = ((_7 as Some).0: i32);
+- StorageLive(_13);
+ _13 = _12;
+ _1 = Add(_1, move _13);
+- StorageDead(_13);
+ _6 = const ();
+- StorageDead(_12);
+- StorageDead(_9);
+- StorageDead(_7);
+- StorageDead(_6);
+ _5 = const ();
+ goto -> bb2;
+ }
+
+ bb5: {
+ unreachable;
+ }
+
+ bb6: {
+ _0 = const ();
+- StorageDead(_9);
+- StorageDead(_7);
+- StorageDead(_6);
+- StorageDead(_4);
+- StorageDead(_2);
+- StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/remove_storage_markers.rs b/tests/mir-opt/remove_storage_markers.rs
index 480db8ac1..6666ff3b7 100644
--- a/tests/mir-opt/remove_storage_markers.rs
+++ b/tests/mir-opt/remove_storage_markers.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: RemoveStorageMarkers
// Checks that storage markers are removed at opt-level=0.
diff --git a/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff
deleted file mode 100644
index 7713649c5..000000000
--- a/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff
+++ /dev/null
@@ -1,31 +0,0 @@
-- // MIR for `cannot_opt_generic` before RemoveUnneededDrops
-+ // MIR for `cannot_opt_generic` after RemoveUnneededDrops
-
- fn cannot_opt_generic(_1: T) -> () {
- debug x => _1; // in scope 0 at $DIR/remove_unneeded_drops.rs:+0:26: +0:27
- let mut _0: (); // return place in scope 0 at $DIR/remove_unneeded_drops.rs:+0:32: +0:32
- let _2: (); // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12
- let mut _3: T; // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11
- scope 1 (inlined std::mem::drop::<T>) { // at $DIR/remove_unneeded_drops.rs:21:5: 21:12
- debug _x => _3; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- }
-
- bb0: {
- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12
- StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11
- _3 = move _1; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11
- drop(_3) -> [return: bb2, unwind: bb1]; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- }
-
- bb1 (cleanup): {
- resume; // scope 0 at $DIR/remove_unneeded_drops.rs:+0:1: +2:2
- }
-
- bb2: {
- StorageDead(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:11: +1:12
- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13
- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+0:32: +2:2
- return; // scope 0 at $DIR/remove_unneeded_drops.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-abort.diff b/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-abort.diff
new file mode 100644
index 000000000..22a1a882b
--- /dev/null
+++ b/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-abort.diff
@@ -0,0 +1,27 @@
+- // MIR for `cannot_opt_generic` before RemoveUnneededDrops
++ // MIR for `cannot_opt_generic` after RemoveUnneededDrops
+
+ fn cannot_opt_generic(_1: T) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: T;
+ scope 1 (inlined std::mem::drop::<T>) {
+ debug _x => _3;
+ }
+
+ bb0: {
+ nop;
+ StorageLive(_3);
+ _3 = move _1;
+ drop(_3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ nop;
+ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-unwind.diff b/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-unwind.diff
new file mode 100644
index 000000000..56070e610
--- /dev/null
+++ b/tests/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.panic-unwind.diff
@@ -0,0 +1,31 @@
+- // MIR for `cannot_opt_generic` before RemoveUnneededDrops
++ // MIR for `cannot_opt_generic` after RemoveUnneededDrops
+
+ fn cannot_opt_generic(_1: T) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: T;
+ scope 1 (inlined std::mem::drop::<T>) {
+ debug _x => _3;
+ }
+
+ bb0: {
+ nop;
+ StorageLive(_3);
+ _3 = move _1;
+ drop(_3) -> [return: bb2, unwind: bb1];
+ }
+
+ bb1 (cleanup): {
+ resume;
+ }
+
+ bb2: {
+ StorageDead(_3);
+ nop;
+ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff
deleted file mode 100644
index 533db4051..000000000
--- a/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff
+++ /dev/null
@@ -1,31 +0,0 @@
-- // MIR for `dont_opt` before RemoveUnneededDrops
-+ // MIR for `dont_opt` after RemoveUnneededDrops
-
- fn dont_opt(_1: Vec<bool>) -> () {
- debug x => _1; // in scope 0 at $DIR/remove_unneeded_drops.rs:+0:13: +0:14
- let mut _0: (); // return place in scope 0 at $DIR/remove_unneeded_drops.rs:+0:27: +0:27
- let _2: (); // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12
- let mut _3: std::vec::Vec<bool>; // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11
- scope 1 (inlined std::mem::drop::<Vec<bool>>) { // at $DIR/remove_unneeded_drops.rs:9:5: 9:12
- debug _x => _3; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- }
-
- bb0: {
- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12
- StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11
- _3 = move _1; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11
- drop(_3) -> [return: bb2, unwind: bb1]; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- }
-
- bb1 (cleanup): {
- resume; // scope 0 at $DIR/remove_unneeded_drops.rs:+0:1: +2:2
- }
-
- bb2: {
- StorageDead(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:11: +1:12
- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13
- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+0:27: +2:2
- return; // scope 0 at $DIR/remove_unneeded_drops.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-abort.diff b/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-abort.diff
new file mode 100644
index 000000000..105bedd0a
--- /dev/null
+++ b/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-abort.diff
@@ -0,0 +1,27 @@
+- // MIR for `dont_opt` before RemoveUnneededDrops
++ // MIR for `dont_opt` after RemoveUnneededDrops
+
+ fn dont_opt(_1: Vec<bool>) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: std::vec::Vec<bool>;
+ scope 1 (inlined std::mem::drop::<Vec<bool>>) {
+ debug _x => _3;
+ }
+
+ bb0: {
+ nop;
+ StorageLive(_3);
+ _3 = move _1;
+ drop(_3) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ nop;
+ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-unwind.diff b/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-unwind.diff
new file mode 100644
index 000000000..c9790dc07
--- /dev/null
+++ b/tests/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.panic-unwind.diff
@@ -0,0 +1,31 @@
+- // MIR for `dont_opt` before RemoveUnneededDrops
++ // MIR for `dont_opt` after RemoveUnneededDrops
+
+ fn dont_opt(_1: Vec<bool>) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: std::vec::Vec<bool>;
+ scope 1 (inlined std::mem::drop::<Vec<bool>>) {
+ debug _x => _3;
+ }
+
+ bb0: {
+ nop;
+ StorageLive(_3);
+ _3 = move _1;
+ drop(_3) -> [return: bb2, unwind: bb1];
+ }
+
+ bb1 (cleanup): {
+ resume;
+ }
+
+ bb2: {
+ StorageDead(_3);
+ nop;
+ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.diff
deleted file mode 100644
index 04a2d54e9..000000000
--- a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.diff
+++ /dev/null
@@ -1,27 +0,0 @@
-- // MIR for `opt` before RemoveUnneededDrops
-+ // MIR for `opt` after RemoveUnneededDrops
-
- fn opt(_1: bool) -> () {
- debug x => _1; // in scope 0 at $DIR/remove_unneeded_drops.rs:+0:8: +0:9
- let mut _0: (); // return place in scope 0 at $DIR/remove_unneeded_drops.rs:+0:17: +0:17
- let _2: (); // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12
- let mut _3: bool; // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11
- scope 1 (inlined std::mem::drop::<bool>) { // at $DIR/remove_unneeded_drops.rs:4:5: 4:12
- debug _x => _3; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- }
-
- bb0: {
-- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12
- StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11
- _3 = _1; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11
-- drop(_3) -> bb1; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
-- }
--
-- bb1: {
- StorageDead(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:11: +1:12
-- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13
-- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+0:17: +2:2
- return; // scope 0 at $DIR/remove_unneeded_drops.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-abort.diff b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-abort.diff
new file mode 100644
index 000000000..a48ac82ea
--- /dev/null
+++ b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-abort.diff
@@ -0,0 +1,27 @@
+- // MIR for `opt` before RemoveUnneededDrops
++ // MIR for `opt` after RemoveUnneededDrops
+
+ fn opt(_1: bool) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: bool;
+ scope 1 (inlined std::mem::drop::<bool>) {
+ debug _x => _3;
+ }
+
+ bb0: {
+- nop;
+ StorageLive(_3);
+ _3 = _1;
+- drop(_3) -> [return: bb1, unwind unreachable];
+- }
+-
+- bb1: {
+ StorageDead(_3);
+- nop;
+- nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff
new file mode 100644
index 000000000..a335e8853
--- /dev/null
+++ b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff
@@ -0,0 +1,27 @@
+- // MIR for `opt` before RemoveUnneededDrops
++ // MIR for `opt` after RemoveUnneededDrops
+
+ fn opt(_1: bool) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: bool;
+ scope 1 (inlined std::mem::drop::<bool>) {
+ debug _x => _3;
+ }
+
+ bb0: {
+- nop;
+ StorageLive(_3);
+ _3 = _1;
+- drop(_3) -> [return: bb1, unwind continue];
+- }
+-
+- bb1: {
+ StorageDead(_3);
+- nop;
+- nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff
deleted file mode 100644
index 782d0c6c5..000000000
--- a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff
+++ /dev/null
@@ -1,27 +0,0 @@
-- // MIR for `opt_generic_copy` before RemoveUnneededDrops
-+ // MIR for `opt_generic_copy` after RemoveUnneededDrops
-
- fn opt_generic_copy(_1: T) -> () {
- debug x => _1; // in scope 0 at $DIR/remove_unneeded_drops.rs:+0:30: +0:31
- let mut _0: (); // return place in scope 0 at $DIR/remove_unneeded_drops.rs:+0:36: +0:36
- let _2: (); // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12
- let mut _3: T; // in scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11
- scope 1 (inlined std::mem::drop::<T>) { // at $DIR/remove_unneeded_drops.rs:14:5: 14:12
- debug _x => _3; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
- }
-
- bb0: {
-- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:5: +1:12
- StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11
- _3 = _1; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:10: +1:11
-- drop(_3) -> bb1; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
-- }
--
-- bb1: {
- StorageDead(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:+1:11: +1:12
-- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+1:12: +1:13
-- nop; // scope 0 at $DIR/remove_unneeded_drops.rs:+0:36: +2:2
- return; // scope 0 at $DIR/remove_unneeded_drops.rs:+2:2: +2:2
- }
- }
-
diff --git a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-abort.diff b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-abort.diff
new file mode 100644
index 000000000..049b32f28
--- /dev/null
+++ b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-abort.diff
@@ -0,0 +1,27 @@
+- // MIR for `opt_generic_copy` before RemoveUnneededDrops
++ // MIR for `opt_generic_copy` after RemoveUnneededDrops
+
+ fn opt_generic_copy(_1: T) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: T;
+ scope 1 (inlined std::mem::drop::<T>) {
+ debug _x => _3;
+ }
+
+ bb0: {
+- nop;
+ StorageLive(_3);
+ _3 = _1;
+- drop(_3) -> [return: bb1, unwind unreachable];
+- }
+-
+- bb1: {
+ StorageDead(_3);
+- nop;
+- nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff
new file mode 100644
index 000000000..1f7a6f9ad
--- /dev/null
+++ b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff
@@ -0,0 +1,27 @@
+- // MIR for `opt_generic_copy` before RemoveUnneededDrops
++ // MIR for `opt_generic_copy` after RemoveUnneededDrops
+
+ fn opt_generic_copy(_1: T) -> () {
+ debug x => _1;
+ let mut _0: ();
+ let _2: ();
+ let mut _3: T;
+ scope 1 (inlined std::mem::drop::<T>) {
+ debug _x => _3;
+ }
+
+ bb0: {
+- nop;
+ StorageLive(_3);
+ _3 = _1;
+- drop(_3) -> [return: bb1, unwind continue];
+- }
+-
+- bb1: {
+ StorageDead(_3);
+- nop;
+- nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/remove_unneeded_drops.rs b/tests/mir-opt/remove_unneeded_drops.rs
index 1052f2886..cad79e0aa 100644
--- a/tests/mir-opt/remove_unneeded_drops.rs
+++ b/tests/mir-opt/remove_unneeded_drops.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32-bare compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR remove_unneeded_drops.opt.RemoveUnneededDrops.diff
fn opt(x: bool) {
drop(x);
diff --git a/tests/mir-opt/remove_zsts.get_union.PreCodegen.after.mir b/tests/mir-opt/remove_zsts.get_union.PreCodegen.after.mir
index 7ac9ef3d4..5886a5bfe 100644
--- a/tests/mir-opt/remove_zsts.get_union.PreCodegen.after.mir
+++ b/tests/mir-opt/remove_zsts.get_union.PreCodegen.after.mir
@@ -1,10 +1,10 @@
// MIR for `get_union` after PreCodegen
fn get_union() -> Foo {
- let mut _0: Foo; // return place in scope 0 at $DIR/remove_zsts.rs:+0:19: +0:22
+ let mut _0: Foo;
bb0: {
- _0 = Foo { x: const () }; // scope 0 at $DIR/remove_zsts.rs:+1:5: +1:18
- return; // scope 0 at $DIR/remove_zsts.rs:+2:2: +2:2
+ _0 = Foo { x: const () };
+ return;
}
}
diff --git a/tests/mir-opt/remove_zsts.get_union.RemoveZsts.diff b/tests/mir-opt/remove_zsts.get_union.RemoveZsts.diff
index edd86ef0a..748c18ba7 100644
--- a/tests/mir-opt/remove_zsts.get_union.RemoveZsts.diff
+++ b/tests/mir-opt/remove_zsts.get_union.RemoveZsts.diff
@@ -2,19 +2,19 @@
+ // MIR for `get_union` after RemoveZsts
fn get_union() -> Foo {
- let mut _0: Foo; // return place in scope 0 at $DIR/remove_zsts.rs:+0:19: +0:22
- let mut _1: (); // in scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16
+ let mut _0: Foo;
+ let mut _1: ();
bb0: {
-- StorageLive(_1); // scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16
-- _1 = (); // scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16
-- _0 = Foo { x: move _1 }; // scope 0 at $DIR/remove_zsts.rs:+1:5: +1:18
-- StorageDead(_1); // scope 0 at $DIR/remove_zsts.rs:+1:17: +1:18
-+ nop; // scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16
-+ nop; // scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16
-+ _0 = Foo { x: const () }; // scope 0 at $DIR/remove_zsts.rs:+1:5: +1:18
-+ nop; // scope 0 at $DIR/remove_zsts.rs:+1:17: +1:18
- return; // scope 0 at $DIR/remove_zsts.rs:+2:2: +2:2
+- StorageLive(_1);
+- _1 = ();
+- _0 = Foo { x: move _1 };
+- StorageDead(_1);
++ nop;
++ nop;
++ _0 = Foo { x: const () };
++ nop;
+ return;
}
}
diff --git a/tests/mir-opt/remove_zsts.rs b/tests/mir-opt/remove_zsts.rs
index 1cf7ad6e3..e33a272fe 100644
--- a/tests/mir-opt/remove_zsts.rs
+++ b/tests/mir-opt/remove_zsts.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
union Foo {
x: (),
y: u64,
diff --git a/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir
deleted file mode 100644
index 3b479710b..000000000
--- a/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir
+++ /dev/null
@@ -1,188 +0,0 @@
-// MIR for `array_casts` after SimplifyCfg-elaborate-drops
-
-fn array_casts() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/retag.rs:+0:18: +0:18
- let mut _1: [usize; 2]; // in scope 0 at $DIR/retag.rs:+1:9: +1:14
- let mut _3: *mut [usize; 2]; // in scope 0 at $DIR/retag.rs:+2:13: +2:19
- let mut _4: &mut [usize; 2]; // in scope 0 at $DIR/retag.rs:+2:13: +2:19
- let _5: (); // in scope 0 at $DIR/retag.rs:+3:5: +3:30
- let mut _6: *mut usize; // in scope 0 at $DIR/retag.rs:+3:15: +3:23
- let mut _7: *mut usize; // in scope 0 at $DIR/retag.rs:+3:15: +3:16
- let mut _10: *const [usize; 2]; // in scope 0 at $DIR/retag.rs:+6:13: +6:15
- let _11: &[usize; 2]; // in scope 0 at $DIR/retag.rs:+6:13: +6:15
- let _12: (); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _13: (&usize, &usize); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _14: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _15: usize; // in scope 0 at $DIR/retag.rs:+7:16: +7:36
- let mut _16: *const usize; // in scope 0 at $DIR/retag.rs:+7:26: +7:34
- let mut _17: *const usize; // in scope 0 at $DIR/retag.rs:+7:26: +7:27
- let mut _18: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _19: usize; // in scope 0 at $DIR/retag.rs:+7:38: +7:39
- let mut _22: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _23: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _24: usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _25: usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _26: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _28: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _29: core::panicking::AssertKind; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _30: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _31: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _32: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _33: &usize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _34: std::option::Option<std::fmt::Arguments<'_>>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/retag.rs:+1:9: +1:14
- let _2: *mut usize; // in scope 1 at $DIR/retag.rs:+2:9: +2:10
- scope 2 {
- debug p => _2; // in scope 2 at $DIR/retag.rs:+2:9: +2:10
- let _8: [usize; 2]; // in scope 2 at $DIR/retag.rs:+5:9: +5:10
- scope 3 {
- }
- scope 4 {
- debug x => _8; // in scope 4 at $DIR/retag.rs:+5:9: +5:10
- let _9: *const usize; // in scope 4 at $DIR/retag.rs:+6:9: +6:10
- scope 5 {
- debug p => _9; // in scope 5 at $DIR/retag.rs:+6:9: +6:10
- let _20: &usize; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _21: &usize; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _35: &usize; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- scope 6 {
- }
- scope 7 {
- debug left_val => _20; // in scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- debug right_val => _21; // in scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let _27: core::panicking::AssertKind; // in scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- scope 8 {
- debug kind => _27; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
- }
- }
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/retag.rs:+1:9: +1:14
- _1 = [const 0_usize, const 0_usize]; // scope 0 at $DIR/retag.rs:+1:29: +1:35
- StorageLive(_2); // scope 1 at $DIR/retag.rs:+2:9: +2:10
- StorageLive(_3); // scope 1 at $DIR/retag.rs:+2:13: +2:19
- StorageLive(_4); // scope 1 at $DIR/retag.rs:+2:13: +2:19
- _4 = &mut _1; // scope 1 at $DIR/retag.rs:+2:13: +2:19
- _3 = &raw mut (*_4); // scope 1 at $DIR/retag.rs:+2:13: +2:19
- _2 = move _3 as *mut usize (Pointer(ArrayToPointer)); // scope 1 at $DIR/retag.rs:+2:13: +2:33
- StorageDead(_3); // scope 1 at $DIR/retag.rs:+2:32: +2:33
- StorageDead(_4); // scope 1 at $DIR/retag.rs:+2:33: +2:34
- StorageLive(_5); // scope 2 at $DIR/retag.rs:+3:5: +3:30
- StorageLive(_6); // scope 3 at $DIR/retag.rs:+3:15: +3:23
- StorageLive(_7); // scope 3 at $DIR/retag.rs:+3:15: +3:16
- _7 = _2; // scope 3 at $DIR/retag.rs:+3:15: +3:16
- _6 = ptr::mut_ptr::<impl *mut usize>::add(move _7, const 1_usize) -> bb1; // scope 3 at $DIR/retag.rs:+3:15: +3:23
- // mir::Constant
- // + span: $DIR/retag.rs:61:17: 61:20
- // + literal: Const { ty: unsafe fn(*mut usize, usize) -> *mut usize {ptr::mut_ptr::<impl *mut usize>::add}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_7); // scope 3 at $DIR/retag.rs:+3:22: +3:23
- (*_6) = const 1_usize; // scope 3 at $DIR/retag.rs:+3:14: +3:27
- StorageDead(_6); // scope 3 at $DIR/retag.rs:+3:27: +3:28
- _5 = const (); // scope 3 at $DIR/retag.rs:+3:5: +3:30
- StorageDead(_5); // scope 2 at $DIR/retag.rs:+3:29: +3:30
- StorageLive(_8); // scope 2 at $DIR/retag.rs:+5:9: +5:10
- _8 = [const 0_usize, const 1_usize]; // scope 2 at $DIR/retag.rs:+5:25: +5:31
- StorageLive(_9); // scope 4 at $DIR/retag.rs:+6:9: +6:10
- StorageLive(_10); // scope 4 at $DIR/retag.rs:+6:13: +6:15
- StorageLive(_11); // scope 4 at $DIR/retag.rs:+6:13: +6:15
- _11 = &_8; // scope 4 at $DIR/retag.rs:+6:13: +6:15
- _10 = &raw const (*_11); // scope 4 at $DIR/retag.rs:+6:13: +6:15
- _9 = move _10 as *const usize (Pointer(ArrayToPointer)); // scope 4 at $DIR/retag.rs:+6:13: +6:31
- StorageDead(_10); // scope 4 at $DIR/retag.rs:+6:30: +6:31
- StorageDead(_11); // scope 4 at $DIR/retag.rs:+6:31: +6:32
- StorageLive(_12); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_14); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_15); // scope 5 at $DIR/retag.rs:+7:16: +7:36
- StorageLive(_16); // scope 6 at $DIR/retag.rs:+7:26: +7:34
- StorageLive(_17); // scope 6 at $DIR/retag.rs:+7:26: +7:27
- _17 = _9; // scope 6 at $DIR/retag.rs:+7:26: +7:27
- _16 = ptr::const_ptr::<impl *const usize>::add(move _17, const 1_usize) -> bb2; // scope 6 at $DIR/retag.rs:+7:26: +7:34
- // mir::Constant
- // + span: $DIR/retag.rs:65:28: 65:31
- // + literal: Const { ty: unsafe fn(*const usize, usize) -> *const usize {ptr::const_ptr::<impl *const usize>::add}, val: Value(<ZST>) }
- }
-
- bb2: {
- StorageDead(_17); // scope 6 at $DIR/retag.rs:+7:33: +7:34
- _15 = (*_16); // scope 6 at $DIR/retag.rs:+7:25: +7:34
- _14 = &_15; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _35 = const _; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
- // + literal: Const { ty: &usize, val: Unevaluated(array_casts, [], Some(promoted[0])) }
- Retag(_35); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _18 = &(*_35); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _13 = (move _14, move _18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- Retag(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_14); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _20 = (_13.0: &usize); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- Retag(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _21 = (_13.1: &usize); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- Retag(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_22); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_24); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _24 = (*_20); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _25 = (*_21); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _23 = Eq(move _24, move _25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_24); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _22 = Not(move _23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- switchInt(move _22) -> [0: bb4, otherwise: bb3]; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb3: {
- StorageLive(_27); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _27 = core::panicking::AssertKind::Eq; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_28); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_29); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _29 = move _27; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_30); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _31 = &(*_20); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _30 = &(*_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_32); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _33 = &(*_21); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _32 = &(*_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageLive(_34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _34 = Option::<Arguments<'_>>::None; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- Retag(_34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _28 = core::panicking::assert_failed::<usize, usize>(move _29, move _30, move _32, move _34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
- // + literal: Const { ty: for<'a, 'b, 'c> fn(core::panicking::AssertKind, &'a usize, &'b usize, Option<Arguments<'c>>) -> ! {core::panicking::assert_failed::<usize, usize>}, val: Value(<ZST>) }
- }
-
- bb4: {
- _12 = const (); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_22); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_16); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_15); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- StorageDead(_12); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _0 = const (); // scope 0 at $DIR/retag.rs:+0:18: +8:2
- StorageDead(_9); // scope 4 at $DIR/retag.rs:+8:1: +8:2
- StorageDead(_8); // scope 2 at $DIR/retag.rs:+8:1: +8:2
- StorageDead(_2); // scope 1 at $DIR/retag.rs:+8:1: +8:2
- StorageDead(_1); // scope 0 at $DIR/retag.rs:+8:1: +8:2
- return; // scope 0 at $DIR/retag.rs:+8:2: +8:2
- }
-}
diff --git a/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-abort.mir
new file mode 100644
index 000000000..9c4d6da29
--- /dev/null
+++ b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-abort.mir
@@ -0,0 +1,174 @@
+// MIR for `array_casts` after SimplifyCfg-elaborate-drops
+
+fn array_casts() -> () {
+ let mut _0: ();
+ let mut _1: [usize; 2];
+ let mut _3: *mut [usize; 2];
+ let mut _4: &mut [usize; 2];
+ let _5: ();
+ let mut _6: *mut usize;
+ let mut _7: *mut usize;
+ let mut _10: *const [usize; 2];
+ let _11: &[usize; 2];
+ let _12: ();
+ let mut _13: (&usize, &usize);
+ let mut _14: &usize;
+ let _15: usize;
+ let mut _16: *const usize;
+ let mut _17: *const usize;
+ let mut _18: &usize;
+ let _19: usize;
+ let mut _22: bool;
+ let mut _23: usize;
+ let mut _24: usize;
+ 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;
+ scope 2 {
+ debug p => _2;
+ let _8: [usize; 2];
+ scope 3 {
+ }
+ scope 4 {
+ debug x => _8;
+ let _9: *const usize;
+ scope 5 {
+ debug p => _9;
+ let _20: &usize;
+ let _21: &usize;
+ let mut _34: &usize;
+ scope 6 {
+ }
+ scope 7 {
+ debug left_val => _20;
+ debug right_val => _21;
+ let _26: core::panicking::AssertKind;
+ scope 8 {
+ debug kind => _26;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = [const 0_usize, const 0_usize];
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &mut _1;
+ _3 = &raw mut (*_4);
+ _2 = move _3 as *mut usize (PointerCoercion(ArrayToPointer));
+ StorageDead(_3);
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = _2;
+ _6 = std::ptr::mut_ptr::<impl *mut usize>::add(move _7, const 1_usize) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_7);
+ (*_6) = const 1_usize;
+ StorageDead(_6);
+ _5 = const ();
+ StorageDead(_5);
+ StorageLive(_8);
+ _8 = [const 0_usize, const 1_usize];
+ StorageLive(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = &_8;
+ _10 = &raw const (*_11);
+ _9 = move _10 as *const usize (PointerCoercion(ArrayToPointer));
+ StorageDead(_10);
+ StorageDead(_11);
+ StorageLive(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+ StorageLive(_15);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = _9;
+ _16 = std::ptr::const_ptr::<impl *const usize>::add(move _17, const 1_usize) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_17);
+ _15 = (*_16);
+ _14 = &_15;
+ StorageLive(_18);
+ _34 = const _;
+ Retag(_34);
+ _18 = &(*_34);
+ _13 = (move _14, move _18);
+ Retag(_13);
+ StorageDead(_18);
+ StorageDead(_14);
+ StorageLive(_20);
+ _20 = (_13.0: &usize);
+ Retag(_20);
+ StorageLive(_21);
+ _21 = (_13.1: &usize);
+ Retag(_21);
+ StorageLive(_22);
+ StorageLive(_23);
+ _23 = (*_20);
+ StorageLive(_24);
+ _24 = (*_21);
+ _22 = Eq(move _23, move _24);
+ switchInt(move _22) -> [0: bb4, otherwise: bb3];
+ }
+
+ bb3: {
+ StorageDead(_24);
+ StorageDead(_23);
+ _12 = const ();
+ StorageDead(_22);
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_16);
+ StorageDead(_15);
+ StorageDead(_13);
+ StorageDead(_12);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_2);
+ 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
new file mode 100644
index 000000000..ca064ab2b
--- /dev/null
+++ b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -0,0 +1,174 @@
+// MIR for `array_casts` after SimplifyCfg-elaborate-drops
+
+fn array_casts() -> () {
+ let mut _0: ();
+ let mut _1: [usize; 2];
+ let mut _3: *mut [usize; 2];
+ let mut _4: &mut [usize; 2];
+ let _5: ();
+ let mut _6: *mut usize;
+ let mut _7: *mut usize;
+ let mut _10: *const [usize; 2];
+ let _11: &[usize; 2];
+ let _12: ();
+ let mut _13: (&usize, &usize);
+ let mut _14: &usize;
+ let _15: usize;
+ let mut _16: *const usize;
+ let mut _17: *const usize;
+ let mut _18: &usize;
+ let _19: usize;
+ let mut _22: bool;
+ let mut _23: usize;
+ let mut _24: usize;
+ 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;
+ scope 2 {
+ debug p => _2;
+ let _8: [usize; 2];
+ scope 3 {
+ }
+ scope 4 {
+ debug x => _8;
+ let _9: *const usize;
+ scope 5 {
+ debug p => _9;
+ let _20: &usize;
+ let _21: &usize;
+ let mut _34: &usize;
+ scope 6 {
+ }
+ scope 7 {
+ debug left_val => _20;
+ debug right_val => _21;
+ let _26: core::panicking::AssertKind;
+ scope 8 {
+ debug kind => _26;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = [const 0_usize, const 0_usize];
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &mut _1;
+ _3 = &raw mut (*_4);
+ _2 = move _3 as *mut usize (PointerCoercion(ArrayToPointer));
+ StorageDead(_3);
+ StorageDead(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = _2;
+ _6 = std::ptr::mut_ptr::<impl *mut usize>::add(move _7, const 1_usize) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_7);
+ (*_6) = const 1_usize;
+ StorageDead(_6);
+ _5 = const ();
+ StorageDead(_5);
+ StorageLive(_8);
+ _8 = [const 0_usize, const 1_usize];
+ StorageLive(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = &_8;
+ _10 = &raw const (*_11);
+ _9 = move _10 as *const usize (PointerCoercion(ArrayToPointer));
+ StorageDead(_10);
+ StorageDead(_11);
+ StorageLive(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+ StorageLive(_15);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = _9;
+ _16 = std::ptr::const_ptr::<impl *const usize>::add(move _17, const 1_usize) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_17);
+ _15 = (*_16);
+ _14 = &_15;
+ StorageLive(_18);
+ _34 = const _;
+ Retag(_34);
+ _18 = &(*_34);
+ _13 = (move _14, move _18);
+ Retag(_13);
+ StorageDead(_18);
+ StorageDead(_14);
+ StorageLive(_20);
+ _20 = (_13.0: &usize);
+ Retag(_20);
+ StorageLive(_21);
+ _21 = (_13.1: &usize);
+ Retag(_21);
+ StorageLive(_22);
+ StorageLive(_23);
+ _23 = (*_20);
+ StorageLive(_24);
+ _24 = (*_21);
+ _22 = Eq(move _23, move _24);
+ switchInt(move _22) -> [0: bb4, otherwise: bb3];
+ }
+
+ bb3: {
+ StorageDead(_24);
+ StorageDead(_23);
+ _12 = const ();
+ StorageDead(_22);
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_16);
+ StorageDead(_15);
+ StorageDead(_13);
+ StorageDead(_12);
+ _0 = const ();
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_2);
+ 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.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir b/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir
deleted file mode 100644
index f495f147b..000000000
--- a/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir
+++ /dev/null
@@ -1,22 +0,0 @@
-// MIR for `std::ptr::drop_in_place` after SimplifyCfg-make_shim
-
-fn std::ptr::drop_in_place(_1: *mut Test) -> () {
- let mut _0: (); // return place in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- let mut _2: &mut Test; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- let mut _3: &mut Test; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- let mut _4: (); // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
-
- bb0: {
- _2 = &mut (*_1); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- Retag([fn entry] _2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- _3 = &mut (*_2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- _4 = <Test as Drop>::drop(move _3) -> bb1; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- // mir::Constant
- // + span: $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- // + literal: Const { ty: for<'a> fn(&'a mut Test) {<Test as Drop>::drop}, val: Value(<ZST>) }
- }
-
- bb1: {
- return; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- }
-}
diff --git a/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-abort.mir b/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-abort.mir
new file mode 100644
index 000000000..146f4240f
--- /dev/null
+++ b/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-abort.mir
@@ -0,0 +1,23 @@
+// MIR for `std::ptr::drop_in_place` after SimplifyCfg-make_shim
+
+fn std::ptr::drop_in_place(_1: *mut Test) -> () {
+ let mut _0: ();
+ let mut _2: &mut Test;
+ let mut _3: &mut Test;
+ let mut _4: ();
+
+ bb0: {
+ _2 = &mut (*_1);
+ Retag([fn entry] _2);
+ _3 = &mut (*_2);
+ _4 = <Test as Drop>::drop(move _3) -> [return: bb2, unwind: bb1];
+ }
+
+ bb1 (cleanup): {
+ resume;
+ }
+
+ bb2: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-unwind.mir b/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-unwind.mir
new file mode 100644
index 000000000..70c53bafa
--- /dev/null
+++ b/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-unwind.mir
@@ -0,0 +1,19 @@
+// MIR for `std::ptr::drop_in_place` after SimplifyCfg-make_shim
+
+fn std::ptr::drop_in_place(_1: *mut Test) -> () {
+ let mut _0: ();
+ let mut _2: &mut Test;
+ let mut _3: &mut Test;
+ let mut _4: ();
+
+ bb0: {
+ _2 = &mut (*_1);
+ Retag([fn entry] _2);
+ _3 = &mut (*_2);
+ _4 = <Test as Drop>::drop(move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.mir
deleted file mode 100644
index 9e5c119a2..000000000
--- a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.mir
+++ /dev/null
@@ -1,21 +0,0 @@
-// MIR for `main::{closure#0}` after SimplifyCfg-elaborate-drops
-
-fn main::{closure#0}(_1: &[closure@main::{closure#0}], _2: &i32) -> &i32 {
- debug x => _2; // in scope 0 at $DIR/retag.rs:+0:32: +0:33
- let mut _0: &i32; // return place in scope 0 at $DIR/retag.rs:+0:44: +0:48
- let _3: &i32; // in scope 0 at $DIR/retag.rs:+1:13: +1:15
- scope 1 {
- debug _y => _3; // in scope 1 at $DIR/retag.rs:+1:13: +1:15
- }
-
- bb0: {
- Retag([fn entry] _1); // scope 0 at $DIR/retag.rs:+0:31: +3:6
- Retag([fn entry] _2); // scope 0 at $DIR/retag.rs:+0:32: +0:33
- StorageLive(_3); // scope 0 at $DIR/retag.rs:+1:13: +1:15
- _3 = _2; // scope 0 at $DIR/retag.rs:+1:18: +1:19
- Retag(_3); // scope 0 at $DIR/retag.rs:+1:18: +1:19
- _0 = &(*_2); // scope 1 at $DIR/retag.rs:+2:9: +2:10
- StorageDead(_3); // scope 0 at $DIR/retag.rs:+3:5: +3:6
- return; // scope 0 at $DIR/retag.rs:+3:6: +3:6
- }
-}
diff --git a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir
new file mode 100644
index 000000000..7f3310919
--- /dev/null
+++ b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-abort.mir
@@ -0,0 +1,21 @@
+// MIR for `main::{closure#0}` after SimplifyCfg-elaborate-drops
+
+fn main::{closure#0}(_1: &{closure@main::{closure#0}}, _2: &i32) -> &i32 {
+ debug x => _2;
+ let mut _0: &i32;
+ let _3: &i32;
+ scope 1 {
+ debug _y => _3;
+ }
+
+ bb0: {
+ Retag([fn entry] _1);
+ Retag([fn entry] _2);
+ StorageLive(_3);
+ _3 = _2;
+ Retag(_3);
+ _0 = &(*_2);
+ StorageDead(_3);
+ return;
+ }
+}
diff --git a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
new file mode 100644
index 000000000..7f3310919
--- /dev/null
+++ b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -0,0 +1,21 @@
+// MIR for `main::{closure#0}` after SimplifyCfg-elaborate-drops
+
+fn main::{closure#0}(_1: &{closure@main::{closure#0}}, _2: &i32) -> &i32 {
+ debug x => _2;
+ let mut _0: &i32;
+ let _3: &i32;
+ scope 1 {
+ debug _y => _3;
+ }
+
+ bb0: {
+ Retag([fn entry] _1);
+ Retag([fn entry] _2);
+ StorageLive(_3);
+ _3 = _2;
+ Retag(_3);
+ _0 = &(*_2);
+ StorageDead(_3);
+ return;
+ }
+}
diff --git a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir
deleted file mode 100644
index 4eef028e1..000000000
--- a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir
+++ /dev/null
@@ -1,199 +0,0 @@
-// MIR for `main` after SimplifyCfg-elaborate-drops
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/retag.rs:+0:11: +0:11
- let mut _1: i32; // in scope 0 at $DIR/retag.rs:+1:9: +1:14
- let _2: (); // in scope 0 at $DIR/retag.rs:+2:5: +8:6
- let mut _4: &Test; // in scope 0 at $DIR/retag.rs:+3:17: +3:36
- let _5: Test; // in scope 0 at $DIR/retag.rs:+3:17: +3:24
- let mut _6: &mut i32; // in scope 0 at $DIR/retag.rs:+3:29: +3:35
- let mut _7: &mut i32; // in scope 0 at $DIR/retag.rs:+3:29: +3:35
- let mut _9: &mut i32; // in scope 0 at $DIR/retag.rs:+4:19: +4:20
- let mut _12: *mut i32; // in scope 0 at $DIR/retag.rs:+7:18: +7:29
- let mut _14: [closure@main::{closure#0}]; // in scope 0 at $DIR/retag.rs:+11:31: +14:6
- let mut _16: for<'a> fn(&'a i32) -> &'a i32; // in scope 0 at $DIR/retag.rs:+15:14: +15:15
- let mut _17: &i32; // in scope 0 at $DIR/retag.rs:+15:16: +15:18
- let _18: &i32; // in scope 0 at $DIR/retag.rs:+15:16: +15:18
- let _19: &i32; // in scope 0 at $DIR/retag.rs:+18:5: +18:24
- let mut _20: &Test; // in scope 0 at $DIR/retag.rs:+18:5: +18:24
- let _21: Test; // in scope 0 at $DIR/retag.rs:+18:5: +18:12
- let mut _22: &i32; // in scope 0 at $DIR/retag.rs:+18:21: +18:23
- let _23: &i32; // in scope 0 at $DIR/retag.rs:+18:21: +18:23
- let _24: i32; // in scope 0 at $DIR/retag.rs:+18:22: +18:23
- let mut _26: *const i32; // in scope 0 at $DIR/retag.rs:+21:14: +21:28
- let _27: (); // in scope 0 at $DIR/retag.rs:+23:5: +23:18
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/retag.rs:+1:9: +1:14
- let _3: &mut i32; // in scope 1 at $DIR/retag.rs:+3:13: +3:14
- let _13: for<'a> fn(&'a i32) -> &'a i32; // in scope 1 at $DIR/retag.rs:+11:9: +11:10
- scope 2 {
- debug v => _3; // in scope 2 at $DIR/retag.rs:+3:13: +3:14
- let _8: &mut i32; // in scope 2 at $DIR/retag.rs:+4:13: +4:14
- scope 3 {
- debug w => _8; // in scope 3 at $DIR/retag.rs:+4:13: +4:14
- let _10: &mut i32; // in scope 3 at $DIR/retag.rs:+5:13: +5:14
- scope 4 {
- debug w => _10; // in scope 4 at $DIR/retag.rs:+5:13: +5:14
- let _11: *mut i32; // in scope 4 at $DIR/retag.rs:+7:13: +7:15
- scope 5 {
- debug _w => _11; // in scope 5 at $DIR/retag.rs:+7:13: +7:15
- }
- }
- }
- }
- scope 6 {
- debug c => _13; // in scope 6 at $DIR/retag.rs:+11:9: +11:10
- let _15: &i32; // in scope 6 at $DIR/retag.rs:+15:9: +15:11
- scope 7 {
- debug _w => _15; // in scope 7 at $DIR/retag.rs:+15:9: +15:11
- let _25: *const i32; // in scope 7 at $DIR/retag.rs:+21:9: +21:11
- let mut _28: &i32; // in scope 7 at $DIR/retag.rs:+18:21: +18:23
- scope 8 {
- debug _w => _25; // in scope 8 at $DIR/retag.rs:+21:9: +21:11
- }
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/retag.rs:+1:9: +1:14
- _1 = const 0_i32; // scope 0 at $DIR/retag.rs:+1:17: +1:18
- StorageLive(_2); // scope 1 at $DIR/retag.rs:+2:5: +8:6
- StorageLive(_3); // scope 1 at $DIR/retag.rs:+3:13: +3:14
- StorageLive(_4); // scope 1 at $DIR/retag.rs:+3:17: +3:36
- StorageLive(_5); // scope 1 at $DIR/retag.rs:+3:17: +3:24
- _5 = Test(const 0_i32); // scope 1 at $DIR/retag.rs:+3:17: +3:24
- _4 = &_5; // scope 1 at $DIR/retag.rs:+3:17: +3:36
- StorageLive(_6); // scope 1 at $DIR/retag.rs:+3:29: +3:35
- StorageLive(_7); // scope 1 at $DIR/retag.rs:+3:29: +3:35
- _7 = &mut _1; // scope 1 at $DIR/retag.rs:+3:29: +3:35
- _6 = &mut (*_7); // scope 1 at $DIR/retag.rs:+3:29: +3:35
- _3 = Test::foo(move _4, move _6) -> [return: bb1, unwind: bb8]; // scope 1 at $DIR/retag.rs:+3:17: +3:36
- // mir::Constant
- // + span: $DIR/retag.rs:33:25: 33:28
- // + literal: Const { ty: for<'a, 'x> fn(&'a Test, &'x mut i32) -> &'x mut i32 {Test::foo}, val: Value(<ZST>) }
- }
-
- bb1: {
- Retag(_3); // scope 1 at $DIR/retag.rs:+3:17: +3:36
- StorageDead(_6); // scope 1 at $DIR/retag.rs:+3:35: +3:36
- StorageDead(_4); // scope 1 at $DIR/retag.rs:+3:35: +3:36
- StorageDead(_7); // scope 1 at $DIR/retag.rs:+3:36: +3:37
- drop(_5) -> [return: bb2, unwind: bb9]; // scope 1 at $DIR/retag.rs:+3:36: +3:37
- }
-
- bb2: {
- StorageDead(_5); // scope 1 at $DIR/retag.rs:+3:36: +3:37
- StorageLive(_8); // scope 2 at $DIR/retag.rs:+4:13: +4:14
- StorageLive(_9); // scope 2 at $DIR/retag.rs:+4:19: +4:20
- _9 = move _3; // scope 2 at $DIR/retag.rs:+4:19: +4:20
- Retag(_9); // scope 2 at $DIR/retag.rs:+4:19: +4:20
- _8 = &mut (*_9); // scope 2 at $DIR/retag.rs:+4:19: +4:20
- StorageDead(_9); // scope 2 at $DIR/retag.rs:+4:22: +4:23
- StorageLive(_10); // scope 3 at $DIR/retag.rs:+5:13: +5:14
- _10 = move _8; // scope 3 at $DIR/retag.rs:+5:17: +5:18
- Retag(_10); // scope 3 at $DIR/retag.rs:+5:17: +5:18
- StorageLive(_11); // scope 4 at $DIR/retag.rs:+7:13: +7:15
- StorageLive(_12); // scope 4 at $DIR/retag.rs:+7:18: +7:29
- _12 = &raw mut (*_10); // scope 4 at $DIR/retag.rs:+7:18: +7:19
- _11 = _12; // scope 4 at $DIR/retag.rs:+7:18: +7:29
- StorageDead(_12); // scope 4 at $DIR/retag.rs:+7:29: +7:30
- _2 = const (); // scope 1 at $DIR/retag.rs:+2:5: +8:6
- StorageDead(_11); // scope 4 at $DIR/retag.rs:+8:5: +8:6
- StorageDead(_10); // scope 3 at $DIR/retag.rs:+8:5: +8:6
- StorageDead(_8); // scope 2 at $DIR/retag.rs:+8:5: +8:6
- StorageDead(_3); // scope 1 at $DIR/retag.rs:+8:5: +8:6
- StorageDead(_2); // scope 1 at $DIR/retag.rs:+8:5: +8:6
- StorageLive(_13); // scope 1 at $DIR/retag.rs:+11:9: +11:10
- StorageLive(_14); // scope 1 at $DIR/retag.rs:+11:31: +14:6
- _14 = [closure@main::{closure#0}]; // scope 1 at $DIR/retag.rs:+11:31: +14:6
- // closure
- // + def_id: DefId(0:14 ~ retag[7654]::main::{closure#0})
- // + substs: [
- // i8,
- // for<'a> extern "rust-call" fn((&'a i32,)) -> &'a i32,
- // (),
- // ]
- Retag(_14); // scope 1 at $DIR/retag.rs:+11:31: +14:6
- _13 = move _14 as for<'a> fn(&'a i32) -> &'a i32 (Pointer(ClosureFnPointer(Normal))); // scope 1 at $DIR/retag.rs:+11:31: +14:6
- StorageDead(_14); // scope 1 at $DIR/retag.rs:+11:47: +11:48
- StorageLive(_15); // scope 6 at $DIR/retag.rs:+15:9: +15:11
- StorageLive(_16); // scope 6 at $DIR/retag.rs:+15:14: +15:15
- _16 = _13; // scope 6 at $DIR/retag.rs:+15:14: +15:15
- StorageLive(_17); // scope 6 at $DIR/retag.rs:+15:16: +15:18
- StorageLive(_18); // scope 6 at $DIR/retag.rs:+15:16: +15:18
- _18 = &_1; // scope 6 at $DIR/retag.rs:+15:16: +15:18
- _17 = &(*_18); // scope 6 at $DIR/retag.rs:+15:16: +15:18
- _15 = move _16(move _17) -> bb3; // scope 6 at $DIR/retag.rs:+15:14: +15:19
- }
-
- bb3: {
- Retag(_15); // scope 6 at $DIR/retag.rs:+15:14: +15:19
- StorageDead(_17); // scope 6 at $DIR/retag.rs:+15:18: +15:19
- StorageDead(_16); // scope 6 at $DIR/retag.rs:+15:18: +15:19
- StorageDead(_18); // scope 6 at $DIR/retag.rs:+15:19: +15:20
- StorageLive(_19); // scope 7 at $DIR/retag.rs:+18:5: +18:24
- StorageLive(_20); // scope 7 at $DIR/retag.rs:+18:5: +18:24
- StorageLive(_21); // scope 7 at $DIR/retag.rs:+18:5: +18:12
- _21 = Test(const 0_i32); // scope 7 at $DIR/retag.rs:+18:5: +18:12
- _20 = &_21; // scope 7 at $DIR/retag.rs:+18:5: +18:24
- StorageLive(_22); // scope 7 at $DIR/retag.rs:+18:21: +18:23
- StorageLive(_23); // scope 7 at $DIR/retag.rs:+18:21: +18:23
- _28 = const _; // scope 7 at $DIR/retag.rs:+18:21: +18:23
- // mir::Constant
- // + span: $DIR/retag.rs:48:21: 48:23
- // + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) }
- Retag(_28); // scope 7 at $DIR/retag.rs:+18:21: +18:23
- _23 = &(*_28); // scope 7 at $DIR/retag.rs:+18:21: +18:23
- _22 = &(*_23); // scope 7 at $DIR/retag.rs:+18:21: +18:23
- _19 = Test::foo_shr(move _20, move _22) -> [return: bb4, unwind: bb7]; // scope 7 at $DIR/retag.rs:+18:5: +18:24
- // mir::Constant
- // + span: $DIR/retag.rs:48:13: 48:20
- // + literal: Const { ty: for<'a, 'x> fn(&'a Test, &'x i32) -> &'x i32 {Test::foo_shr}, val: Value(<ZST>) }
- }
-
- bb4: {
- Retag(_19); // scope 7 at $DIR/retag.rs:+18:5: +18:24
- StorageDead(_22); // scope 7 at $DIR/retag.rs:+18:23: +18:24
- StorageDead(_20); // scope 7 at $DIR/retag.rs:+18:23: +18:24
- StorageDead(_23); // scope 7 at $DIR/retag.rs:+18:24: +18:25
- drop(_21) -> [return: bb5, unwind: bb9]; // scope 7 at $DIR/retag.rs:+18:24: +18:25
- }
-
- bb5: {
- StorageDead(_21); // scope 7 at $DIR/retag.rs:+18:24: +18:25
- StorageDead(_19); // scope 7 at $DIR/retag.rs:+18:24: +18:25
- StorageLive(_25); // scope 7 at $DIR/retag.rs:+21:9: +21:11
- StorageLive(_26); // scope 7 at $DIR/retag.rs:+21:14: +21:28
- _26 = &raw const (*_15); // scope 7 at $DIR/retag.rs:+21:14: +21:16
- _25 = _26; // scope 7 at $DIR/retag.rs:+21:14: +21:28
- StorageDead(_26); // scope 7 at $DIR/retag.rs:+21:28: +21:29
- StorageLive(_27); // scope 8 at $DIR/retag.rs:+23:5: +23:18
- _27 = array_casts() -> bb6; // scope 8 at $DIR/retag.rs:+23:5: +23:18
- // mir::Constant
- // + span: $DIR/retag.rs:53:5: 53:16
- // + literal: Const { ty: fn() {array_casts}, val: Value(<ZST>) }
- }
-
- bb6: {
- StorageDead(_27); // scope 8 at $DIR/retag.rs:+23:18: +23:19
- _0 = const (); // scope 0 at $DIR/retag.rs:+0:11: +24:2
- StorageDead(_25); // scope 7 at $DIR/retag.rs:+24:1: +24:2
- StorageDead(_15); // scope 6 at $DIR/retag.rs:+24:1: +24:2
- StorageDead(_13); // scope 1 at $DIR/retag.rs:+24:1: +24:2
- StorageDead(_1); // scope 0 at $DIR/retag.rs:+24:1: +24:2
- return; // scope 0 at $DIR/retag.rs:+24:2: +24:2
- }
-
- bb7 (cleanup): {
- drop(_21) -> [return: bb9, unwind terminate]; // scope 7 at $DIR/retag.rs:+18:24: +18:25
- }
-
- bb8 (cleanup): {
- drop(_5) -> [return: bb9, unwind terminate]; // scope 1 at $DIR/retag.rs:+3:36: +3:37
- }
-
- bb9 (cleanup): {
- resume; // scope 0 at $DIR/retag.rs:+0:1: +24:2
- }
-}
diff --git a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir
new file mode 100644
index 000000000..ec894fa51
--- /dev/null
+++ b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir
@@ -0,0 +1,168 @@
+// MIR for `main` after SimplifyCfg-elaborate-drops
+
+fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+ let _2: ();
+ let mut _4: &Test;
+ let _5: Test;
+ let mut _6: &mut i32;
+ let mut _7: &mut i32;
+ let mut _9: &mut i32;
+ let mut _12: *mut i32;
+ let mut _14: {closure@main::{closure#0}};
+ let mut _16: for<'a> fn(&'a i32) -> &'a i32;
+ let mut _17: &i32;
+ let _18: &i32;
+ let _19: &i32;
+ let mut _20: &Test;
+ let _21: Test;
+ let mut _22: &i32;
+ let _23: &i32;
+ let _24: i32;
+ let mut _26: *const i32;
+ let _27: ();
+ scope 1 {
+ debug x => _1;
+ let _3: &mut i32;
+ let _13: for<'a> fn(&'a i32) -> &'a i32;
+ scope 2 {
+ debug v => _3;
+ let _8: &mut i32;
+ scope 3 {
+ debug w => _8;
+ let _10: &mut i32;
+ scope 4 {
+ debug w => _10;
+ let _11: *mut i32;
+ scope 5 {
+ debug _w => _11;
+ }
+ }
+ }
+ }
+ scope 6 {
+ debug c => _13;
+ let _15: &i32;
+ scope 7 {
+ debug _w => _15;
+ let _25: *const i32;
+ let mut _28: &i32;
+ scope 8 {
+ debug _w => _25;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 0_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = Test(const 0_i32);
+ _4 = &_5;
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &mut _1;
+ _6 = &mut (*_7);
+ _3 = Test::foo(move _4, move _6) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ Retag(_3);
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_7);
+ drop(_5) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = move _3;
+ Retag(_9);
+ _8 = &mut (*_9);
+ StorageDead(_9);
+ StorageLive(_10);
+ _10 = move _8;
+ Retag(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = &raw mut (*_10);
+ _11 = _12;
+ StorageDead(_12);
+ _2 = const ();
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_8);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_13);
+ StorageLive(_14);
+ _14 = {closure@main::{closure#0}};
+ Retag(_14);
+ _13 = move _14 as for<'a> fn(&'a i32) -> &'a i32 (PointerCoercion(ClosureFnPointer(Normal)));
+ StorageDead(_14);
+ StorageLive(_15);
+ StorageLive(_16);
+ _16 = _13;
+ StorageLive(_17);
+ StorageLive(_18);
+ _18 = &_1;
+ _17 = &(*_18);
+ _15 = move _16(move _17) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ Retag(_15);
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageDead(_18);
+ StorageLive(_19);
+ StorageLive(_20);
+ StorageLive(_21);
+ _21 = Test(const 0_i32);
+ _20 = &_21;
+ StorageLive(_22);
+ StorageLive(_23);
+ _28 = const _;
+ Retag(_28);
+ _23 = &(*_28);
+ _22 = &(*_23);
+ _19 = Test::foo_shr(move _20, move _22) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ Retag(_19);
+ StorageDead(_22);
+ StorageDead(_20);
+ StorageDead(_23);
+ drop(_21) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_21);
+ StorageDead(_19);
+ StorageLive(_25);
+ StorageLive(_26);
+ _26 = &raw const (*_15);
+ _25 = _26;
+ StorageDead(_26);
+ StorageLive(_27);
+ _27 = array_casts() -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_27);
+ _0 = const ();
+ StorageDead(_25);
+ StorageDead(_15);
+ StorageDead(_13);
+ StorageDead(_1);
+ return;
+ }
+}
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
new file mode 100644
index 000000000..d89124f69
--- /dev/null
+++ b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -0,0 +1,180 @@
+// MIR for `main` after SimplifyCfg-elaborate-drops
+
+fn main() -> () {
+ let mut _0: ();
+ let mut _1: i32;
+ let _2: ();
+ let mut _4: &Test;
+ let _5: Test;
+ let mut _6: &mut i32;
+ let mut _7: &mut i32;
+ let mut _9: &mut i32;
+ let mut _12: *mut i32;
+ let mut _14: {closure@main::{closure#0}};
+ let mut _16: for<'a> fn(&'a i32) -> &'a i32;
+ let mut _17: &i32;
+ let _18: &i32;
+ let _19: &i32;
+ let mut _20: &Test;
+ let _21: Test;
+ let mut _22: &i32;
+ let _23: &i32;
+ let _24: i32;
+ let mut _26: *const i32;
+ let _27: ();
+ scope 1 {
+ debug x => _1;
+ let _3: &mut i32;
+ let _13: for<'a> fn(&'a i32) -> &'a i32;
+ scope 2 {
+ debug v => _3;
+ let _8: &mut i32;
+ scope 3 {
+ debug w => _8;
+ let _10: &mut i32;
+ scope 4 {
+ debug w => _10;
+ let _11: *mut i32;
+ scope 5 {
+ debug _w => _11;
+ }
+ }
+ }
+ }
+ scope 6 {
+ debug c => _13;
+ let _15: &i32;
+ scope 7 {
+ debug _w => _15;
+ let _25: *const i32;
+ let mut _28: &i32;
+ scope 8 {
+ debug _w => _25;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 0_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = Test(const 0_i32);
+ _4 = &_5;
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = &mut _1;
+ _6 = &mut (*_7);
+ _3 = Test::foo(move _4, move _6) -> [return: bb1, unwind: bb8];
+ }
+
+ bb1: {
+ Retag(_3);
+ StorageDead(_6);
+ StorageDead(_4);
+ StorageDead(_7);
+ drop(_5) -> [return: bb2, unwind: bb9];
+ }
+
+ bb2: {
+ StorageDead(_5);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = move _3;
+ Retag(_9);
+ _8 = &mut (*_9);
+ StorageDead(_9);
+ StorageLive(_10);
+ _10 = move _8;
+ Retag(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = &raw mut (*_10);
+ _11 = _12;
+ StorageDead(_12);
+ _2 = const ();
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_8);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_13);
+ StorageLive(_14);
+ _14 = {closure@main::{closure#0}};
+ Retag(_14);
+ _13 = move _14 as for<'a> fn(&'a i32) -> &'a i32 (PointerCoercion(ClosureFnPointer(Normal)));
+ StorageDead(_14);
+ StorageLive(_15);
+ StorageLive(_16);
+ _16 = _13;
+ StorageLive(_17);
+ StorageLive(_18);
+ _18 = &_1;
+ _17 = &(*_18);
+ _15 = move _16(move _17) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ Retag(_15);
+ StorageDead(_17);
+ StorageDead(_16);
+ StorageDead(_18);
+ StorageLive(_19);
+ StorageLive(_20);
+ StorageLive(_21);
+ _21 = Test(const 0_i32);
+ _20 = &_21;
+ StorageLive(_22);
+ StorageLive(_23);
+ _28 = const _;
+ Retag(_28);
+ _23 = &(*_28);
+ _22 = &(*_23);
+ _19 = Test::foo_shr(move _20, move _22) -> [return: bb4, unwind: bb7];
+ }
+
+ bb4: {
+ Retag(_19);
+ StorageDead(_22);
+ StorageDead(_20);
+ StorageDead(_23);
+ drop(_21) -> [return: bb5, unwind: bb9];
+ }
+
+ bb5: {
+ StorageDead(_21);
+ StorageDead(_19);
+ StorageLive(_25);
+ StorageLive(_26);
+ _26 = &raw const (*_15);
+ _25 = _26;
+ StorageDead(_26);
+ StorageLive(_27);
+ _27 = array_casts() -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_27);
+ _0 = const ();
+ StorageDead(_25);
+ StorageDead(_15);
+ StorageDead(_13);
+ StorageDead(_1);
+ return;
+ }
+
+ bb7 (cleanup): {
+ drop(_21) -> [return: bb9, unwind terminate(cleanup)];
+ }
+
+ bb8 (cleanup): {
+ drop(_5) -> [return: bb9, unwind terminate(cleanup)];
+ }
+
+ bb9 (cleanup): {
+ resume;
+ }
+}
diff --git a/tests/mir-opt/retag.rs b/tests/mir-opt/retag.rs
index 86deb0e7c..1e4b017da 100644
--- a/tests/mir-opt/retag.rs
+++ b/tests/mir-opt/retag.rs
@@ -1,5 +1,6 @@
+// skip-filecheck
// unit-test: AddRetag
-// ignore-wasm32-bare compiled with panic=abort by default
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// ignore-tidy-linelength
// compile-flags: -Z mir-emit-retag -Z mir-opt-level=0 -Z span_free_formats
diff --git a/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir
deleted file mode 100644
index 4b50205fa..000000000
--- a/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir
+++ /dev/null
@@ -1,18 +0,0 @@
-// MIR for `<impl at $DIR/retag.rs:12:1: 12:10>::foo` after SimplifyCfg-elaborate-drops
-
-fn <impl at $DIR/retag.rs:12:1: 12:10>::foo(_1: &Test, _2: &mut i32) -> &mut i32 {
- debug self => _1; // in scope 0 at $DIR/retag.rs:+0:16: +0:21
- debug x => _2; // in scope 0 at $DIR/retag.rs:+0:23: +0:24
- let mut _0: &mut i32; // return place in scope 0 at $DIR/retag.rs:+0:42: +0:53
- let mut _3: &mut i32; // in scope 0 at $DIR/retag.rs:+1:9: +1:10
-
- bb0: {
- Retag([fn entry] _1); // scope 0 at $DIR/retag.rs:+0:16: +0:21
- Retag([fn entry] _2); // scope 0 at $DIR/retag.rs:+0:23: +0:24
- StorageLive(_3); // scope 0 at $DIR/retag.rs:+1:9: +1:10
- _3 = &mut (*_2); // scope 0 at $DIR/retag.rs:+1:9: +1:10
- _0 = &mut (*_3); // scope 0 at $DIR/retag.rs:+1:9: +1:10
- StorageDead(_3); // scope 0 at $DIR/retag.rs:+2:5: +2:6
- return; // scope 0 at $DIR/retag.rs:+2:6: +2:6
- }
-}
diff --git a/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir
new file mode 100644
index 000000000..285db435f
--- /dev/null
+++ b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir
@@ -0,0 +1,18 @@
+// MIR for `<impl at $DIR/retag.rs:13:1: 13:10>::foo` after SimplifyCfg-elaborate-drops
+
+fn <impl at $DIR/retag.rs:13:1: 13:10>::foo(_1: &Test, _2: &mut i32) -> &mut i32 {
+ debug self => _1;
+ debug x => _2;
+ let mut _0: &mut i32;
+ let mut _3: &mut i32;
+
+ bb0: {
+ Retag([fn entry] _1);
+ Retag([fn entry] _2);
+ StorageLive(_3);
+ _3 = &mut (*_2);
+ _0 = &mut (*_3);
+ StorageDead(_3);
+ return;
+ }
+}
diff --git a/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
new file mode 100644
index 000000000..285db435f
--- /dev/null
+++ b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -0,0 +1,18 @@
+// MIR for `<impl at $DIR/retag.rs:13:1: 13:10>::foo` after SimplifyCfg-elaborate-drops
+
+fn <impl at $DIR/retag.rs:13:1: 13:10>::foo(_1: &Test, _2: &mut i32) -> &mut i32 {
+ debug self => _1;
+ debug x => _2;
+ let mut _0: &mut i32;
+ let mut _3: &mut i32;
+
+ bb0: {
+ Retag([fn entry] _1);
+ Retag([fn entry] _2);
+ StorageLive(_3);
+ _3 = &mut (*_2);
+ _0 = &mut (*_3);
+ StorageDead(_3);
+ return;
+ }
+}
diff --git a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.mir
deleted file mode 100644
index f32a84e4c..000000000
--- a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.mir
+++ /dev/null
@@ -1,15 +0,0 @@
-// MIR for `<impl at $DIR/retag.rs:12:1: 12:10>::foo_shr` after SimplifyCfg-elaborate-drops
-
-fn <impl at $DIR/retag.rs:12:1: 12:10>::foo_shr(_1: &Test, _2: &i32) -> &i32 {
- debug self => _1; // in scope 0 at $DIR/retag.rs:+0:20: +0:25
- debug x => _2; // in scope 0 at $DIR/retag.rs:+0:27: +0:28
- let mut _0: &i32; // return place in scope 0 at $DIR/retag.rs:+0:42: +0:49
-
- bb0: {
- Retag([fn entry] _1); // scope 0 at $DIR/retag.rs:+0:20: +0:25
- Retag([fn entry] _2); // scope 0 at $DIR/retag.rs:+0:27: +0:28
- _0 = _2; // scope 0 at $DIR/retag.rs:+1:9: +1:10
- Retag(_0); // scope 0 at $DIR/retag.rs:+1:9: +1:10
- return; // scope 0 at $DIR/retag.rs:+2:6: +2:6
- }
-}
diff --git a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir
new file mode 100644
index 000000000..9ad607b2f
--- /dev/null
+++ b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir
@@ -0,0 +1,15 @@
+// MIR for `<impl at $DIR/retag.rs:13:1: 13:10>::foo_shr` after SimplifyCfg-elaborate-drops
+
+fn <impl at $DIR/retag.rs:13:1: 13:10>::foo_shr(_1: &Test, _2: &i32) -> &i32 {
+ debug self => _1;
+ debug x => _2;
+ let mut _0: &i32;
+
+ bb0: {
+ Retag([fn entry] _1);
+ Retag([fn entry] _2);
+ _0 = _2;
+ Retag(_0);
+ return;
+ }
+}
diff --git a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
new file mode 100644
index 000000000..9ad607b2f
--- /dev/null
+++ b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -0,0 +1,15 @@
+// MIR for `<impl at $DIR/retag.rs:13:1: 13:10>::foo_shr` after SimplifyCfg-elaborate-drops
+
+fn <impl at $DIR/retag.rs:13:1: 13:10>::foo_shr(_1: &Test, _2: &i32) -> &i32 {
+ debug self => _1;
+ debug x => _2;
+ let mut _0: &i32;
+
+ bb0: {
+ Retag([fn entry] _1);
+ Retag([fn entry] _2);
+ _0 = _2;
+ Retag(_0);
+ return;
+ }
+}
diff --git a/tests/mir-opt/return_an_array.rs b/tests/mir-opt/return_an_array.rs
index bea3c317c..09146a824 100644
--- a/tests/mir-opt/return_an_array.rs
+++ b/tests/mir-opt/return_an_array.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// this tests move up progration, which is not yet implemented
fn foo() -> [u8; 1024] {
diff --git a/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff b/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff
index bdf1de468..d287b20c4 100644
--- a/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff
+++ b/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff
@@ -2,121 +2,99 @@
+ // MIR for `identity` after SeparateConstSwitch
fn identity(_1: Result<i32, i32>) -> Result<i32, i32> {
- debug x => _1; // in scope 0 at $DIR/separate_const_switch.rs:+0:13: +0:14
- let mut _0: std::result::Result<i32, i32>; // return place in scope 0 at $DIR/separate_const_switch.rs:+0:37: +0:53
- let mut _2: i32; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
- let mut _3: std::ops::ControlFlow<std::result::Result<std::convert::Infallible, i32>, i32>; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
- let mut _4: std::result::Result<i32, i32>; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9
- let mut _5: isize; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
- let _6: std::result::Result<std::convert::Infallible, i32>; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
- let mut _7: !; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
- let mut _8: std::result::Result<std::convert::Infallible, i32>; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
- let _9: i32; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
+ debug x => _1;
+ let mut _0: std::result::Result<i32, i32>;
+ let mut _2: i32;
+ let mut _3: std::ops::ControlFlow<std::result::Result<std::convert::Infallible, i32>, i32>;
+ let mut _4: std::result::Result<i32, i32>;
+ let mut _5: isize;
+ let _6: std::result::Result<std::convert::Infallible, i32>;
+ let mut _7: std::result::Result<std::convert::Infallible, i32>;
+ let _8: i32;
scope 1 {
- debug residual => _6; // in scope 1 at $DIR/separate_const_switch.rs:+1:9: +1:10
+ debug residual => _6;
scope 2 {
- scope 8 (inlined #[track_caller] <Result<i32, i32> as FromResidual<Result<Infallible, i32>>>::from_residual) { // at $DIR/separate_const_switch.rs:25:8: 25:10
- debug residual => _8; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
- let _14: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
- let mut _15: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
+ scope 8 (inlined #[track_caller] <Result<i32, i32> as FromResidual<Result<Infallible, i32>>>::from_residual) {
+ debug residual => _6;
+ let _13: i32;
+ let mut _14: i32;
scope 9 {
- debug e => _14; // in scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
- scope 10 (inlined <i32 as From<i32>>::from) { // at $SRC_DIR/core/src/result.rs:LL:COL
- debug t => _14; // in scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
+ debug e => _13;
+ scope 10 (inlined <i32 as From<i32>>::from) {
+ debug t => _13;
}
}
}
}
}
scope 3 {
- debug val => _9; // in scope 3 at $DIR/separate_const_switch.rs:+1:8: +1:10
+ debug val => _8;
scope 4 {
}
}
- scope 5 (inlined <Result<i32, i32> as Try>::branch) { // at $DIR/separate_const_switch.rs:25:8: 25:10
- debug self => _4; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- let mut _10: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- let _11: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- let _12: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- let mut _13: std::result::Result<std::convert::Infallible, i32>; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
+ scope 5 (inlined <Result<i32, i32> as Try>::branch) {
+ debug self => _1;
+ let mut _9: isize;
+ let _10: i32;
+ let _11: i32;
+ let mut _12: std::result::Result<std::convert::Infallible, i32>;
scope 6 {
- debug v => _11; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
+ debug v => _10;
}
scope 7 {
- debug e => _12; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ debug e => _11;
}
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
- StorageLive(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
- StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9
- _4 = _1; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9
- StorageLive(_11); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
- StorageLive(_12); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
- _10 = discriminant(_4); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- switchInt(move _10) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
+ StorageLive(_3);
+ StorageLive(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ _9 = discriminant(_1);
+ switchInt(move _9) -> [0: bb6, 1: bb5, otherwise: bb2];
}
bb1: {
- StorageDead(_12); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
- StorageDead(_11); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
- StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
- _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
- switchInt(move _5) -> [0: bb2, 1: bb4, otherwise: bb3]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
+ _8 = ((_3 as Continue).0: i32);
+ _0 = Result::<i32, i32>::Ok(_8);
+ StorageDead(_3);
+ return;
}
bb2: {
- StorageLive(_9); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
- _9 = ((_3 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
- _2 = _9; // scope 4 at $DIR/separate_const_switch.rs:+1:8: +1:10
- StorageDead(_9); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
- _0 = Result::<i32, i32>::Ok(move _2); // scope 0 at $DIR/separate_const_switch.rs:+1:5: +1:11
- StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:+1:10: +1:11
- StorageDead(_3); // scope 0 at $DIR/separate_const_switch.rs:+2:1: +2:2
- return; // scope 0 at $DIR/separate_const_switch.rs:+2:2: +2:2
+ unreachable;
}
bb3: {
- unreachable; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
+ _6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>);
+ _13 = ((_6 as Err).0: i32);
+ _0 = Result::<i32, i32>::Err(move _13);
+ StorageDead(_3);
+ return;
}
bb4: {
- StorageLive(_6); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
- _6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
- StorageLive(_8); // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10
- _8 = _6; // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10
- StorageLive(_14); // scope 2 at $DIR/separate_const_switch.rs:+1:8: +1:10
- _14 = move ((_8 as Err).0: i32); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
- StorageLive(_15); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
- _15 = move _14; // scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
- _0 = Result::<i32, i32>::Err(move _15); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
- StorageDead(_15); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
- StorageDead(_14); // scope 2 at $DIR/separate_const_switch.rs:+1:8: +1:10
- StorageDead(_8); // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10
- StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
- StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:+1:10: +1:11
- StorageDead(_3); // scope 0 at $DIR/separate_const_switch.rs:+2:1: +2:2
- return; // scope 0 at $DIR/separate_const_switch.rs:+2:2: +2:2
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_9);
+ _5 = discriminant(_3);
+ switchInt(move _5) -> [0: bb1, 1: bb3, otherwise: bb2];
}
bb5: {
- _12 = move ((_4 as Err).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- StorageLive(_13); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- _13 = Result::<Infallible, i32>::Err(move _12); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- _3 = ControlFlow::<Result<Infallible, i32>, i32>::Break(move _13); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- StorageDead(_13); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
- goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
+ _11 = ((_1 as Err).0: i32);
+ StorageLive(_12);
+ _12 = Result::<Infallible, i32>::Err(move _11);
+ _3 = ControlFlow::<Result<Infallible, i32>, i32>::Break(move _12);
+ StorageDead(_12);
+ goto -> bb4;
}
bb6: {
- unreachable; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- }
-
- bb7: {
- _11 = move ((_4 as Ok).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- _3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(move _11); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
- goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
+ _10 = ((_1 as Ok).0: i32);
+ _3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(move _10);
+ goto -> bb4;
}
}
diff --git a/tests/mir-opt/separate_const_switch.rs b/tests/mir-opt/separate_const_switch.rs
index c809e5629..3f43cdf43 100644
--- a/tests/mir-opt/separate_const_switch.rs
+++ b/tests/mir-opt/separate_const_switch.rs
@@ -1,6 +1,9 @@
+// skip-filecheck
#![feature(control_flow_enum)]
#![feature(try_trait_v2)]
+// compile-flags: -Zunsound-mir-opts
+
use std::ops::ControlFlow;
// EMIT_MIR separate_const_switch.too_complex.SeparateConstSwitch.diff
diff --git a/tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff b/tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff
index b5e0a66d8..e2bf33f7f 100644
--- a/tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff
+++ b/tests/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff
@@ -2,90 +2,75 @@
+ // MIR for `too_complex` after SeparateConstSwitch
fn too_complex(_1: Result<i32, usize>) -> Option<i32> {
- debug x => _1; // in scope 0 at $DIR/separate_const_switch.rs:+0:16: +0:17
- let mut _0: std::option::Option<i32>; // return place in scope 0 at $DIR/separate_const_switch.rs:+0:42: +0:53
- let mut _2: std::ops::ControlFlow<usize, i32>; // in scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6
- let mut _3: isize; // in scope 0 at $DIR/separate_const_switch.rs:+7:13: +7:18
- let _4: i32; // in scope 0 at $DIR/separate_const_switch.rs:+7:16: +7:17
- let mut _5: i32; // in scope 0 at $DIR/separate_const_switch.rs:+7:44: +7:45
- let _6: usize; // in scope 0 at $DIR/separate_const_switch.rs:+8:17: +8:18
- let mut _7: usize; // in scope 0 at $DIR/separate_const_switch.rs:+8:42: +8:43
- let mut _8: isize; // in scope 0 at $DIR/separate_const_switch.rs:+11:9: +11:33
- let _9: i32; // in scope 0 at $DIR/separate_const_switch.rs:+11:31: +11:32
- let mut _10: i32; // in scope 0 at $DIR/separate_const_switch.rs:+11:42: +11:43
- let _11: usize; // in scope 0 at $DIR/separate_const_switch.rs:+12:28: +12:29
+ debug x => _1;
+ let mut _0: std::option::Option<i32>;
+ let mut _2: std::ops::ControlFlow<usize, i32>;
+ let mut _3: isize;
+ let _4: i32;
+ let mut _5: i32;
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: isize;
+ let _9: i32;
+ let mut _10: i32;
+ let _11: usize;
scope 1 {
- debug v => _4; // in scope 1 at $DIR/separate_const_switch.rs:+7:16: +7:17
+ debug v => _4;
}
scope 2 {
- debug r => _6; // in scope 2 at $DIR/separate_const_switch.rs:+8:17: +8:18
+ debug r => _6;
}
scope 3 {
- debug v => _9; // in scope 3 at $DIR/separate_const_switch.rs:+11:31: +11:32
+ debug v => _9;
}
scope 4 {
- debug r => _11; // in scope 4 at $DIR/separate_const_switch.rs:+12:28: +12:29
+ debug r => _11;
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6
- _3 = discriminant(_1); // scope 0 at $DIR/separate_const_switch.rs:+6:15: +6:16
- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+6:9: +6:16
+ StorageLive(_2);
+ _3 = discriminant(_1);
+ switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2];
}
bb1: {
- StorageLive(_6); // scope 0 at $DIR/separate_const_switch.rs:+8:17: +8:18
- _6 = ((_1 as Err).0: usize); // scope 0 at $DIR/separate_const_switch.rs:+8:17: +8:18
- StorageLive(_7); // scope 2 at $DIR/separate_const_switch.rs:+8:42: +8:43
- _7 = _6; // scope 2 at $DIR/separate_const_switch.rs:+8:42: +8:43
- _2 = ControlFlow::<usize, i32>::Break(move _7); // scope 2 at $DIR/separate_const_switch.rs:+8:23: +8:44
- StorageDead(_7); // scope 2 at $DIR/separate_const_switch.rs:+8:43: +8:44
- StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:+8:43: +8:44
- goto -> bb4; // scope 0 at $DIR/separate_const_switch.rs:+8:43: +8:44
+ _6 = ((_1 as Err).0: usize);
+ _2 = ControlFlow::<usize, i32>::Break(_6);
+ goto -> bb4;
}
bb2: {
- unreachable; // scope 0 at $DIR/separate_const_switch.rs:+6:15: +6:16
+ unreachable;
}
bb3: {
- StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:+7:16: +7:17
- _4 = ((_1 as Ok).0: i32); // scope 0 at $DIR/separate_const_switch.rs:+7:16: +7:17
- StorageLive(_5); // scope 1 at $DIR/separate_const_switch.rs:+7:44: +7:45
- _5 = _4; // scope 1 at $DIR/separate_const_switch.rs:+7:44: +7:45
- _2 = ControlFlow::<usize, i32>::Continue(move _5); // scope 1 at $DIR/separate_const_switch.rs:+7:22: +7:46
- StorageDead(_5); // scope 1 at $DIR/separate_const_switch.rs:+7:45: +7:46
- StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+7:45: +7:46
- goto -> bb4; // scope 0 at $DIR/separate_const_switch.rs:+7:45: +7:46
+ _4 = ((_1 as Ok).0: i32);
+ _2 = ControlFlow::<usize, i32>::Continue(_4);
+ goto -> bb4;
}
bb4: {
- _8 = discriminant(_2); // scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6
- switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+5:5: +10:6
+ _8 = discriminant(_2);
+ switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb2];
}
bb5: {
- StorageLive(_11); // scope 0 at $DIR/separate_const_switch.rs:+12:28: +12:29
- _11 = ((_2 as Break).0: usize); // scope 0 at $DIR/separate_const_switch.rs:+12:28: +12:29
- _0 = Option::<i32>::None; // scope 4 at $DIR/separate_const_switch.rs:+12:34: +12:38
- StorageDead(_11); // scope 0 at $DIR/separate_const_switch.rs:+12:37: +12:38
- goto -> bb7; // scope 0 at $DIR/separate_const_switch.rs:+12:37: +12:38
+ StorageLive(_11);
+ _11 = ((_2 as Break).0: usize);
+ _0 = Option::<i32>::None;
+ StorageDead(_11);
+ goto -> bb7;
}
bb6: {
- StorageLive(_9); // scope 0 at $DIR/separate_const_switch.rs:+11:31: +11:32
- _9 = ((_2 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:+11:31: +11:32
- StorageLive(_10); // scope 3 at $DIR/separate_const_switch.rs:+11:42: +11:43
- _10 = _9; // scope 3 at $DIR/separate_const_switch.rs:+11:42: +11:43
- _0 = Option::<i32>::Some(move _10); // scope 3 at $DIR/separate_const_switch.rs:+11:37: +11:44
- StorageDead(_10); // scope 3 at $DIR/separate_const_switch.rs:+11:43: +11:44
- StorageDead(_9); // scope 0 at $DIR/separate_const_switch.rs:+11:43: +11:44
- goto -> bb7; // scope 0 at $DIR/separate_const_switch.rs:+11:43: +11:44
+ _9 = ((_2 as Continue).0: i32);
+ _0 = Option::<i32>::Some(_9);
+ goto -> bb7;
}
bb7: {
- StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:+14:1: +14:2
- return; // scope 0 at $DIR/separate_const_switch.rs:+14:2: +14:2
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/simplify_arm.rs b/tests/mir-opt/simplify_arm.rs
index 4c471ce04..e933cb987 100644
--- a/tests/mir-opt/simplify_arm.rs
+++ b/tests/mir-opt/simplify_arm.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z mir-opt-level=3 -Zunsound-mir-opts
// EMIT_MIR simplify_arm.id.SimplifyArmIdentity.diff
// EMIT_MIR simplify_arm.id.SimplifyBranchSame.diff
diff --git a/tests/mir-opt/simplify_arm_identity.rs b/tests/mir-opt/simplify_arm_identity.rs
index e122cd50e..1b546c393 100644
--- a/tests/mir-opt/simplify_arm_identity.rs
+++ b/tests/mir-opt/simplify_arm_identity.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Checks that `SimplifyArmIdentity` is not applied if enums have incompatible layouts.
// Regression test for issue #66856.
//
diff --git a/tests/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff b/tests/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff
index 8eb1aa1f3..f20ab869b 100644
--- a/tests/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff
+++ b/tests/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff
@@ -2,51 +2,47 @@
+ // MIR for `main` after SimplifyCfg-early-opt
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/simplify_cfg.rs:+0:11: +0:11
- let mut _1: (); // in scope 0 at $DIR/simplify_cfg.rs:+0:1: +6:2
- let mut _2: bool; // in scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17
- let mut _3: !; // in scope 0 at $DIR/simplify_cfg.rs:+2:18: +4:10
+ let mut _0: ();
+ let mut _1: ();
+ let mut _2: bool;
+ let mut _3: !;
bb0: {
- goto -> bb1; // scope 0 at $DIR/simplify_cfg.rs:+1:5: +5:6
+ goto -> bb1;
}
bb1: {
-- goto -> bb2; // scope 0 at $DIR/simplify_cfg.rs:+1:5: +5:6
-- }
--
-- bb2: {
- StorageLive(_2); // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17
-- _2 = bar() -> [return: bb3, unwind: bb6]; // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17
-+ _2 = bar() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17
- // mir::Constant
- // + span: $DIR/simplify_cfg.rs:9:12: 9:15
- // + literal: Const { ty: fn() -> bool {bar}, val: Value(<ZST>) }
+- goto -> bb2;
++ StorageLive(_2);
++ _2 = bar() -> [return: bb2, unwind: bb5];
}
-- bb3: {
-- switchInt(move _2) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17
-+ bb2: {
-+ switchInt(move _2) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17
+ bb2: {
+- StorageLive(_2);
+- _2 = bar() -> [return: bb3, unwind: bb6];
++ switchInt(move _2) -> [0: bb4, otherwise: bb3];
}
+ bb3: {
+- switchInt(move _2) -> [0: bb5, otherwise: bb4];
+- }
+-
- bb4: {
-+ bb3: {
- _0 = const (); // scope 0 at $DIR/simplify_cfg.rs:+3:13: +3:18
- StorageDead(_2); // scope 0 at $DIR/simplify_cfg.rs:+4:9: +4:10
- return; // scope 0 at $DIR/simplify_cfg.rs:+6:2: +6:2
+ _0 = const ();
+ StorageDead(_2);
+ return;
}
- bb5: {
+ bb4: {
- _1 = const (); // scope 0 at $DIR/simplify_cfg.rs:+4:10: +4:10
- StorageDead(_2); // scope 0 at $DIR/simplify_cfg.rs:+4:9: +4:10
- goto -> bb1; // scope 0 at $DIR/simplify_cfg.rs:+1:5: +5:6
+ _1 = const ();
+ StorageDead(_2);
+ goto -> bb1;
}
- bb6 (cleanup): {
+ bb5 (cleanup): {
- resume; // scope 0 at $DIR/simplify_cfg.rs:+0:1: +6:2
+ resume;
}
}
diff --git a/tests/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff b/tests/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff
index c61107d25..d106313f0 100644
--- a/tests/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff
+++ b/tests/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff
@@ -2,70 +2,67 @@
+ // MIR for `main` after SimplifyCfg-initial
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/simplify_cfg.rs:+0:11: +0:11
- let mut _1: (); // in scope 0 at $DIR/simplify_cfg.rs:+0:1: +6:2
- let mut _2: bool; // in scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17
- let mut _3: !; // in scope 0 at $DIR/simplify_cfg.rs:+2:18: +4:10
+ let mut _0: ();
+ let mut _1: ();
+ let mut _2: bool;
+ let mut _3: !;
bb0: {
- goto -> bb1; // scope 0 at $DIR/simplify_cfg.rs:+1:5: +5:6
+ goto -> bb1;
}
bb1: {
-- falseUnwind -> [real: bb2, unwind: bb11]; // scope 0 at $DIR/simplify_cfg.rs:+1:5: +5:6
-+ falseUnwind -> [real: bb2, unwind: bb6]; // scope 0 at $DIR/simplify_cfg.rs:+1:5: +5:6
+- falseUnwind -> [real: bb2, unwind: bb11];
++ falseUnwind -> [real: bb2, unwind: bb6];
}
bb2: {
- StorageLive(_2); // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17
-- _2 = bar() -> [return: bb3, unwind: bb11]; // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17
-+ _2 = bar() -> [return: bb3, unwind: bb6]; // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17
- // mir::Constant
- // + span: $DIR/simplify_cfg.rs:9:12: 9:15
- // + literal: Const { ty: fn() -> bool {bar}, val: Value(<ZST>) }
+ StorageLive(_2);
+- _2 = bar() -> [return: bb3, unwind: bb11];
++ _2 = bar() -> [return: bb3, unwind: bb6];
}
bb3: {
- switchInt(move _2) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17
+ switchInt(move _2) -> [0: bb5, otherwise: bb4];
}
bb4: {
- _0 = const (); // scope 0 at $DIR/simplify_cfg.rs:+3:13: +3:18
-- goto -> bb10; // scope 0 at $DIR/simplify_cfg.rs:+3:13: +3:18
-+ StorageDead(_2); // scope 0 at $DIR/simplify_cfg.rs:+4:9: +4:10
-+ return; // scope 0 at $DIR/simplify_cfg.rs:+6:2: +6:2
+ _0 = const ();
+- goto -> bb10;
++ StorageDead(_2);
++ return;
}
bb5: {
-- goto -> bb8; // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17
+- goto -> bb8;
- }
-
- bb6: {
-- unreachable; // scope 0 at $DIR/simplify_cfg.rs:+2:18: +4:10
+- unreachable;
- }
-
- bb7: {
-- goto -> bb9; // scope 0 at $DIR/simplify_cfg.rs:+2:9: +4:10
+- goto -> bb9;
- }
-
- bb8: {
- _1 = const (); // scope 0 at $DIR/simplify_cfg.rs:+4:10: +4:10
-- goto -> bb9; // scope 0 at $DIR/simplify_cfg.rs:+2:9: +4:10
+ _1 = const ();
+- goto -> bb9;
- }
-
- bb9: {
- StorageDead(_2); // scope 0 at $DIR/simplify_cfg.rs:+4:9: +4:10
- goto -> bb1; // scope 0 at $DIR/simplify_cfg.rs:+1:5: +5:6
+ StorageDead(_2);
+ goto -> bb1;
}
- bb10: {
-- StorageDead(_2); // scope 0 at $DIR/simplify_cfg.rs:+4:9: +4:10
-- return; // scope 0 at $DIR/simplify_cfg.rs:+6:2: +6:2
+- StorageDead(_2);
+- return;
- }
-
- bb11 (cleanup): {
+ bb6 (cleanup): {
- resume; // scope 0 at $DIR/simplify_cfg.rs:+0:1: +6:2
+ resume;
}
}
diff --git a/tests/mir-opt/simplify_cfg.rs b/tests/mir-opt/simplify_cfg.rs
index cf7eac440..a87aaca54 100644
--- a/tests/mir-opt/simplify_cfg.rs
+++ b/tests/mir-opt/simplify_cfg.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that the goto chain starting from bb0 is collapsed.
// compile-flags: -Cpanic=abort
// no-prefer-dynamic
diff --git a/tests/mir-opt/simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff b/tests/mir-opt/simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff
index f7f50206a..35c0a4d45 100644
--- a/tests/mir-opt/simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff
+++ b/tests/mir-opt/simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff
@@ -2,24 +2,24 @@
+ // MIR for `assert_nonzero_nonmax` after SimplifyCfg-after-uninhabited-enum-branching
fn assert_nonzero_nonmax(_1: u8) -> u8 {
- let mut _0: u8; // return place in scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+0:47: +0:49
+ let mut _0: u8;
bb0: {
-- switchInt(_1) -> [0: bb1, 255: bb2, otherwise: bb3]; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+3:13: +7:14
-+ switchInt(_1) -> [0: bb1, 255: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+3:13: +7:14
+- switchInt(_1) -> [0: bb1, 255: bb2, otherwise: bb3];
++ switchInt(_1) -> [0: bb1, 255: bb1, otherwise: bb2];
}
bb1: {
- unreachable; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+10:13: +10:26
+ unreachable;
}
bb2: {
-- unreachable; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+13:13: +13:26
+- unreachable;
- }
-
- bb3: {
- _0 = _1; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+16:13: +16:20
- return; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+17:13: +17:21
+ _0 = _1;
+ return;
}
}
diff --git a/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs b/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs
index e2578407f..5c4277898 100644
--- a/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs
+++ b/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
#![crate_type = "lib"]
diff --git a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff
deleted file mode 100644
index b473d0fde..000000000
--- a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff
+++ /dev/null
@@ -1,36 +0,0 @@
-- // MIR for `main` before SimplifyConstCondition-after-const-prop
-+ // MIR for `main` after SimplifyConstCondition-after-const-prop
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/simplify_if.rs:+0:11: +0:11
- let mut _1: bool; // in scope 0 at $DIR/simplify_if.rs:+1:8: +1:13
- let _2: (); // in scope 0 at $DIR/simplify_if.rs:+2:9: +2:15
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/simplify_if.rs:+1:8: +1:13
- _1 = const false; // scope 0 at $DIR/simplify_if.rs:+1:8: +1:13
-- switchInt(const false) -> [0: bb3, otherwise: bb1]; // scope 0 at $DIR/simplify_if.rs:+1:8: +1:13
-+ goto -> bb3; // scope 0 at $DIR/simplify_if.rs:+1:8: +1:13
- }
-
- bb1: {
- _2 = noop() -> bb2; // scope 0 at $DIR/simplify_if.rs:+2:9: +2:15
- // mir::Constant
- // + span: $DIR/simplify_if.rs:8:9: 8:13
- // + literal: Const { ty: fn() {noop}, val: Value(<ZST>) }
- }
-
- bb2: {
- goto -> bb4; // scope 0 at $DIR/simplify_if.rs:+1:5: +3:6
- }
-
- bb3: {
- goto -> bb4; // scope 0 at $DIR/simplify_if.rs:+1:5: +3:6
- }
-
- bb4: {
- StorageDead(_1); // scope 0 at $DIR/simplify_if.rs:+3:5: +3:6
- return; // scope 0 at $DIR/simplify_if.rs:+4:2: +4:2
- }
- }
-
diff --git a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff
new file mode 100644
index 000000000..64a435f22
--- /dev/null
+++ b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff
@@ -0,0 +1,29 @@
+- // MIR for `main` before SimplifyConstCondition-after-const-prop
++ // MIR for `main` after SimplifyConstCondition-after-const-prop
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
+
+ bb0: {
+- switchInt(const false) -> [0: bb3, otherwise: bb1];
++ goto -> bb3;
+ }
+
+ bb1: {
+ _1 = noop() -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ goto -> bb4;
+ }
+
+ bb3: {
+ goto -> bb4;
+ }
+
+ bb4: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff
new file mode 100644
index 000000000..146e00686
--- /dev/null
+++ b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff
@@ -0,0 +1,29 @@
+- // MIR for `main` before SimplifyConstCondition-after-const-prop
++ // MIR for `main` after SimplifyConstCondition-after-const-prop
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: ();
+
+ bb0: {
+- switchInt(const false) -> [0: bb3, otherwise: bb1];
++ goto -> bb3;
+ }
+
+ bb1: {
+ _1 = noop() -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ goto -> bb4;
+ }
+
+ bb3: {
+ goto -> bb4;
+ }
+
+ bb4: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/simplify_if.rs b/tests/mir-opt/simplify_if.rs
index b86f80a80..19b5806f7 100644
--- a/tests/mir-opt/simplify_if.rs
+++ b/tests/mir-opt/simplify_if.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#[inline(never)]
fn noop() {}
diff --git a/tests/mir-opt/simplify_locals.c.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.c.SimplifyLocals-before-const-prop.diff
index 1be27e963..7cc5e335c 100644
--- a/tests/mir-opt/simplify_locals.c.SimplifyLocals-before-const-prop.diff
+++ b/tests/mir-opt/simplify_locals.c.SimplifyLocals-before-const-prop.diff
@@ -2,32 +2,32 @@
+ // MIR for `c` after SimplifyLocals-before-const-prop
fn c() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/simplify_locals.rs:+0:8: +0:8
- let _1: [u8; 10]; // in scope 0 at $DIR/simplify_locals.rs:+1:9: +1:14
-- let mut _2: &[u8]; // in scope 0 at $DIR/simplify_locals.rs:+3:20: +3:26
-- let mut _3: &[u8; 10]; // in scope 0 at $DIR/simplify_locals.rs:+3:20: +3:26
-- let _4: &[u8; 10]; // in scope 0 at $DIR/simplify_locals.rs:+3:20: +3:26
+ let mut _0: ();
+ let _1: [u8; 10];
+- let mut _2: &[u8];
+- let mut _3: &[u8; 10];
+- let _4: &[u8; 10];
scope 1 {
- debug bytes => _1; // in scope 1 at $DIR/simplify_locals.rs:+1:9: +1:14
+ debug bytes => _1;
scope 2 {
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/simplify_locals.rs:+1:9: +1:14
- _1 = [const 0_u8; 10]; // scope 0 at $DIR/simplify_locals.rs:+1:17: +1:26
-- StorageLive(_2); // scope 1 at $DIR/simplify_locals.rs:+3:20: +3:26
-- StorageLive(_3); // scope 1 at $DIR/simplify_locals.rs:+3:20: +3:26
-- StorageLive(_4); // scope 1 at $DIR/simplify_locals.rs:+3:20: +3:26
-- _4 = &_1; // scope 1 at $DIR/simplify_locals.rs:+3:20: +3:26
-- _3 = &(*_4); // scope 1 at $DIR/simplify_locals.rs:+3:20: +3:26
-- _2 = move _3 as &[u8] (Pointer(Unsize)); // scope 1 at $DIR/simplify_locals.rs:+3:20: +3:26
-- StorageDead(_3); // scope 1 at $DIR/simplify_locals.rs:+3:25: +3:26
-- StorageDead(_4); // scope 1 at $DIR/simplify_locals.rs:+3:26: +3:27
-- StorageDead(_2); // scope 1 at $DIR/simplify_locals.rs:+3:26: +3:27
- _0 = const (); // scope 0 at $DIR/simplify_locals.rs:+0:8: +4:2
- StorageDead(_1); // scope 0 at $DIR/simplify_locals.rs:+4:1: +4:2
- return; // scope 0 at $DIR/simplify_locals.rs:+4:2: +4:2
+ StorageLive(_1);
+ _1 = [const 0_u8; 10];
+- StorageLive(_2);
+- StorageLive(_3);
+- StorageLive(_4);
+- _4 = &_1;
+- _3 = &(*_4);
+- _2 = move _3 as &[u8] (PointerCoercion(Unsize));
+- StorageDead(_3);
+- StorageDead(_4);
+- StorageDead(_2);
+ _0 = const ();
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/simplify_locals.d1.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.d1.SimplifyLocals-before-const-prop.diff
index 946595e32..d66caeb04 100644
--- a/tests/mir-opt/simplify_locals.d1.SimplifyLocals-before-const-prop.diff
+++ b/tests/mir-opt/simplify_locals.d1.SimplifyLocals-before-const-prop.diff
@@ -2,17 +2,17 @@
+ // MIR for `d1` after SimplifyLocals-before-const-prop
fn d1() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/simplify_locals.rs:+0:9: +0:9
-- let mut _1: E; // in scope 0 at $DIR/simplify_locals.rs:+2:13: +2:17
+ let mut _0: ();
+- let mut _1: E;
scope 1 {
}
bb0: {
-- StorageLive(_1); // scope 0 at $DIR/simplify_locals.rs:+2:13: +2:17
-- _1 = E::A; // scope 0 at $DIR/simplify_locals.rs:+2:13: +2:17
-- StorageDead(_1); // scope 0 at $DIR/simplify_locals.rs:+2:17: +2:18
- _0 = const (); // scope 0 at $DIR/simplify_locals.rs:+0:9: +3:2
- return; // scope 0 at $DIR/simplify_locals.rs:+3:2: +3:2
+- StorageLive(_1);
+- _1 = E::A;
+- StorageDead(_1);
+ _0 = const ();
+ return;
}
}
diff --git a/tests/mir-opt/simplify_locals.d2.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.d2.SimplifyLocals-before-const-prop.diff
index 6a5dc56e2..374c5895e 100644
--- a/tests/mir-opt/simplify_locals.d2.SimplifyLocals-before-const-prop.diff
+++ b/tests/mir-opt/simplify_locals.d2.SimplifyLocals-before-const-prop.diff
@@ -2,24 +2,24 @@
+ // MIR for `d2` after SimplifyLocals-before-const-prop
fn d2() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/simplify_locals.rs:+0:9: +0:9
-- let mut _1: E; // in scope 0 at $DIR/simplify_locals.rs:+2:22: +2:26
-- let mut _2: (i32, E); // in scope 0 at $DIR/simplify_locals.rs:+2:5: +2:17
-- let mut _3: E; // in scope 0 at $DIR/simplify_locals.rs:+2:11: +2:15
+ let mut _0: ();
+- let mut _1: E;
+- let mut _2: (i32, E);
+- let mut _3: E;
bb0: {
-- StorageLive(_1); // scope 0 at $DIR/simplify_locals.rs:+2:22: +2:26
-- _1 = E::B; // scope 0 at $DIR/simplify_locals.rs:+2:22: +2:26
-- StorageLive(_2); // scope 0 at $DIR/simplify_locals.rs:+2:5: +2:17
-- StorageLive(_3); // scope 0 at $DIR/simplify_locals.rs:+2:11: +2:15
-- _3 = E::A; // scope 0 at $DIR/simplify_locals.rs:+2:11: +2:15
-- _2 = (const 10_i32, move _3); // scope 0 at $DIR/simplify_locals.rs:+2:6: +2:16
-- StorageDead(_3); // scope 0 at $DIR/simplify_locals.rs:+2:15: +2:16
-- (_2.1: E) = move _1; // scope 0 at $DIR/simplify_locals.rs:+2:5: +2:26
-- StorageDead(_1); // scope 0 at $DIR/simplify_locals.rs:+2:25: +2:26
-- StorageDead(_2); // scope 0 at $DIR/simplify_locals.rs:+2:26: +2:27
- _0 = const (); // scope 0 at $DIR/simplify_locals.rs:+0:9: +3:2
- return; // scope 0 at $DIR/simplify_locals.rs:+3:2: +3:2
+- StorageLive(_1);
+- _1 = E::B;
+- StorageLive(_2);
+- StorageLive(_3);
+- _3 = E::A;
+- _2 = (const 10_i32, move _3);
+- StorageDead(_3);
+- (_2.1: E) = move _1;
+- StorageDead(_1);
+- StorageDead(_2);
+ _0 = const ();
+ return;
}
}
diff --git a/tests/mir-opt/simplify_locals.expose_addr.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.expose_addr.SimplifyLocals-before-const-prop.diff
index 9ca1dbbd0..9ebee3df6 100644
--- a/tests/mir-opt/simplify_locals.expose_addr.SimplifyLocals-before-const-prop.diff
+++ b/tests/mir-opt/simplify_locals.expose_addr.SimplifyLocals-before-const-prop.diff
@@ -2,20 +2,20 @@
+ // MIR for `expose_addr` after SimplifyLocals-before-const-prop
fn expose_addr(_1: *const usize) -> () {
- debug p => _1; // in scope 0 at $DIR/simplify_locals.rs:+0:16: +0:17
- let mut _0: (); // return place in scope 0 at $DIR/simplify_locals.rs:+0:33: +0:33
- let _2: usize; // in scope 0 at $DIR/simplify_locals.rs:+2:5: +2:15
- let mut _3: *const usize; // in scope 0 at $DIR/simplify_locals.rs:+2:5: +2:6
+ debug p => _1;
+ let mut _0: ();
+ let _2: usize;
+ let mut _3: *const usize;
bb0: {
- StorageLive(_2); // scope 0 at $DIR/simplify_locals.rs:+2:5: +2:15
- StorageLive(_3); // scope 0 at $DIR/simplify_locals.rs:+2:5: +2:6
- _3 = _1; // scope 0 at $DIR/simplify_locals.rs:+2:5: +2:6
- _2 = move _3 as usize (PointerExposeAddress); // scope 0 at $DIR/simplify_locals.rs:+2:5: +2:15
- StorageDead(_3); // scope 0 at $DIR/simplify_locals.rs:+2:14: +2:15
- StorageDead(_2); // scope 0 at $DIR/simplify_locals.rs:+2:15: +2:16
- _0 = const (); // scope 0 at $DIR/simplify_locals.rs:+0:33: +3:2
- return; // scope 0 at $DIR/simplify_locals.rs:+3:2: +3:2
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _2 = move _3 as usize (PointerExposeAddress);
+ StorageDead(_3);
+ StorageDead(_2);
+ _0 = const ();
+ return;
}
}
diff --git a/tests/mir-opt/simplify_locals.r.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.r.SimplifyLocals-before-const-prop.diff
index 19dacb427..c9f7785a4 100644
--- a/tests/mir-opt/simplify_locals.r.SimplifyLocals-before-const-prop.diff
+++ b/tests/mir-opt/simplify_locals.r.SimplifyLocals-before-const-prop.diff
@@ -2,12 +2,12 @@
+ // MIR for `r` after SimplifyLocals-before-const-prop
fn r() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/simplify_locals.rs:+0:8: +0:8
- let mut _1: i32; // in scope 0 at $DIR/simplify_locals.rs:+1:9: +1:14
-- let mut _2: &i32; // in scope 0 at $DIR/simplify_locals.rs:+3:13: +3:15
-- let mut _3: &mut i32; // in scope 0 at $DIR/simplify_locals.rs:+4:13: +4:19
+ let mut _0: ();
+ let mut _1: i32;
+- let mut _2: &i32;
+- let mut _3: &mut i32;
scope 1 {
- debug a => _1; // in scope 1 at $DIR/simplify_locals.rs:+1:9: +1:14
+ debug a => _1;
scope 2 {
scope 3 {
}
@@ -15,17 +15,17 @@
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/simplify_locals.rs:+1:9: +1:14
- _1 = const 1_i32; // scope 0 at $DIR/simplify_locals.rs:+1:17: +1:18
-- StorageLive(_2); // scope 1 at $DIR/simplify_locals.rs:+3:13: +3:15
-- _2 = &_1; // scope 1 at $DIR/simplify_locals.rs:+3:13: +3:15
-- StorageDead(_2); // scope 1 at $DIR/simplify_locals.rs:+3:15: +3:16
-- StorageLive(_3); // scope 2 at $DIR/simplify_locals.rs:+4:13: +4:19
-- _3 = &mut _1; // scope 2 at $DIR/simplify_locals.rs:+4:13: +4:19
-- StorageDead(_3); // scope 2 at $DIR/simplify_locals.rs:+4:19: +4:20
- _0 = const (); // scope 0 at $DIR/simplify_locals.rs:+0:8: +5:2
- StorageDead(_1); // scope 0 at $DIR/simplify_locals.rs:+5:1: +5:2
- return; // scope 0 at $DIR/simplify_locals.rs:+5:2: +5:2
+ StorageLive(_1);
+ _1 = const 1_i32;
+- StorageLive(_2);
+- _2 = &_1;
+- StorageDead(_2);
+- StorageLive(_3);
+- _3 = &mut _1;
+- StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/simplify_locals.rs b/tests/mir-opt/simplify_locals.rs
index 7bbc0481c..d4052e521 100644
--- a/tests/mir-opt/simplify_locals.rs
+++ b/tests/mir-opt/simplify_locals.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: SimplifyLocals-before-const-prop
diff --git a/tests/mir-opt/simplify_locals.t1.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.t1.SimplifyLocals-before-const-prop.diff
index 1b2e1158e..a903e8d78 100644
--- a/tests/mir-opt/simplify_locals.t1.SimplifyLocals-before-const-prop.diff
+++ b/tests/mir-opt/simplify_locals.t1.SimplifyLocals-before-const-prop.diff
@@ -2,21 +2,21 @@
+ // MIR for `t1` after SimplifyLocals-before-const-prop
fn t1() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/simplify_locals.rs:+0:9: +0:9
-- let _1: u32; // in scope 0 at $DIR/simplify_locals.rs:+2:14: +2:15
-- let mut _2: *mut u32; // in scope 0 at $DIR/simplify_locals.rs:+2:14: +2:15
+ let mut _0: ();
+- let _1: u32;
+- let mut _2: *mut u32;
scope 1 {
}
bb0: {
-- StorageLive(_1); // scope 0 at $DIR/simplify_locals.rs:+2:5: +2:17
-- StorageLive(_2); // scope 1 at $DIR/simplify_locals.rs:+2:14: +2:15
-- _2 = &/*tls*/ mut X; // scope 1 at $DIR/simplify_locals.rs:+2:14: +2:15
-- _1 = (*_2); // scope 1 at $DIR/simplify_locals.rs:+2:14: +2:15
-- StorageDead(_2); // scope 0 at $DIR/simplify_locals.rs:+2:17: +2:18
-- StorageDead(_1); // scope 0 at $DIR/simplify_locals.rs:+2:17: +2:18
- _0 = const (); // scope 0 at $DIR/simplify_locals.rs:+0:9: +3:2
- return; // scope 0 at $DIR/simplify_locals.rs:+3:2: +3:2
+- StorageLive(_1);
+- StorageLive(_2);
+- _2 = &/*tls*/ mut X;
+- _1 = (*_2);
+- StorageDead(_2);
+- StorageDead(_1);
+ _0 = const ();
+ return;
}
}
diff --git a/tests/mir-opt/simplify_locals.t2.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.t2.SimplifyLocals-before-const-prop.diff
index cf019357b..e72e71a13 100644
--- a/tests/mir-opt/simplify_locals.t2.SimplifyLocals-before-const-prop.diff
+++ b/tests/mir-opt/simplify_locals.t2.SimplifyLocals-before-const-prop.diff
@@ -2,21 +2,21 @@
+ // MIR for `t2` after SimplifyLocals-before-const-prop
fn t2() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/simplify_locals.rs:+0:9: +0:9
-- let _1: &mut u32; // in scope 0 at $DIR/simplify_locals.rs:+2:14: +2:20
-- let mut _2: *mut u32; // in scope 0 at $DIR/simplify_locals.rs:+2:19: +2:20
+ let mut _0: ();
+- let _1: &mut u32;
+- let mut _2: *mut u32;
scope 1 {
}
bb0: {
-- StorageLive(_1); // scope 0 at $DIR/simplify_locals.rs:+2:5: +2:22
-- StorageLive(_2); // scope 1 at $DIR/simplify_locals.rs:+2:19: +2:20
-- _2 = &/*tls*/ mut X; // scope 1 at $DIR/simplify_locals.rs:+2:19: +2:20
-- _1 = &mut (*_2); // scope 1 at $DIR/simplify_locals.rs:+2:14: +2:20
-- StorageDead(_2); // scope 0 at $DIR/simplify_locals.rs:+2:22: +2:23
-- StorageDead(_1); // scope 0 at $DIR/simplify_locals.rs:+2:22: +2:23
- _0 = const (); // scope 0 at $DIR/simplify_locals.rs:+0:9: +3:2
- return; // scope 0 at $DIR/simplify_locals.rs:+3:2: +3:2
+- StorageLive(_1);
+- StorageLive(_2);
+- _2 = &/*tls*/ mut X;
+- _1 = &mut (*_2);
+- StorageDead(_2);
+- StorageDead(_1);
+ _0 = const ();
+ return;
}
}
diff --git a/tests/mir-opt/simplify_locals.t3.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.t3.SimplifyLocals-before-const-prop.diff
index 90ee21580..37c367c82 100644
--- a/tests/mir-opt/simplify_locals.t3.SimplifyLocals-before-const-prop.diff
+++ b/tests/mir-opt/simplify_locals.t3.SimplifyLocals-before-const-prop.diff
@@ -2,25 +2,25 @@
+ // MIR for `t3` after SimplifyLocals-before-const-prop
fn t3() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/simplify_locals.rs:+0:9: +0:9
-- let _1: u32; // in scope 0 at $DIR/simplify_locals.rs:+2:14: +2:21
-- let mut _2: &mut u32; // in scope 0 at $DIR/simplify_locals.rs:+2:15: +2:21
-- let mut _3: *mut u32; // in scope 0 at $DIR/simplify_locals.rs:+2:20: +2:21
+ let mut _0: ();
+- let _1: u32;
+- let mut _2: &mut u32;
+- let mut _3: *mut u32;
scope 1 {
}
bb0: {
-- StorageLive(_1); // scope 0 at $DIR/simplify_locals.rs:+2:5: +2:23
-- StorageLive(_2); // scope 1 at $DIR/simplify_locals.rs:+2:15: +2:21
-- StorageLive(_3); // scope 1 at $DIR/simplify_locals.rs:+2:20: +2:21
-- _3 = &/*tls*/ mut X; // scope 1 at $DIR/simplify_locals.rs:+2:20: +2:21
-- _2 = &mut (*_3); // scope 1 at $DIR/simplify_locals.rs:+2:15: +2:21
-- _1 = (*_2); // scope 1 at $DIR/simplify_locals.rs:+2:14: +2:21
-- StorageDead(_3); // scope 0 at $DIR/simplify_locals.rs:+2:23: +2:24
-- StorageDead(_2); // scope 0 at $DIR/simplify_locals.rs:+2:23: +2:24
-- StorageDead(_1); // scope 0 at $DIR/simplify_locals.rs:+2:23: +2:24
- _0 = const (); // scope 0 at $DIR/simplify_locals.rs:+0:9: +3:2
- return; // scope 0 at $DIR/simplify_locals.rs:+3:2: +3:2
+- StorageLive(_1);
+- StorageLive(_2);
+- StorageLive(_3);
+- _3 = &/*tls*/ mut X;
+- _2 = &mut (*_3);
+- _1 = (*_2);
+- StorageDead(_3);
+- StorageDead(_2);
+- StorageDead(_1);
+ _0 = const ();
+ return;
}
}
diff --git a/tests/mir-opt/simplify_locals.t4.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.t4.SimplifyLocals-before-const-prop.diff
index 9add9a6c5..006e3c423 100644
--- a/tests/mir-opt/simplify_locals.t4.SimplifyLocals-before-const-prop.diff
+++ b/tests/mir-opt/simplify_locals.t4.SimplifyLocals-before-const-prop.diff
@@ -2,21 +2,21 @@
+ // MIR for `t4` after SimplifyLocals-before-const-prop
fn t4() -> u32 {
- let mut _0: u32; // return place in scope 0 at $DIR/simplify_locals.rs:+0:12: +0:15
- let mut _1: u32; // in scope 0 at $DIR/simplify_locals.rs:+2:14: +2:15
- let mut _2: *mut u32; // in scope 0 at $DIR/simplify_locals.rs:+2:14: +2:15
+ let mut _0: u32;
+ let mut _1: u32;
+ let mut _2: *mut u32;
scope 1 {
}
bb0: {
- StorageLive(_1); // scope 1 at $DIR/simplify_locals.rs:+2:14: +2:15
- StorageLive(_2); // scope 1 at $DIR/simplify_locals.rs:+2:14: +2:15
- _2 = &/*tls*/ mut X; // scope 1 at $DIR/simplify_locals.rs:+2:14: +2:15
- _1 = (*_2); // scope 1 at $DIR/simplify_locals.rs:+2:14: +2:15
- _0 = Add(move _1, const 1_u32); // scope 1 at $DIR/simplify_locals.rs:+2:14: +2:19
- StorageDead(_1); // scope 1 at $DIR/simplify_locals.rs:+2:18: +2:19
- StorageDead(_2); // scope 0 at $DIR/simplify_locals.rs:+3:1: +3:2
- return; // scope 0 at $DIR/simplify_locals.rs:+3:2: +3:2
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = &/*tls*/ mut X;
+ _1 = (*_2);
+ _0 = Add(move _1, const 1_u32);
+ StorageDead(_1);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.diff b/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.diff
deleted file mode 100644
index f908e8dd0..000000000
--- a/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.diff
+++ /dev/null
@@ -1,53 +0,0 @@
-- // MIR for `foo` before SimplifyLocals-final
-+ // MIR for `foo` after SimplifyLocals-final
-
- fn foo() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/simplify_locals_fixedpoint.rs:+0:13: +0:13
- let mut _1: (std::option::Option<u8>, std::option::Option<T>); // in scope 0 at $DIR/simplify_locals_fixedpoint.rs:+1:30: +1:69
- let mut _2: std::option::Option<u8>; // in scope 0 at $DIR/simplify_locals_fixedpoint.rs:+1:31: +1:49
- let mut _3: std::option::Option<T>; // in scope 0 at $DIR/simplify_locals_fixedpoint.rs:+1:51: +1:68
- let mut _4: isize; // in scope 0 at $DIR/simplify_locals_fixedpoint.rs:+1:22: +1:26
- let mut _5: isize; // in scope 0 at $DIR/simplify_locals_fixedpoint.rs:+1:13: +1:20
-- let mut _7: bool; // in scope 0 at $DIR/simplify_locals_fixedpoint.rs:+2:12: +2:20
-- let mut _8: u8; // in scope 0 at $DIR/simplify_locals_fixedpoint.rs:+2:12: +2:13
- scope 1 {
- debug a => _6; // in scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:18: +1:19
- let _6: u8; // in scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:18: +1:19
- }
-
- bb0: {
- StorageLive(_1); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:30: +1:69
- StorageLive(_2); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:31: +1:49
- _2 = Option::<u8>::None; // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:31: +1:49
- StorageLive(_3); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:51: +1:68
- _3 = Option::<T>::None; // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:51: +1:68
- _1 = (move _2, move _3); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:30: +1:69
- StorageDead(_3); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:68: +1:69
- StorageDead(_2); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:68: +1:69
- _5 = discriminant((_1.0: std::option::Option<u8>)); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:12: +1:27
- switchInt(move _5) -> [1: bb1, otherwise: bb3]; // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:12: +1:27
- }
-
- bb1: {
- _4 = discriminant((_1.1: std::option::Option<T>)); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:12: +1:27
- switchInt(move _4) -> [0: bb2, otherwise: bb3]; // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:12: +1:27
- }
-
- bb2: {
- _6 = (((_1.0: std::option::Option<u8>) as Some).0: u8); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:18: +1:19
-- StorageLive(_7); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+2:12: +2:20
-- _7 = Gt(_6, const 42_u8); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+2:12: +2:20
-- StorageDead(_7); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+4:9: +4:10
- goto -> bb3; // scope 0 at $DIR/simplify_locals_fixedpoint.rs:+1:5: +5:6
- }
-
- bb3: {
- drop(_1) -> bb4; // scope 0 at $DIR/simplify_locals_fixedpoint.rs:+6:1: +6:2
- }
-
- bb4: {
- StorageDead(_1); // scope 0 at $DIR/simplify_locals_fixedpoint.rs:+6:1: +6:2
- return; // scope 0 at $DIR/simplify_locals_fixedpoint.rs:+6:2: +6:2
- }
- }
-
diff --git a/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-abort.diff b/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-abort.diff
new file mode 100644
index 000000000..1566d7197
--- /dev/null
+++ b/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-abort.diff
@@ -0,0 +1,50 @@
+- // MIR for `foo` before SimplifyLocals-final
++ // MIR for `foo` after SimplifyLocals-final
+
+ fn foo() -> () {
+ let mut _0: ();
+ let mut _1: (std::option::Option<u8>, std::option::Option<T>);
+ let mut _2: std::option::Option<u8>;
+ let mut _3: std::option::Option<T>;
+ let mut _4: isize;
+ let mut _5: isize;
+ scope 1 {
+ debug a => _6;
+ let _6: u8;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = Option::<u8>::None;
+ StorageLive(_3);
+ _3 = Option::<T>::None;
+ _1 = (move _2, move _3);
+ StorageDead(_3);
+ StorageDead(_2);
+ _5 = discriminant((_1.0: std::option::Option<u8>));
+ switchInt(move _5) -> [1: bb1, otherwise: bb3];
+ }
+
+ bb1: {
+ _4 = discriminant((_1.1: std::option::Option<T>));
+ switchInt(move _4) -> [0: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ StorageLive(_6);
+ _6 = (((_1.0: std::option::Option<u8>) as Some).0: u8);
+ StorageDead(_6);
+ goto -> bb3;
+ }
+
+ bb3: {
+ drop(_1) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-unwind.diff b/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-unwind.diff
new file mode 100644
index 000000000..ba5262b0e
--- /dev/null
+++ b/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-unwind.diff
@@ -0,0 +1,50 @@
+- // MIR for `foo` before SimplifyLocals-final
++ // MIR for `foo` after SimplifyLocals-final
+
+ fn foo() -> () {
+ let mut _0: ();
+ let mut _1: (std::option::Option<u8>, std::option::Option<T>);
+ let mut _2: std::option::Option<u8>;
+ let mut _3: std::option::Option<T>;
+ let mut _4: isize;
+ let mut _5: isize;
+ scope 1 {
+ debug a => _6;
+ let _6: u8;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = Option::<u8>::None;
+ StorageLive(_3);
+ _3 = Option::<T>::None;
+ _1 = (move _2, move _3);
+ StorageDead(_3);
+ StorageDead(_2);
+ _5 = discriminant((_1.0: std::option::Option<u8>));
+ switchInt(move _5) -> [1: bb1, otherwise: bb3];
+ }
+
+ bb1: {
+ _4 = discriminant((_1.1: std::option::Option<T>));
+ switchInt(move _4) -> [0: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ StorageLive(_6);
+ _6 = (((_1.0: std::option::Option<u8>) as Some).0: u8);
+ StorageDead(_6);
+ goto -> bb3;
+ }
+
+ bb3: {
+ drop(_1) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/simplify_locals_fixedpoint.rs b/tests/mir-opt/simplify_locals_fixedpoint.rs
index 7c41e8b7c..b0c6e2d8e 100644
--- a/tests/mir-opt/simplify_locals_fixedpoint.rs
+++ b/tests/mir-opt/simplify_locals_fixedpoint.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -Zmir-opt-level=1
fn foo<T>() {
diff --git a/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.diff
deleted file mode 100644
index ae2c774f2..000000000
--- a/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.diff
+++ /dev/null
@@ -1,101 +0,0 @@
-- // MIR for `main` before SimplifyLocals-before-const-prop
-+ // MIR for `main` after SimplifyLocals-before-const-prop
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+0:11: +0:11
-- let mut _1: ((), ()); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:20: +1:28
-- let mut _2: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:21: +1:23
-- let mut _3: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:25: +1:27
-- let _4: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:5: +2:22
-- let mut _5: ((), ()); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:13: +2:21
-- let mut _6: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:14: +2:16
-- let mut _7: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:18: +2:20
-- let _8: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:5: +4:35
-- let mut _9: u8; // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:34
-- let mut _10: u8; // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:30
-- let mut _11: Temp; // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:28
-+ let _1: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:5: +2:22
-+ let mut _2: ((), ()); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:13: +2:21
-+ let mut _3: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:14: +2:16
-+ let mut _4: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+2:18: +2:20
-+ let _5: (); // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:5: +4:35
-+ let mut _6: u8; // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:34
-+ let mut _7: u8; // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:30
-+ let mut _8: Temp; // in scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:28
- scope 1 {
- }
-
- bb0: {
-- StorageLive(_1); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:20: +1:28
-- StorageLive(_2); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:21: +1:23
-- _2 = (); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:21: +1:23
-- StorageLive(_3); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:25: +1:27
-- _3 = (); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:25: +1:27
-- _1 = (move _2, move _3); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:20: +1:28
-- StorageDead(_3); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:27: +1:28
-- StorageDead(_2); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:27: +1:28
-- StorageDead(_1); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+1:28: +1:29
-- StorageLive(_4); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:5: +2:22
-- StorageLive(_5); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:13: +2:21
-- StorageLive(_6); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:14: +2:16
-- _6 = (); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:14: +2:16
-- StorageLive(_7); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:18: +2:20
-- _7 = (); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:18: +2:20
-- _5 = (move _6, move _7); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:13: +2:21
-- StorageDead(_7); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:20: +2:21
-- StorageDead(_6); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:20: +2:21
-- _4 = use_zst(move _5) -> bb1; // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:5: +2:22
-+ StorageLive(_1); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:5: +2:22
-+ StorageLive(_2); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:13: +2:21
-+ StorageLive(_3); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:14: +2:16
-+ _3 = (); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:14: +2:16
-+ StorageLive(_4); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:18: +2:20
-+ _4 = (); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:18: +2:20
-+ _2 = (move _3, move _4); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:13: +2:21
-+ StorageDead(_4); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:20: +2:21
-+ StorageDead(_3); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:20: +2:21
-+ _1 = use_zst(move _2) -> bb1; // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:5: +2:22
- // mir::Constant
- // + span: $DIR/simplify_locals_removes_unused_consts.rs:16:5: 16:12
- // + literal: Const { ty: fn(((), ())) {use_zst}, val: Value(<ZST>) }
- }
-
- bb1: {
-- StorageDead(_5); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:21: +2:22
-- StorageDead(_4); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:22: +2:23
-- StorageLive(_8); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:5: +4:35
-- StorageLive(_9); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:34
-- StorageLive(_10); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:30
-- StorageLive(_11); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:28
-- _11 = Temp { x: const 40_u8 }; // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:28
-- _10 = (_11.0: u8); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:30
-- _9 = Add(move _10, const 2_u8); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:34
-- StorageDead(_10); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:33: +4:34
-- _8 = use_u8(move _9) -> bb2; // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:5: +4:35
-+ StorageDead(_2); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:21: +2:22
-+ StorageDead(_1); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+2:22: +2:23
-+ StorageLive(_5); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:5: +4:35
-+ StorageLive(_6); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:34
-+ StorageLive(_7); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:30
-+ StorageLive(_8); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:28
-+ _8 = Temp { x: const 40_u8 }; // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:28
-+ _7 = (_8.0: u8); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:30
-+ _6 = Add(move _7, const 2_u8); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:12: +4:34
-+ StorageDead(_7); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:33: +4:34
-+ _5 = use_u8(move _6) -> bb2; // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:5: +4:35
- // mir::Constant
- // + span: $DIR/simplify_locals_removes_unused_consts.rs:18:5: 18:11
- // + literal: Const { ty: fn(u8) {use_u8}, val: Value(<ZST>) }
- }
-
- bb2: {
-- StorageDead(_9); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:34: +4:35
-- StorageDead(_11); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:35: +4:36
-+ StorageDead(_6); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:34: +4:35
- StorageDead(_8); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:35: +4:36
-+ StorageDead(_5); // scope 1 at $DIR/simplify_locals_removes_unused_consts.rs:+4:35: +4:36
- _0 = const (); // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+0:11: +5:2
- return; // scope 0 at $DIR/simplify_locals_removes_unused_consts.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-abort.diff b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-abort.diff
new file mode 100644
index 000000000..54d254ee3
--- /dev/null
+++ b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-abort.diff
@@ -0,0 +1,86 @@
+- // MIR for `main` before SimplifyLocals-before-const-prop
++ // MIR for `main` after SimplifyLocals-before-const-prop
+
+ fn main() -> () {
+ let mut _0: ();
+- let mut _1: ((), ());
+- let mut _2: ();
++ let _1: ();
++ let mut _2: ((), ());
+ let mut _3: ();
+- let _4: ();
+- let mut _5: ((), ());
+- let mut _6: ();
+- let mut _7: ();
+- let _8: ();
+- let mut _9: u8;
+- let mut _10: u8;
+- let mut _11: Temp;
++ let mut _4: ();
++ let _5: ();
++ let mut _6: u8;
++ let mut _7: u8;
++ let mut _8: Temp;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = ();
+ StorageLive(_3);
+ _3 = ();
+- _1 = (move _2, move _3);
++ StorageLive(_4);
++ _4 = ();
++ _2 = (move _3, move _4);
++ StorageDead(_4);
+ StorageDead(_3);
++ _1 = use_zst(move _2) -> [return: bb1, unwind unreachable];
++ }
++
++ bb1: {
+ StorageDead(_2);
+ StorageDead(_1);
+- StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = ();
+ StorageLive(_7);
+- _7 = ();
+- _5 = (move _6, move _7);
++ StorageLive(_8);
++ _8 = Temp { x: const 40_u8 };
++ _7 = (_8.0: u8);
++ _6 = Add(move _7, const 2_u8);
+ StorageDead(_7);
+- StorageDead(_6);
+- _4 = use_zst(move _5) -> [return: bb1, unwind unreachable];
++ _5 = use_u8(move _6) -> [return: bb2, unwind unreachable];
+ }
+
+- bb1: {
+- StorageDead(_5);
+- StorageDead(_4);
+- StorageLive(_8);
+- StorageLive(_9);
+- StorageLive(_10);
+- StorageLive(_11);
+- _11 = Temp { x: const 40_u8 };
+- _10 = (_11.0: u8);
+- _9 = Add(move _10, const 2_u8);
+- StorageDead(_10);
+- _8 = use_u8(move _9) -> [return: bb2, unwind unreachable];
+- }
+-
+ bb2: {
+- StorageDead(_9);
+- StorageDead(_11);
++ StorageDead(_6);
+ StorageDead(_8);
++ StorageDead(_5);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-unwind.diff b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-unwind.diff
new file mode 100644
index 000000000..a5d9bbc49
--- /dev/null
+++ b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-unwind.diff
@@ -0,0 +1,86 @@
+- // MIR for `main` before SimplifyLocals-before-const-prop
++ // MIR for `main` after SimplifyLocals-before-const-prop
+
+ fn main() -> () {
+ let mut _0: ();
+- let mut _1: ((), ());
+- let mut _2: ();
++ let _1: ();
++ let mut _2: ((), ());
+ let mut _3: ();
+- let _4: ();
+- let mut _5: ((), ());
+- let mut _6: ();
+- let mut _7: ();
+- let _8: ();
+- let mut _9: u8;
+- let mut _10: u8;
+- let mut _11: Temp;
++ let mut _4: ();
++ let _5: ();
++ let mut _6: u8;
++ let mut _7: u8;
++ let mut _8: Temp;
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+- _2 = ();
+ StorageLive(_3);
+ _3 = ();
+- _1 = (move _2, move _3);
++ StorageLive(_4);
++ _4 = ();
++ _2 = (move _3, move _4);
++ StorageDead(_4);
+ StorageDead(_3);
++ _1 = use_zst(move _2) -> [return: bb1, unwind continue];
++ }
++
++ bb1: {
+ StorageDead(_2);
+ StorageDead(_1);
+- StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+- _6 = ();
+ StorageLive(_7);
+- _7 = ();
+- _5 = (move _6, move _7);
++ StorageLive(_8);
++ _8 = Temp { x: const 40_u8 };
++ _7 = (_8.0: u8);
++ _6 = Add(move _7, const 2_u8);
+ StorageDead(_7);
+- StorageDead(_6);
+- _4 = use_zst(move _5) -> [return: bb1, unwind continue];
++ _5 = use_u8(move _6) -> [return: bb2, unwind continue];
+ }
+
+- bb1: {
+- StorageDead(_5);
+- StorageDead(_4);
+- StorageLive(_8);
+- StorageLive(_9);
+- StorageLive(_10);
+- StorageLive(_11);
+- _11 = Temp { x: const 40_u8 };
+- _10 = (_11.0: u8);
+- _9 = Add(move _10, const 2_u8);
+- StorageDead(_10);
+- _8 = use_u8(move _9) -> [return: bb2, unwind continue];
+- }
+-
+ bb2: {
+- StorageDead(_9);
+- StorageDead(_11);
++ StorageDead(_6);
+ StorageDead(_8);
++ StorageDead(_5);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/simplify_locals_removes_unused_consts.rs b/tests/mir-opt/simplify_locals_removes_unused_consts.rs
index 983d8004e..42879254d 100644
--- a/tests/mir-opt/simplify_locals_removes_unused_consts.rs
+++ b/tests/mir-opt/simplify_locals_removes_unused_consts.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: SimplifyLocals-before-const-prop
// compile-flags: -C overflow-checks=no
diff --git a/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals-before-const-prop.diff
index 3f9af31d8..9ff32b26b 100644
--- a/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals-before-const-prop.diff
+++ b/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals-before-const-prop.diff
@@ -2,48 +2,48 @@
+ // MIR for `map` after SimplifyLocals-before-const-prop
fn map(_1: Option<Box<()>>) -> Option<Box<()>> {
- debug x => _1; // in scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+0:8: +0:9
- let mut _0: std::option::Option<std::boxed::Box<()>>; // return place in scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+0:31: +0:46
- let mut _2: isize; // in scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+2:9: +2:13
- let _3: std::boxed::Box<()>; // in scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+3:14: +3:15
- let mut _4: std::boxed::Box<()>; // in scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+3:25: +3:26
-- let mut _5: bool; // in scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+5:1: +5:2
-- let mut _6: isize; // in scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+5:1: +5:2
-- let mut _7: isize; // in scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+5:1: +5:2
+ debug x => _1;
+ let mut _0: std::option::Option<std::boxed::Box<()>>;
+ let mut _2: isize;
+ let _3: std::boxed::Box<()>;
+ let mut _4: std::boxed::Box<()>;
+- let mut _5: bool;
+- let mut _6: isize;
+- let mut _7: isize;
scope 1 {
- debug x => _3; // in scope 1 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+3:14: +3:15
+ debug x => _3;
}
bb0: {
-- _5 = const false; // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+1:11: +1:12
-- _5 = const true; // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+1:11: +1:12
- _2 = discriminant(_1); // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+1:11: +1:12
- switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+1:5: +1:12
+- _5 = const false;
+- _5 = const true;
+ _2 = discriminant(_1);
+ switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2];
}
bb1: {
- StorageLive(_3); // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+3:14: +3:15
- _3 = move ((_1 as Some).0: std::boxed::Box<()>); // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+3:14: +3:15
- StorageLive(_4); // scope 1 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+3:25: +3:26
- _4 = move _3; // scope 1 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+3:25: +3:26
- _0 = Option::<Box<()>>::Some(move _4); // scope 1 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+3:20: +3:27
- StorageDead(_4); // scope 1 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+3:26: +3:27
- StorageDead(_3); // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+3:26: +3:27
- goto -> bb4; // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+3:26: +3:27
+ StorageLive(_3);
+ _3 = move ((_1 as Some).0: std::boxed::Box<()>);
+ StorageLive(_4);
+ _4 = move _3;
+ _0 = Option::<Box<()>>::Some(move _4);
+ StorageDead(_4);
+ StorageDead(_3);
+ goto -> bb4;
}
bb2: {
- unreachable; // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+1:11: +1:12
+ unreachable;
}
bb3: {
- _0 = Option::<Box<()>>::None; // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+2:17: +2:21
- goto -> bb4; // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+2:17: +2:21
+ _0 = Option::<Box<()>>::None;
+ goto -> bb4;
}
bb4: {
-- _6 = discriminant(_1); // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+5:1: +5:2
- return; // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+5:2: +5:2
+- _6 = discriminant(_1);
+ return;
}
}
diff --git a/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs b/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs
index de6585741..615b97220 100644
--- a/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs
+++ b/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: SimplifyLocals-before-const-prop
fn map(x: Option<Box<()>>) -> Option<Box<()>> {
diff --git a/tests/mir-opt/simplify_match.main.ConstProp.diff b/tests/mir-opt/simplify_match.main.ConstProp.diff
deleted file mode 100644
index d2b9ac3cc..000000000
--- a/tests/mir-opt/simplify_match.main.ConstProp.diff
+++ /dev/null
@@ -1,33 +0,0 @@
-- // MIR for `main` before ConstProp
-+ // MIR for `main` after ConstProp
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/simplify_match.rs:+0:11: +0:11
- let mut _1: bool; // in scope 0 at $DIR/simplify_match.rs:+1:11: +1:31
- let _2: bool; // in scope 0 at $DIR/simplify_match.rs:+1:17: +1:18
- scope 1 {
- debug x => _2; // in scope 1 at $DIR/simplify_match.rs:+1:17: +1:18
- }
-
- bb0: {
- _2 = const false; // scope 0 at $DIR/simplify_match.rs:+1:21: +1:26
-- switchInt(_2) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_match.rs:+1:5: +1:31
-+ switchInt(const false) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_match.rs:+1:5: +1:31
- }
-
- bb1: {
- goto -> bb3; // scope 0 at $DIR/simplify_match.rs:+3:18: +3:20
- }
-
- bb2: {
- _0 = noop() -> bb3; // scope 0 at $DIR/simplify_match.rs:+2:17: +2:23
- // mir::Constant
- // + span: $DIR/simplify_match.rs:8:17: 8:21
- // + literal: Const { ty: fn() {noop}, val: Value(<ZST>) }
- }
-
- bb3: {
- return; // scope 0 at $DIR/simplify_match.rs:+5:2: +5:2
- }
- }
-
diff --git a/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff b/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff
new file mode 100644
index 000000000..6025abb73
--- /dev/null
+++ b/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff
@@ -0,0 +1,30 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: bool;
+ let _2: bool;
+ scope 1 {
+ debug x => _2;
+ }
+
+ bb0: {
+ _2 = const false;
+- switchInt(_2) -> [0: bb1, otherwise: bb2];
++ switchInt(const false) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ goto -> bb3;
+ }
+
+ bb2: {
+ _0 = noop() -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff b/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff
new file mode 100644
index 000000000..c881dec28
--- /dev/null
+++ b/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff
@@ -0,0 +1,30 @@
+- // MIR for `main` before ConstProp
++ // MIR for `main` after ConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: bool;
+ let _2: bool;
+ scope 1 {
+ debug x => _2;
+ }
+
+ bb0: {
+ _2 = const false;
+- switchInt(_2) -> [0: bb1, otherwise: bb2];
++ switchInt(const false) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ goto -> bb3;
+ }
+
+ bb2: {
+ _0 = noop() -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/simplify_match.rs b/tests/mir-opt/simplify_match.rs
index 6a2a6f217..eb385005c 100644
--- a/tests/mir-opt/simplify_match.rs
+++ b/tests/mir-opt/simplify_match.rs
@@ -1,4 +1,5 @@
-// ignore-wasm32 compiled with panic=abort by default
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#[inline(never)]
fn noop() {}
diff --git a/tests/mir-opt/simplify_try_if_let.rs b/tests/mir-opt/simplify_try_if_let.rs
index fba67de40..3a59d7850 100644
--- a/tests/mir-opt/simplify_try_if_let.rs
+++ b/tests/mir-opt/simplify_try_if_let.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Zmir-opt-level=1 -Zunsound-mir-opts
// ignore-test
// FIXME: the pass is unsound and causes ICEs in the MIR validator
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 11115c96e..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
@@ -1,55 +1,55 @@
// MIR for `std::ptr::drop_in_place` before AddMovesForPackedDrops
fn std::ptr::drop_in_place(_1: *mut [String]) -> () {
- let mut _0: (); // return place in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- let mut _2: usize; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- let mut _3: usize; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- let mut _4: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- let mut _5: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- let mut _6: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- let mut _7: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ let mut _0: ();
+ let mut _2: usize;
+ let mut _3: usize;
+ let mut _4: *mut std::string::String;
+ let mut _5: bool;
+ let mut _6: *mut std::string::String;
+ let mut _7: bool;
bb0: {
- goto -> bb8; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ goto -> bb8;
}
bb1: {
- return; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ return;
}
bb2 (cleanup): {
- resume; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ resume;
}
bb3 (cleanup): {
- _4 = &raw mut (*_1)[_3]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- _3 = Add(move _3, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- drop((*_4)) -> [return: bb4, unwind terminate]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ _4 = &raw mut (*_1)[_3];
+ _3 = Add(move _3, const 1_usize);
+ drop((*_4)) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
- _5 = Eq(_3, _2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- switchInt(move _5) -> [0: bb3, otherwise: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ _5 = Eq(_3, _2);
+ switchInt(move _5) -> [0: bb3, otherwise: bb2];
}
bb5: {
- _6 = &raw mut (*_1)[_3]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- _3 = Add(move _3, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- drop((*_6)) -> [return: bb6, unwind: bb4]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ _6 = &raw mut (*_1)[_3];
+ _3 = Add(move _3, const 1_usize);
+ drop((*_6)) -> [return: bb6, unwind: bb4];
}
bb6: {
- _7 = Eq(_3, _2); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- switchInt(move _7) -> [0: bb5, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ _7 = Eq(_3, _2);
+ switchInt(move _7) -> [0: bb5, otherwise: bb1];
}
bb7: {
- _2 = Len((*_1)); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- _3 = const 0_usize; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- goto -> bb6; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ _2 = Len((*_1));
+ _3 = const 0_usize;
+ goto -> bb6;
}
bb8: {
- goto -> bb7; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ goto -> bb7;
}
}
diff --git a/tests/mir-opt/slice_drop_shim.rs b/tests/mir-opt/slice_drop_shim.rs
index 344c1af2c..cac0a3491 100644
--- a/tests/mir-opt/slice_drop_shim.rs
+++ b/tests/mir-opt/slice_drop_shim.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Zmir-opt-level=0
diff --git a/tests/mir-opt/slice_filter.rs b/tests/mir-opt/slice_filter.rs
deleted file mode 100644
index be32f40f1..000000000
--- a/tests/mir-opt/slice_filter.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-fn main() {
- let input = vec![];
- let _variant_a_result = variant_a(&input);
- let _variant_b_result = variant_b(&input);
-}
-
-pub fn variant_a(input: &[(usize, usize, usize, usize)]) -> usize {
- input.iter().filter(|(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count()
-}
-
-pub fn variant_b(input: &[(usize, usize, usize, usize)]) -> usize {
- input.iter().filter(|&&(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count()
-}
-
-// EMIT_MIR slice_filter.variant_a-{closure#0}.ReferencePropagation.diff
-// EMIT_MIR slice_filter.variant_a-{closure#0}.CopyProp.diff
-// EMIT_MIR slice_filter.variant_a-{closure#0}.DestinationPropagation.diff
-// EMIT_MIR slice_filter.variant_b-{closure#0}.CopyProp.diff
-// EMIT_MIR slice_filter.variant_b-{closure#0}.ReferencePropagation.diff
-// EMIT_MIR slice_filter.variant_b-{closure#0}.DestinationPropagation.diff
diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff
deleted file mode 100644
index 60e5056c7..000000000
--- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff
+++ /dev/null
@@ -1,279 +0,0 @@
-- // MIR for `variant_a::{closure#0}` before CopyProp
-+ // MIR for `variant_a::{closure#0}` after CopyProp
-
- fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:8:25: 8:39], _2: &&(usize, usize, usize, usize)) -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40
- let _3: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
- let _4: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
- let _5: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
- let _6: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
- let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56
- let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46
- let mut _9: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:41
- let mut _10: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46
- let _11: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46
- let mut _12: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56
- let mut _13: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:51
- let mut _14: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56
- let _15: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56
- let mut _16: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76
- let mut _17: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66
- let mut _18: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:61
- let mut _19: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66
- let _20: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66
- let mut _21: bool; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76
- let mut _22: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:71
- let mut _23: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
- let _24: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
- let mut _25: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
- let mut _26: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
- let mut _27: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
- let mut _28: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
- let mut _31: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _32: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _37: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _38: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _43: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _44: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _49: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _50: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- scope 1 {
- debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28
- debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31
- debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34
- debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37
- scope 2 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:40: 8:46
- debug self => _9; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => _10; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _29: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _30: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug self => _31; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug other => _32; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug self => _29; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug other => _30; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _33: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _34: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- }
- }
- scope 4 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:60: 8:66
- debug self => _18; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => _19; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _35: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _36: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- scope 5 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug self => _37; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug other => _38; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug self => _35; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug other => _36; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _39: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _40: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- }
- }
- scope 6 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:50: 8:56
- debug self => _13; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => _14; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _41: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _42: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug self => _43; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug other => _44; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug self => _41; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug other => _42; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _45: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _46: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- }
- }
- scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:70: 8:76
- debug self => _22; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => _23; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _47: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _48: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug self => _49; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug other => _50; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug self => _47; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug other => _48; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _51: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _52: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- }
- }
- }
-
- bb0: {
- StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
- _25 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
- _3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
- StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
- _26 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
- _4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
- StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
- _27 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
- _5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
- StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
- _28 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
- _6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
- StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
- StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46
- StorageLive(_9); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41
- _9 = &_3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41
- StorageLive(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
- StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
- _11 = _5; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
- _10 = &_11; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
- _29 = deref_copy (*_9); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _30 = deref_copy (*_10); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageLive(_31); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _31 = _29; // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageLive(_32); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _32 = _30; // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_33); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _33 = (*_31); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _33 = (*_29); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _34 = (*_32); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _34 = (*_30); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _8 = Le(move _33, move _34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_33); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageDead(_32); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageDead(_31); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
- StorageDead(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
- StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
- switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
- }
-
- bb1: {
- _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
- goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
- }
-
- bb2: {
- StorageLive(_16); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- StorageLive(_17); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66
- StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61
- _18 = &_5; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61
- StorageLive(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
- StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
- _20 = _3; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
- _19 = &_20; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
- _35 = deref_copy (*_18); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _36 = deref_copy (*_19); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageLive(_37); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _37 = _35; // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageLive(_38); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _38 = _36; // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_39); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _39 = (*_37); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _39 = (*_35); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _40 = (*_38); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _40 = (*_36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _17 = Le(move _39, move _40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_39); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageDead(_38); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageDead(_37); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
- StorageDead(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
- StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
- switchInt(move _17) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- }
-
- bb3: {
- StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
- return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76
- }
-
- bb4: {
- _7 = const false; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
- StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
- }
-
- bb5: {
- StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56
- StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51
- _13 = &_6; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51
- StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- _15 = _4; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- _14 = &_15; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- _41 = deref_copy (*_13); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _42 = deref_copy (*_14); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageLive(_43); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _43 = _41; // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageLive(_44); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _44 = _42; // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_45); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _45 = (*_43); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _45 = (*_41); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _46 = (*_44); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _46 = (*_42); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _12 = Le(move _45, move _46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_45); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageDead(_44); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageDead(_43); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- _7 = move _12; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
- StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
- }
-
- bb6: {
- _16 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- }
-
- bb7: {
- StorageLive(_21); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76
- StorageLive(_22); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71
- _22 = &_4; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71
- StorageLive(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageLive(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- _24 = _6; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- _23 = &_24; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- _47 = deref_copy (*_22); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _48 = deref_copy (*_23); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageLive(_49); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _49 = _47; // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageLive(_50); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _50 = _48; // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_51); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _51 = (*_49); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _51 = (*_47); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _52 = (*_50); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _52 = (*_48); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _21 = Le(move _51, move _52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_51); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageDead(_50); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageDead(_49); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageDead(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageDead(_22); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- _16 = move _21; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- }
-
- bb8: {
- StorageDead(_21); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageDead(_17); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- _0 = move _16; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
- goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
- }
- }
-
diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff
deleted file mode 100644
index afdcf5781..000000000
--- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff
+++ /dev/null
@@ -1,165 +0,0 @@
-- // MIR for `variant_a::{closure#0}` before DestinationPropagation
-+ // MIR for `variant_a::{closure#0}` after DestinationPropagation
-
- fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:8:25: 8:39], _2: &&(usize, usize, usize, usize)) -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40
- let mut _3: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56
- let mut _4: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46
- let mut _5: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56
- let mut _6: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76
- let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66
- let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76
- let mut _9: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
- let mut _10: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
- let mut _11: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
- let mut _12: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
- scope 1 {
- debug a => &((*_9).0: usize); // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28
- debug b => &((*_10).1: usize); // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31
- debug c => &((*_11).2: usize); // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34
- debug d => &((*_12).3: usize); // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37
- scope 2 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:40: 8:46
- debug self => &&((*_9).0: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => &&((*_11).2: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug self => &((*_9).0: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => &((*_11).2: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _13: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _14: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- }
- }
- scope 4 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:60: 8:66
- debug self => &&((*_11).2: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => &&((*_9).0: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- scope 5 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug self => &((*_11).2: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => &((*_9).0: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _15: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _16: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- }
- }
- scope 6 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:50: 8:56
- debug self => &&((*_12).3: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => &&((*_10).1: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug self => &((*_12).3: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => &((*_10).1: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _17: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _18: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- }
- }
- scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:70: 8:76
- debug self => &&((*_10).1: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => &&((*_12).3: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug self => &((*_10).1: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => &((*_12).3: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _19: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _20: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- }
- }
- }
-
- bb0: {
- _9 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
- _10 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
- _11 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
- _12 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
-- StorageLive(_3); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
- StorageLive(_4); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46
- StorageLive(_13); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _13 = ((*_9).0: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_14); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _14 = ((*_11).2: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _4 = Le(move _13, move _14); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_14); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_13); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- switchInt(move _4) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
- }
-
- bb1: {
- _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
- goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
- }
-
- bb2: {
-- StorageLive(_6); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66
- StorageLive(_15); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _15 = ((*_11).2: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_16); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _16 = ((*_9).0: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _7 = Le(move _15, move _16); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_16); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_15); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- switchInt(move _7) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- }
-
- bb3: {
-- StorageDead(_6); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-- StorageDead(_3); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76
- }
-
- bb4: {
-- StorageDead(_5); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- StorageDead(_4); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
- }
-
- bb5: {
-- StorageLive(_5); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56
- StorageLive(_17); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _17 = ((*_12).3: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_18); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _18 = ((*_10).1: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _5 = Le(move _17, move _18); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_18); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_17); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _3 = move _5; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
-- StorageDead(_5); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- StorageDead(_4); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-- switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
-+ switchInt(move _5) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
- }
-
- bb6: {
-- _6 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
-+ _0 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- }
-
- bb7: {
-- StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76
- StorageLive(_19); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _19 = ((*_10).1: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _20 = ((*_12).3: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _8 = Le(move _19, move _20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _0 = Le(move _19, move _20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_19); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _6 = move _8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- }
-
- bb8: {
-- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-- _0 = move _6; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
- goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
- }
- }
-
diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff
deleted file mode 100644
index 2534eeef4..000000000
--- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff
+++ /dev/null
@@ -1,267 +0,0 @@
-- // MIR for `variant_a::{closure#0}` before ReferencePropagation
-+ // MIR for `variant_a::{closure#0}` after ReferencePropagation
-
- fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:8:25: 8:39], _2: &&(usize, usize, usize, usize)) -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40
- let _3: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
- let _4: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
- let _5: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
- let _6: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
- let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56
- let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46
- let mut _9: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:41
- let mut _10: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46
- let _11: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46
- let mut _12: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56
- let mut _13: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:51
- let mut _14: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56
- let _15: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56
- let mut _16: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76
- let mut _17: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66
- let mut _18: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:61
- let mut _19: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66
- let _20: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66
- let mut _21: bool; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76
- let mut _22: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:71
- let mut _23: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
- let _24: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
- let mut _25: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
- let mut _26: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
- let mut _27: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
- let mut _28: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
- let mut _31: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _32: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _37: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _38: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _43: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _44: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _49: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _50: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
- scope 1 {
-- debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28
-- debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31
-- debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34
-- debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37
-+ debug a => &((*_25).0: usize); // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28
-+ debug b => &((*_26).1: usize); // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31
-+ debug c => &((*_27).2: usize); // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34
-+ debug d => &((*_28).3: usize); // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37
- scope 2 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:40: 8:46
-- debug self => _9; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug other => _10; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug self => &&((*_25).0: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug other => &&((*_27).2: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _29: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _30: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug self => _29; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug other => _30; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug self => &((*_25).0: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug other => &((*_27).2: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _33: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _34: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- }
- }
- scope 4 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:60: 8:66
-- debug self => _18; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug other => _19; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug self => &&((*_27).2: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug other => &&((*_25).0: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _35: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _36: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- scope 5 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug self => _35; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug other => _36; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug self => &((*_27).2: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug other => &((*_25).0: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _39: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _40: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- }
- }
- scope 6 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:50: 8:56
-- debug self => _13; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug other => _14; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug self => &&((*_28).3: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug other => &&((*_26).1: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _41: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _42: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug self => _41; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug other => _42; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug self => &((*_28).3: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug other => &((*_26).1: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _45: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _46: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- }
- }
- scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:70: 8:76
-- debug self => _22; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug other => _23; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug self => &&((*_26).1: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug other => &&((*_28).3: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _47: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _48: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug self => _47; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- debug other => _48; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug self => &((*_26).1: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ debug other => &((*_28).3: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _51: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _52: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- }
- }
- }
-
- bb0: {
-- StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
- _25 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
-- _3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
-- StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
- _26 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
-- _4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
-- StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
- _27 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
-- _5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
-- StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
- _28 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
-- _6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
- StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
- StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46
-- StorageLive(_9); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41
-- _9 = &_3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41
-- StorageLive(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
-- StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
-- _11 = _5; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
-- _10 = &_11; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
-- _29 = deref_copy (*_9); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _30 = deref_copy (*_10); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_33); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _33 = (*_29); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _33 = ((*_25).0: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _34 = (*_30); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _34 = ((*_27).2: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _8 = Le(move _33, move _34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_33); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
-- StorageDead(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
-- StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
- switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
- }
-
- bb1: {
- _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
- goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
- }
-
- bb2: {
- StorageLive(_16); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- StorageLive(_17); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66
-- StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61
-- _18 = &_5; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61
-- StorageLive(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
-- StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
-- _20 = _3; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
-- _19 = &_20; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
-- _35 = deref_copy (*_18); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _36 = deref_copy (*_19); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_39); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _39 = (*_35); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _39 = ((*_27).2: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _40 = (*_36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _40 = ((*_25).0: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _17 = Le(move _39, move _40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_39); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageDead(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
-- StorageDead(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
-- StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
- switchInt(move _17) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- }
-
- bb3: {
- StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-- StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
-- StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
-- StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
-- StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
- return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76
- }
-
- bb4: {
- _7 = const false; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
- StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
- }
-
- bb5: {
- StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56
-- StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51
-- _13 = &_6; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51
-- StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-- StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-- _15 = _4; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-- _14 = &_15; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-- _41 = deref_copy (*_13); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _42 = deref_copy (*_14); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_45); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _45 = (*_41); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _45 = ((*_28).3: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _46 = (*_42); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _46 = ((*_26).1: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _12 = Le(move _45, move _46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_45); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-- StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-- StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- _7 = move _12; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
- StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
- }
-
- bb6: {
- _16 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- }
-
- bb7: {
- StorageLive(_21); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76
-- StorageLive(_22); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71
-- _22 = &_4; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71
-- StorageLive(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-- StorageLive(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-- _24 = _6; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-- _23 = &_24; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-- _47 = deref_copy (*_22); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _48 = deref_copy (*_23); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_51); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _51 = (*_47); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _51 = ((*_26).1: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _52 = (*_48); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _52 = ((*_28).3: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _21 = Le(move _51, move _52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_51); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- StorageDead(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-- StorageDead(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-- StorageDead(_22); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- _16 = move _21; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- }
-
- bb8: {
- StorageDead(_21); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageDead(_17); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- _0 = move _16; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
- goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
- }
- }
-
diff --git a/tests/mir-opt/slice_filter.variant_b-{closure#0}.CopyProp.diff b/tests/mir-opt/slice_filter.variant_b-{closure#0}.CopyProp.diff
deleted file mode 100644
index 5e4bdbdfa..000000000
--- a/tests/mir-opt/slice_filter.variant_b-{closure#0}.CopyProp.diff
+++ /dev/null
@@ -1,139 +0,0 @@
-- // MIR for `variant_b::{closure#0}` before CopyProp
-+ // MIR for `variant_b::{closure#0}` after CopyProp
-
- fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:12:25: 12:41], _2: &&(usize, usize, usize, usize)) -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:42: +0:42
- let _3: usize; // in scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
- let _4: usize; // in scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
- let _5: usize; // in scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
- let _6: usize; // in scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
- let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58
- let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:48
- let mut _9: usize; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:43
- let mut _10: usize; // in scope 0 at $DIR/slice_filter.rs:+0:47: +0:48
- let mut _11: bool; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58
- let mut _12: usize; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:53
- let mut _13: usize; // in scope 0 at $DIR/slice_filter.rs:+0:57: +0:58
- let mut _14: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:78
- let mut _15: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:68
- let mut _16: usize; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:63
- let mut _17: usize; // in scope 0 at $DIR/slice_filter.rs:+0:67: +0:68
- let mut _18: bool; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:78
- let mut _19: usize; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:73
- let mut _20: usize; // in scope 0 at $DIR/slice_filter.rs:+0:77: +0:78
- let mut _21: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
- let mut _22: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
- let mut _23: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
- let mut _24: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
- scope 1 {
- debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:29: +0:30
- debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:32: +0:33
- debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:35: +0:36
- debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:38: +0:39
- }
-
- bb0: {
-- StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
- _21 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
- _3 = ((*_21).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
-- StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
- _22 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
- _4 = ((*_22).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
-- StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
- _23 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
- _5 = ((*_23).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
-- StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
- _24 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
- _6 = ((*_24).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
- StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
- StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
-- StorageLive(_9); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:43
-- _9 = _3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:43
-- StorageLive(_10); // scope 1 at $DIR/slice_filter.rs:+0:47: +0:48
-- _10 = _5; // scope 1 at $DIR/slice_filter.rs:+0:47: +0:48
-- _8 = Le(move _9, move _10); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
-- StorageDead(_10); // scope 1 at $DIR/slice_filter.rs:+0:47: +0:48
-- StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:47: +0:48
-+ _8 = Le(_3, _5); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
- switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
- }
-
- bb1: {
- _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
- goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
- }
-
- bb2: {
- StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
-- StorageLive(_16); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:63
-- _16 = _5; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:63
-- StorageLive(_17); // scope 1 at $DIR/slice_filter.rs:+0:67: +0:68
-- _17 = _3; // scope 1 at $DIR/slice_filter.rs:+0:67: +0:68
-- _15 = Le(move _16, move _17); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
-- StorageDead(_17); // scope 1 at $DIR/slice_filter.rs:+0:67: +0:68
-- StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:67: +0:68
-+ _15 = Le(_5, _3); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
- switchInt(move _15) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- }
-
- bb3: {
- StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
- StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-- StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:77: +0:78
-- StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:77: +0:78
-- StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:77: +0:78
-- StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:77: +0:78
- return; // scope 0 at $DIR/slice_filter.rs:+0:78: +0:78
- }
-
- bb4: {
- _7 = const false; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
- StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
- goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
- }
-
- bb5: {
- StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
-- StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:53
-- _12 = _6; // scope 1 at $DIR/slice_filter.rs:+0:52: +0:53
-- StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-- _13 = _4; // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-- _11 = Le(move _12, move _13); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
-- StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-- StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-+ _11 = Le(_6, _4); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
- _7 = move _11; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
- StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
- switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
- }
-
- bb6: {
- _14 = const false; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- }
-
- bb7: {
- StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
-- StorageLive(_19); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:73
-- _19 = _4; // scope 1 at $DIR/slice_filter.rs:+0:72: +0:73
-- StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-- _20 = _6; // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-- _18 = Le(move _19, move _20); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
-- StorageDead(_20); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-- StorageDead(_19); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-+ _18 = Le(_4, _6); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
- _14 = move _18; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- }
-
- bb8: {
- StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
- StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
- _0 = move _14; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
- goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
- }
- }
-
diff --git a/tests/mir-opt/slice_filter.variant_b-{closure#0}.DestinationPropagation.diff b/tests/mir-opt/slice_filter.variant_b-{closure#0}.DestinationPropagation.diff
deleted file mode 100644
index 45af6600c..000000000
--- a/tests/mir-opt/slice_filter.variant_b-{closure#0}.DestinationPropagation.diff
+++ /dev/null
@@ -1,109 +0,0 @@
-- // MIR for `variant_b::{closure#0}` before DestinationPropagation
-+ // MIR for `variant_b::{closure#0}` after DestinationPropagation
-
- fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:12:25: 12:41], _2: &&(usize, usize, usize, usize)) -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:42: +0:42
- let _3: usize; // in scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
- let _4: usize; // in scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
- let _5: usize; // in scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
- let _6: usize; // in scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
- let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58
- let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:48
- let mut _9: bool; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58
- let mut _10: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:78
- let mut _11: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:68
- let mut _12: bool; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:78
- let mut _13: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
- let mut _14: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
- let mut _15: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
- let mut _16: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
- scope 1 {
- debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:29: +0:30
- debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:32: +0:33
- debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:35: +0:36
- debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:38: +0:39
- }
-
- bb0: {
- _13 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
- _3 = ((*_13).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
- _14 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
- _4 = ((*_14).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
- _15 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
- _5 = ((*_15).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
- _16 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
- _6 = ((*_16).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
-- StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
- StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
- _8 = Le(_3, _5); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
- switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
- }
-
- bb1: {
- _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
- goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
- }
-
- bb2: {
-- StorageLive(_10); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
- _11 = Le(_5, _3); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
- switchInt(move _11) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- }
-
- bb3: {
-- StorageDead(_10); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-- StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
- return; // scope 0 at $DIR/slice_filter.rs:+0:78: +0:78
- }
-
- bb4: {
-- StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
- goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
- }
-
- bb5: {
-- StorageLive(_9); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
- _9 = Le(_6, _4); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
-- _7 = move _9; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-- StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
-- switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-+ switchInt(move _9) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
- }
-
- bb6: {
-- _10 = const false; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-+ _0 = const false; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- }
-
- bb7: {
-- StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
-- _12 = Le(_4, _6); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
-- _10 = move _12; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
-+ _0 = Le(_4, _6); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- }
-
- bb8: {
-- StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
- StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
-- _0 = move _10; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
-+ nop; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
- goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
- }
- }
-
diff --git a/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff b/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff
deleted file mode 100644
index d1241c6b0..000000000
--- a/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff
+++ /dev/null
@@ -1,103 +0,0 @@
-- // MIR for `variant_b::{closure#0}` before ReferencePropagation
-+ // MIR for `variant_b::{closure#0}` after ReferencePropagation
-
- fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:12:25: 12:41], _2: &&(usize, usize, usize, usize)) -> bool {
- let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:42: +0:42
- let _3: usize; // in scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
- let _4: usize; // in scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
- let _5: usize; // in scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
- let _6: usize; // in scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
- let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58
- let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:48
- let mut _9: usize; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:43
- let mut _10: usize; // in scope 0 at $DIR/slice_filter.rs:+0:47: +0:48
- let mut _11: bool; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58
- let mut _12: usize; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:53
- let mut _13: usize; // in scope 0 at $DIR/slice_filter.rs:+0:57: +0:58
- let mut _14: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:78
- let mut _15: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:68
- let mut _16: usize; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:63
- let mut _17: usize; // in scope 0 at $DIR/slice_filter.rs:+0:67: +0:68
- let mut _18: bool; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:78
- let mut _19: usize; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:73
- let mut _20: usize; // in scope 0 at $DIR/slice_filter.rs:+0:77: +0:78
- let mut _21: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
- let mut _22: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
- let mut _23: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
- let mut _24: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
- scope 1 {
- debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:29: +0:30
- debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:32: +0:33
- debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:35: +0:36
- debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:38: +0:39
- }
-
- bb0: {
- _21 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
- _3 = ((*_21).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
- _22 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
- _4 = ((*_22).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
- _23 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
- _5 = ((*_23).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
- _24 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
- _6 = ((*_24).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
- StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
- StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
- _8 = Le(_3, _5); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
- switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
- }
-
- bb1: {
- _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
- goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
- }
-
- bb2: {
- StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
- _15 = Le(_5, _3); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
- switchInt(move _15) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- }
-
- bb3: {
- StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
- StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
- return; // scope 0 at $DIR/slice_filter.rs:+0:78: +0:78
- }
-
- bb4: {
- _7 = const false; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
- StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
- goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
- }
-
- bb5: {
- StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
- _11 = Le(_6, _4); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
- _7 = move _11; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
- StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
- switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
- }
-
- bb6: {
- _14 = const false; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- }
-
- bb7: {
- StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
- _18 = Le(_4, _6); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
- _14 = move _18; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
- }
-
- bb8: {
- StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
- StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
- _0 = move _14; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
- goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
- }
- }
-
diff --git a/tests/mir-opt/spanview_block.main.built.after.html b/tests/mir-opt/spanview_block.main.built.after.html
index b962d80c5..54ef00f56 100644
--- a/tests/mir-opt/spanview_block.main.built.after.html
+++ b/tests/mir-opt/spanview_block.main.built.after.html
@@ -1,6 +1,7 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
+<meta charset="utf-8">
<title>spanview_block.main.built.after</title>
<style>
.line {
@@ -59,8 +60,8 @@
</style>
</head>
<body>
-<div class="code" style="counter-reset: line 4"><span class="line"><span class="code" style="--layer: 0">fn main() </span><span><span class="code even" style="--layer: 1" title="0: $DIR/spanview_block.rs:5:11: 5:13:
- 5:11-5:13: Assign: _0 = const ()
- 5:13-5:13: Return: return"><span class="annotation">0⦊</span>{}<span class="annotation">⦉0</span></span></span></span></div>
+<div class="code" style="counter-reset: line 5"><span class="line"><span class="code" style="--layer: 0">fn main() </span><span><span class="code even" style="--layer: 1" title="0: $DIR/spanview_block.rs:6:11: 6:13:
+ 6:11-6:13: Assign: _0 = const ()
+ 6:13-6:13: Return: return"><span class="annotation">0⦊</span>{}<span class="annotation">⦉0</span></span></span></span></div>
</body>
</html>
diff --git a/tests/mir-opt/spanview_block.rs b/tests/mir-opt/spanview_block.rs
index 0ecf35ad6..e8bc3d163 100644
--- a/tests/mir-opt/spanview_block.rs
+++ b/tests/mir-opt/spanview_block.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test spanview block output
// compile-flags: -Z dump-mir-spanview=block
diff --git a/tests/mir-opt/spanview_statement.main.built.after.html b/tests/mir-opt/spanview_statement.main.built.after.html
index 43bff7d09..5e782b05f 100644
--- a/tests/mir-opt/spanview_statement.main.built.after.html
+++ b/tests/mir-opt/spanview_statement.main.built.after.html
@@ -1,6 +1,7 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
+<meta charset="utf-8">
<title>spanview_statement.main.built.after</title>
<style>
.line {
@@ -59,8 +60,8 @@
</style>
</head>
<body>
-<div class="code" style="counter-reset: line 4"><span class="line"><span class="code" style="--layer: 0">fn main() </span><span><span class="code even" style="--layer: 1" title="0[0]: $DIR/spanview_statement.rs:5:11: 5:13:
- 5:11-5:13: Assign: _0 = const ()"><span class="annotation">0[0]⦊</span>{}<span class="annotation">⦉0[0]</span></span></span><span><span class="code odd" style="--layer: 1" title="0:Return: $DIR/spanview_statement.rs:5:13: 5:13:
- 5:13-5:13: Return: return"><span class="annotation">0:Return⦊</span>‸<span class="annotation">⦉0:Return</span></span></span></span></div>
+<div class="code" style="counter-reset: line 5"><span class="line"><span class="code" style="--layer: 0">fn main() </span><span><span class="code even" style="--layer: 1" title="0[0]: $DIR/spanview_statement.rs:6:11: 6:13:
+ 6:11-6:13: Assign: _0 = const ()"><span class="annotation">0[0]⦊</span>{}<span class="annotation">⦉0[0]</span></span></span><span><span class="code odd" style="--layer: 1" title="0:Return: $DIR/spanview_statement.rs:6:13: 6:13:
+ 6:13-6:13: Return: return"><span class="annotation">0:Return⦊</span>‸<span class="annotation">⦉0:Return</span></span></span></span></div>
</body>
</html>
diff --git a/tests/mir-opt/spanview_statement.rs b/tests/mir-opt/spanview_statement.rs
index 457052617..d547e6cb1 100644
--- a/tests/mir-opt/spanview_statement.rs
+++ b/tests/mir-opt/spanview_statement.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test spanview output (the default value for `-Z dump-mir-spanview` is "statement")
// compile-flags: -Z dump-mir-spanview
diff --git a/tests/mir-opt/spanview_terminator.main.built.after.html b/tests/mir-opt/spanview_terminator.main.built.after.html
index aa7e44c15..2a651489e 100644
--- a/tests/mir-opt/spanview_terminator.main.built.after.html
+++ b/tests/mir-opt/spanview_terminator.main.built.after.html
@@ -1,6 +1,7 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
+<meta charset="utf-8">
<title>spanview_terminator.main.built.after</title>
<style>
.line {
@@ -59,7 +60,7 @@
</style>
</head>
<body>
-<div class="code" style="counter-reset: line 4"><span class="line"><span class="code" style="--layer: 0">fn main() {}</span><span><span class="code even" style="--layer: 1" title="0:Return: $DIR/spanview_terminator.rs:5:13: 5:13:
- 5:13-5:13: Return: return"><span class="annotation">0:Return⦊</span>‸<span class="annotation">⦉0:Return</span></span></span></span></div>
+<div class="code" style="counter-reset: line 5"><span class="line"><span class="code" style="--layer: 0">fn main() {}</span><span><span class="code even" style="--layer: 1" title="0:Return: $DIR/spanview_terminator.rs:6:13: 6:13:
+ 6:13-6:13: Return: return"><span class="annotation">0:Return⦊</span>‸<span class="annotation">⦉0:Return</span></span></span></span></div>
</body>
</html>
diff --git a/tests/mir-opt/spanview_terminator.rs b/tests/mir-opt/spanview_terminator.rs
index 76fced188..a2c68b98e 100644
--- a/tests/mir-opt/spanview_terminator.rs
+++ b/tests/mir-opt/spanview_terminator.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test spanview terminator output
// compile-flags: -Z dump-mir-spanview=terminator
diff --git a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff
index 9bda5f575..b020d1baa 100644
--- a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff
@@ -2,213 +2,192 @@
+ // MIR for `foo` after ScalarReplacementOfAggregates
fn foo() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/lifetimes.rs:+0:18: +0:18
- let _1: Foo<T>; // in scope 0 at $DIR/lifetimes.rs:+1:9: +1:12
- let mut _2: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>; // in scope 0 at $DIR/lifetimes.rs:+2:12: +2:31
- let mut _3: std::boxed::Box<dyn std::fmt::Display>; // in scope 0 at $DIR/lifetimes.rs:+2:15: +2:30
- let mut _4: std::boxed::Box<u32>; // in scope 0 at $DIR/lifetimes.rs:+2:15: +2:30
- let mut _7: isize; // in scope 0 at $DIR/lifetimes.rs:+9:12: +9:17
- let _9: (); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
- let _10: (); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
- let mut _11: std::fmt::Arguments<'_>; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
- let mut _12: &[&str]; // in scope 0 at $DIR/lifetimes.rs:+10:19: +10:28
- let mut _13: &[&str; 3]; // in scope 0 at $DIR/lifetimes.rs:+10:19: +10:28
- let _14: &[&str; 3]; // in scope 0 at $DIR/lifetimes.rs:+10:19: +10:28
- let _15: [&str; 3]; // in scope 0 at $DIR/lifetimes.rs:+10:19: +10:28
- let mut _16: &[core::fmt::rt::Argument<'_>]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
- let mut _17: &[core::fmt::rt::Argument<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
- let _18: &[core::fmt::rt::Argument<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
- let _19: [core::fmt::rt::Argument<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
- let mut _20: core::fmt::rt::Argument<'_>; // in scope 0 at $DIR/lifetimes.rs:+10:20: +10:23
- let mut _21: &std::boxed::Box<dyn std::fmt::Display>; // in scope 0 at $DIR/lifetimes.rs:+10:20: +10:23
- let _22: &std::boxed::Box<dyn std::fmt::Display>; // in scope 0 at $DIR/lifetimes.rs:+10:20: +10:23
- let mut _23: core::fmt::rt::Argument<'_>; // in scope 0 at $DIR/lifetimes.rs:+10:24: +10:27
- let mut _24: &u32; // in scope 0 at $DIR/lifetimes.rs:+10:24: +10:27
- let _25: &u32; // in scope 0 at $DIR/lifetimes.rs:+10:24: +10:27
- let mut _27: bool; // in scope 0 at $DIR/lifetimes.rs:+12:1: +12:2
- let mut _28: isize; // in scope 0 at $DIR/lifetimes.rs:+12:1: +12:2
- let mut _29: isize; // in scope 0 at $DIR/lifetimes.rs:+12:1: +12:2
- let mut _30: isize; // in scope 0 at $DIR/lifetimes.rs:+12:1: +12:2
-+ let _31: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>; // in scope 0 at $DIR/lifetimes.rs:+1:9: +1:12
-+ let _32: u32; // in scope 0 at $DIR/lifetimes.rs:+1:9: +1:12
+ let mut _0: ();
+ let _1: Foo<T>;
+ let mut _2: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>;
+ let mut _3: std::boxed::Box<dyn std::fmt::Display>;
+ let mut _4: std::boxed::Box<u32>;
+ let mut _7: isize;
+ let _9: ();
+ let _10: ();
+ let mut _11: std::fmt::Arguments<'_>;
+ let mut _12: &[&str];
+ let mut _13: &[&str; 3];
+ let _14: &[&str; 3];
+ let _15: [&str; 3];
+ let mut _16: &[core::fmt::rt::Argument<'_>];
+ let mut _17: &[core::fmt::rt::Argument<'_>; 2];
+ let _18: &[core::fmt::rt::Argument<'_>; 2];
+ let _19: [core::fmt::rt::Argument<'_>; 2];
+ let mut _20: core::fmt::rt::Argument<'_>;
+ let mut _21: &std::boxed::Box<dyn std::fmt::Display>;
+ let _22: &std::boxed::Box<dyn std::fmt::Display>;
+ let mut _23: core::fmt::rt::Argument<'_>;
+ let mut _24: &u32;
+ let _25: &u32;
+ let mut _27: bool;
+ let mut _28: isize;
+ let mut _29: isize;
+ let mut _30: isize;
++ let _31: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>;
++ let _32: u32;
scope 1 {
-- debug foo => _1; // in scope 1 at $DIR/lifetimes.rs:+1:9: +1:12
-+ debug foo => Foo<T>{ .0 => _31, .1 => _32, }; // in scope 1 at $DIR/lifetimes.rs:+1:9: +1:12
- let _5: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>; // in scope 1 at $DIR/lifetimes.rs:+6:9: +6:10
+- debug foo => _1;
++ 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; // in scope 2 at $DIR/lifetimes.rs:+6:9: +6:10
- let _6: u32; // in scope 2 at $DIR/lifetimes.rs:+7:9: +7:10
+ debug x => _5;
+ let _6: u32;
scope 3 {
- debug y => _6; // in scope 3 at $DIR/lifetimes.rs:+7:9: +7:10
+ debug y => _6;
scope 4 {
- debug x => _8; // in scope 4 at $DIR/lifetimes.rs:+9:15: +9:16
- let _8: std::boxed::Box<dyn std::fmt::Display>; // in scope 4 at $DIR/lifetimes.rs:+9:15: +9:16
- let mut _26: &[&str; 3]; // in scope 4 at $DIR/lifetimes.rs:+10:19: +10:28
+ debug x => _8;
+ let _8: std::boxed::Box<dyn std::fmt::Display>;
+ let mut _26: &[&str; 3];
}
}
}
}
bb0: {
- _27 = const false; // scope 0 at $DIR/lifetimes.rs:+1:9: +1:12
-- StorageLive(_1); // scope 0 at $DIR/lifetimes.rs:+1:9: +1:12
-+ StorageLive(_31); // scope 0 at $DIR/lifetimes.rs:+1:9: +1:12
-+ StorageLive(_32); // scope 0 at $DIR/lifetimes.rs:+1:9: +1:12
-+ nop; // scope 0 at $DIR/lifetimes.rs:+1:9: +1:12
- StorageLive(_2); // scope 0 at $DIR/lifetimes.rs:+2:12: +2:31
- StorageLive(_3); // scope 0 at $DIR/lifetimes.rs:+2:15: +2:30
- StorageLive(_4); // scope 0 at $DIR/lifetimes.rs:+2:15: +2:30
- _4 = Box::<u32>::new(const 5_u32) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lifetimes.rs:+2:15: +2:30
- // mir::Constant
- // + span: $DIR/lifetimes.rs:19:15: 19:23
- // + user_ty: UserType(1)
- // + literal: Const { ty: fn(u32) -> Box<u32> {Box::<u32>::new}, val: Value(<ZST>) }
+ _27 = const false;
+- StorageLive(_1);
++ StorageLive(_31);
++ StorageLive(_32);
++ nop;
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = Box::<u32>::new(const 5_u32) -> [return: bb1, unwind unreachable];
}
bb1: {
- _3 = move _4 as std::boxed::Box<dyn std::fmt::Display> (Pointer(Unsize)); // scope 0 at $DIR/lifetimes.rs:+2:15: +2:30
- StorageDead(_4); // scope 0 at $DIR/lifetimes.rs:+2:29: +2:30
- _2 = Result::<Box<dyn std::fmt::Display>, <T as Err>::Err>::Ok(move _3); // scope 0 at $DIR/lifetimes.rs:+2:12: +2:31
- StorageDead(_3); // scope 0 at $DIR/lifetimes.rs:+2:30: +2:31
-- _1 = Foo::<T> { x: move _2, y: const 7_u32 }; // scope 0 at $DIR/lifetimes.rs:+1:23: +4:6
-+ _31 = move _2; // scope 0 at $DIR/lifetimes.rs:+1:23: +4:6
-+ _32 = const 7_u32; // scope 0 at $DIR/lifetimes.rs:+1:23: +4:6
-+ nop; // scope 0 at $DIR/lifetimes.rs:+1:23: +4:6
- StorageDead(_2); // scope 0 at $DIR/lifetimes.rs:+4:5: +4:6
- StorageLive(_5); // scope 1 at $DIR/lifetimes.rs:+6:9: +6:10
- _27 = const true; // scope 1 at $DIR/lifetimes.rs:+6:13: +6:18
-- _5 = move (_1.0: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>); // scope 1 at $DIR/lifetimes.rs:+6:13: +6:18
-+ _5 = move _31; // scope 1 at $DIR/lifetimes.rs:+6:13: +6:18
- StorageLive(_6); // scope 2 at $DIR/lifetimes.rs:+7:9: +7:10
-- _6 = (_1.1: u32); // scope 2 at $DIR/lifetimes.rs:+7:13: +7:18
-+ _6 = _32; // scope 2 at $DIR/lifetimes.rs:+7:13: +7:18
- _7 = discriminant(_5); // scope 4 at $DIR/lifetimes.rs:+9:12: +9:17
- switchInt(move _7) -> [0: bb2, otherwise: bb7]; // scope 4 at $DIR/lifetimes.rs:+9:12: +9:17
+ _3 = move _4 as std::boxed::Box<dyn std::fmt::Display> (PointerCoercion(Unsize));
+ StorageDead(_4);
+ _2 = Result::<Box<dyn std::fmt::Display>, <T as Err>::Err>::Ok(move _3);
+ StorageDead(_3);
+- _1 = Foo::<T> { x: move _2, y: const 7_u32 };
++ _31 = move _2;
++ _32 = const 7_u32;
++ nop;
+ StorageDead(_2);
+ StorageLive(_5);
+ _27 = const true;
+- _5 = move (_1.0: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>);
++ _5 = move _31;
+ StorageLive(_6);
+- _6 = (_1.1: u32);
++ _6 = _32;
+ _7 = discriminant(_5);
+ switchInt(move _7) -> [0: bb2, otherwise: bb7];
}
bb2: {
- StorageLive(_8); // scope 4 at $DIR/lifetimes.rs:+9:15: +9:16
- _27 = const false; // scope 4 at $DIR/lifetimes.rs:+9:15: +9:16
- _8 = move ((_5 as Ok).0: std::boxed::Box<dyn std::fmt::Display>); // scope 4 at $DIR/lifetimes.rs:+9:15: +9:16
- StorageLive(_9); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageLive(_10); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageLive(_11); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageLive(_12); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28
- StorageLive(_13); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28
- StorageLive(_14); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28
- _26 = const _; // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28
- // mir::Constant
- // + span: $DIR/lifetimes.rs:27:19: 27:28
- // + literal: Const { ty: &[&str; 3], val: Unevaluated(foo, [T], Some(promoted[0])) }
- _14 = &(*_26); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28
- _13 = &(*_14); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28
- _12 = move _13 as &[&str] (Pointer(Unsize)); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28
- StorageDead(_13); // scope 4 at $DIR/lifetimes.rs:+10:27: +10:28
- StorageLive(_16); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageLive(_17); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageLive(_18); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageLive(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageLive(_20); // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23
- StorageLive(_21); // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23
- StorageLive(_22); // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23
- _22 = &_8; // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23
- _21 = &(*_22); // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23
- _20 = core::fmt::rt::Argument::<'_>::new_display::<Box<dyn std::fmt::Display>>(move _21) -> [return: bb3, unwind unreachable]; // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23
- // mir::Constant
- // + span: $DIR/lifetimes.rs:27:20: 27:23
- // + user_ty: UserType(4)
- // + literal: Const { ty: for<'b> fn(&'b Box<dyn std::fmt::Display>) -> core::fmt::rt::Argument<'b> {core::fmt::rt::Argument::<'_>::new_display::<Box<dyn std::fmt::Display>>}, val: Value(<ZST>) }
+ StorageLive(_8);
+ _27 = const false;
+ _8 = move ((_5 as Ok).0: std::boxed::Box<dyn std::fmt::Display>);
+ StorageLive(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+ _26 = const _;
+ _14 = &(*_26);
+ _13 = &(*_14);
+ _12 = move _13 as &[&str] (PointerCoercion(Unsize));
+ StorageDead(_13);
+ StorageLive(_16);
+ StorageLive(_17);
+ StorageLive(_18);
+ StorageLive(_19);
+ StorageLive(_20);
+ StorageLive(_21);
+ StorageLive(_22);
+ _22 = &_8;
+ _21 = &(*_22);
+ _20 = core::fmt::rt::Argument::<'_>::new_display::<Box<dyn std::fmt::Display>>(move _21) -> [return: bb3, unwind unreachable];
}
bb3: {
- StorageDead(_21); // scope 4 at $DIR/lifetimes.rs:+10:22: +10:23
- StorageLive(_23); // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27
- StorageLive(_24); // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27
- StorageLive(_25); // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27
- _25 = &_6; // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27
- _24 = &(*_25); // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27
- _23 = core::fmt::rt::Argument::<'_>::new_display::<u32>(move _24) -> [return: bb4, unwind unreachable]; // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27
- // mir::Constant
- // + span: $DIR/lifetimes.rs:27:24: 27:27
- // + user_ty: UserType(5)
- // + literal: Const { ty: for<'b> fn(&'b u32) -> core::fmt::rt::Argument<'b> {core::fmt::rt::Argument::<'_>::new_display::<u32>}, val: Value(<ZST>) }
+ StorageDead(_21);
+ StorageLive(_23);
+ StorageLive(_24);
+ StorageLive(_25);
+ _25 = &_6;
+ _24 = &(*_25);
+ _23 = core::fmt::rt::Argument::<'_>::new_display::<u32>(move _24) -> [return: bb4, unwind unreachable];
}
bb4: {
- StorageDead(_24); // scope 4 at $DIR/lifetimes.rs:+10:26: +10:27
- _19 = [move _20, move _23]; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageDead(_23); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageDead(_20); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- _18 = &_19; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- _17 = &(*_18); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- _16 = move _17 as &[core::fmt::rt::Argument<'_>] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageDead(_17); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- _11 = Arguments::<'_>::new_v1(move _12, move _16) -> [return: bb5, unwind unreachable]; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/std/src/macros.rs:LL:COL
- // + user_ty: UserType(3)
- // + literal: Const { ty: fn(&[&'static str], &[core::fmt::rt::Argument<'_>]) -> Arguments<'_> {Arguments::<'_>::new_v1}, val: Value(<ZST>) }
+ StorageDead(_24);
+ _19 = [move _20, move _23];
+ StorageDead(_23);
+ StorageDead(_20);
+ _18 = &_19;
+ _17 = &(*_18);
+ _16 = move _17 as &[core::fmt::rt::Argument<'_>] (PointerCoercion(Unsize));
+ StorageDead(_17);
+ _11 = Arguments::<'_>::new_v1(move _12, move _16) -> [return: bb5, unwind unreachable];
}
bb5: {
- StorageDead(_16); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageDead(_12); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- _10 = _eprint(move _11) -> [return: bb6, unwind unreachable]; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- // mir::Constant
- // + span: $SRC_DIR/std/src/macros.rs:LL:COL
- // + literal: Const { ty: for<'a> fn(Arguments<'a>) {_eprint}, val: Value(<ZST>) }
+ StorageDead(_16);
+ StorageDead(_12);
+ _10 = _eprint(move _11) -> [return: bb6, unwind unreachable];
}
bb6: {
- StorageDead(_11); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageDead(_25); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageDead(_22); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageDead(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageDead(_18); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageDead(_14); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageDead(_10); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- _9 = const (); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- StorageDead(_9); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- _0 = const (); // scope 4 at $DIR/lifetimes.rs:+9:22: +11:6
- drop(_8) -> [return: bb8, unwind unreachable]; // scope 3 at $DIR/lifetimes.rs:+11:5: +11:6
+ StorageDead(_11);
+ StorageDead(_25);
+ StorageDead(_22);
+ StorageDead(_19);
+ StorageDead(_18);
+ StorageDead(_14);
+ StorageDead(_10);
+ _9 = const ();
+ StorageDead(_9);
+ _0 = const ();
+ drop(_8) -> [return: bb8, unwind unreachable];
}
bb7: {
- _0 = const (); // scope 3 at $DIR/lifetimes.rs:+11:6: +11:6
- goto -> bb9; // scope 3 at $DIR/lifetimes.rs:+9:5: +11:6
+ _0 = const ();
+ goto -> bb9;
}
bb8: {
- StorageDead(_8); // scope 3 at $DIR/lifetimes.rs:+11:5: +11:6
- goto -> bb9; // scope 3 at $DIR/lifetimes.rs:+9:5: +11:6
+ StorageDead(_8);
+ goto -> bb9;
}
bb9: {
- StorageDead(_6); // scope 2 at $DIR/lifetimes.rs:+12:1: +12:2
- _28 = discriminant(_5); // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2
- switchInt(move _28) -> [0: bb11, otherwise: bb13]; // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2
+ StorageDead(_6);
+ _28 = discriminant(_5);
+ switchInt(move _28) -> [0: bb11, otherwise: bb13];
}
bb10: {
- _27 = const false; // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2
- StorageDead(_5); // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2
-- StorageDead(_1); // scope 0 at $DIR/lifetimes.rs:+12:1: +12:2
-+ StorageDead(_31); // scope 0 at $DIR/lifetimes.rs:+12:1: +12:2
-+ StorageDead(_32); // scope 0 at $DIR/lifetimes.rs:+12:1: +12:2
-+ nop; // scope 0 at $DIR/lifetimes.rs:+12:1: +12:2
- return; // scope 0 at $DIR/lifetimes.rs:+12:2: +12:2
+ _27 = const false;
+ StorageDead(_5);
+- StorageDead(_1);
++ StorageDead(_31);
++ StorageDead(_32);
++ nop;
+ return;
}
bb11: {
- switchInt(_27) -> [0: bb10, otherwise: bb12]; // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2
+ switchInt(_27) -> [0: bb10, otherwise: bb12];
}
bb12: {
- drop(((_5 as Ok).0: std::boxed::Box<dyn std::fmt::Display>)) -> [return: bb10, unwind unreachable]; // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2
+ drop(((_5 as Ok).0: std::boxed::Box<dyn std::fmt::Display>)) -> [return: bb10, unwind unreachable];
}
bb13: {
- drop(_5) -> [return: bb10, unwind unreachable]; // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2
+ drop(_5) -> [return: bb10, unwind unreachable];
}
}
diff --git a/tests/mir-opt/sroa/lifetimes.rs b/tests/mir-opt/sroa/lifetimes.rs
index 2356d212f..cc5c0c9bb 100644
--- a/tests/mir-opt/sroa/lifetimes.rs
+++ b/tests/mir-opt/sroa/lifetimes.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ScalarReplacementOfAggregates
// compile-flags: -Cpanic=abort
// no-prefer-dynamic
diff --git a/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff
index 647681f0e..1330f9b3a 100644
--- a/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff
@@ -2,45 +2,46 @@
+ // MIR for `constant` after ScalarReplacementOfAggregates
fn constant() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:15: +0:15
- let _1: (usize, u8); // in scope 0 at $DIR/structs.rs:+2:9: +2:10
-+ let _4: usize; // in scope 0 at $DIR/structs.rs:+2:9: +2:10
-+ let _5: u8; // in scope 0 at $DIR/structs.rs:+2:9: +2:10
+ let mut _0: ();
+ let _1: (usize, u8);
++ let _4: usize;
++ let _5: u8;
scope 1 {
-- debug y => _1; // in scope 1 at $DIR/structs.rs:+2:9: +2:10
-+ debug y => (usize, u8){ .0 => _4, .1 => _5, }; // in scope 1 at $DIR/structs.rs:+2:9: +2:10
- let _2: usize; // in scope 1 at $DIR/structs.rs:+3:9: +3:10
+- debug y => _1;
++ debug ((y: (usize, u8)).0: usize) => _4;
++ debug ((y: (usize, u8)).1: u8) => _5;
+ let _2: usize;
scope 2 {
- debug t => _2; // in scope 2 at $DIR/structs.rs:+3:9: +3:10
- let _3: u8; // in scope 2 at $DIR/structs.rs:+4:9: +4:10
+ debug t => _2;
+ let _3: u8;
scope 3 {
- debug u => _3; // in scope 3 at $DIR/structs.rs:+4:9: +4:10
+ debug u => _3;
}
}
}
bb0: {
-- StorageLive(_1); // scope 0 at $DIR/structs.rs:+2:9: +2:10
-+ StorageLive(_4); // scope 0 at $DIR/structs.rs:+2:9: +2:10
-+ StorageLive(_5); // scope 0 at $DIR/structs.rs:+2:9: +2:10
-+ nop; // scope 0 at $DIR/structs.rs:+2:9: +2:10
- _1 = const _; // scope 0 at $DIR/structs.rs:+2:13: +2:14
-+ _4 = move (_1.0: usize); // scope 1 at $DIR/structs.rs:+3:9: +3:10
-+ _5 = move (_1.1: u8); // scope 1 at $DIR/structs.rs:+3:9: +3:10
- StorageLive(_2); // scope 1 at $DIR/structs.rs:+3:9: +3:10
-- _2 = (_1.0: usize); // scope 1 at $DIR/structs.rs:+3:13: +3:16
-+ _2 = _4; // scope 1 at $DIR/structs.rs:+3:13: +3:16
- StorageLive(_3); // scope 2 at $DIR/structs.rs:+4:9: +4:10
-- _3 = (_1.1: u8); // scope 2 at $DIR/structs.rs:+4:13: +4:16
-+ _3 = _5; // scope 2 at $DIR/structs.rs:+4:13: +4:16
- _0 = const (); // scope 0 at $DIR/structs.rs:+0:15: +5:2
- StorageDead(_3); // scope 2 at $DIR/structs.rs:+5:1: +5:2
- StorageDead(_2); // scope 1 at $DIR/structs.rs:+5:1: +5:2
-- StorageDead(_1); // scope 0 at $DIR/structs.rs:+5:1: +5:2
-+ StorageDead(_4); // scope 0 at $DIR/structs.rs:+5:1: +5:2
-+ StorageDead(_5); // scope 0 at $DIR/structs.rs:+5:1: +5:2
-+ nop; // scope 0 at $DIR/structs.rs:+5:1: +5:2
- return; // scope 0 at $DIR/structs.rs:+5:2: +5:2
+- StorageLive(_1);
++ StorageLive(_4);
++ StorageLive(_5);
++ nop;
+ _1 = const _;
++ _4 = move (_1.0: usize);
++ _5 = move (_1.1: u8);
+ StorageLive(_2);
+- _2 = (_1.0: usize);
++ _2 = _4;
+ StorageLive(_3);
+- _3 = (_1.1: u8);
++ _3 = _5;
+ _0 = const ();
+ StorageDead(_3);
+ StorageDead(_2);
+- StorageDead(_1);
++ StorageDead(_4);
++ StorageDead(_5);
++ nop;
+ return;
}
}
diff --git a/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff
index b0b0da886..362133863 100644
--- a/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff
@@ -2,33 +2,39 @@
+ // MIR for `copies` after ScalarReplacementOfAggregates
fn copies(_1: Foo) -> () {
- debug x => _1; // in scope 0 at $DIR/structs.rs:+0:11: +0:12
- let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:19: +0:19
- let _2: Foo; // in scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ let _11: u8; // in scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ let _12: (); // in scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ let _13: &str; // in scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ let _14: std::option::Option<isize>; // in scope 0 at $DIR/structs.rs:+1:9: +1:10
+ debug x => _1;
+ let mut _0: ();
+ let _2: Foo;
++ let _11: u8;
++ let _12: ();
++ let _13: &str;
++ let _14: std::option::Option<isize>;
scope 1 {
-- debug y => _2; // in scope 1 at $DIR/structs.rs:+1:9: +1:10
-+ debug y => Foo{ .0 => _11, .1 => _12, .2 => _13, .3 => _14, }; // in scope 1 at $DIR/structs.rs:+1:9: +1:10
- let _3: u8; // in scope 1 at $DIR/structs.rs:+2:9: +2:10
+- debug y => _2;
++ 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; // in scope 2 at $DIR/structs.rs:+2:9: +2:10
- let _4: &str; // in scope 2 at $DIR/structs.rs:+3:9: +3:10
+ debug t => _3;
+ let _4: &str;
scope 3 {
- debug u => _4; // in scope 3 at $DIR/structs.rs:+3:9: +3:10
- let _5: Foo; // in scope 3 at $DIR/structs.rs:+4:9: +4:10
-+ let _7: u8; // in scope 3 at $DIR/structs.rs:+4:9: +4:10
-+ let _8: (); // in scope 3 at $DIR/structs.rs:+4:9: +4:10
-+ let _9: &str; // in scope 3 at $DIR/structs.rs:+4:9: +4:10
-+ let _10: std::option::Option<isize>; // in scope 3 at $DIR/structs.rs:+4:9: +4:10
+ debug u => _4;
+ let _5: Foo;
++ let _7: u8;
++ let _8: ();
++ let _9: &str;
++ let _10: std::option::Option<isize>;
scope 4 {
-- debug z => _5; // in scope 4 at $DIR/structs.rs:+4:9: +4:10
-+ debug z => Foo{ .0 => _7, .1 => _8, .2 => _9, .3 => _10, }; // in scope 4 at $DIR/structs.rs:+4:9: +4:10
- let _6: (); // in scope 4 at $DIR/structs.rs:+5:9: +5:10
+- debug z => _5;
++ 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; // in scope 5 at $DIR/structs.rs:+5:9: +5:10
+ debug a => _6;
}
}
}
@@ -36,56 +42,56 @@
}
bb0: {
-- StorageLive(_2); // scope 0 at $DIR/structs.rs:+1:9: +1:10
-- _2 = _1; // scope 0 at $DIR/structs.rs:+1:13: +1:14
-+ StorageLive(_11); // scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ StorageLive(_12); // scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ StorageLive(_13); // scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ StorageLive(_14); // scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ nop; // scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ _11 = (_1.0: u8); // scope 0 at $DIR/structs.rs:+1:13: +1:14
-+ _12 = (_1.1: ()); // scope 0 at $DIR/structs.rs:+1:13: +1:14
-+ _13 = (_1.2: &str); // scope 0 at $DIR/structs.rs:+1:13: +1:14
-+ _14 = (_1.3: std::option::Option<isize>); // scope 0 at $DIR/structs.rs:+1:13: +1:14
-+ nop; // scope 0 at $DIR/structs.rs:+1:13: +1:14
- StorageLive(_3); // scope 1 at $DIR/structs.rs:+2:9: +2:10
-- _3 = (_2.0: u8); // scope 1 at $DIR/structs.rs:+2:13: +2:16
-+ _3 = _11; // scope 1 at $DIR/structs.rs:+2:13: +2:16
- StorageLive(_4); // scope 2 at $DIR/structs.rs:+3:9: +3:10
-- _4 = (_2.2: &str); // scope 2 at $DIR/structs.rs:+3:13: +3:16
-- StorageLive(_5); // scope 3 at $DIR/structs.rs:+4:9: +4:10
-- _5 = _2; // scope 3 at $DIR/structs.rs:+4:13: +4:14
-+ _4 = _13; // scope 2 at $DIR/structs.rs:+3:13: +3:16
-+ StorageLive(_7); // scope 3 at $DIR/structs.rs:+4:9: +4:10
-+ StorageLive(_8); // scope 3 at $DIR/structs.rs:+4:9: +4:10
-+ StorageLive(_9); // scope 3 at $DIR/structs.rs:+4:9: +4:10
-+ StorageLive(_10); // scope 3 at $DIR/structs.rs:+4:9: +4:10
-+ nop; // scope 3 at $DIR/structs.rs:+4:9: +4:10
-+ _7 = _11; // scope 3 at $DIR/structs.rs:+4:13: +4:14
-+ _8 = _12; // scope 3 at $DIR/structs.rs:+4:13: +4:14
-+ _9 = _13; // scope 3 at $DIR/structs.rs:+4:13: +4:14
-+ _10 = _14; // scope 3 at $DIR/structs.rs:+4:13: +4:14
-+ nop; // scope 3 at $DIR/structs.rs:+4:13: +4:14
- StorageLive(_6); // scope 4 at $DIR/structs.rs:+5:9: +5:10
-- _6 = (_5.1: ()); // scope 4 at $DIR/structs.rs:+5:13: +5:16
-+ _6 = _8; // scope 4 at $DIR/structs.rs:+5:13: +5:16
- _0 = const (); // scope 0 at $DIR/structs.rs:+0:19: +6:2
- StorageDead(_6); // scope 4 at $DIR/structs.rs:+6:1: +6:2
-- StorageDead(_5); // scope 3 at $DIR/structs.rs:+6:1: +6:2
-+ StorageDead(_7); // scope 3 at $DIR/structs.rs:+6:1: +6:2
-+ StorageDead(_8); // scope 3 at $DIR/structs.rs:+6:1: +6:2
-+ StorageDead(_9); // scope 3 at $DIR/structs.rs:+6:1: +6:2
-+ StorageDead(_10); // scope 3 at $DIR/structs.rs:+6:1: +6:2
-+ nop; // scope 3 at $DIR/structs.rs:+6:1: +6:2
- StorageDead(_4); // scope 2 at $DIR/structs.rs:+6:1: +6:2
- StorageDead(_3); // scope 1 at $DIR/structs.rs:+6:1: +6:2
-- StorageDead(_2); // scope 0 at $DIR/structs.rs:+6:1: +6:2
-+ StorageDead(_11); // scope 0 at $DIR/structs.rs:+6:1: +6:2
-+ StorageDead(_12); // scope 0 at $DIR/structs.rs:+6:1: +6:2
-+ StorageDead(_13); // scope 0 at $DIR/structs.rs:+6:1: +6:2
-+ StorageDead(_14); // scope 0 at $DIR/structs.rs:+6:1: +6:2
-+ nop; // scope 0 at $DIR/structs.rs:+6:1: +6:2
- return; // scope 0 at $DIR/structs.rs:+6:2: +6:2
+- StorageLive(_2);
+- _2 = _1;
++ StorageLive(_11);
++ StorageLive(_12);
++ StorageLive(_13);
++ StorageLive(_14);
++ nop;
++ _11 = (_1.0: u8);
++ _12 = (_1.1: ());
++ _13 = (_1.2: &str);
++ _14 = (_1.3: std::option::Option<isize>);
++ nop;
+ StorageLive(_3);
+- _3 = (_2.0: u8);
++ _3 = _11;
+ StorageLive(_4);
+- _4 = (_2.2: &str);
+- StorageLive(_5);
+- _5 = _2;
++ _4 = _13;
++ StorageLive(_7);
++ StorageLive(_8);
++ StorageLive(_9);
++ StorageLive(_10);
++ nop;
++ _7 = _11;
++ _8 = _12;
++ _9 = _13;
++ _10 = _14;
++ nop;
+ StorageLive(_6);
+- _6 = (_5.1: ());
++ _6 = _8;
+ _0 = const ();
+ StorageDead(_6);
+- StorageDead(_5);
++ StorageDead(_7);
++ StorageDead(_8);
++ StorageDead(_9);
++ StorageDead(_10);
++ nop;
+ StorageDead(_4);
+ StorageDead(_3);
+- StorageDead(_2);
++ StorageDead(_11);
++ StorageDead(_12);
++ StorageDead(_13);
++ StorageDead(_14);
++ nop;
+ return;
}
}
diff --git a/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff
index d378c260a..bc38a219e 100644
--- a/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff
@@ -2,43 +2,43 @@
+ // MIR for `dropping` after ScalarReplacementOfAggregates
fn dropping() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:19: +0:19
- let _1: Tag; // in scope 0 at $DIR/structs.rs:+1:5: +1:32
- let mut _2: S; // in scope 0 at $DIR/structs.rs:+1:5: +1:30
- let mut _3: Tag; // in scope 0 at $DIR/structs.rs:+1:7: +1:13
- let mut _4: Tag; // in scope 0 at $DIR/structs.rs:+1:15: +1:21
- let mut _5: Tag; // in scope 0 at $DIR/structs.rs:+1:23: +1:29
+ let mut _0: ();
+ let _1: Tag;
+ let mut _2: S;
+ let mut _3: Tag;
+ let mut _4: Tag;
+ let mut _5: Tag;
bb0: {
- StorageLive(_1); // scope 0 at $DIR/structs.rs:+1:5: +1:32
- StorageLive(_2); // scope 0 at $DIR/structs.rs:+1:5: +1:30
- StorageLive(_3); // scope 0 at $DIR/structs.rs:+1:7: +1:13
- _3 = Tag(const 0_usize); // scope 0 at $DIR/structs.rs:+1:7: +1:13
- StorageLive(_4); // scope 0 at $DIR/structs.rs:+1:15: +1:21
- _4 = Tag(const 1_usize); // scope 0 at $DIR/structs.rs:+1:15: +1:21
- StorageLive(_5); // scope 0 at $DIR/structs.rs:+1:23: +1:29
- _5 = Tag(const 2_usize); // scope 0 at $DIR/structs.rs:+1:23: +1:29
- _2 = S(move _3, move _4, move _5); // scope 0 at $DIR/structs.rs:+1:5: +1:30
- StorageDead(_5); // scope 0 at $DIR/structs.rs:+1:29: +1:30
- StorageDead(_4); // scope 0 at $DIR/structs.rs:+1:29: +1:30
- StorageDead(_3); // scope 0 at $DIR/structs.rs:+1:29: +1:30
- _1 = move (_2.1: Tag); // scope 0 at $DIR/structs.rs:+1:5: +1:32
- drop(_1) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/structs.rs:+1:32: +1:33
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = Tag(const 0_usize);
+ StorageLive(_4);
+ _4 = Tag(const 1_usize);
+ StorageLive(_5);
+ _5 = Tag(const 2_usize);
+ _2 = S(move _3, move _4, move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ _1 = move (_2.1: Tag);
+ drop(_1) -> [return: bb1, unwind unreachable];
}
bb1: {
- drop((_2.0: Tag)) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/structs.rs:+1:32: +1:33
+ drop((_2.0: Tag)) -> [return: bb3, unwind unreachable];
}
bb2: {
- StorageDead(_2); // scope 0 at $DIR/structs.rs:+1:32: +1:33
- StorageDead(_1); // scope 0 at $DIR/structs.rs:+1:32: +1:33
- _0 = const (); // scope 0 at $DIR/structs.rs:+0:19: +2:2
- return; // scope 0 at $DIR/structs.rs:+2:2: +2:2
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
}
bb3: {
- drop((_2.2: Tag)) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/structs.rs:+1:32: +1:33
+ drop((_2.2: Tag)) -> [return: bb2, unwind unreachable];
}
}
diff --git a/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff
index ff1e30c2d..b5e39e632 100644
--- a/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff
@@ -2,42 +2,42 @@
+ // MIR for `enums` after ScalarReplacementOfAggregates
fn enums(_1: usize) -> usize {
- debug a => _1; // in scope 0 at $DIR/structs.rs:+0:14: +0:15
- let mut _0: usize; // return place in scope 0 at $DIR/structs.rs:+0:27: +0:32
- let mut _2: std::option::Option<usize>; // in scope 0 at $DIR/structs.rs:+1:22: +1:29
- let mut _3: usize; // in scope 0 at $DIR/structs.rs:+1:27: +1:28
- let mut _4: isize; // in scope 0 at $DIR/structs.rs:+1:12: +1:19
+ debug a => _1;
+ let mut _0: usize;
+ let mut _2: std::option::Option<usize>;
+ let mut _3: usize;
+ let mut _4: isize;
scope 1 {
- debug a => _5; // in scope 1 at $DIR/structs.rs:+1:17: +1:18
- let _5: usize; // in scope 1 at $DIR/structs.rs:+1:17: +1:18
+ debug a => _5;
+ let _5: usize;
}
bb0: {
- StorageLive(_2); // scope 1 at $DIR/structs.rs:+1:22: +1:29
- StorageLive(_3); // scope 1 at $DIR/structs.rs:+1:27: +1:28
- _3 = _1; // scope 1 at $DIR/structs.rs:+1:27: +1:28
- _2 = Option::<usize>::Some(move _3); // scope 1 at $DIR/structs.rs:+1:22: +1:29
- StorageDead(_3); // scope 1 at $DIR/structs.rs:+1:28: +1:29
- _4 = discriminant(_2); // scope 1 at $DIR/structs.rs:+1:12: +1:19
- switchInt(move _4) -> [1: bb1, otherwise: bb2]; // scope 1 at $DIR/structs.rs:+1:12: +1:19
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _2 = Option::<usize>::Some(move _3);
+ StorageDead(_3);
+ _4 = discriminant(_2);
+ switchInt(move _4) -> [1: bb1, otherwise: bb2];
}
bb1: {
- StorageLive(_5); // scope 1 at $DIR/structs.rs:+1:17: +1:18
- _5 = ((_2 as Some).0: usize); // scope 1 at $DIR/structs.rs:+1:17: +1:18
- _0 = _5; // scope 1 at $DIR/structs.rs:+1:32: +1:33
- StorageDead(_5); // scope 0 at $DIR/structs.rs:+1:34: +1:35
- goto -> bb3; // scope 0 at $DIR/structs.rs:+1:5: +1:46
+ StorageLive(_5);
+ _5 = ((_2 as Some).0: usize);
+ _0 = _5;
+ StorageDead(_5);
+ goto -> bb3;
}
bb2: {
- _0 = const 0_usize; // scope 0 at $DIR/structs.rs:+1:43: +1:44
- goto -> bb3; // scope 0 at $DIR/structs.rs:+1:5: +1:46
+ _0 = const 0_usize;
+ goto -> bb3;
}
bb3: {
- StorageDead(_2); // scope 0 at $DIR/structs.rs:+2:1: +2:2
- return; // scope 0 at $DIR/structs.rs:+2:2: +2:2
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff
index 3074fcbdf..6443c6486 100644
--- a/tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff
@@ -2,43 +2,37 @@
+ // MIR for `escaping` after ScalarReplacementOfAggregates
fn escaping() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:19: +0:19
- let _1: (); // in scope 0 at $DIR/structs.rs:+1:5: +1:42
- let mut _2: *const u32; // in scope 0 at $DIR/structs.rs:+1:7: +1:41
- let _3: &u32; // in scope 0 at $DIR/structs.rs:+1:7: +1:41
- let _4: Escaping; // in scope 0 at $DIR/structs.rs:+1:8: +1:39
- let mut _5: u32; // in scope 0 at $DIR/structs.rs:+1:34: +1:37
+ let mut _0: ();
+ let _1: ();
+ let mut _2: *const u32;
+ let _3: &u32;
+ let _4: Escaping;
+ let mut _5: u32;
bb0: {
- StorageLive(_1); // scope 0 at $DIR/structs.rs:+1:5: +1:42
- StorageLive(_2); // scope 0 at $DIR/structs.rs:+1:7: +1:41
- StorageLive(_3); // scope 0 at $DIR/structs.rs:+1:7: +1:41
- StorageLive(_4); // scope 0 at $DIR/structs.rs:+1:8: +1:39
- StorageLive(_5); // scope 0 at $DIR/structs.rs:+1:34: +1:37
- _5 = g() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/structs.rs:+1:34: +1:37
- // mir::Constant
- // + span: $DIR/structs.rs:78:34: 78:35
- // + literal: Const { ty: fn() -> u32 {g}, val: Value(<ZST>) }
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = g() -> [return: bb1, unwind unreachable];
}
bb1: {
- _4 = Escaping { a: const 1_u32, b: const 2_u32, c: move _5 }; // scope 0 at $DIR/structs.rs:+1:8: +1:39
- StorageDead(_5); // scope 0 at $DIR/structs.rs:+1:38: +1:39
- _3 = &(_4.0: u32); // scope 0 at $DIR/structs.rs:+1:7: +1:41
- _2 = &raw const (*_3); // scope 0 at $DIR/structs.rs:+1:7: +1:41
- _1 = f(move _2) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/structs.rs:+1:5: +1:42
- // mir::Constant
- // + span: $DIR/structs.rs:78:5: 78:6
- // + literal: Const { ty: fn(*const u32) {f}, val: Value(<ZST>) }
+ _4 = Escaping { a: const 1_u32, b: const 2_u32, c: move _5 };
+ StorageDead(_5);
+ _3 = &(_4.0: u32);
+ _2 = &raw const (*_3);
+ _1 = f(move _2) -> [return: bb2, unwind unreachable];
}
bb2: {
- StorageDead(_2); // scope 0 at $DIR/structs.rs:+1:41: +1:42
- StorageDead(_4); // scope 0 at $DIR/structs.rs:+1:42: +1:43
- StorageDead(_3); // scope 0 at $DIR/structs.rs:+1:42: +1:43
- StorageDead(_1); // scope 0 at $DIR/structs.rs:+1:42: +1:43
- _0 = const (); // scope 0 at $DIR/structs.rs:+0:19: +2:2
- return; // scope 0 at $DIR/structs.rs:+2:2: +2:2
+ StorageDead(_2);
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_1);
+ _0 = const ();
+ return;
}
}
diff --git a/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff
index 1aa11d17b..a84048365 100644
--- a/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff
@@ -2,23 +2,23 @@
+ // MIR for `flat` after ScalarReplacementOfAggregates
fn flat() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:15: +0:15
- let _1: u8; // in scope 0 at $DIR/structs.rs:+1:15: +1:16
- let _2: (); // in scope 0 at $DIR/structs.rs:+1:18: +1:19
- let _3: &str; // in scope 0 at $DIR/structs.rs:+1:21: +1:22
- let _4: std::option::Option<isize>; // in scope 0 at $DIR/structs.rs:+1:24: +1:25
- let mut _5: Foo; // in scope 0 at $DIR/structs.rs:+1:30: +1:70
- let mut _6: (); // in scope 0 at $DIR/structs.rs:+1:45: +1:47
- let mut _7: std::option::Option<isize>; // in scope 0 at $DIR/structs.rs:+1:60: +1:68
-+ let mut _8: u8; // in scope 0 at $DIR/structs.rs:+1:30: +1:70
-+ let mut _9: (); // in scope 0 at $DIR/structs.rs:+1:30: +1:70
-+ let mut _10: &str; // in scope 0 at $DIR/structs.rs:+1:30: +1:70
-+ let mut _11: std::option::Option<isize>; // in scope 0 at $DIR/structs.rs:+1:30: +1:70
+ let mut _0: ();
+ let _1: u8;
+ let _2: ();
+ let _3: &str;
+ let _4: std::option::Option<isize>;
+ let mut _5: Foo;
+ let mut _6: ();
+ let mut _7: std::option::Option<isize>;
++ let mut _8: u8;
++ let mut _9: ();
++ let mut _10: &str;
++ let mut _11: std::option::Option<isize>;
scope 1 {
- debug a => _1; // in scope 1 at $DIR/structs.rs:+1:15: +1:16
- debug b => _2; // in scope 1 at $DIR/structs.rs:+1:18: +1:19
- debug c => _3; // in scope 1 at $DIR/structs.rs:+1:21: +1:22
- debug d => _4; // in scope 1 at $DIR/structs.rs:+1:24: +1:25
+ debug a => _1;
+ debug b => _2;
+ debug c => _3;
+ debug d => _4;
scope 2 {
scope 3 {
scope 4 {
@@ -30,51 +30,48 @@
}
bb0: {
-- StorageLive(_5); // scope 0 at $DIR/structs.rs:+1:30: +1:70
-+ StorageLive(_8); // scope 0 at $DIR/structs.rs:+1:30: +1:70
-+ StorageLive(_9); // scope 0 at $DIR/structs.rs:+1:30: +1:70
-+ StorageLive(_10); // scope 0 at $DIR/structs.rs:+1:30: +1:70
-+ StorageLive(_11); // scope 0 at $DIR/structs.rs:+1:30: +1:70
-+ nop; // scope 0 at $DIR/structs.rs:+1:30: +1:70
- StorageLive(_6); // scope 0 at $DIR/structs.rs:+1:45: +1:47
- _6 = (); // scope 0 at $DIR/structs.rs:+1:45: +1:47
- StorageLive(_7); // scope 0 at $DIR/structs.rs:+1:60: +1:68
- _7 = Option::<isize>::Some(const -4_isize); // scope 0 at $DIR/structs.rs:+1:60: +1:68
-- _5 = Foo { a: const 5_u8, b: move _6, c: const "a", d: move _7 }; // scope 0 at $DIR/structs.rs:+1:30: +1:70
-+ _8 = const 5_u8; // scope 0 at $DIR/structs.rs:+1:30: +1:70
-+ _9 = move _6; // scope 0 at $DIR/structs.rs:+1:30: +1:70
-+ _10 = const "a"; // scope 0 at $DIR/structs.rs:+1:30: +1:70
- // mir::Constant
- // + span: $DIR/structs.rs:53:52: 53:55
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
-+ _11 = move _7; // scope 0 at $DIR/structs.rs:+1:30: +1:70
-+ nop; // scope 0 at $DIR/structs.rs:+1:30: +1:70
- StorageDead(_7); // scope 0 at $DIR/structs.rs:+1:69: +1:70
- StorageDead(_6); // scope 0 at $DIR/structs.rs:+1:69: +1:70
- StorageLive(_1); // scope 0 at $DIR/structs.rs:+1:15: +1:16
-- _1 = (_5.0: u8); // scope 0 at $DIR/structs.rs:+1:15: +1:16
-+ _1 = _8; // scope 0 at $DIR/structs.rs:+1:15: +1:16
- StorageLive(_2); // scope 0 at $DIR/structs.rs:+1:18: +1:19
-- _2 = (_5.1: ()); // scope 0 at $DIR/structs.rs:+1:18: +1:19
-+ _2 = _9; // scope 0 at $DIR/structs.rs:+1:18: +1:19
- StorageLive(_3); // scope 0 at $DIR/structs.rs:+1:21: +1:22
-- _3 = (_5.2: &str); // scope 0 at $DIR/structs.rs:+1:21: +1:22
-+ _3 = _10; // scope 0 at $DIR/structs.rs:+1:21: +1:22
- StorageLive(_4); // scope 0 at $DIR/structs.rs:+1:24: +1:25
-- _4 = (_5.3: std::option::Option<isize>); // scope 0 at $DIR/structs.rs:+1:24: +1:25
-- StorageDead(_5); // scope 0 at $DIR/structs.rs:+1:70: +1:71
-+ _4 = _11; // scope 0 at $DIR/structs.rs:+1:24: +1:25
-+ StorageDead(_8); // scope 0 at $DIR/structs.rs:+1:70: +1:71
-+ StorageDead(_9); // scope 0 at $DIR/structs.rs:+1:70: +1:71
-+ StorageDead(_10); // scope 0 at $DIR/structs.rs:+1:70: +1:71
-+ StorageDead(_11); // scope 0 at $DIR/structs.rs:+1:70: +1:71
-+ nop; // scope 0 at $DIR/structs.rs:+1:70: +1:71
- _0 = const (); // scope 0 at $DIR/structs.rs:+0:15: +6:2
- StorageDead(_4); // scope 0 at $DIR/structs.rs:+6:1: +6:2
- StorageDead(_3); // scope 0 at $DIR/structs.rs:+6:1: +6:2
- StorageDead(_2); // scope 0 at $DIR/structs.rs:+6:1: +6:2
- StorageDead(_1); // scope 0 at $DIR/structs.rs:+6:1: +6:2
- return; // scope 0 at $DIR/structs.rs:+6:2: +6:2
+- StorageLive(_5);
++ StorageLive(_8);
++ StorageLive(_9);
++ StorageLive(_10);
++ StorageLive(_11);
++ nop;
+ StorageLive(_6);
+ _6 = ();
+ StorageLive(_7);
+ _7 = Option::<isize>::Some(const -4_isize);
+- _5 = Foo { a: const 5_u8, b: move _6, c: const "a", d: move _7 };
++ _8 = const 5_u8;
++ _9 = move _6;
++ _10 = const "a";
++ _11 = move _7;
++ nop;
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_1);
+- _1 = (_5.0: u8);
++ _1 = _8;
+ StorageLive(_2);
+- _2 = (_5.1: ());
++ _2 = _9;
+ StorageLive(_3);
+- _3 = (_5.2: &str);
++ _3 = _10;
+ StorageLive(_4);
+- _4 = (_5.3: std::option::Option<isize>);
+- StorageDead(_5);
++ _4 = _11;
++ StorageDead(_8);
++ StorageDead(_9);
++ StorageDead(_10);
++ StorageDead(_11);
++ nop;
+ _0 = const ();
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff
index 7b09ac182..304bf2fb1 100644
--- a/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff
@@ -2,55 +2,58 @@
+ // MIR for `ref_copies` after ScalarReplacementOfAggregates
fn ref_copies(_1: &Foo) -> () {
- debug x => _1; // in scope 0 at $DIR/structs.rs:+0:15: +0:16
- let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:24: +0:24
- let _2: Foo; // in scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ let _5: u8; // in scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ let _6: (); // in scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ let _7: &str; // in scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ let _8: std::option::Option<isize>; // in scope 0 at $DIR/structs.rs:+1:9: +1:10
+ debug x => _1;
+ let mut _0: ();
+ let _2: Foo;
++ let _5: u8;
++ let _6: ();
++ let _7: &str;
++ let _8: std::option::Option<isize>;
scope 1 {
-- debug y => _2; // in scope 1 at $DIR/structs.rs:+1:9: +1:10
-+ debug y => Foo{ .0 => _5, .1 => _6, .2 => _7, .3 => _8, }; // in scope 1 at $DIR/structs.rs:+1:9: +1:10
- let _3: u8; // in scope 1 at $DIR/structs.rs:+2:9: +2:10
+- debug y => _2;
++ 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; // in scope 2 at $DIR/structs.rs:+2:9: +2:10
- let _4: &str; // in scope 2 at $DIR/structs.rs:+3:9: +3:10
+ debug t => _3;
+ let _4: &str;
scope 3 {
- debug u => _4; // in scope 3 at $DIR/structs.rs:+3:9: +3:10
+ debug u => _4;
}
}
}
bb0: {
-- StorageLive(_2); // scope 0 at $DIR/structs.rs:+1:9: +1:10
-- _2 = (*_1); // scope 0 at $DIR/structs.rs:+1:13: +1:15
-+ StorageLive(_5); // scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ StorageLive(_6); // scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ StorageLive(_7); // scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ StorageLive(_8); // scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ nop; // scope 0 at $DIR/structs.rs:+1:9: +1:10
-+ _5 = ((*_1).0: u8); // scope 0 at $DIR/structs.rs:+1:13: +1:15
-+ _6 = ((*_1).1: ()); // scope 0 at $DIR/structs.rs:+1:13: +1:15
-+ _7 = ((*_1).2: &str); // scope 0 at $DIR/structs.rs:+1:13: +1:15
-+ _8 = ((*_1).3: std::option::Option<isize>); // scope 0 at $DIR/structs.rs:+1:13: +1:15
-+ nop; // scope 0 at $DIR/structs.rs:+1:13: +1:15
- StorageLive(_3); // scope 1 at $DIR/structs.rs:+2:9: +2:10
-- _3 = (_2.0: u8); // scope 1 at $DIR/structs.rs:+2:13: +2:16
-+ _3 = _5; // scope 1 at $DIR/structs.rs:+2:13: +2:16
- StorageLive(_4); // scope 2 at $DIR/structs.rs:+3:9: +3:10
-- _4 = (_2.2: &str); // scope 2 at $DIR/structs.rs:+3:13: +3:16
-+ _4 = _7; // scope 2 at $DIR/structs.rs:+3:13: +3:16
- _0 = const (); // scope 0 at $DIR/structs.rs:+0:24: +4:2
- StorageDead(_4); // scope 2 at $DIR/structs.rs:+4:1: +4:2
- StorageDead(_3); // scope 1 at $DIR/structs.rs:+4:1: +4:2
-- StorageDead(_2); // scope 0 at $DIR/structs.rs:+4:1: +4:2
-+ StorageDead(_5); // scope 0 at $DIR/structs.rs:+4:1: +4:2
-+ StorageDead(_6); // scope 0 at $DIR/structs.rs:+4:1: +4:2
-+ StorageDead(_7); // scope 0 at $DIR/structs.rs:+4:1: +4:2
-+ StorageDead(_8); // scope 0 at $DIR/structs.rs:+4:1: +4:2
-+ nop; // scope 0 at $DIR/structs.rs:+4:1: +4:2
- return; // scope 0 at $DIR/structs.rs:+4:2: +4:2
+- StorageLive(_2);
+- _2 = (*_1);
++ StorageLive(_5);
++ StorageLive(_6);
++ StorageLive(_7);
++ StorageLive(_8);
++ nop;
++ _5 = ((*_1).0: u8);
++ _6 = ((*_1).1: ());
++ _7 = ((*_1).2: &str);
++ _8 = ((*_1).3: std::option::Option<isize>);
++ nop;
+ StorageLive(_3);
+- _3 = (_2.0: u8);
++ _3 = _5;
+ StorageLive(_4);
+- _4 = (_2.2: &str);
++ _4 = _7;
+ _0 = const ();
+ StorageDead(_4);
+ StorageDead(_3);
+- StorageDead(_2);
++ StorageDead(_5);
++ StorageDead(_6);
++ StorageDead(_7);
++ StorageDead(_8);
++ nop;
+ return;
}
}
diff --git a/tests/mir-opt/sroa/structs.rs b/tests/mir-opt/sroa/structs.rs
index 7946eeaea..73563e12c 100644
--- a/tests/mir-opt/sroa/structs.rs
+++ b/tests/mir-opt/sroa/structs.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ScalarReplacementOfAggregates
// compile-flags: -Cpanic=abort
// no-prefer-dynamic
diff --git a/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff
index c94e4b137..bf5c3e3bd 100644
--- a/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff
@@ -2,32 +2,32 @@
+ // MIR for `structs` after ScalarReplacementOfAggregates
fn structs(_1: f32) -> f32 {
- debug a => _1; // in scope 0 at $DIR/structs.rs:+0:16: +0:17
- let mut _0: f32; // return place in scope 0 at $DIR/structs.rs:+0:27: +0:30
- let mut _2: structs::U; // in scope 0 at $DIR/structs.rs:+6:5: +6:21
- let mut _3: f32; // in scope 0 at $DIR/structs.rs:+6:18: +6:19
-+ let mut _4: usize; // in scope 0 at $DIR/structs.rs:+6:5: +6:21
-+ let mut _5: f32; // in scope 0 at $DIR/structs.rs:+6:5: +6:21
+ debug a => _1;
+ let mut _0: f32;
+ let mut _2: structs::U;
+ let mut _3: f32;
++ let mut _4: usize;
++ let mut _5: f32;
bb0: {
-- StorageLive(_2); // scope 0 at $DIR/structs.rs:+6:5: +6:21
-+ StorageLive(_4); // scope 0 at $DIR/structs.rs:+6:5: +6:21
-+ StorageLive(_5); // scope 0 at $DIR/structs.rs:+6:5: +6:21
-+ nop; // scope 0 at $DIR/structs.rs:+6:5: +6:21
- StorageLive(_3); // scope 0 at $DIR/structs.rs:+6:18: +6:19
- _3 = _1; // scope 0 at $DIR/structs.rs:+6:18: +6:19
-- _2 = U { _foo: const 0_usize, a: move _3 }; // scope 0 at $DIR/structs.rs:+6:5: +6:21
-+ _4 = const 0_usize; // scope 0 at $DIR/structs.rs:+6:5: +6:21
-+ _5 = move _3; // scope 0 at $DIR/structs.rs:+6:5: +6:21
-+ nop; // scope 0 at $DIR/structs.rs:+6:5: +6:21
- StorageDead(_3); // scope 0 at $DIR/structs.rs:+6:20: +6:21
-- _0 = (_2.1: f32); // scope 0 at $DIR/structs.rs:+6:5: +6:23
-- StorageDead(_2); // scope 0 at $DIR/structs.rs:+7:1: +7:2
-+ _0 = _5; // scope 0 at $DIR/structs.rs:+6:5: +6:23
-+ StorageDead(_4); // scope 0 at $DIR/structs.rs:+7:1: +7:2
-+ StorageDead(_5); // scope 0 at $DIR/structs.rs:+7:1: +7:2
-+ nop; // scope 0 at $DIR/structs.rs:+7:1: +7:2
- return; // scope 0 at $DIR/structs.rs:+7:2: +7:2
+- StorageLive(_2);
++ StorageLive(_4);
++ StorageLive(_5);
++ nop;
+ StorageLive(_3);
+ _3 = _1;
+- _2 = U { _foo: const 0_usize, a: move _3 };
++ _4 = const 0_usize;
++ _5 = move _3;
++ nop;
+ StorageDead(_3);
+- _0 = (_2.1: f32);
+- StorageDead(_2);
++ _0 = _5;
++ StorageDead(_4);
++ StorageDead(_5);
++ nop;
+ return;
}
}
diff --git a/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff
index 5aa054589..6c99d3efd 100644
--- a/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff
@@ -2,22 +2,22 @@
+ // MIR for `unions` after ScalarReplacementOfAggregates
fn unions(_1: f32) -> u32 {
- debug a => _1; // in scope 0 at $DIR/structs.rs:+0:15: +0:16
- let mut _0: u32; // return place in scope 0 at $DIR/structs.rs:+0:26: +0:29
- let mut _2: unions::Repr; // in scope 0 at $DIR/structs.rs:+5:14: +5:27
- let mut _3: f32; // in scope 0 at $DIR/structs.rs:+5:24: +5:25
+ debug a => _1;
+ let mut _0: u32;
+ let mut _2: unions::Repr;
+ let mut _3: f32;
scope 1 {
}
bb0: {
- StorageLive(_2); // scope 1 at $DIR/structs.rs:+5:14: +5:27
- StorageLive(_3); // scope 1 at $DIR/structs.rs:+5:24: +5:25
- _3 = _1; // scope 1 at $DIR/structs.rs:+5:24: +5:25
- _2 = Repr { f: move _3 }; // scope 1 at $DIR/structs.rs:+5:14: +5:27
- StorageDead(_3); // scope 1 at $DIR/structs.rs:+5:26: +5:27
- _0 = (_2.1: u32); // scope 1 at $DIR/structs.rs:+5:14: +5:29
- StorageDead(_2); // scope 0 at $DIR/structs.rs:+6:1: +6:2
- return; // scope 0 at $DIR/structs.rs:+6:2: +6:2
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ _2 = Repr { f: move _3 };
+ StorageDead(_3);
+ _0 = (_2.1: u32);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/ssa_unreachable_116212.rs b/tests/mir-opt/ssa_unreachable_116212.rs
new file mode 100644
index 000000000..9f1cf223e
--- /dev/null
+++ b/tests/mir-opt/ssa_unreachable_116212.rs
@@ -0,0 +1,15 @@
+// skip-filecheck
+// 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/storage_ranges.main.nll.0.mir b/tests/mir-opt/storage_ranges.main.nll.0.mir
index 5bb1a7bf0..782efd5ac 100644
--- a/tests/mir-opt/storage_ranges.main.nll.0.mir
+++ b/tests/mir-opt/storage_ranges.main.nll.0.mir
@@ -15,49 +15,49 @@
| '?1 live at {bb0[0..=22]}
| '?2 live at {bb0[10]}
| '?3 live at {bb0[11]}
-| '?2: '?3 due to Assignment at Single(bb0[10]) ($DIR/storage_ranges.rs:6:17: 6:25 (#0)
+| '?2: '?3 due to Assignment at Single(bb0[10]) ($DIR/storage_ranges.rs:7:17: 7:25 (#0)
|
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/storage_ranges.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/storage_ranges.rs:+1:9: +1:10
- let _2: (); // in scope 0 at $DIR/storage_ranges.rs:+2:5: +4:6
- let _4: std::option::Option<i32>; // in scope 0 at $DIR/storage_ranges.rs:+3:18: +3:25
- let mut _5: i32; // in scope 0 at $DIR/storage_ranges.rs:+3:23: +3:24
+ let mut _0: ();
+ let _1: i32;
+ let _2: ();
+ let _4: std::option::Option<i32>;
+ let mut _5: i32;
scope 1 {
- debug a => _1; // in scope 1 at $DIR/storage_ranges.rs:+1:9: +1:10
- let _3: &std::option::Option<i32>; // in scope 1 at $DIR/storage_ranges.rs:+3:13: +3:14
- let _6: i32; // in scope 1 at $DIR/storage_ranges.rs:+5:9: +5:10
+ debug a => _1;
+ let _3: &std::option::Option<i32>;
+ let _6: i32;
scope 2 {
- debug b => _3; // in scope 2 at $DIR/storage_ranges.rs:+3:13: +3:14
+ debug b => _3;
}
scope 3 {
- debug c => _6; // in scope 3 at $DIR/storage_ranges.rs:+5:9: +5:10
+ debug c => _6;
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/storage_ranges.rs:+1:9: +1:10
- _1 = const 0_i32; // scope 0 at $DIR/storage_ranges.rs:+1:13: +1:14
- FakeRead(ForLet(None), _1); // scope 0 at $DIR/storage_ranges.rs:+1:9: +1:10
- StorageLive(_2); // scope 1 at $DIR/storage_ranges.rs:+2:5: +4:6
- StorageLive(_3); // scope 1 at $DIR/storage_ranges.rs:+3:13: +3:14
- StorageLive(_4); // scope 1 at $DIR/storage_ranges.rs:+3:18: +3:25
- StorageLive(_5); // scope 1 at $DIR/storage_ranges.rs:+3:23: +3:24
- _5 = _1; // scope 1 at $DIR/storage_ranges.rs:+3:23: +3:24
- _4 = Option::<i32>::Some(move _5); // scope 1 at $DIR/storage_ranges.rs:+3:18: +3:25
- StorageDead(_5); // scope 1 at $DIR/storage_ranges.rs:+3:24: +3:25
- _3 = &_4; // scope 1 at $DIR/storage_ranges.rs:+3:17: +3:25
- FakeRead(ForLet(None), _3); // scope 1 at $DIR/storage_ranges.rs:+3:13: +3:14
- _2 = const (); // scope 1 at $DIR/storage_ranges.rs:+2:5: +4:6
- StorageDead(_4); // scope 1 at $DIR/storage_ranges.rs:+4:5: +4:6
- StorageDead(_3); // scope 1 at $DIR/storage_ranges.rs:+4:5: +4:6
- StorageDead(_2); // scope 1 at $DIR/storage_ranges.rs:+4:5: +4:6
- StorageLive(_6); // scope 1 at $DIR/storage_ranges.rs:+5:9: +5:10
- _6 = const 1_i32; // scope 1 at $DIR/storage_ranges.rs:+5:13: +5:14
- FakeRead(ForLet(None), _6); // scope 1 at $DIR/storage_ranges.rs:+5:9: +5:10
- _0 = const (); // scope 0 at $DIR/storage_ranges.rs:+0:11: +6:2
- StorageDead(_6); // scope 1 at $DIR/storage_ranges.rs:+6:1: +6:2
- StorageDead(_1); // scope 0 at $DIR/storage_ranges.rs:+6:1: +6:2
- return; // scope 0 at $DIR/storage_ranges.rs:+6:2: +6:2
+ StorageLive(_1);
+ _1 = const 0_i32;
+ FakeRead(ForLet(None), _1);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ _4 = Option::<i32>::Some(move _5);
+ StorageDead(_5);
+ _3 = &_4;
+ FakeRead(ForLet(None), _3);
+ _2 = const ();
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_6);
+ _6 = const 1_i32;
+ FakeRead(ForLet(None), _6);
+ _0 = const ();
+ StorageDead(_6);
+ StorageDead(_1);
+ return;
}
}
diff --git a/tests/mir-opt/storage_ranges.rs b/tests/mir-opt/storage_ranges.rs
index 996051a29..5a68d5684 100644
--- a/tests/mir-opt/storage_ranges.rs
+++ b/tests/mir-opt/storage_ranges.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR storage_ranges.main.nll.0.mir
fn main() {
diff --git a/tests/mir-opt/switch_to_self.rs b/tests/mir-opt/switch_to_self.rs
new file mode 100644
index 000000000..fc270fd33
--- /dev/null
+++ b/tests/mir-opt/switch_to_self.rs
@@ -0,0 +1,22 @@
+// skip-filecheck
+// Test that MatchBranchSimplification doesn't ICE on a SwitchInt where
+// one of the targets is the block that the SwitchInt terminates.
+#![crate_type = "lib"]
+#![feature(core_intrinsics, custom_mir)]
+use std::intrinsics::mir::*;
+
+// EMIT_MIR switch_to_self.test.MatchBranchSimplification.diff
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+pub fn test(x: bool) {
+ mir!(
+ {
+ Goto(bb0)
+ }
+ bb0 = {
+ match x { false => bb0, _ => bb1 }
+ }
+ bb1 = {
+ match x { false => bb0, _ => bb1 }
+ }
+ )
+}
diff --git a/tests/mir-opt/switch_to_self.test.MatchBranchSimplification.diff b/tests/mir-opt/switch_to_self.test.MatchBranchSimplification.diff
new file mode 100644
index 000000000..c0b599e06
--- /dev/null
+++ b/tests/mir-opt/switch_to_self.test.MatchBranchSimplification.diff
@@ -0,0 +1,19 @@
+- // MIR for `test` before MatchBranchSimplification
++ // MIR for `test` after MatchBranchSimplification
+
+ fn test(_1: bool) -> () {
+ let mut _0: ();
+
+ bb0: {
+ goto -> bb1;
+ }
+
+ bb1: {
+ switchInt(_1) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb2: {
+ switchInt(_1) -> [0: bb1, otherwise: bb2];
+ }
+ }
+
diff --git a/tests/mir-opt/tls_access.main.PreCodegen.after.mir b/tests/mir-opt/tls_access.main.PreCodegen.after.mir
index 09453b8ba..43c7051f0 100644
--- a/tests/mir-opt/tls_access.main.PreCodegen.after.mir
+++ b/tests/mir-opt/tls_access.main.PreCodegen.after.mir
@@ -1,28 +1,28 @@
// MIR for `main` after PreCodegen
fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/tls_access.rs:+0:11: +0:11
- let _2: *mut u8; // in scope 0 at $DIR/tls_access.rs:+2:18: +2:21
- let mut _3: *mut u8; // in scope 0 at $DIR/tls_access.rs:+3:9: +3:12
+ let mut _0: ();
+ let _1: *mut u8;
+ let mut _3: *mut u8;
scope 1 {
- let _1: &u8; // in scope 1 at $DIR/tls_access.rs:+2:13: +2:14
+ let _2: &u8;
scope 2 {
- debug a => _1; // in scope 2 at $DIR/tls_access.rs:+2:13: +2:14
+ debug a => _2;
}
}
bb0: {
- StorageLive(_1); // scope 1 at $DIR/tls_access.rs:+2:13: +2:14
- StorageLive(_2); // scope 1 at $DIR/tls_access.rs:+2:18: +2:21
- _2 = &/*tls*/ mut FOO; // scope 1 at $DIR/tls_access.rs:+2:18: +2:21
- _1 = &(*_2); // scope 1 at $DIR/tls_access.rs:+2:17: +2:21
- StorageLive(_3); // scope 2 at $DIR/tls_access.rs:+3:9: +3:12
- _3 = &/*tls*/ mut FOO; // scope 2 at $DIR/tls_access.rs:+3:9: +3:12
- (*_3) = const 42_u8; // scope 2 at $DIR/tls_access.rs:+3:9: +3:17
- StorageDead(_3); // scope 2 at $DIR/tls_access.rs:+3:17: +3:18
- _0 = const (); // scope 1 at $DIR/tls_access.rs:+1:5: +4:6
- StorageDead(_2); // scope 1 at $DIR/tls_access.rs:+4:5: +4:6
- StorageDead(_1); // scope 1 at $DIR/tls_access.rs:+4:5: +4:6
- return; // scope 0 at $DIR/tls_access.rs:+5:2: +5:2
+ StorageLive(_2);
+ StorageLive(_1);
+ _1 = &/*tls*/ mut FOO;
+ _2 = &(*_1);
+ StorageLive(_3);
+ _3 = &/*tls*/ mut FOO;
+ (*_3) = const 42_u8;
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_1);
+ StorageDead(_2);
+ return;
}
}
diff --git a/tests/mir-opt/tls_access.rs b/tests/mir-opt/tls_access.rs
index 19344c868..450dd9b47 100644
--- a/tests/mir-opt/tls_access.rs
+++ b/tests/mir-opt/tls_access.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR tls_access.main.PreCodegen.after.mir
// compile-flags: -Zmir-opt-level=0
diff --git a/tests/mir-opt/uninhabited_enum.process_never.SimplifyLocals-final.after.mir b/tests/mir-opt/uninhabited_enum.process_never.SimplifyLocals-final.after.mir
index b4fb330f3..89f7016fe 100644
--- a/tests/mir-opt/uninhabited_enum.process_never.SimplifyLocals-final.after.mir
+++ b/tests/mir-opt/uninhabited_enum.process_never.SimplifyLocals-final.after.mir
@@ -1,16 +1,16 @@
// MIR for `process_never` after SimplifyLocals-final
fn process_never(_1: *const !) -> () {
- debug input => _1; // in scope 0 at $DIR/uninhabited_enum.rs:+0:22: +0:27
- let mut _0: (); // return place in scope 0 at $DIR/uninhabited_enum.rs:+0:39: +0:39
- let _2: &!; // in scope 0 at $DIR/uninhabited_enum.rs:+1:8: +1:14
+ debug input => _1;
+ let mut _0: ();
+ let _2: &!;
scope 1 {
- debug _input => _2; // in scope 1 at $DIR/uninhabited_enum.rs:+1:8: +1:14
+ debug _input => _2;
}
scope 2 {
}
bb0: {
- unreachable; // scope 0 at $DIR/uninhabited_enum.rs:+0:39: +2:2
+ unreachable;
}
}
diff --git a/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir b/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir
index 4b2a16b50..51905f982 100644
--- a/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir
+++ b/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir
@@ -1,15 +1,15 @@
// MIR for `process_void` after SimplifyLocals-final
fn process_void(_1: *const Void) -> () {
- debug input => _1; // in scope 0 at $DIR/uninhabited_enum.rs:+0:21: +0:26
- let mut _0: (); // return place in scope 0 at $DIR/uninhabited_enum.rs:+0:41: +0:41
+ debug input => _1;
+ let mut _0: ();
scope 1 {
- debug _input => _1; // in scope 1 at $DIR/uninhabited_enum.rs:+1:8: +1:14
+ debug _input => _1;
}
scope 2 {
}
bb0: {
- return; // scope 0 at $DIR/uninhabited_enum.rs:+4:2: +4:2
+ return;
}
}
diff --git a/tests/mir-opt/uninhabited_enum.rs b/tests/mir-opt/uninhabited_enum.rs
index 19db54815..8816f31f9 100644
--- a/tests/mir-opt/uninhabited_enum.rs
+++ b/tests/mir-opt/uninhabited_enum.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(never_type)]
pub enum Void {}
diff --git a/tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.diff
new file mode 100644
index 000000000..7919450cd
--- /dev/null
+++ b/tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.diff
@@ -0,0 +1,119 @@
+- // MIR for `byref` before UninhabitedEnumBranching
++ // MIR for `byref` after UninhabitedEnumBranching
+
+ fn byref() -> () {
+ let mut _0: ();
+ let _1: Plop;
+ let mut _2: Test3;
+ let _3: &str;
+ let mut _4: &Test3;
+ let mut _5: isize;
+ let _6: &str;
+ let _7: &str;
+ let _8: &str;
+ let _9: &str;
+ let mut _10: isize;
+ let _11: &str;
+ let _12: &str;
+ let _13: &str;
+ scope 1 {
+ debug plop => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = Test3::C;
+ _1 = Plop { xx: const 51_u32, test3: move _2 };
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = &(_1.1: Test3);
+ _5 = discriminant((*_4));
+- switchInt(move _5) -> [0: bb3, 1: bb4, 2: bb5, 3: bb1, otherwise: bb2];
++ switchInt(move _5) -> [0: bb12, 1: bb12, 2: bb5, 3: bb1, otherwise: bb12];
+ }
+
+ bb1: {
+ StorageLive(_8);
+ _8 = const "D";
+ _3 = &(*_8);
+ StorageDead(_8);
+ goto -> bb6;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ _3 = const "A(Empty)";
+ goto -> bb6;
+ }
+
+ bb4: {
+ StorageLive(_6);
+ _6 = const "B(Empty)";
+ _3 = &(*_6);
+ StorageDead(_6);
+ goto -> bb6;
+ }
+
+ bb5: {
+ StorageLive(_7);
+ _7 = const "C";
+ _3 = &(*_7);
+ StorageDead(_7);
+ goto -> bb6;
+ }
+
+ bb6: {
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageLive(_9);
+ _10 = discriminant((_1.1: Test3));
+- switchInt(move _10) -> [0: bb8, 1: bb9, 2: bb10, 3: bb7, otherwise: bb2];
++ switchInt(move _10) -> [0: bb12, 1: bb12, 2: bb10, 3: bb7, otherwise: bb12];
+ }
+
+ bb7: {
+ StorageLive(_13);
+ _13 = const "D";
+ _9 = &(*_13);
+ StorageDead(_13);
+ goto -> bb11;
+ }
+
+ bb8: {
+ _9 = const "A(Empty)";
+ goto -> bb11;
+ }
+
+ bb9: {
+ StorageLive(_11);
+ _11 = const "B(Empty)";
+ _9 = &(*_11);
+ StorageDead(_11);
+ goto -> bb11;
+ }
+
+ bb10: {
+ StorageLive(_12);
+ _12 = const "C";
+ _9 = &(*_12);
+ StorageDead(_12);
+ goto -> bb11;
+ }
+
+ bb11: {
+ StorageDead(_9);
+ _0 = const ();
+ StorageDead(_1);
+ return;
++ }
++
++ bb12: {
++ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.diff
new file mode 100644
index 000000000..5e15298a7
--- /dev/null
+++ b/tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.diff
@@ -0,0 +1,48 @@
+- // MIR for `custom_discriminant` before UninhabitedEnumBranching
++ // MIR for `custom_discriminant` after UninhabitedEnumBranching
+
+ fn custom_discriminant() -> () {
+ let mut _0: ();
+ let _1: &str;
+ let mut _2: Test2;
+ let mut _3: isize;
+ let _4: &str;
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = Test2::D;
+ _3 = discriminant(_2);
+- switchInt(move _3) -> [4: bb3, 5: bb1, otherwise: bb2];
++ switchInt(move _3) -> [4: bb3, 5: bb1, otherwise: bb5];
+ }
+
+ bb1: {
+ StorageLive(_4);
+ _4 = const "E";
+ _1 = &(*_4);
+ StorageDead(_4);
+ goto -> bb4;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ _1 = const "D";
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
++ }
++
++ bb5: {
++ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir b/tests/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
deleted file mode 100644
index a0b556640..000000000
--- a/tests/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
+++ /dev/null
@@ -1,69 +0,0 @@
-// MIR for `main` after SimplifyCfg-after-uninhabited-enum-branching
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/uninhabited_enum_branching.rs:+0:11: +0:11
- let _1: &str; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+1:5: +5:6
- let mut _2: Test1; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19
- let mut _3: isize; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+2:9: +2:20
- let _4: &str; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+3:24: +3:34
- let _5: &str; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+4:21: +4:24
- let _6: &str; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+7:5: +10:6
- let mut _7: Test2; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19
- let mut _8: isize; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+8:9: +8:17
- let _9: &str; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+9:21: +9:24
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:5: +5:6
- StorageLive(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19
- _2 = Test1::C; // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19
- _3 = discriminant(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19
- switchInt(move _3) -> [2: bb1, otherwise: bb2]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:5: +1:19
- }
-
- bb1: {
- StorageLive(_5); // scope 0 at $DIR/uninhabited_enum_branching.rs:+4:21: +4:24
- _5 = const "C"; // scope 0 at $DIR/uninhabited_enum_branching.rs:+4:21: +4:24
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching.rs:23:21: 23:24
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _1 = &(*_5); // scope 0 at $DIR/uninhabited_enum_branching.rs:+4:21: +4:24
- StorageDead(_5); // scope 0 at $DIR/uninhabited_enum_branching.rs:+4:23: +4:24
- StorageDead(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:+5:6: +5:7
- StorageDead(_1); // scope 0 at $DIR/uninhabited_enum_branching.rs:+5:6: +5:7
- StorageLive(_6); // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:5: +10:6
- StorageLive(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19
- _7 = Test2::D; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19
- _8 = discriminant(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19
- switchInt(move _8) -> [4: bb4, 5: bb3, otherwise: bb2]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:5: +7:19
- }
-
- bb2: {
- unreachable; // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19
- }
-
- bb3: {
- StorageLive(_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:21: +9:24
- _9 = const "E"; // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:21: +9:24
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching.rs:28:21: 28:24
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _6 = &(*_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:21: +9:24
- StorageDead(_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:23: +9:24
- goto -> bb5; // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:23: +9:24
- }
-
- bb4: {
- _6 = const "D"; // scope 0 at $DIR/uninhabited_enum_branching.rs:+8:21: +8:24
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching.rs:27:21: 27:24
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- goto -> bb5; // scope 0 at $DIR/uninhabited_enum_branching.rs:+8:21: +8:24
- }
-
- bb5: {
- StorageDead(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+10:6: +10:7
- StorageDead(_6); // scope 0 at $DIR/uninhabited_enum_branching.rs:+10:6: +10:7
- _0 = const (); // scope 0 at $DIR/uninhabited_enum_branching.rs:+0:11: +11:2
- return; // scope 0 at $DIR/uninhabited_enum_branching.rs:+11:2: +11:2
- }
-}
diff --git a/tests/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff
deleted file mode 100644
index 58d6e4281..000000000
--- a/tests/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff
+++ /dev/null
@@ -1,95 +0,0 @@
-- // MIR for `main` before UninhabitedEnumBranching
-+ // MIR for `main` after UninhabitedEnumBranching
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/uninhabited_enum_branching.rs:+0:11: +0:11
- let _1: &str; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+1:5: +5:6
- let mut _2: Test1; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19
- let mut _3: isize; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+2:9: +2:20
- let _4: &str; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+3:24: +3:34
- let _5: &str; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+4:21: +4:24
- let _6: &str; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+7:5: +10:6
- let mut _7: Test2; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19
- let mut _8: isize; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+8:9: +8:17
- let _9: &str; // in scope 0 at $DIR/uninhabited_enum_branching.rs:+9:21: +9:24
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:5: +5:6
- StorageLive(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19
- _2 = Test1::C; // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19
- _3 = discriminant(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19
-- switchInt(move _3) -> [0: bb3, 1: bb4, 2: bb1, otherwise: bb2]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:5: +1:19
-+ switchInt(move _3) -> [2: bb1, otherwise: bb2]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:5: +1:19
- }
-
- bb1: {
- StorageLive(_5); // scope 0 at $DIR/uninhabited_enum_branching.rs:+4:21: +4:24
- _5 = const "C"; // scope 0 at $DIR/uninhabited_enum_branching.rs:+4:21: +4:24
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching.rs:23:21: 23:24
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _1 = &(*_5); // scope 0 at $DIR/uninhabited_enum_branching.rs:+4:21: +4:24
- StorageDead(_5); // scope 0 at $DIR/uninhabited_enum_branching.rs:+4:23: +4:24
- goto -> bb5; // scope 0 at $DIR/uninhabited_enum_branching.rs:+4:23: +4:24
- }
-
- bb2: {
- unreachable; // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19
- }
-
- bb3: {
- _1 = const "A(Empty)"; // scope 0 at $DIR/uninhabited_enum_branching.rs:+2:24: +2:34
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching.rs:21:24: 21:34
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- goto -> bb5; // scope 0 at $DIR/uninhabited_enum_branching.rs:+2:24: +2:34
- }
-
- bb4: {
- StorageLive(_4); // scope 0 at $DIR/uninhabited_enum_branching.rs:+3:24: +3:34
- _4 = const "B(Empty)"; // scope 0 at $DIR/uninhabited_enum_branching.rs:+3:24: +3:34
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching.rs:22:24: 22:34
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _1 = &(*_4); // scope 0 at $DIR/uninhabited_enum_branching.rs:+3:24: +3:34
- StorageDead(_4); // scope 0 at $DIR/uninhabited_enum_branching.rs:+3:33: +3:34
- goto -> bb5; // scope 0 at $DIR/uninhabited_enum_branching.rs:+3:33: +3:34
- }
-
- bb5: {
- StorageDead(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:+5:6: +5:7
- StorageDead(_1); // scope 0 at $DIR/uninhabited_enum_branching.rs:+5:6: +5:7
- StorageLive(_6); // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:5: +10:6
- StorageLive(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19
- _7 = Test2::D; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19
- _8 = discriminant(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19
- switchInt(move _8) -> [4: bb7, 5: bb6, otherwise: bb2]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:5: +7:19
- }
-
- bb6: {
- StorageLive(_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:21: +9:24
- _9 = const "E"; // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:21: +9:24
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching.rs:28:21: 28:24
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _6 = &(*_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:21: +9:24
- StorageDead(_9); // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:23: +9:24
- goto -> bb8; // scope 0 at $DIR/uninhabited_enum_branching.rs:+9:23: +9:24
- }
-
- bb7: {
- _6 = const "D"; // scope 0 at $DIR/uninhabited_enum_branching.rs:+8:21: +8:24
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching.rs:27:21: 27:24
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- goto -> bb8; // scope 0 at $DIR/uninhabited_enum_branching.rs:+8:21: +8:24
- }
-
- bb8: {
- StorageDead(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+10:6: +10:7
- StorageDead(_6); // scope 0 at $DIR/uninhabited_enum_branching.rs:+10:6: +10:7
- _0 = const (); // scope 0 at $DIR/uninhabited_enum_branching.rs:+0:11: +11:2
- return; // scope 0 at $DIR/uninhabited_enum_branching.rs:+11:2: +11:2
- }
- }
-
diff --git a/tests/mir-opt/uninhabited_enum_branching.rs b/tests/mir-opt/uninhabited_enum_branching.rs
index 0ef604c30..60389117b 100644
--- a/tests/mir-opt/uninhabited_enum_branching.rs
+++ b/tests/mir-opt/uninhabited_enum_branching.rs
@@ -1,10 +1,11 @@
-enum Empty { }
+// unit-test: UninhabitedEnumBranching
+enum Empty {}
// test matching an enum with uninhabited variants
enum Test1 {
A(Empty),
B(Empty),
- C
+ C,
}
// test an enum where the discriminants don't match the variant indexes
@@ -14,17 +15,75 @@ enum Test2 {
E = 5,
}
-// EMIT_MIR uninhabited_enum_branching.main.UninhabitedEnumBranching.diff
-// EMIT_MIR uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
-fn main() {
+// test matching an enum with uninhabited variants and multiple inhabited
+enum Test3 {
+ A(Empty),
+ B(Empty),
+ C,
+ D,
+}
+
+struct Plop {
+ xx: u32,
+ test3: Test3,
+}
+
+// EMIT_MIR uninhabited_enum_branching.simple.UninhabitedEnumBranching.diff
+fn simple() {
+ // CHECK-LABEL: fn simple(
+ // CHECK: [[discr:_.*]] = discriminant(
+ // CHECK: switchInt(move [[discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb1, otherwise: [[unreachable]]];
+ // CHECK: [[unreachable]]: {
+ // CHECK-NEXT: unreachable;
match Test1::C {
Test1::A(_) => "A(Empty)",
Test1::B(_) => "B(Empty)",
Test1::C => "C",
};
+}
+// EMIT_MIR uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.diff
+fn custom_discriminant() {
+ // CHECK-LABEL: fn custom_discriminant(
+ // CHECK: [[discr:_.*]] = discriminant(
+ // CHECK: switchInt(move [[discr]]) -> [4: bb3, 5: bb1, otherwise: bb5];
+ // CHECK: bb5: {
+ // CHECK-NEXT: unreachable;
match Test2::D {
Test2::D => "D",
Test2::E => "E",
};
}
+
+// EMIT_MIR uninhabited_enum_branching.byref.UninhabitedEnumBranching.diff
+fn byref() {
+ // CHECK-LABEL: fn byref(
+ let plop = Plop { xx: 51, test3: Test3::C };
+
+ // CHECK: [[ref_discr:_.*]] = discriminant((*
+ // CHECK: switchInt(move [[ref_discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb5, 3: bb1, otherwise: [[unreachable]]];
+ match &plop.test3 {
+ Test3::A(_) => "A(Empty)",
+ Test3::B(_) => "B(Empty)",
+ Test3::C => "C",
+ Test3::D => "D",
+ };
+
+ // CHECK: [[discr:_.*]] = discriminant(
+ // CHECK: switchInt(move [[discr]]) -> [0: [[unreachable]], 1: [[unreachable]], 2: bb10, 3: bb7, otherwise: [[unreachable]]];
+ match plop.test3 {
+ Test3::A(_) => "A(Empty)",
+ Test3::B(_) => "B(Empty)",
+ Test3::C => "C",
+ Test3::D => "D",
+ };
+
+ // CHECK: [[unreachable]]: {
+ // CHECK-NEXT: unreachable;
+}
+
+fn main() {
+ simple();
+ custom_discriminant();
+ byref();
+}
diff --git a/tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.diff
new file mode 100644
index 000000000..410db7980
--- /dev/null
+++ b/tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.diff
@@ -0,0 +1,57 @@
+- // MIR for `simple` before UninhabitedEnumBranching
++ // MIR for `simple` after UninhabitedEnumBranching
+
+ fn simple() -> () {
+ let mut _0: ();
+ let _1: &str;
+ let mut _2: Test1;
+ let mut _3: isize;
+ let _4: &str;
+ let _5: &str;
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = Test1::C;
+ _3 = discriminant(_2);
+- switchInt(move _3) -> [0: bb3, 1: bb4, 2: bb1, otherwise: bb2];
++ switchInt(move _3) -> [0: bb6, 1: bb6, 2: bb1, otherwise: bb6];
+ }
+
+ bb1: {
+ StorageLive(_5);
+ _5 = const "C";
+ _1 = &(*_5);
+ StorageDead(_5);
+ goto -> bb5;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ _1 = const "A(Empty)";
+ goto -> bb5;
+ }
+
+ bb4: {
+ StorageLive(_4);
+ _4 = const "B(Empty)";
+ _1 = &(*_4);
+ StorageDead(_4);
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
++ }
++
++ bb6: {
++ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir b/tests/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
deleted file mode 100644
index 0368b5f18..000000000
--- a/tests/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
+++ /dev/null
@@ -1,97 +0,0 @@
-// MIR for `main` after SimplifyCfg-after-uninhabited-enum-branching
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/uninhabited_enum_branching2.rs:+0:11: +0:11
- let _1: Plop; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+1:9: +1:13
- let mut _2: Test1; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+1:38: +1:46
- let _3: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+3:5: +8:6
- let mut _4: &Test1; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22
- let mut _5: isize; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+4:9: +4:20
- let _6: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+5:24: +5:34
- let _7: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+6:21: +6:24
- let _8: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+7:21: +7:24
- let _9: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+10:5: +15:6
- let mut _10: isize; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+11:9: +11:20
- let _11: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+12:24: +12:34
- let _12: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+13:21: +13:24
- let _13: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+14:21: +14:24
- scope 1 {
- debug plop => _1; // in scope 1 at $DIR/uninhabited_enum_branching2.rs:+1:9: +1:13
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/uninhabited_enum_branching2.rs:+1:9: +1:13
- StorageLive(_2); // scope 0 at $DIR/uninhabited_enum_branching2.rs:+1:38: +1:46
- _2 = Test1::C; // scope 0 at $DIR/uninhabited_enum_branching2.rs:+1:38: +1:46
- _1 = Plop { xx: const 51_u32, test1: move _2 }; // scope 0 at $DIR/uninhabited_enum_branching2.rs:+1:16: +1:48
- StorageDead(_2); // scope 0 at $DIR/uninhabited_enum_branching2.rs:+1:47: +1:48
- StorageLive(_3); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:5: +8:6
- StorageLive(_4); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22
- _4 = &(_1.1: Test1); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22
- _5 = discriminant((*_4)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22
- switchInt(move _5) -> [2: bb3, 3: bb1, otherwise: bb2]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:5: +3:22
- }
-
- bb1: {
- StorageLive(_8); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+7:21: +7:24
- _8 = const "D"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+7:21: +7:24
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching2.rs:25:21: 25:24
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _3 = &(*_8); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+7:21: +7:24
- StorageDead(_8); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+7:23: +7:24
- goto -> bb4; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+7:23: +7:24
- }
-
- bb2: {
- unreachable; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22
- }
-
- bb3: {
- StorageLive(_7); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+6:21: +6:24
- _7 = const "C"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+6:21: +6:24
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching2.rs:24:21: 24:24
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _3 = &(*_7); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+6:21: +6:24
- StorageDead(_7); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+6:23: +6:24
- goto -> bb4; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+6:23: +6:24
- }
-
- bb4: {
- StorageDead(_4); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+8:6: +8:7
- StorageDead(_3); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+8:6: +8:7
- StorageLive(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +15:6
- _10 = discriminant((_1.1: Test1)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:11: +10:21
- switchInt(move _10) -> [2: bb6, 3: bb5, otherwise: bb2]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +10:21
- }
-
- bb5: {
- StorageLive(_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:21: +14:24
- _13 = const "D"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:21: +14:24
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching2.rs:32:21: 32:24
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _9 = &(*_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:21: +14:24
- StorageDead(_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:23: +14:24
- goto -> bb7; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:23: +14:24
- }
-
- bb6: {
- StorageLive(_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:21: +13:24
- _12 = const "C"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:21: +13:24
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching2.rs:31:21: 31:24
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _9 = &(*_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:21: +13:24
- StorageDead(_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:23: +13:24
- goto -> bb7; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:23: +13:24
- }
-
- bb7: {
- StorageDead(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+15:6: +15:7
- _0 = const (); // scope 0 at $DIR/uninhabited_enum_branching2.rs:+0:11: +16:2
- StorageDead(_1); // scope 0 at $DIR/uninhabited_enum_branching2.rs:+16:1: +16:2
- return; // scope 0 at $DIR/uninhabited_enum_branching2.rs:+16:2: +16:2
- }
-}
diff --git a/tests/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff
deleted file mode 100644
index 73353941f..000000000
--- a/tests/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff
+++ /dev/null
@@ -1,139 +0,0 @@
-- // MIR for `main` before UninhabitedEnumBranching
-+ // MIR for `main` after UninhabitedEnumBranching
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/uninhabited_enum_branching2.rs:+0:11: +0:11
- let _1: Plop; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+1:9: +1:13
- let mut _2: Test1; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+1:38: +1:46
- let _3: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+3:5: +8:6
- let mut _4: &Test1; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22
- let mut _5: isize; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+4:9: +4:20
- let _6: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+5:24: +5:34
- let _7: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+6:21: +6:24
- let _8: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+7:21: +7:24
- let _9: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+10:5: +15:6
- let mut _10: isize; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+11:9: +11:20
- let _11: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+12:24: +12:34
- let _12: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+13:21: +13:24
- let _13: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:+14:21: +14:24
- scope 1 {
- debug plop => _1; // in scope 1 at $DIR/uninhabited_enum_branching2.rs:+1:9: +1:13
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/uninhabited_enum_branching2.rs:+1:9: +1:13
- StorageLive(_2); // scope 0 at $DIR/uninhabited_enum_branching2.rs:+1:38: +1:46
- _2 = Test1::C; // scope 0 at $DIR/uninhabited_enum_branching2.rs:+1:38: +1:46
- _1 = Plop { xx: const 51_u32, test1: move _2 }; // scope 0 at $DIR/uninhabited_enum_branching2.rs:+1:16: +1:48
- StorageDead(_2); // scope 0 at $DIR/uninhabited_enum_branching2.rs:+1:47: +1:48
- StorageLive(_3); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:5: +8:6
- StorageLive(_4); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22
- _4 = &(_1.1: Test1); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22
- _5 = discriminant((*_4)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22
-- switchInt(move _5) -> [0: bb3, 1: bb4, 2: bb5, 3: bb1, otherwise: bb2]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:5: +3:22
-+ switchInt(move _5) -> [2: bb5, 3: bb1, otherwise: bb2]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:5: +3:22
- }
-
- bb1: {
- StorageLive(_8); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+7:21: +7:24
- _8 = const "D"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+7:21: +7:24
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching2.rs:25:21: 25:24
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _3 = &(*_8); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+7:21: +7:24
- StorageDead(_8); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+7:23: +7:24
- goto -> bb6; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+7:23: +7:24
- }
-
- bb2: {
- unreachable; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22
- }
-
- bb3: {
- _3 = const "A(Empty)"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+4:24: +4:34
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching2.rs:22:24: 22:34
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- goto -> bb6; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+4:24: +4:34
- }
-
- bb4: {
- StorageLive(_6); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+5:24: +5:34
- _6 = const "B(Empty)"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+5:24: +5:34
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching2.rs:23:24: 23:34
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _3 = &(*_6); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+5:24: +5:34
- StorageDead(_6); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+5:33: +5:34
- goto -> bb6; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+5:33: +5:34
- }
-
- bb5: {
- StorageLive(_7); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+6:21: +6:24
- _7 = const "C"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+6:21: +6:24
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching2.rs:24:21: 24:24
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _3 = &(*_7); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+6:21: +6:24
- StorageDead(_7); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+6:23: +6:24
- goto -> bb6; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+6:23: +6:24
- }
-
- bb6: {
- StorageDead(_4); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+8:6: +8:7
- StorageDead(_3); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+8:6: +8:7
- StorageLive(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +15:6
- _10 = discriminant((_1.1: Test1)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:11: +10:21
-- switchInt(move _10) -> [0: bb8, 1: bb9, 2: bb10, 3: bb7, otherwise: bb2]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +10:21
-+ switchInt(move _10) -> [2: bb10, 3: bb7, otherwise: bb2]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +10:21
- }
-
- bb7: {
- StorageLive(_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:21: +14:24
- _13 = const "D"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:21: +14:24
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching2.rs:32:21: 32:24
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _9 = &(*_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:21: +14:24
- StorageDead(_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:23: +14:24
- goto -> bb11; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+14:23: +14:24
- }
-
- bb8: {
- _9 = const "A(Empty)"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+11:24: +11:34
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching2.rs:29:24: 29:34
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- goto -> bb11; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+11:24: +11:34
- }
-
- bb9: {
- StorageLive(_11); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+12:24: +12:34
- _11 = const "B(Empty)"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+12:24: +12:34
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching2.rs:30:24: 30:34
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _9 = &(*_11); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+12:24: +12:34
- StorageDead(_11); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+12:33: +12:34
- goto -> bb11; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+12:33: +12:34
- }
-
- bb10: {
- StorageLive(_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:21: +13:24
- _12 = const "C"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:21: +13:24
- // mir::Constant
- // + span: $DIR/uninhabited_enum_branching2.rs:31:21: 31:24
- // + literal: Const { ty: &str, val: Value(Slice(..)) }
- _9 = &(*_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:21: +13:24
- StorageDead(_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:23: +13:24
- goto -> bb11; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+13:23: +13:24
- }
-
- bb11: {
- StorageDead(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+15:6: +15:7
- _0 = const (); // scope 0 at $DIR/uninhabited_enum_branching2.rs:+0:11: +16:2
- StorageDead(_1); // scope 0 at $DIR/uninhabited_enum_branching2.rs:+16:1: +16:2
- return; // scope 0 at $DIR/uninhabited_enum_branching2.rs:+16:2: +16:2
- }
- }
-
diff --git a/tests/mir-opt/uninhabited_enum_branching2.rs b/tests/mir-opt/uninhabited_enum_branching2.rs
deleted file mode 100644
index e22e94314..000000000
--- a/tests/mir-opt/uninhabited_enum_branching2.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-enum Empty { }
-
-// test matching an enum with uninhabited variants
-enum Test1 {
- A(Empty),
- B(Empty),
- C,
- D,
-}
-
-struct Plop {
- xx: u32,
- test1: Test1,
-}
-
-// EMIT_MIR uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff
-// EMIT_MIR uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
-fn main() {
- let plop = Plop { xx: 51, test1: Test1::C };
-
- match &plop.test1 {
- Test1::A(_) => "A(Empty)",
- Test1::B(_) => "B(Empty)",
- Test1::C => "C",
- Test1::D => "D",
- };
-
- match plop.test1 {
- Test1::A(_) => "A(Empty)",
- Test1::B(_) => "B(Empty)",
- Test1::C => "C",
- Test1::D => "D",
- };
-}
diff --git a/tests/mir-opt/uninhabited_fallthrough_elimination.eliminate_fallthrough.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_fallthrough_elimination.eliminate_fallthrough.UninhabitedEnumBranching.diff
index 58e085dd0..daff4f9c8 100644
--- a/tests/mir-opt/uninhabited_fallthrough_elimination.eliminate_fallthrough.UninhabitedEnumBranching.diff
+++ b/tests/mir-opt/uninhabited_fallthrough_elimination.eliminate_fallthrough.UninhabitedEnumBranching.diff
@@ -2,37 +2,37 @@
+ // MIR for `eliminate_fallthrough` after UninhabitedEnumBranching
fn eliminate_fallthrough(_1: S) -> u32 {
- debug s => _1; // in scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+0:26: +0:27
- let mut _0: u32; // return place in scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+0:35: +0:38
- let mut _2: isize; // in scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+2:9: +2:10
+ debug s => _1;
+ let mut _0: u32;
+ let mut _2: isize;
bb0: {
- _2 = discriminant(_1); // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:11: +1:12
-- switchInt(move _2) -> [1: bb3, 2: bb2, otherwise: bb1]; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:5: +1:12
-+ switchInt(move _2) -> [1: bb3, 2: bb2, otherwise: bb5]; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:5: +1:12
+ _2 = discriminant(_1);
+- switchInt(move _2) -> [1: bb3, 2: bb2, otherwise: bb1];
++ switchInt(move _2) -> [1: bb3, 2: bb2, otherwise: bb5];
}
bb1: {
- _0 = const 3_u32; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+4:14: +4:15
- goto -> bb4; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+4:14: +4:15
+ _0 = const 3_u32;
+ goto -> bb4;
}
bb2: {
- _0 = const 1_u32; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+2:14: +2:15
- goto -> bb4; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+2:14: +2:15
+ _0 = const 1_u32;
+ goto -> bb4;
}
bb3: {
- _0 = const 2_u32; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+3:14: +3:15
- goto -> bb4; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+3:14: +3:15
+ _0 = const 2_u32;
+ goto -> bb4;
}
bb4: {
- return; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+6:2: +6:2
+ return;
+ }
+
+ bb5: {
-+ unreachable; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+4:14: +4:15
++ unreachable;
}
}
diff --git a/tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff
index e765851eb..79948139f 100644
--- a/tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff
+++ b/tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff
@@ -2,33 +2,37 @@
+ // MIR for `keep_fallthrough` after UninhabitedEnumBranching
fn keep_fallthrough(_1: S) -> u32 {
- debug s => _1; // in scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+0:21: +0:22
- let mut _0: u32; // return place in scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+0:30: +0:33
- let mut _2: isize; // in scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+2:9: +2:13
+ debug s => _1;
+ let mut _0: u32;
+ let mut _2: isize;
bb0: {
- _2 = discriminant(_1); // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:11: +1:12
-- switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1]; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:5: +1:12
-+ switchInt(move _2) -> [1: bb3, otherwise: bb1]; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:5: +1:12
+ _2 = discriminant(_1);
+- switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1];
++ switchInt(move _2) -> [0: bb5, 1: bb3, otherwise: bb1];
}
bb1: {
- _0 = const 3_u32; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+4:14: +4:15
- goto -> bb4; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+4:14: +4:15
+ _0 = const 3_u32;
+ goto -> bb4;
}
bb2: {
- _0 = const 1_u32; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+2:17: +2:18
- goto -> bb4; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+2:17: +2:18
+ _0 = const 1_u32;
+ goto -> bb4;
}
bb3: {
- _0 = const 2_u32; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+3:14: +3:15
- goto -> bb4; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+3:14: +3:15
+ _0 = const 2_u32;
+ goto -> bb4;
}
bb4: {
- return; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+6:2: +6:2
+ return;
++ }
++
++ bb5: {
++ unreachable;
}
}
diff --git a/tests/mir-opt/uninhabited_fallthrough_elimination.rs b/tests/mir-opt/uninhabited_fallthrough_elimination.rs
index 0853883f8..7dd41aea5 100644
--- a/tests/mir-opt/uninhabited_fallthrough_elimination.rs
+++ b/tests/mir-opt/uninhabited_fallthrough_elimination.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
enum Empty {}
enum S {
diff --git a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff
new file mode 100644
index 000000000..f6e594ffa
--- /dev/null
+++ b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff
@@ -0,0 +1,45 @@
+- // MIR for `as_match` before UnreachablePropagation
++ // MIR for `as_match` after UnreachablePropagation
+
+ fn as_match() -> () {
+ let mut _0: ();
+ let mut _1: std::option::Option<Empty>;
+ let mut _2: isize;
+ let _3: Empty;
+ let mut _4: !;
++ let mut _5: bool;
+ scope 1 {
+ debug _x => _3;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = empty() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _2 = discriminant(_1);
+- switchInt(move _2) -> [0: bb4, 1: bb2, otherwise: bb3];
++ _5 = Eq(_2, const 0_isize);
++ assume(move _5);
++ goto -> bb4;
+ }
+
+ bb2: {
+- StorageLive(_3);
+- _3 = move ((_1 as Some).0: Empty);
+- StorageLive(_4);
+ unreachable;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff
new file mode 100644
index 000000000..2813d6467
--- /dev/null
+++ b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff
@@ -0,0 +1,45 @@
+- // MIR for `as_match` before UnreachablePropagation
++ // MIR for `as_match` after UnreachablePropagation
+
+ fn as_match() -> () {
+ let mut _0: ();
+ let mut _1: std::option::Option<Empty>;
+ let mut _2: isize;
+ let _3: Empty;
+ let mut _4: !;
++ let mut _5: bool;
+ scope 1 {
+ debug _x => _3;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = empty() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ _2 = discriminant(_1);
+- switchInt(move _2) -> [0: bb4, 1: bb2, otherwise: bb3];
++ _5 = Eq(_2, const 0_isize);
++ assume(move _5);
++ goto -> bb4;
+ }
+
+ bb2: {
+- StorageLive(_3);
+- _3 = move ((_1 as Some).0: Empty);
+- StorageLive(_4);
+ unreachable;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-abort.diff b/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-abort.diff
new file mode 100644
index 000000000..619597327
--- /dev/null
+++ b/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-abort.diff
@@ -0,0 +1,72 @@
+- // MIR for `if_let` before UnreachablePropagation
++ // MIR for `if_let` after UnreachablePropagation
+
+ fn if_let() -> () {
+ let mut _0: ();
+ let mut _1: std::option::Option<Empty>;
+ let mut _2: isize;
+ let _5: ();
+ let mut _6: bool;
+ let mut _7: !;
++ let mut _8: bool;
+ scope 1 {
+ debug _x => _3;
+ let _3: Empty;
+ let mut _4: i32;
+ scope 2 {
+ debug _y => _4;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = empty() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _2 = discriminant(_1);
+- switchInt(move _2) -> [1: bb2, otherwise: bb6];
++ _8 = Ne(_2, const 1_isize);
++ assume(move _8);
++ goto -> bb6;
+ }
+
+ bb2: {
+- StorageLive(_3);
+- _3 = move ((_1 as Some).0: Empty);
+- StorageLive(_4);
+- StorageLive(_5);
+- StorageLive(_6);
+- _6 = const true;
+- switchInt(move _6) -> [0: bb4, otherwise: bb3];
++ unreachable;
+ }
+
+ bb3: {
+- _4 = const 21_i32;
+- _5 = const ();
+- goto -> bb5;
++ unreachable;
+ }
+
+ bb4: {
+- _4 = const 42_i32;
+- _5 = const ();
+- goto -> bb5;
++ unreachable;
+ }
+
+ bb5: {
+- StorageDead(_6);
+- StorageDead(_5);
+- StorageLive(_7);
+ unreachable;
+ }
+
+ bb6: {
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-unwind.diff b/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-unwind.diff
new file mode 100644
index 000000000..476e2f559
--- /dev/null
+++ b/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-unwind.diff
@@ -0,0 +1,72 @@
+- // MIR for `if_let` before UnreachablePropagation
++ // MIR for `if_let` after UnreachablePropagation
+
+ fn if_let() -> () {
+ let mut _0: ();
+ let mut _1: std::option::Option<Empty>;
+ let mut _2: isize;
+ let _5: ();
+ let mut _6: bool;
+ let mut _7: !;
++ let mut _8: bool;
+ scope 1 {
+ debug _x => _3;
+ let _3: Empty;
+ let mut _4: i32;
+ scope 2 {
+ debug _y => _4;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = empty() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ _2 = discriminant(_1);
+- switchInt(move _2) -> [1: bb2, otherwise: bb6];
++ _8 = Ne(_2, const 1_isize);
++ assume(move _8);
++ goto -> bb6;
+ }
+
+ bb2: {
+- StorageLive(_3);
+- _3 = move ((_1 as Some).0: Empty);
+- StorageLive(_4);
+- StorageLive(_5);
+- StorageLive(_6);
+- _6 = const true;
+- switchInt(move _6) -> [0: bb4, otherwise: bb3];
++ unreachable;
+ }
+
+ bb3: {
+- _4 = const 21_i32;
+- _5 = const ();
+- goto -> bb5;
++ unreachable;
+ }
+
+ bb4: {
+- _4 = const 42_i32;
+- _5 = const ();
+- goto -> bb5;
++ unreachable;
+ }
+
+ bb5: {
+- StorageDead(_6);
+- StorageDead(_5);
+- StorageLive(_7);
+ unreachable;
+ }
+
+ bb6: {
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/unreachable.main.UnreachablePropagation.diff b/tests/mir-opt/unreachable.main.UnreachablePropagation.diff
deleted file mode 100644
index 323b61346..000000000
--- a/tests/mir-opt/unreachable.main.UnreachablePropagation.diff
+++ /dev/null
@@ -1,70 +0,0 @@
-- // MIR for `main` before UnreachablePropagation
-+ // MIR for `main` after UnreachablePropagation
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/unreachable.rs:+0:11: +0:11
- let mut _1: std::option::Option<Empty>; // in scope 0 at $DIR/unreachable.rs:+1:23: +1:30
- let mut _2: isize; // in scope 0 at $DIR/unreachable.rs:+1:12: +1:20
- let _5: (); // in scope 0 at $DIR/unreachable.rs:+4:9: +8:10
- let mut _6: bool; // in scope 0 at $DIR/unreachable.rs:+4:12: +4:16
- let mut _7: !; // in scope 0 at $DIR/unreachable.rs:+10:9: +10:21
- scope 1 {
- debug _x => _3; // in scope 1 at $DIR/unreachable.rs:+1:17: +1:19
- let _3: Empty; // in scope 1 at $DIR/unreachable.rs:+1:17: +1:19
- let mut _4: i32; // in scope 1 at $DIR/unreachable.rs:+2:13: +2:19
- scope 2 {
- debug _y => _4; // in scope 2 at $DIR/unreachable.rs:+2:13: +2:19
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 1 at $DIR/unreachable.rs:+1:23: +1:30
- _1 = empty() -> bb1; // scope 1 at $DIR/unreachable.rs:+1:23: +1:30
- // mir::Constant
- // + span: $DIR/unreachable.rs:10:23: 10:28
- // + literal: Const { ty: fn() -> Option<Empty> {empty}, val: Value(<ZST>) }
- }
-
- bb1: {
- _2 = discriminant(_1); // scope 1 at $DIR/unreachable.rs:+1:12: +1:20
-- switchInt(move _2) -> [1: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable.rs:+1:12: +1:20
-+ switchInt(move _2) -> [1: bb2, otherwise: bb3]; // scope 1 at $DIR/unreachable.rs:+1:12: +1:20
- }
-
- bb2: {
-- StorageLive(_3); // scope 1 at $DIR/unreachable.rs:+1:17: +1:19
-- _3 = move ((_1 as Some).0: Empty); // scope 1 at $DIR/unreachable.rs:+1:17: +1:19
-- StorageLive(_4); // scope 1 at $DIR/unreachable.rs:+2:13: +2:19
-- StorageLive(_5); // scope 2 at $DIR/unreachable.rs:+4:9: +8:10
-- StorageLive(_6); // scope 2 at $DIR/unreachable.rs:+4:12: +4:16
-- _6 = const true; // scope 2 at $DIR/unreachable.rs:+4:12: +4:16
-- switchInt(move _6) -> [0: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable.rs:+4:12: +4:16
-+ unreachable; // scope 2 at $DIR/unreachable.rs:+4:12: +4:16
- }
-
- bb3: {
-- _4 = const 21_i32; // scope 2 at $DIR/unreachable.rs:+5:13: +5:20
-- _5 = const (); // scope 2 at $DIR/unreachable.rs:+4:17: +6:10
-- goto -> bb5; // scope 2 at $DIR/unreachable.rs:+4:9: +8:10
-- }
--
-- bb4: {
-- _4 = const 42_i32; // scope 2 at $DIR/unreachable.rs:+7:13: +7:20
-- _5 = const (); // scope 2 at $DIR/unreachable.rs:+6:16: +8:10
-- goto -> bb5; // scope 2 at $DIR/unreachable.rs:+4:9: +8:10
-- }
--
-- bb5: {
-- StorageDead(_6); // scope 2 at $DIR/unreachable.rs:+8:9: +8:10
-- StorageDead(_5); // scope 2 at $DIR/unreachable.rs:+8:9: +8:10
-- StorageLive(_7); // scope 2 at $DIR/unreachable.rs:+10:9: +10:21
-- unreachable; // scope 2 at $DIR/unreachable.rs:+10:15: +10:17
-- }
--
-- bb6: {
- _0 = const (); // scope 0 at $DIR/unreachable.rs:+11:6: +11:6
- StorageDead(_1); // scope 0 at $DIR/unreachable.rs:+12:1: +12:2
- return; // scope 0 at $DIR/unreachable.rs:+12:2: +12:2
- }
- }
-
diff --git a/tests/mir-opt/unreachable.rs b/tests/mir-opt/unreachable.rs
index 97093729d..5b96681d9 100644
--- a/tests/mir-opt/unreachable.rs
+++ b/tests/mir-opt/unreachable.rs
@@ -1,12 +1,31 @@
-// ignore-wasm32 compiled with panic=abort by default
+// unit-test: UnreachablePropagation
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
enum Empty {}
fn empty() -> Option<Empty> {
None
}
-// EMIT_MIR unreachable.main.UnreachablePropagation.diff
-fn main() {
+// EMIT_MIR unreachable.if_let.UnreachablePropagation.diff
+fn if_let() {
+ // CHECK-LABEL: fn if_let(
+ // CHECK: bb0: {
+ // CHECK: {{_.*}} = empty()
+ // CHECK: bb1: {
+ // CHECK: [[ne:_.*]] = Ne({{.*}}, const 1_isize);
+ // CHECK-NEXT: assume(move [[ne]]);
+ // CHECK-NEXT: goto -> bb6;
+ // CHECK: bb2: {
+ // CHECK-NEXT: unreachable;
+ // CHECK: bb3: {
+ // CHECK-NEXT: unreachable;
+ // CHECK: bb4: {
+ // CHECK-NEXT: unreachable;
+ // CHECK: bb5: {
+ // CHECK-NEXT: unreachable;
+ // CHECK: bb6: {
+ // CHECK: return;
if let Some(_x) = empty() {
let mut _y;
@@ -19,3 +38,29 @@ fn main() {
match _x { }
}
}
+
+// EMIT_MIR unreachable.as_match.UnreachablePropagation.diff
+fn as_match() {
+ // CHECK-LABEL: fn as_match(
+ // CHECK: bb0: {
+ // CHECK: {{_.*}} = empty()
+ // CHECK: bb1: {
+ // CHECK: [[eq:_.*]] = Eq({{.*}}, const 0_isize);
+ // CHECK-NEXT: assume(move [[eq]]);
+ // CHECK-NEXT: goto -> bb4;
+ // CHECK: bb2: {
+ // CHECK-NEXT: unreachable;
+ // CHECK: bb3: {
+ // CHECK-NEXT: unreachable;
+ // CHECK: bb4: {
+ // CHECK: return;
+ match empty() {
+ None => {}
+ Some(_x) => match _x {}
+ }
+}
+
+fn main() {
+ if_let();
+ as_match();
+}
diff --git a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff
deleted file mode 100644
index 94bc63361..000000000
--- a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff
+++ /dev/null
@@ -1,71 +0,0 @@
-- // MIR for `main` before UnreachablePropagation
-+ // MIR for `main` after UnreachablePropagation
-
- fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/unreachable_diverging.rs:+0:11: +0:11
- let _1: bool; // in scope 0 at $DIR/unreachable_diverging.rs:+1:9: +1:10
- let mut _2: std::option::Option<Empty>; // in scope 0 at $DIR/unreachable_diverging.rs:+2:25: +2:32
- let mut _3: isize; // in scope 0 at $DIR/unreachable_diverging.rs:+2:12: +2:22
- let _5: (); // in scope 0 at $DIR/unreachable_diverging.rs:+3:9: +5:10
- let mut _6: bool; // in scope 0 at $DIR/unreachable_diverging.rs:+3:12: +3:13
- let mut _7: !; // in scope 0 at $DIR/unreachable_diverging.rs:+6:9: +6:22
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/unreachable_diverging.rs:+1:9: +1:10
- scope 2 {
- debug bomb => _4; // in scope 2 at $DIR/unreachable_diverging.rs:+2:17: +2:21
- let _4: Empty; // in scope 2 at $DIR/unreachable_diverging.rs:+2:17: +2:21
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/unreachable_diverging.rs:+1:9: +1:10
- _1 = const true; // scope 0 at $DIR/unreachable_diverging.rs:+1:13: +1:17
- StorageLive(_2); // scope 2 at $DIR/unreachable_diverging.rs:+2:25: +2:32
- _2 = empty() -> bb1; // scope 2 at $DIR/unreachable_diverging.rs:+2:25: +2:32
- // mir::Constant
- // + span: $DIR/unreachable_diverging.rs:15:25: 15:30
- // + literal: Const { ty: fn() -> Option<Empty> {empty}, val: Value(<ZST>) }
- }
-
- bb1: {
- _3 = discriminant(_2); // scope 2 at $DIR/unreachable_diverging.rs:+2:12: +2:22
- switchInt(move _3) -> [1: bb2, otherwise: bb6]; // scope 2 at $DIR/unreachable_diverging.rs:+2:12: +2:22
- }
-
- bb2: {
- StorageLive(_4); // scope 2 at $DIR/unreachable_diverging.rs:+2:17: +2:21
- _4 = move ((_2 as Some).0: Empty); // scope 2 at $DIR/unreachable_diverging.rs:+2:17: +2:21
- StorageLive(_5); // scope 2 at $DIR/unreachable_diverging.rs:+3:9: +5:10
- StorageLive(_6); // scope 2 at $DIR/unreachable_diverging.rs:+3:12: +3:13
- _6 = _1; // scope 2 at $DIR/unreachable_diverging.rs:+3:12: +3:13
- switchInt(move _6) -> [0: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable_diverging.rs:+3:12: +3:13
- }
-
- bb3: {
- _5 = loop_forever() -> bb5; // scope 2 at $DIR/unreachable_diverging.rs:+4:13: +4:27
- // mir::Constant
- // + span: $DIR/unreachable_diverging.rs:17:13: 17:25
- // + literal: Const { ty: fn() {loop_forever}, val: Value(<ZST>) }
- }
-
- bb4: {
-- _5 = const (); // scope 2 at $DIR/unreachable_diverging.rs:+5:10: +5:10
-- goto -> bb5; // scope 2 at $DIR/unreachable_diverging.rs:+3:9: +5:10
-+ unreachable; // scope 2 at $DIR/unreachable_diverging.rs:+3:9: +5:10
- }
-
- bb5: {
-- StorageDead(_6); // scope 2 at $DIR/unreachable_diverging.rs:+5:9: +5:10
-- StorageDead(_5); // scope 2 at $DIR/unreachable_diverging.rs:+5:9: +5:10
-- StorageLive(_7); // scope 2 at $DIR/unreachable_diverging.rs:+6:9: +6:22
- unreachable; // scope 2 at $DIR/unreachable_diverging.rs:+6:15: +6:19
- }
-
- bb6: {
- _0 = const (); // scope 1 at $DIR/unreachable_diverging.rs:+7:6: +7:6
- StorageDead(_1); // scope 0 at $DIR/unreachable_diverging.rs:+8:1: +8:2
- StorageDead(_2); // scope 0 at $DIR/unreachable_diverging.rs:+8:1: +8:2
- return; // scope 0 at $DIR/unreachable_diverging.rs:+8:2: +8:2
- }
- }
-
diff --git a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff
new file mode 100644
index 000000000..11d7924e7
--- /dev/null
+++ b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff
@@ -0,0 +1,69 @@
+- // MIR for `main` before UnreachablePropagation
++ // MIR for `main` after UnreachablePropagation
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: bool;
+ let mut _2: std::option::Option<Empty>;
+ let mut _3: isize;
+ let _5: ();
+ let mut _6: bool;
+ let mut _7: !;
++ let mut _8: bool;
+ scope 1 {
+ debug x => _1;
+ scope 2 {
+ debug bomb => _4;
+ let _4: Empty;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const true;
+ StorageLive(_2);
+ _2 = empty() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _3 = discriminant(_2);
+ switchInt(move _3) -> [1: bb2, otherwise: bb6];
+ }
+
+ bb2: {
+ StorageLive(_4);
+ _4 = move ((_2 as Some).0: Empty);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = _1;
+- switchInt(move _6) -> [0: bb4, otherwise: bb3];
++ _8 = Ne(_6, const false);
++ assume(move _8);
++ goto -> bb3;
+ }
+
+ bb3: {
+ _5 = loop_forever() -> [return: bb5, unwind unreachable];
+ }
+
+ bb4: {
+- _5 = const ();
+- goto -> bb5;
++ unreachable;
+ }
+
+ bb5: {
+- StorageDead(_6);
+- StorageDead(_5);
+- StorageLive(_7);
+ unreachable;
+ }
+
+ bb6: {
+ _0 = const ();
+ StorageDead(_1);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff
new file mode 100644
index 000000000..df6f5609f
--- /dev/null
+++ b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff
@@ -0,0 +1,69 @@
+- // MIR for `main` before UnreachablePropagation
++ // MIR for `main` after UnreachablePropagation
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: bool;
+ let mut _2: std::option::Option<Empty>;
+ let mut _3: isize;
+ let _5: ();
+ let mut _6: bool;
+ let mut _7: !;
++ let mut _8: bool;
+ scope 1 {
+ debug x => _1;
+ scope 2 {
+ debug bomb => _4;
+ let _4: Empty;
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const true;
+ StorageLive(_2);
+ _2 = empty() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ _3 = discriminant(_2);
+ switchInt(move _3) -> [1: bb2, otherwise: bb6];
+ }
+
+ bb2: {
+ StorageLive(_4);
+ _4 = move ((_2 as Some).0: Empty);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = _1;
+- switchInt(move _6) -> [0: bb4, otherwise: bb3];
++ _8 = Ne(_6, const false);
++ assume(move _8);
++ goto -> bb3;
+ }
+
+ bb3: {
+ _5 = loop_forever() -> [return: bb5, unwind continue];
+ }
+
+ bb4: {
+- _5 = const ();
+- goto -> bb5;
++ unreachable;
+ }
+
+ bb5: {
+- StorageDead(_6);
+- StorageDead(_5);
+- StorageLive(_7);
+ unreachable;
+ }
+
+ bb6: {
+ _0 = const ();
+ StorageDead(_1);
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/unreachable_diverging.rs b/tests/mir-opt/unreachable_diverging.rs
index 24e776148..b1df6f852 100644
--- a/tests/mir-opt/unreachable_diverging.rs
+++ b/tests/mir-opt/unreachable_diverging.rs
@@ -1,4 +1,6 @@
-// ignore-wasm32 compiled with panic=abort by default
+// unit-test: UnreachablePropagation
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
pub enum Empty {}
fn empty() -> Option<Empty> {
@@ -11,6 +13,23 @@ fn loop_forever() {
// EMIT_MIR unreachable_diverging.main.UnreachablePropagation.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: bb0: {
+ // CHECK: {{_.*}} = empty()
+ // CHECK: bb1: {
+ // CHECK: switchInt({{.*}}) -> [1: bb2, otherwise: bb6];
+ // CHECK: bb2: {
+ // CHECK: [[ne:_.*]] = Ne({{.*}}, const false);
+ // CHECK: assume(move [[ne]]);
+ // CHECK: goto -> bb3;
+ // CHECK: bb3: {
+ // CHECK: {{_.*}} = loop_forever()
+ // CHECK: bb4: {
+ // CHECK: unreachable;
+ // CHECK: bb5: {
+ // CHECK: unreachable;
+ // CHECK: bb6: {
+ // CHECK: return;
let x = true;
if let Some(bomb) = empty() {
if x {
diff --git a/tests/mir-opt/unusual_item_types.E-V-{constant#0}.built.after.mir b/tests/mir-opt/unusual_item_types.E-V-{constant#0}.built.after.mir
index 5257491f0..993e668b0 100644
--- a/tests/mir-opt/unusual_item_types.E-V-{constant#0}.built.after.mir
+++ b/tests/mir-opt/unusual_item_types.E-V-{constant#0}.built.after.mir
@@ -1,10 +1,10 @@
// MIR for `E::V::{constant#0}` after built
E::V::{constant#0}: isize = {
- let mut _0: isize; // return place in scope 0 at $DIR/unusual_item_types.rs:+0:9: +0:10
+ let mut _0: isize;
bb0: {
- _0 = const 5_isize; // scope 0 at $DIR/unusual_item_types.rs:+0:9: +0:10
- return; // scope 0 at $DIR/unusual_item_types.rs:+0:9: +0:10
+ _0 = const 5_isize;
+ return;
}
}
diff --git a/tests/mir-opt/unusual_item_types.Test-X-{constructor#0}.built.after.mir b/tests/mir-opt/unusual_item_types.Test-X-{constructor#0}.built.after.mir
index 8b271135c..1e497b412 100644
--- a/tests/mir-opt/unusual_item_types.Test-X-{constructor#0}.built.after.mir
+++ b/tests/mir-opt/unusual_item_types.Test-X-{constructor#0}.built.after.mir
@@ -1,10 +1,10 @@
// MIR for `Test::X` after built
fn Test::X(_1: usize) -> Test {
- let mut _0: Test; // return place in scope 0 at $DIR/unusual_item_types.rs:+0:5: +0:6
+ let mut _0: Test;
bb0: {
- _0 = Test::X(move _1); // scope 0 at $DIR/unusual_item_types.rs:+0:5: +0:6
- return; // scope 0 at $DIR/unusual_item_types.rs:+0:5: +0:6
+ _0 = Test::X(move _1);
+ return;
}
}
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 c27a93e91..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
@@ -1,39 +1,36 @@
// MIR for `std::ptr::drop_in_place` before AddMovesForPackedDrops
fn std::ptr::drop_in_place(_1: *mut Vec<i32>) -> () {
- let mut _0: (); // return place in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- let mut _2: &mut std::vec::Vec<i32>; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- let mut _3: (); // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ let mut _0: ();
+ let mut _2: &mut std::vec::Vec<i32>;
+ let mut _3: ();
bb0: {
- goto -> bb6; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ goto -> bb6;
}
bb1: {
- return; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ return;
}
bb2 (cleanup): {
- resume; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ resume;
}
bb3: {
- goto -> bb1; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ goto -> bb1;
}
bb4 (cleanup): {
- drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> [return: bb2, unwind terminate]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> [return: bb2, unwind terminate(cleanup)];
}
bb5: {
- drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> [return: bb3, unwind: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
+ drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> [return: bb3, unwind: bb2];
}
bb6: {
- _2 = &mut (*_1); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- _3 = <Vec<i32> as Drop>::drop(move _2) -> [return: bb5, unwind: bb4]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56
- // mir::Constant
- // + span: $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- // + literal: Const { ty: for<'a> fn(&'a mut Vec<i32>) {<Vec<i32> as Drop>::drop}, val: Value(<ZST>) }
+ _2 = &mut (*_1);
+ _3 = <Vec<i32> as Drop>::drop(move _2) -> [return: bb5, unwind: bb4];
}
}
diff --git a/tests/mir-opt/unusual_item_types.rs b/tests/mir-opt/unusual_item_types.rs
index 6dad63641..49b663b4f 100644
--- a/tests/mir-opt/unusual_item_types.rs
+++ b/tests/mir-opt/unusual_item_types.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that we don't ICE when trying to dump MIR for unusual item types and
// that we don't create filenames containing `<` and `>`
// compile-flags: -Zmir-opt-level=0
diff --git a/tests/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.built.after.mir b/tests/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.built.after.mir
index 90444b481..a5121ae55 100644
--- a/tests/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.built.after.mir
+++ b/tests/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.built.after.mir
@@ -1,10 +1,10 @@
-// MIR for `<impl at $DIR/unusual_item_types.rs:9:1: 9:7>::ASSOCIATED_CONSTANT` after built
+// MIR for `<impl at $DIR/unusual_item_types.rs:10:1: 10:7>::ASSOCIATED_CONSTANT` after built
-const <impl at $DIR/unusual_item_types.rs:9:1: 9:7>::ASSOCIATED_CONSTANT: i32 = {
- let mut _0: i32; // return place in scope 0 at $DIR/unusual_item_types.rs:+0:32: +0:35
+const <impl at $DIR/unusual_item_types.rs:10:1: 10:7>::ASSOCIATED_CONSTANT: i32 = {
+ let mut _0: i32;
bb0: {
- _0 = const 2_i32; // scope 0 at $DIR/unusual_item_types.rs:+0:38: +0:39
- return; // scope 0 at $DIR/unusual_item_types.rs:+0:5: +0:40
+ _0 = const 2_i32;
+ return;
}
}
diff --git a/tests/mir-opt/while_storage.rs b/tests/mir-opt/while_storage.rs
deleted file mode 100644
index d10048dd9..000000000
--- a/tests/mir-opt/while_storage.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// ignore-wasm32 compiled with panic=abort by default
-// Test that we correctly generate StorageDead statements for while loop
-// conditions on all branches
-
-fn get_bool(c: bool) -> bool {
- c
-}
-
-// EMIT_MIR while_storage.while_loop.PreCodegen.after.mir
-fn while_loop(c: bool) {
- while get_bool(c) {
- if get_bool(c) {
- break;
- }
- }
-}
-
-fn main() {
- while_loop(false);
-}
diff --git a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.mir b/tests/mir-opt/while_storage.while_loop.PreCodegen.after.mir
deleted file mode 100644
index 811789a60..000000000
--- a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.mir
+++ /dev/null
@@ -1,52 +0,0 @@
-// MIR for `while_loop` after PreCodegen
-
-fn while_loop(_1: bool) -> () {
- debug c => _1; // in scope 0 at $DIR/while_storage.rs:+0:15: +0:16
- let mut _0: (); // return place in scope 0 at $DIR/while_storage.rs:+0:24: +0:24
- let mut _2: bool; // in scope 0 at $DIR/while_storage.rs:+1:11: +1:22
- let mut _3: bool; // in scope 0 at $DIR/while_storage.rs:+2:12: +2:23
-
- bb0: {
- goto -> bb1; // scope 0 at $DIR/while_storage.rs:+1:5: +5:6
- }
-
- bb1: {
- StorageLive(_2); // scope 0 at $DIR/while_storage.rs:+1:11: +1:22
- _2 = get_bool(_1) -> bb2; // scope 0 at $DIR/while_storage.rs:+1:11: +1:22
- // mir::Constant
- // + span: $DIR/while_storage.rs:11:11: 11:19
- // + literal: Const { ty: fn(bool) -> bool {get_bool}, val: Value(<ZST>) }
- }
-
- bb2: {
- switchInt(move _2) -> [0: bb7, otherwise: bb3]; // scope 0 at $DIR/while_storage.rs:+1:11: +1:22
- }
-
- bb3: {
- StorageLive(_3); // scope 0 at $DIR/while_storage.rs:+2:12: +2:23
- _3 = get_bool(_1) -> bb4; // scope 0 at $DIR/while_storage.rs:+2:12: +2:23
- // mir::Constant
- // + span: $DIR/while_storage.rs:12:12: 12:20
- // + literal: Const { ty: fn(bool) -> bool {get_bool}, val: Value(<ZST>) }
- }
-
- bb4: {
- switchInt(move _3) -> [0: bb6, otherwise: bb5]; // scope 0 at $DIR/while_storage.rs:+2:12: +2:23
- }
-
- bb5: {
- StorageDead(_3); // scope 0 at $DIR/while_storage.rs:+4:9: +4:10
- goto -> bb7; // scope 0 at no-location
- }
-
- bb6: {
- StorageDead(_3); // scope 0 at $DIR/while_storage.rs:+4:9: +4:10
- StorageDead(_2); // scope 0 at $DIR/while_storage.rs:+5:5: +5:6
- goto -> bb1; // scope 0 at $DIR/while_storage.rs:+1:5: +5:6
- }
-
- bb7: {
- StorageDead(_2); // scope 0 at $DIR/while_storage.rs:+5:5: +5:6
- return; // scope 0 at $DIR/while_storage.rs:+6:2: +6:2
- }
-}